Bug 1681980 [wpt PR 26856] - Update wpt metadata, a=testonly
[gecko.git] / accessible / interfaces / nsIAccessibleTextRange.idl
blob1c351c734c91926e91ce40a9d63e201152b75392
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
8 interface nsIAccessible;
9 interface nsIAccessibleText;
10 interface nsIArray;
11 interface nsIVariant;
13 /**
14 * A range representing a piece of text in the document.
16 [scriptable, builtinclass, uuid(c4515623-55f9-4543-a3d5-c1e9afa588f4)]
17 interface nsIAccessibleTextRange : nsISupports
19 readonly attribute nsIAccessibleText startContainer;
20 readonly attribute long startOffset;
21 readonly attribute nsIAccessibleText endContainer;
22 readonly attribute long endOffset;
24 /**
25 * Return an accessible containing the whole range
27 readonly attribute nsIAccessible container;
29 /**
30 * Return embedded children within the range.
32 readonly attribute nsIArray embeddedChildren;
34 /**
35 * Return true if this range has the same end points of the given range.
37 boolean compare(in nsIAccessibleTextRange aOtherRange);
39 /**
40 * The two endpoints of the range (starting and ending).
42 const unsigned long EndPoint_Start = 1;
43 const unsigned long EndPoint_End = 2;
45 /**
46 * Compare this and given ranges end points.
48 * @return -1/0/1 if this range end point is before/equal/after the given
49 * range end point.
51 long compareEndPoints(in unsigned long aEndPoint,
52 in nsIAccessibleTextRange aOtherRange,
53 in unsigned long aOtherRangeEndPoint);
55 /**
56 * Return text within the range.
58 readonly attribute AString text;
60 /**
61 * Return list of rects of the range.
63 readonly attribute nsIArray bounds;
65 const unsigned long FormatUnit = 0;
66 const unsigned long WordUnit = 1;
67 const unsigned long LineUnit = 2;
68 const unsigned long ParagraphUnit = 3;
69 const unsigned long PageUnit = 4;
70 const unsigned long DocumentUnit = 5;
72 /**
73 * Move the boundary(ies) by the given number of the unit.
75 void move(in unsigned long aUnit, in long aCount);
76 void moveStart(in unsigned long aUnit, in long aCount);
77 void moveEnd(in unsigned long aUnit, in long aCount);
79 /**
80 * Normalize the range to the closest unit of the given type.
82 void normalize(in unsigned long aUnit);
84 /**
85 * Crops the range by the given accessible element.
87 boolean crop(in nsIAccessible aContainer);
89 /**
90 * Return range enclosing the found text.
92 nsIAccessibleTextRange findText(in AString aText, in boolean aIsBackward,
93 in boolean aIsIgnoreCase);
95 /**
96 * Text attributes. Used in conjunction with findAttrs().
98 const unsigned long AnimationStyleAttr = 0;
99 const unsigned long AnnotationObjectsAttr = 1;
100 const unsigned long AnnotationTypesAttr = 2;
101 const unsigned long BackgroundColorAttr = 3;
102 const unsigned long BulletStyleAttr = 4;
103 const unsigned long CapStyleAttr = 5;
104 const unsigned long CaretBidiModeAttr = 6;
105 const unsigned long CaretPositionAttr = 7;
106 const unsigned long CultureAttr = 8;
107 const unsigned long FontNameAttr = 9;
108 const unsigned long FontSizeAttr = 10;
109 const unsigned long FontWeightAttr = 11;
110 const unsigned long ForegroundColorAttr = 12;
111 const unsigned long HorizontalTextAlignmentAttr = 13;
112 const unsigned long IndentationFirstLineAttr = 14;
113 const unsigned long IndentationLeadingAttr = 15;
114 const unsigned long IndentationTrailingAttr = 16;
115 const unsigned long IsActiveAttr = 17;
116 const unsigned long IsHiddenAttr = 18;
117 const unsigned long IsItalicAttr = 19;
118 const unsigned long IsReadOnlyAttr = 20;
119 const unsigned long IsSubscriptAttr = 21;
120 const unsigned long IsSuperscriptAttr = 22;
121 const unsigned long LinkAttr = 23;
122 const unsigned long MarginBottomAttr = 24;
123 const unsigned long MarginLeadingAttr = 25;
124 const unsigned long MarginTopAttr = 26;
125 const unsigned long MarginTrailingAttr = 27;
126 const unsigned long OutlineStylesAttr = 28;
127 const unsigned long OverlineColorAttr = 29;
128 const unsigned long OverlineStyleAttr = 30;
129 const unsigned long SelectionActiveEndAttr = 31;
130 const unsigned long StrikethroughColorAttr = 32;
131 const unsigned long StrikethroughStyleAttr = 33;
132 const unsigned long StyleIdAttr = 34;
133 const unsigned long StyleNameAttr = 35;
134 const unsigned long TabsAttr = 36;
135 const unsigned long TextFlowDirectionsAttr = 37;
136 const unsigned long UnderlineColorAttr = 38;
137 const unsigned long UnderlineStyleAttr = 39;
140 * Return range enslosing the text having requested attribute.
142 nsIAccessibleTextRange findAttr(in unsigned long aAttr, in nsIVariant aValue,
143 in boolean aIsBackward);
146 * Add/remove the text range from selection.
148 void addToSelection();
149 void removeFromSelection();
150 void select();
152 const unsigned long AlignToTop = 0;
153 const unsigned long AlignToBottom = 1;
156 * Scroll the range into view.
158 void scrollIntoView(in unsigned long aHow);