Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIAccessibleText

Please add a summary to this article.
Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

Method overview

void addSelection(in long startOffset, in long endOffset);
nsIAccessible getAttributeRange(in long offset, out long rangeStartOffset, out long rangeEndOffset); Obsolete since Gecko 1.9.1
wchar getCharacterAtOffset(in long offset);
void getCharacterExtents(in long offset, out long x, out long y, out long width, out long height, in unsigned long coordType);
long getOffsetAtPoint(in long x, in long y, in unsigned long coordType);
void getRangeExtents(in long startOffset, in long endOffset, out long x, out long y, out long width, out long height, in unsigned long coordType);
void getSelectionBounds(in long selectionNum, out long startOffset, out long endOffset);
AString getText(in long startOffset, in long endOffset);
AString getTextAfterOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset);
AString getTextAtOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset);
nsIPersistentProperties getTextAttributes(in boolean includeDefAttrs, in long offset, out long rangeStartOffset, out long rangeEndOffset);
AString getTextBeforeOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset);
void removeSelection(in long selectionNum);
void scrollSubstringTo(in long startIndex, in long endIndex, in unsigned long scrollType);
void scrollSubstringToPoint(in long startIndex, in long endIndex, in unsigned long coordinateType, in long x, in long y);
void setSelectionBounds(in long selectionNum, in long startOffset, in long endOffset);

Attributes

Attribute Type Description
caretOffset long The current current caret offset. If set < 0 then caret will be placed at the end of the text.
characterCount long Read only.
defaultTextAttributes nsIPersistentProperties Return the text attributes that apply to the entire accessible. Read only.
selectionCount long Read only.

Constants

Text Offset Constants

Constant Value Description
TEXT_OFFSET_END_OF_TEXT -1 Will be treated as the equal to the end of the text.
TEXT_OFFSET_CARET -2 Will be treated as the caret position.

Text Boundary Constants

Constant Value Description
BOUNDARY_CHAR 0  
BOUNDARY_WORD_START 1  
BOUNDARY_WORD_END 2  
BOUNDARY_SENTENCE_START 3 Do not use in new code.
BOUNDARY_SENTENCE_END 4 Do not use in new code.
BOUNDARY_LINE_START 5  
BOUNDARY_LINE_END 6  
BOUNDARY_ATTRIBUTE_RANGE 7  

Coordinate Type Constants

Obsolete since Gecko 1.9 (Firefox 3)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Constant Value Description
COORD_TYPE_SCREEN 0  
COORD_TYPE_WINDOW 1  

Methods

addSelection()

void addSelection(
  in long startOffset,
  in long endOffset
);
Parameters
startOffset
endOffset

Obsolete since Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

getAttributeRange()

Get the accessible and start/end offsets around the given offset. This accessible get return the DOM node and layout frame with the uniform attributes for this range of text.

nsIAccessible getAttributeRange(
  in long offset,
  out long rangeStartOffset,
  out long rangeEndOffset
);
Parameters
offset
rangeStartOffset
rangeEndOffset
Return value

 

getCharacterAtOffset()

It would be better to return an unsigned long here, to allow unicode chars > 16 bits.

wchar getCharacterAtOffset(
  in long offset
);
Parameters
offset
Return value

 

getCharacterExtents()

Returns the bounding box of the specified position.

The virtual character after the last character of the represented text, that is the one at position length is a special case. It represents the current input position and will therefore typically be queried by AT more often than other positions. Because it does not represent an existing character its bounding box is defined in relation to preceding characters. It should be roughly equivalent to the bounding box of some character when inserted at the end of the text. Its height typically being the maximal height of all the characters in the text or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate.

void getCharacterExtents(
  in long offset,
  out long x,
  out long y,
  out long width,
  out long height,
  in unsigned long coordType
);
Parameters
offset
Index of the character for which to return its bounding box. The valid range is 0..length.
x
X coordinate of the bounding box of the referenced character.
y
Y coordinate of the bounding box of the referenced character.
width
Width of the bounding box of the referenced character.
height
Height of the bounding box of the referenced character.
coordType
Specifies if the coordinates are relative to the screen or to the parent window (see constants declared in nsIAccessibleCoordinateType.Constants).

getOffsetAtPoint()

Get the text offset at the given point, or return -1 if no character exists at that point.

long getOffsetAtPoint(
  in long x,
  in long y,
  in unsigned long coordType
);
Parameters
x
The position's x value for which to look up the index of the character that is rendered on to the display at that point.
y
The position's y value for which to look up the index of the character that is rendered on to the display at that point.
coordType
Screen coordinates or window coordinates (see constants declared in nsIAccessibleCoordinateType).
Return value

