Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISelectionDisplay.idl" |
michael@0 | 8 | |
michael@0 | 9 | %{C++ |
michael@0 | 10 | typedef short SelectionType; |
michael@0 | 11 | typedef short SelectionRegion; |
michael@0 | 12 | %} |
michael@0 | 13 | |
michael@0 | 14 | interface nsIContent; |
michael@0 | 15 | interface nsIDOMNode; |
michael@0 | 16 | interface nsISelection; |
michael@0 | 17 | interface nsISelectionDisplay; |
michael@0 | 18 | |
michael@0 | 19 | [scriptable, uuid(b1ff7faa-8097-431d-b7f1-b0615e3cd596)] |
michael@0 | 20 | interface nsISelectionController : nsISelectionDisplay |
michael@0 | 21 | { |
michael@0 | 22 | const short SELECTION_NONE=0; |
michael@0 | 23 | const short SELECTION_NORMAL=1; |
michael@0 | 24 | const short SELECTION_SPELLCHECK=2; |
michael@0 | 25 | const short SELECTION_IME_RAWINPUT=4; |
michael@0 | 26 | const short SELECTION_IME_SELECTEDRAWTEXT=8; |
michael@0 | 27 | const short SELECTION_IME_CONVERTEDTEXT=16; |
michael@0 | 28 | const short SELECTION_IME_SELECTEDCONVERTEDTEXT=32; |
michael@0 | 29 | const short SELECTION_ACCESSIBILITY=64; // For accessibility API usage |
michael@0 | 30 | const short SELECTION_FIND=128; |
michael@0 | 31 | const short SELECTION_URLSECONDARY=256; |
michael@0 | 32 | const short NUM_SELECTIONTYPES=10; |
michael@0 | 33 | |
michael@0 | 34 | const short SELECTION_ANCHOR_REGION = 0; |
michael@0 | 35 | const short SELECTION_FOCUS_REGION = 1; |
michael@0 | 36 | const short SELECTION_WHOLE_SELECTION = 2; |
michael@0 | 37 | const short NUM_SELECTION_REGIONS = 3; |
michael@0 | 38 | |
michael@0 | 39 | const short SELECTION_OFF = 0; |
michael@0 | 40 | const short SELECTION_HIDDEN =1;//>HIDDEN displays selection |
michael@0 | 41 | const short SELECTION_ON = 2; |
michael@0 | 42 | const short SELECTION_DISABLED = 3; |
michael@0 | 43 | const short SELECTION_ATTENTION = 4; |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED |
michael@0 | 47 | */ |
michael@0 | 48 | void setDisplaySelection(in short toggle); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED |
michael@0 | 52 | */ |
michael@0 | 53 | short getDisplaySelection(); |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | * GetSelection will return the selection that the presentation |
michael@0 | 57 | * shell may implement. |
michael@0 | 58 | * |
michael@0 | 59 | * @param aType will hold the type of selection //SelectionType |
michael@0 | 60 | * @param _return will hold the return value |
michael@0 | 61 | */ |
michael@0 | 62 | nsISelection getSelection(in short type); |
michael@0 | 63 | |
michael@0 | 64 | const short SCROLL_SYNCHRONOUS = 1<<1; |
michael@0 | 65 | const short SCROLL_FIRST_ANCESTOR_ONLY = 1<<2; |
michael@0 | 66 | const short SCROLL_CENTER_VERTICALLY = 1<<4; |
michael@0 | 67 | const short SCROLL_OVERFLOW_HIDDEN = 1<<5; |
michael@0 | 68 | |
michael@0 | 69 | /** |
michael@0 | 70 | * ScrollSelectionIntoView scrolls a region of the selection, |
michael@0 | 71 | * so that it is visible in the scrolled view. |
michael@0 | 72 | * |
michael@0 | 73 | * @param aType the selection to scroll into view. //SelectionType |
michael@0 | 74 | * @param aRegion the region inside the selection to scroll into view. //SelectionRegion |
michael@0 | 75 | * @param aFlags the scroll flags. Valid bits include: |
michael@0 | 76 | * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view |
michael@0 | 77 | * before returning. If not set, posts a request which is processed |
michael@0 | 78 | * at some point after the method returns. |
michael@0 | 79 | * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be scrolled |
michael@0 | 80 | * into view. |
michael@0 | 81 | * SCROLL_OVERFLOW_HIDDEN: if set, scrolls even if the overflow is specified |
michael@0 | 82 | * as hidden. |
michael@0 | 83 | * |
michael@0 | 84 | * Note that if isSynchronous is true, then this might flush the pending |
michael@0 | 85 | * reflow. It's dangerous for some objects. See bug 418470 comment 12. |
michael@0 | 86 | */ |
michael@0 | 87 | void scrollSelectionIntoView(in short type, in short region, in short flags); |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * RepaintSelection repaints the selection specified by aType. |
michael@0 | 91 | * |
michael@0 | 92 | * @param aType specifies the selection to repaint. |
michael@0 | 93 | */ |
michael@0 | 94 | void repaintSelection(in short type); |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * Set the caret as enabled or disabled. An enabled caret will |
michael@0 | 98 | * draw or blink when made visible. A disabled caret will never show up. |
michael@0 | 99 | * Can be called any time. |
michael@0 | 100 | * @param aEnable PR_TRUE to enable caret. PR_FALSE to disable. |
michael@0 | 101 | * @return always NS_OK |
michael@0 | 102 | */ |
michael@0 | 103 | |
michael@0 | 104 | void setCaretEnabled(in boolean enabled); |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * Set the caret readonly or not. An readonly caret will |
michael@0 | 108 | * draw but not blink when made visible. |
michael@0 | 109 | * @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable. |
michael@0 | 110 | * @return always NS_OK |
michael@0 | 111 | */ |
michael@0 | 112 | void setCaretReadOnly(in boolean readOnly); |
michael@0 | 113 | |
michael@0 | 114 | /** |
michael@0 | 115 | * Gets the current state of the caret. |
michael@0 | 116 | * @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled |
michael@0 | 117 | * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG |
michael@0 | 118 | * else NS_OK |
michael@0 | 119 | */ |
michael@0 | 120 | boolean getCaretEnabled(); |
michael@0 | 121 | |
michael@0 | 122 | /** |
michael@0 | 123 | * This is true if the caret is enabled, visible, and currently blinking. |
michael@0 | 124 | * This is still true when the caret is enabled, visible, but in its "off" |
michael@0 | 125 | * blink cycle. |
michael@0 | 126 | */ |
michael@0 | 127 | readonly attribute boolean caretVisible; |
michael@0 | 128 | |
michael@0 | 129 | /** |
michael@0 | 130 | * Show the caret even in selections. By default the caret is hidden unless the |
michael@0 | 131 | * selection is collapsed. Use this function to show the caret even in selections. |
michael@0 | 132 | * @param aVisibility PR_TRUE to show the caret in selections. PR_FALSE to hide. |
michael@0 | 133 | * @return always NS_OK |
michael@0 | 134 | */ |
michael@0 | 135 | void setCaretVisibilityDuringSelection(in boolean visibility); |
michael@0 | 136 | |
michael@0 | 137 | /** CharacterMove will move the selection one character forward/backward in the document. |
michael@0 | 138 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 139 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 140 | * or the last point adjusted by the selection. |
michael@0 | 141 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 142 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 143 | */ |
michael@0 | 144 | void characterMove(in boolean forward, in boolean extend); |
michael@0 | 145 | |
michael@0 | 146 | /** |
michael@0 | 147 | * CharacterExtendForDelete will extend the selection one character cell |
michael@0 | 148 | * forward in the document. |
michael@0 | 149 | * this method is used internally for handling del key. |
michael@0 | 150 | */ |
michael@0 | 151 | [noscript] void characterExtendForDelete(); |
michael@0 | 152 | |
michael@0 | 153 | /** |
michael@0 | 154 | * CharacterExtendForBackspace will extend the selection one character cell |
michael@0 | 155 | * backward in the document. |
michael@0 | 156 | * this method is used internally for handling backspace key only when we're |
michael@0 | 157 | * after UTF-16 surrogates. |
michael@0 | 158 | */ |
michael@0 | 159 | [noscript] void characterExtendForBackspace(); |
michael@0 | 160 | |
michael@0 | 161 | /** WordMove will move the selection one word forward/backward in the document. |
michael@0 | 162 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 163 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 164 | * or the last point adjusted by the selection. |
michael@0 | 165 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 166 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 167 | */ |
michael@0 | 168 | |
michael@0 | 169 | void wordMove(in boolean forward, in boolean extend); |
michael@0 | 170 | |
michael@0 | 171 | /** wordExtendForDelete will extend the selection one word forward/backward in the document. |
michael@0 | 172 | * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del. |
michael@0 | 173 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 174 | */ |
michael@0 | 175 | [noscript] void wordExtendForDelete(in boolean forward); |
michael@0 | 176 | |
michael@0 | 177 | /** LineMove will move the selection one line forward/backward in the document. |
michael@0 | 178 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 179 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 180 | * or the last point adjusted by the selection. |
michael@0 | 181 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 182 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 183 | */ |
michael@0 | 184 | void lineMove(in boolean forward, in boolean extend); |
michael@0 | 185 | |
michael@0 | 186 | /** IntraLineMove will move the selection to the front of the line or end of the line |
michael@0 | 187 | * in the document. |
michael@0 | 188 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 189 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 190 | * or the last point adjusted by the selection. |
michael@0 | 191 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 192 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 193 | */ |
michael@0 | 194 | void intraLineMove(in boolean forward, in boolean extend); |
michael@0 | 195 | |
michael@0 | 196 | /** PageMove will move the selection one page forward/backward in the document. |
michael@0 | 197 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 198 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 199 | * or the last point adjusted by the selection. |
michael@0 | 200 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 201 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 202 | */ |
michael@0 | 203 | void pageMove(in boolean forward, in boolean extend); |
michael@0 | 204 | |
michael@0 | 205 | /** CompleteScroll will move page view to the top or bottom of the document |
michael@0 | 206 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 207 | */ |
michael@0 | 208 | void completeScroll(in boolean forward); |
michael@0 | 209 | |
michael@0 | 210 | /** CompleteMove will move page view to the top or bottom of the document |
michael@0 | 211 | * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE |
michael@0 | 212 | * the "point" of selection that is extended is considered the "focus" point. |
michael@0 | 213 | * or the last point adjusted by the selection. |
michael@0 | 214 | * @param aForward forward or backward if PR_FALSE |
michael@0 | 215 | * @param aExtend should it collapse the selection of extend it? |
michael@0 | 216 | */ |
michael@0 | 217 | void completeMove(in boolean forward, in boolean extend); |
michael@0 | 218 | |
michael@0 | 219 | |
michael@0 | 220 | /** ScrollPage will scroll the page without affecting the selection. |
michael@0 | 221 | * @param aForward scroll forward or backwards in selection |
michael@0 | 222 | */ |
michael@0 | 223 | void scrollPage(in boolean forward); |
michael@0 | 224 | |
michael@0 | 225 | /** ScrollLine will scroll line up or down dependent on the boolean |
michael@0 | 226 | * @param aForward scroll forward or backwards in selection |
michael@0 | 227 | */ |
michael@0 | 228 | void scrollLine(in boolean forward); |
michael@0 | 229 | |
michael@0 | 230 | /** ScrollCharacter will scroll right or left dependent on the boolean |
michael@0 | 231 | * @param aRight if true will scroll right. if not will scroll left. |
michael@0 | 232 | */ |
michael@0 | 233 | void scrollCharacter(in boolean right); |
michael@0 | 234 | |
michael@0 | 235 | /** SelectAll will select the whole page |
michael@0 | 236 | */ |
michael@0 | 237 | void selectAll(); |
michael@0 | 238 | |
michael@0 | 239 | /** CheckVisibility will return true if textnode and offsets are actually rendered |
michael@0 | 240 | * in the current precontext. |
michael@0 | 241 | * @param aNode textNode to test |
michael@0 | 242 | * @param aStartOffset offset in dom to first char of textnode to test |
michael@0 | 243 | * @param aEndOffset offset in dom to last char of textnode to test |
michael@0 | 244 | * @param aReturnBool boolean returned TRUE if visible FALSE if not |
michael@0 | 245 | */ |
michael@0 | 246 | boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset); |
michael@0 | 247 | [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset); |
michael@0 | 248 | |
michael@0 | 249 | }; |
michael@0 | 250 | %{ C++ |
michael@0 | 251 | #define NS_ISELECTIONCONTROLLER_CID \ |
michael@0 | 252 | { 0x513b9460, 0xd56a, 0x4c4e, \ |
michael@0 | 253 | { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }} |
michael@0 | 254 | %} |