Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | typedef short TextBoundaryType; |
michael@0 | 10 | typedef short PivotMoveReason; |
michael@0 | 11 | |
michael@0 | 12 | interface nsIAccessible; |
michael@0 | 13 | interface nsIAccessibleText; |
michael@0 | 14 | interface nsIAccessibleTraversalRule; |
michael@0 | 15 | interface nsIAccessiblePivotObserver; |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * The pivot interface encapsulates a reference to a single place in an accessible |
michael@0 | 19 | * subtree. The pivot is a point or a range in the accessible tree. This interface |
michael@0 | 20 | * provides traversal methods to move the pivot to next/prev state that complies |
michael@0 | 21 | * to a given rule. |
michael@0 | 22 | */ |
michael@0 | 23 | [scriptable, uuid(c2938033-e240-4fe5-9cb6-e7ad649ccd10)] |
michael@0 | 24 | interface nsIAccessiblePivot : nsISupports |
michael@0 | 25 | { |
michael@0 | 26 | const TextBoundaryType CHAR_BOUNDARY = 0; |
michael@0 | 27 | const TextBoundaryType WORD_BOUNDARY = 1; |
michael@0 | 28 | const TextBoundaryType LINE_BOUNDARY = 2; |
michael@0 | 29 | const TextBoundaryType ATTRIBUTE_RANGE_BOUNDARY = 3; |
michael@0 | 30 | |
michael@0 | 31 | const PivotMoveReason REASON_NONE = 0; |
michael@0 | 32 | const PivotMoveReason REASON_NEXT = 1; |
michael@0 | 33 | const PivotMoveReason REASON_PREV = 2; |
michael@0 | 34 | const PivotMoveReason REASON_FIRST = 3; |
michael@0 | 35 | const PivotMoveReason REASON_LAST = 4; |
michael@0 | 36 | const PivotMoveReason REASON_TEXT = 5; |
michael@0 | 37 | const PivotMoveReason REASON_POINT = 6; |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * The accessible the pivot is currently pointed at. |
michael@0 | 41 | */ |
michael@0 | 42 | attribute nsIAccessible position; |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * The root of the subtree in which the pivot traverses. |
michael@0 | 46 | */ |
michael@0 | 47 | readonly attribute nsIAccessible root; |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * The temporary modal root to which traversal is limited to. |
michael@0 | 51 | */ |
michael@0 | 52 | attribute nsIAccessible modalRoot; |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * The start offset of the text range the pivot points at, otherwise -1. |
michael@0 | 56 | */ |
michael@0 | 57 | readonly attribute long startOffset; |
michael@0 | 58 | |
michael@0 | 59 | /** |
michael@0 | 60 | * The end offset of the text range the pivot points at, otherwise -1. |
michael@0 | 61 | */ |
michael@0 | 62 | readonly attribute long endOffset; |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * Set the pivot's text range in a text accessible. |
michael@0 | 66 | * |
michael@0 | 67 | * @param aTextAccessible [in] the text accessible that contains the desired |
michael@0 | 68 | * range. |
michael@0 | 69 | * @param aStartOffset [in] the start offset to set. |
michael@0 | 70 | * @param aEndOffset [in] the end offset to set. |
michael@0 | 71 | * @throws NS_ERROR_INVALID_ARG when the offset exceeds the accessible's |
michael@0 | 72 | * character count. |
michael@0 | 73 | */ |
michael@0 | 74 | void setTextRange(in nsIAccessibleText aTextAccessible, |
michael@0 | 75 | in long aStartOffset, in long aEndOffset); |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * Move pivot to next object, from current position or given anchor, |
michael@0 | 79 | * complying to given traversal rule. |
michael@0 | 80 | * |
michael@0 | 81 | * @param aRule [in] traversal rule to use. |
michael@0 | 82 | * @param aAnchor [in] accessible to start search from, if not provided, |
michael@0 | 83 | * current position will be used. |
michael@0 | 84 | * @param aIncludeStart [in] include anchor accessible in search. |
michael@0 | 85 | * @return true on success, false if there are no new nodes to traverse to. |
michael@0 | 86 | */ |
michael@0 | 87 | [optional_argc] boolean moveNext(in nsIAccessibleTraversalRule aRule, |
michael@0 | 88 | [optional] in nsIAccessible aAnchor, |
michael@0 | 89 | [optional] in boolean aIncludeStart); |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * Move pivot to previous object, from current position or given anchor, |
michael@0 | 93 | * complying to given traversal rule. |
michael@0 | 94 | * |
michael@0 | 95 | * @param aRule [in] traversal rule to use. |
michael@0 | 96 | * @param aAnchor [in] accessible to start search from, if not provided, |
michael@0 | 97 | * current position will be used. |
michael@0 | 98 | * @param aIncludeStart [in] include anchor accessible in search. |
michael@0 | 99 | * @return true on success, false if there are no new nodes to traverse to. |
michael@0 | 100 | */ |
michael@0 | 101 | [optional_argc] boolean movePrevious(in nsIAccessibleTraversalRule aRule, |
michael@0 | 102 | [optional] in nsIAccessible aAnchor, |
michael@0 | 103 | [optional] in boolean aIncludeStart); |
michael@0 | 104 | |
michael@0 | 105 | /** |
michael@0 | 106 | * Move pivot to first object in subtree complying to given traversal rule. |
michael@0 | 107 | * |
michael@0 | 108 | * @param aRule [in] traversal rule to use. |
michael@0 | 109 | * @return true on success, false if there are no new nodes to traverse to. |
michael@0 | 110 | */ |
michael@0 | 111 | boolean moveFirst(in nsIAccessibleTraversalRule aRule); |
michael@0 | 112 | |
michael@0 | 113 | /** |
michael@0 | 114 | * Move pivot to last object in subtree complying to given traversal rule. |
michael@0 | 115 | * |
michael@0 | 116 | * @param aRule [in] traversal rule to use. |
michael@0 | 117 | * @return true on success, false if there are no new nodes to traverse to. |
michael@0 | 118 | */ |
michael@0 | 119 | boolean moveLast(in nsIAccessibleTraversalRule aRule); |
michael@0 | 120 | |
michael@0 | 121 | /** |
michael@0 | 122 | * Move pivot to next text range. |
michael@0 | 123 | * |
michael@0 | 124 | * @param aBoundary [in] type of boundary for next text range, character, word, |
michael@0 | 125 | * etc. |
michael@0 | 126 | * @return true on success, false if there are is no more text. |
michael@0 | 127 | */ |
michael@0 | 128 | boolean moveNextByText(in TextBoundaryType aBoundary); |
michael@0 | 129 | |
michael@0 | 130 | /** |
michael@0 | 131 | * Move pivot to previous text range. |
michael@0 | 132 | * |
michael@0 | 133 | * @param aBoundary [in] type of boundary for previous text range, character, |
michael@0 | 134 | * word, etc. |
michael@0 | 135 | * @return true on success, false if there are is no more text. |
michael@0 | 136 | */ |
michael@0 | 137 | boolean movePreviousByText(in TextBoundaryType aBoundary); |
michael@0 | 138 | |
michael@0 | 139 | /** |
michael@0 | 140 | * Move pivot to given coordinate in screen pixels. |
michael@0 | 141 | * |
michael@0 | 142 | * @param aRule [in] raversal rule to use. |
michael@0 | 143 | * @param aX [in] screen's x coordinate |
michael@0 | 144 | * @param aY [in] screen's y coordinate |
michael@0 | 145 | * @param aIgnoreNoMatch [in] don't unset position if no object was found at |
michael@0 | 146 | * point. |
michael@0 | 147 | * @return true on success, false if the pivot has not been moved. |
michael@0 | 148 | */ |
michael@0 | 149 | boolean moveToPoint(in nsIAccessibleTraversalRule aRule, |
michael@0 | 150 | in long aX, in long aY, |
michael@0 | 151 | in boolean aIgnoreNoMatch); |
michael@0 | 152 | |
michael@0 | 153 | /** |
michael@0 | 154 | * Add an observer for pivot changes. |
michael@0 | 155 | * |
michael@0 | 156 | * @param aObserver [in] the observer object to be notified of pivot changes. |
michael@0 | 157 | */ |
michael@0 | 158 | void addObserver(in nsIAccessiblePivotObserver aObserver); |
michael@0 | 159 | |
michael@0 | 160 | /** |
michael@0 | 161 | * Remove an observer for pivot changes. |
michael@0 | 162 | * |
michael@0 | 163 | * @param aObserver [in] the observer object to remove from being notified. |
michael@0 | 164 | */ |
michael@0 | 165 | void removeObserver(in nsIAccessiblePivotObserver aObserver); |
michael@0 | 166 | }; |
michael@0 | 167 | |
michael@0 | 168 | /** |
michael@0 | 169 | * An observer interface for pivot changes. |
michael@0 | 170 | */ |
michael@0 | 171 | [scriptable, uuid(b6508c5e-c081-467d-835c-613eedf9ee9b)] |
michael@0 | 172 | interface nsIAccessiblePivotObserver : nsISupports |
michael@0 | 173 | { |
michael@0 | 174 | /** |
michael@0 | 175 | * Called when the pivot changes. |
michael@0 | 176 | * |
michael@0 | 177 | * @param aPivot [in] the pivot that has changed. |
michael@0 | 178 | * @param aOldAccessible [in] the old pivot position before the change, or null. |
michael@0 | 179 | * @param aOldStart [in] the old start offset, or -1. |
michael@0 | 180 | * @param aOldEnd [in] the old end offset, or -1. |
michael@0 | 181 | * @param aReason [in] the reason for the pivot change. |
michael@0 | 182 | */ |
michael@0 | 183 | void onPivotChanged(in nsIAccessiblePivot aPivot, |
michael@0 | 184 | in nsIAccessible aOldAccessible, |
michael@0 | 185 | in long aOldStart, in long aOldEnd, |
michael@0 | 186 | in PivotMoveReason aReason); |
michael@0 | 187 | }; |
michael@0 | 188 | |
michael@0 | 189 | [scriptable, uuid(4d9c4352-20f5-4c54-9580-0c77bb6b1115)] |
michael@0 | 190 | interface nsIAccessibleTraversalRule : nsISupports |
michael@0 | 191 | { |
michael@0 | 192 | /* Ignore this accessible object */ |
michael@0 | 193 | const unsigned short FILTER_IGNORE = 0x0; |
michael@0 | 194 | /* Accept this accessible object */ |
michael@0 | 195 | const unsigned short FILTER_MATCH = 0x1; |
michael@0 | 196 | /* Don't traverse accessibles children */ |
michael@0 | 197 | const unsigned short FILTER_IGNORE_SUBTREE = 0x2; |
michael@0 | 198 | |
michael@0 | 199 | /* Pre-filters */ |
michael@0 | 200 | const unsigned long PREFILTER_INVISIBLE = 0x00000001; |
michael@0 | 201 | const unsigned long PREFILTER_OFFSCREEN = 0x00000002; |
michael@0 | 202 | const unsigned long PREFILTER_NOT_FOCUSABLE = 0x00000004; |
michael@0 | 203 | const unsigned long PREFILTER_ARIA_HIDDEN = 0x00000008; |
michael@0 | 204 | const unsigned long PREFILTER_TRANSPARENT = 0x00000010; |
michael@0 | 205 | |
michael@0 | 206 | /** |
michael@0 | 207 | * Pre-filter bitfield to filter out obviously ignorable nodes and lighten |
michael@0 | 208 | * the load on match(). |
michael@0 | 209 | */ |
michael@0 | 210 | readonly attribute unsigned long preFilter; |
michael@0 | 211 | |
michael@0 | 212 | /** |
michael@0 | 213 | * Retrieve a list of roles that the traversal rule should test for. Any node |
michael@0 | 214 | * with a role not in this list will automatically be ignored. An empty list |
michael@0 | 215 | * will match all roles. It should be assumed that this method is called once |
michael@0 | 216 | * at the start of a traversal, so changing the method's return result after |
michael@0 | 217 | * that would have no affect. |
michael@0 | 218 | * |
michael@0 | 219 | * @param aRoles [out] an array of the roles to match. |
michael@0 | 220 | * @param aCount [out] the length of the array. |
michael@0 | 221 | */ |
michael@0 | 222 | void getMatchRoles([array, size_is(aCount)]out unsigned long aRoles, |
michael@0 | 223 | [retval]out unsigned long aCount); |
michael@0 | 224 | |
michael@0 | 225 | /** |
michael@0 | 226 | * Determines if a given accessible is to be accepted in our traversal rule |
michael@0 | 227 | * |
michael@0 | 228 | * @param aAccessible [in] accessible to examine. |
michael@0 | 229 | * @return a bitfield of FILTER_MATCH and FILTER_IGNORE_SUBTREE. |
michael@0 | 230 | */ |
michael@0 | 231 | unsigned short match(in nsIAccessible aAccessible); |
michael@0 | 232 | }; |