Offset - Index of the character under the given point or -1 if the point is invalid or there is no character under the point.

Requires Gecko 1.9 (Firefox 3)

getRangeExtents()

The virtual character after the last character of the represented text, that is the one at position length is a special case. It represents the current input position and will therefore typically be queried by AT more often than other positions. Because it does not represent an existing character its bounding box is defined in relation to preceding characters. It should be roughly equivalent to the bounding box of some character when inserted at the end of the text. Its height typically being the maximal height of all the characters in the text or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate.

void getRangeExtents(
  in long startOffset,
  in long endOffset,
  out long x,
  out long y,
  out long width,
  out long height,
  in unsigned long coordType
);
Parameters
startOffset
Index of the character for which to return its bounding box. The valid range is 0..length.
endOffset
Index of the character for which to return its bounding box. The valid range is 0..length.
x
X coordinate of the bounding box of the referenced character.
y
Y coordinate of the bounding box of the referenced character.
width
Width of the bounding box of the referenced character.
height
Height of the bounding box of the referenced character.
coordType
Specifies if the coordinates are relative to the screen or to the parent window (see constants declared in nsIAccessibleCoordinateType.Constants.

getSelectionBounds()

void getSelectionBounds(
  in long selectionNum,
  out long startOffset,
  out long endOffset
);
Parameters
selectionNum
startOffset
endOffset

getText()

String methods may need to return multibyte-encoded strings, since some locales can not be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8.

AString getText(
  in long startOffset,
  in long endOffset
);
Parameters
startOffset
endOffset
Return value

 

getTextAfterOffset()

String methods may need to return multibyte-encoded strings, since some locales can't be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8.

AString getTextAfterOffset(
  in long offset,
  in nsAccessibleTextBoundary boundaryType,
  out long startOffset,
  out long endOffset
);
Parameters
offset
boundaryType
startOffset
endOffset
Return value

 

getTextAtOffset()

String methods may need to return multibyte-encoded strings, since some locales can't be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8.

AString getTextAtOffset(
  in long offset,
  in nsAccessibleTextBoundary boundaryType,
  out long startOffset,
  out long endOffset
);
Parameters
offset
boundaryType
startOffset
endOffset
Return value

 

Requires Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

getTextAttributes()

Get the accessible start/end offsets around the given offset, return the text attributes for this range of text.

nsIPersistentProperties getTextAttributes(
  in boolean includeDefAttrs,
  in long offset,
  out long rangeStartOffset,
  out long rangeEndOffset
);
Parameters
includeDefAttrs
Points whether text attributes applied to the entire accessible should be included or not.
offset
Text offset.
rangeStartOffset
Start offset of the range of text.
rangeEndOffset
End offset of the range of text.
Return value

 

Exceptions thrown
Missing Exception

getTextBeforeOffset()

String methods may need to return multibyte-encoded strings, since some locales can't be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8.

AString getTextBeforeOffset(
  in long offset,
  in nsAccessibleTextBoundary boundaryType,
  out long startOffset,
  out long endOffset
);
Parameters
offset
boundaryType
startOffset
endOffset
Return value

 

removeSelection()

void removeSelection(
  in long selectionNum
);
Parameters
selectionNum

Requires Gecko 1.9 (Firefox 3)

scrollSubstringTo()

Makes a specific part of string visible on screen.

void scrollSubstringTo(
  in long startIndex,
  in long endIndex,
  in unsigned long scrollType
);
Parameters
startIndex
0-based character offset.
endIndex
0-based character offset - the offset of the character just past the last character of the string.
scrollType
Defines how to scroll (see nsIAccessibleScrollType.Constants for available constants)

Requires Gecko 1.9 (Firefox 3)

scrollSubstringToPoint()

Moves the top left of a substring to a specified location.

void scrollSubstringToPoint(
  in long startIndex,
  in long endIndex,
  in unsigned long coordinateType,
  in long x,
  in long y
);
Parameters
startIndex
0-based character offset.
endIndex
0-based character offset - the offset of the character just past the last character of the string.
coordinateType
Specifies the coordinates origin (for available constants refer to nsIAccessibleCoordinateType.Constants)
x
Defines the x coordinate.
y
Defines the y coordinate.

setSelectionBounds()

Set the bounds for the given selection range.

void setSelectionBounds(
  in long selectionNum,
  in long startOffset,
  in long endOffset
);
Parameters
selectionNum
startOffset
endOffset

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh, Kglee
 Last updated by: Sheppy,