content/base/public/nsISelectionController.idlScriptable
Please add a summary to this article.
Inherits from: nsISelectionDisplay Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

void characterExtendForBackspace(); Native code only!
void characterExtendForDelete(); Native code only!
void characterMove(in boolean forward, in boolean extend);
boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
void completeMove(in boolean forward, in boolean extend);
void completeScroll(in boolean forward);
boolean getCaretEnabled();
short getDisplaySelection();
nsISelection getSelection(in short type);
void intraLineMove(in boolean forward, in boolean extend);
void lineMove(in boolean forward, in boolean extend);
void pageMove(in boolean forward, in boolean extend);
void repaintSelection(in short type);
void scrollHorizontal(in boolean left);
void scrollLine(in boolean forward);
void scrollPage(in boolean forward);
void scrollSelectionIntoView(in short type, in short region, in short flags);
void selectAll();
void setCaretEnabled(in boolean enabled);
void setCaretReadOnly(in boolean readOnly);
void setCaretVisibilityDuringSelection(in boolean visibility);
void setCaretWidth(in short pixels); Obsolete since Gecko 1.8
void setDisplaySelection(in short toggle);
void wordExtendForDelete(in boolean forward); Native code only!
void wordMove(in boolean forward, in boolean extend);

Attributes

Attribute Type Description
caretVisible boolean This is true if the caret is enabled, visible, and currently blinking. This is still true when the caret is enabled, visible, but in its "off" blink cycle. Read only.

Constants

Selection constants

Constant Gecko version Description
1.7 - 1.9 1.9.1 - 1.9.2 2.0
SELECTION_NONE 0  
SELECTION_NORMAL 1  
SELECTION_SPELLCHECK 2  
SELECTION_IME_RAWINPUT 4  
SELECTION_IME_SELECTEDRAWTEXT 8  
SELECTION_IME_CONVERTEDTEXT 16  
SELECTION_IME_SELECTEDCONVERTEDTEXT 32  
SELECTION_ACCESSIBILITY 64 For accessibility API usage.
SELECTION_FIND   128  
NUM_SELECTIONTYPES 8 9  
SELECTION_ANCHOR_REGION 0  
SELECTION_FOCUS_REGION 1  
SELECTION_WHOLE_SELECTION   2  
NUM_SELECTION_REGIONS 2 3  
SELECTION_OFF 0  
SELECTION_HIDDEN 1 Hidden displays selection.
SELECTION_ON 2  
SELECTION_DISABLED 3  
SELECTION_ATTENTION 4  

Scroll constants

Constant Value Description
SCROLL_SYNCHRONOUS 1<<1 If set scrolls the selection into view before returning. If not set, posts a request which is processed at some point after the method returns.
SCROLL_FIRST_ANCESTOR_ONLY 1<<2 If set, only the first ancestor will be scrolled into view.
SCROLL_CENTER_VERTICALLY 1<<4 If set, the specified location will be scrolled to the center of the view.

Methods

Native code only!

characterExtendForBackspace

Will extend the selection one character cell backward in the document. This method is used internally for handling backspace key only when we're after UTF-16 surrogates.

void characterExtendForBackspace();
Parameters

None.

Native code only!

characterExtendForDelete

Will extend the selection one character cell forward in the document. This method is used internally for handling delete key.

void characterExtendForDelete();
Parameters

None.

characterMove()

Will move the selection one character forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void characterMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

checkVisibility()

Checks if textnode and offsets are actually rendered in the current precontext.

boolean checkVisibility(
  in nsIDOMNode node,
  in short startOffset,
  in short endOffset
);
Parameters
node
nsIDOMNode to test.
startOffset
Offset in DOM to first char of textnode to test.
endOffset
Offset in DOM to last char of textnode to test.
Return value

true if visible, false if not.

completeMove()

Will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void completeMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

completeScroll()

Will move page view to the top or bottom of the document.

void completeScroll(
  in boolean forward
);
Parameters
forward
Forward or backward if PR_FALSE.

getCaretEnabled()

Gets the current state of the caret, as set by setCaretEnabled().

boolean getCaretEnabled();
Parameters

None.

Return value

If aOutEnabled==null, returns NS_ERROR_INVALID_ARG else NS_OK.

getDisplaySelection()

Will get the display mode for the selection.

short getDisplaySelection();
Parameters

None.

Return value

OFF, ON, DISABLED.

getSelection()

Will return the selection that the presentation shell may implement.

nsISelection getSelection(
  in short type
);
Parameters
type
Will hold the type of selection. (SelectionType)
Return value

Will hold the return value.

intraLineMove()

Will move the selection to the front of the line or end of the line in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void intraLineMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

lineMove()

Will move the selection one line forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void lineMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

pageMove()

Will move the selection one page forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void pageMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE
extend
Should it collapse the selection or extend it?

repaintSelection()

Repaints the selection specified.

void repaintSelection(
  in short type
);
Parameters
type
Specifies the selection to repaint.

scrollHorizontal()

Will scroll left or right dependent on the boolean.

void scrollHorizontal(
  in boolean left
);
Parameters
left
If true will scroll left. If not will scroll right.

scrollLine()

Will scroll line up or down dependent on the boolean.

void scrollLine(
  in boolean forward
);
Parameters
forward
Scroll forward or backwards in selection.

scrollPage()

Will scroll the page without affecting the selection.

void scrollPage(
  in boolean forward
);
Parameters
forward
Scroll forward or backwards in selection.

scrollSelectionIntoView()

Scrolls a region of the selection, so that it is visible in the scrolled view.

Note: If isSynchronous is true, calling this method may flush the pending reflow. This is dangerous for some objects. See bug 418470, comment 12 for details.

void scrollSelectionIntoView(
  in short type,
  in short region,
  in short flags
);
Parameters
type
The selection to scroll into view. (SelectionType)
region
The region inside the selection to scroll into view. (SelectionRegion)
flags
One of the SCROLL_* constants.
Exceptions thrown
Missing Exception
Missing Description

selectAll()

Will select the whole page.

void selectAll();
Parameters

None.

setCaretEnabled()

Set the caret as enabled or disabled. An enabled caret will draw or blink when made visible. A disabled caret will never show up. Can be called any time.

void setCaretEnabled(
  in boolean enabled
);
Parameters
enabled
PR_TRUE to enable caret. PR_FALSE to disable.

setCaretReadOnly()

Set the caret readonly or not. An readonly caret will draw but not blink when made visible.

void setCaretReadOnly(
  in boolean readOnly
);
Parameters
readOnly
PR_TRUE to enable caret. PR_FALSE to disable.

setCaretVisibilityDuringSelection()

Show the caret even in selections. By default the caret is hidden unless the selection is collapsed. Use this function to show the caret even in selections.

void setCaretVisibilityDuringSelection(
  in boolean visibility
);
Parameters
visibility
PR_TRUE to show the caret in selections. PR_FALSE to hide.

setCaretWidth()

Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Set the carets width. Can be called any time.

void setCaretWidth(
  in short pixels
);
Parameters
pixels
The width to set the caret to in pixels.

setDisplaySelection()

Will set the display mode for the selection.

void setDisplaySelection(
  in short toggle
);
Parameters
toggle
OFF, ON, DISABLED.

Native code only!

wordExtendForDelete

Will extend the selection one word forward/backward in the document. This method is used internally for handling ctrl[option]-backspace and ctrl[option]-del.

void wordExtendForDelete(
  in boolean forward
);
Parameters
forward
Forward or backward if PR_FALSE.

wordMove()

Wwill move the selection one word forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void wordMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?