/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"nsISelectionDisplay.idl"
%{C++
#include <ostream> #include <string>
using SelectionRegion = short;
namespace mozilla { namespace dom { class Selection;
} // namespace dom
// RawSelectionType should be used to store nsISelectionController::SELECTION_*.
using RawSelectionType = short;
// SelectionTypeMask should be used to store bit-mask of selection types. // The value can be retrieved with ToSelectionTypeMask() and checking if // a selection type is in a mask with |SelectionType & SelectionTypeMask|.
using SelectionTypeMask = uint16_t;
// SelectionType should be used in internal handling because of type safe. enumclass SelectionType : RawSelectionType;
cenum ControllerScrollFlags : 8 { // Scrolls the selection into view before returning.
SCROLL_SYNCHRONOUS = 1 << 1, // Only the first ancestor will be scrolled into view. // Note that this flushes layout, and thus can run script. // See bug 418470 comment 12.
SCROLL_FIRST_ANCESTOR_ONLY = 1 << 2, // Scrolls even if overflow is set to hidden.
SCROLL_OVERFLOW_HIDDEN = 1 << 3, // No flag scrolls to nearest, vertically.
SCROLL_VERTICAL_NEAREST = 0,
SCROLL_VERTICAL_START = 1 << 4,
SCROLL_VERTICAL_CENTER = 1 << 5,
SCROLL_VERTICAL_END = 1 << 6,
};
/** *ScrollSelectionIntoViewscrollsaregionoftheselection, *sothatitisvisibleinthescrolledview. * *@paramaTypetheselectiontoscrollintoview.Thisvaluemustbeone *ofRawSelectionTypevalues. *@paramaRegiontheregioninsidetheselectiontoscrollintoview.//SelectionRegion *@paramaFlagsthescrollflags.
*/
[can_run_script] void scrollSelectionIntoView(in short type, in short region, in nsISelectionController_ControllerScrollFlags flags);
/** *RepaintSelectionrepaintstheselectionspecifiedbyaType. * *@paramaTypespecifiestheselectiontorepaint.
*/ void repaintSelection(in short type);
/** CharacterMove will move the selection one character forward/backward in the document. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void characterMove(in boolean forward, in boolean extend);
/** PhysicalMove will move the selection one "unit" in a given direction *withinthedocument. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaDirection *@paramaAmount0:character/line;1:word/lineBoundary;2:visuallineedge *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void physicalMove(in short direction, in short amount, in boolean extend);
/** WordMove will move the selection one word forward/backward in the document. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void wordMove(in boolean forward, in boolean extend);
/** LineMove will move the selection one line forward/backward in the document. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void lineMove(in boolean forward, in boolean extend);
/** IntraLineMove will move the selection to the front of the line or end of the line *inthedocument. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void intraLineMove(in boolean forward, in boolean extend);
/** ParagraphMove will move the selection to the beginning or end of the *currentparagraphinthedocument. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void paragraphMove(in boolean forward, in boolean extend);
/** PageMove will move the selection one page forward/backward in the document. *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void pageMove(in boolean forward, in boolean extend);
/** CompleteScroll will move page view to the top or bottom of the document *@paramaForwardforwardorbackwardiffalse
*/ void completeScroll(in boolean forward);
/** CompleteMove will move page view to the top or bottom of the document *thiswillalsohavetheeffectofcollapsingtheselectioniftheaExtend=false *the"point"ofselectionthatisextendedisconsideredthe"focus"point. *orthelastpointadjustedbytheselection. *@paramaForwardforwardorbackwardiffalse *@paramaExtendshoulditcollapsetheselectionofextendit?
*/
[can_run_script] void completeMove(in boolean forward, in boolean extend);
/** ScrollPage will scroll the page without affecting the selection. *@paramaForwardscrollforwardorbackwardsinselection
*/ void scrollPage(in boolean forward);
/** ScrollLine will scroll line up or down dependent on the boolean *@paramaForwardscrollforwardorbackwardsinselection
*/ void scrollLine(in boolean forward);
/** ScrollCharacter will scroll right or left dependent on the boolean *@paramaRightiftruewillscrollright.ifnotwillscrollleft.
*/ void scrollCharacter(in boolean right);
%{C++ // Like the XPCOM method, but more convenient and flexible for C++ callers. Implemented in Selection.h // TODO: Use `MOZ_CAN_RUN_SCRIPT`, but it's a bit tricky because whether it // can run script depends on the SelectionScrollMode.
MOZ_CAN_RUN_SCRIPT_BOUNDARY inline nsresult ScrollSelectionIntoView(
mozilla::SelectionType, SelectionRegion, const mozilla::AxisScrollParams& aVertical, const mozilla::AxisScrollParams& aHorizontal,
mozilla::ScrollFlags, mozilla::SelectionScrollMode);
MOZ_CAN_RUN_SCRIPT_BOUNDARY inline nsresult ScrollSelectionIntoView(
mozilla::SelectionType, SelectionRegion,
mozilla::SelectionScrollMode);
%}
};
%{C++
namespace mozilla {
// SelectionType should be used in internal handling code as it is type safe. // NOTE: Maintain format_as() and operator<<() if you change this enum class. enumclass SelectionType : RawSelectionType {
eInvalid = -1,
eNone = nsISelectionController::SELECTION_NONE,
eNormal = nsISelectionController::SELECTION_NORMAL,
eSpellCheck = nsISelectionController::SELECTION_SPELLCHECK,
eIMERawClause = nsISelectionController::SELECTION_IME_RAWINPUT,
eIMESelectedRawClause = nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT,
eIMEConvertedClause = nsISelectionController::SELECTION_IME_CONVERTEDTEXT,
eIMESelectedClause =
nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT,
eAccessibility = nsISelectionController::SELECTION_ACCESSIBILITY,
eFind = nsISelectionController::SELECTION_FIND,
eURLSecondary = nsISelectionController::SELECTION_URLSECONDARY,
eURLStrikeout = nsISelectionController::SELECTION_URLSTRIKEOUT,
eTargetText = nsISelectionController::SELECTION_TARGET_TEXT,
eHighlight = nsISelectionController::SELECTION_HIGHLIGHT,
};
// kPresentSelectionTypes is selection types which may be displayed. // I.e., selection types except eNone. staticconst SelectionType kPresentSelectionTypes[] = {
SelectionType::eNormal,
SelectionType::eSpellCheck,
SelectionType::eIMERawClause,
SelectionType::eIMESelectedRawClause,
SelectionType::eIMEConvertedClause,
SelectionType::eIMESelectedClause,
SelectionType::eAccessibility,
SelectionType::eFind,
SelectionType::eURLSecondary,
SelectionType::eURLStrikeout,
SelectionType::eTargetText,
SelectionType::eHighlight,
};
// Please include mozilla/dom/Selection.h for the following APIs.
constexpr bool IsValidRawSelectionType(RawSelectionType aRawSelectionType);
constexpr SelectionType ToSelectionType(RawSelectionType aRawSelectionType);
constexpr RawSelectionType ToRawSelectionType(SelectionType aSelectionType);
constexpr SelectionTypeMask ToSelectionTypeMask(SelectionType aSelectionType);
// These are defined in Selection.cpp.
std::string format_as(SelectionType);
std::ostream& operator<<(std::ostream&, SelectionType);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.