accessible/src/windows/ia2/ia2AccessibleText.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:expandtab:shiftwidth=2:tabstop=2:
michael@0 3 */
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 #ifndef _ACCESSIBLE_TEXT_H
michael@0 9 #define _ACCESSIBLE_TEXT_H
michael@0 10
michael@0 11 #include "nsISupports.h"
michael@0 12 #include "nsIAccessibleText.h"
michael@0 13
michael@0 14 #include "AccessibleText.h"
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace a11y {
michael@0 18
michael@0 19 class ia2AccessibleText: public IAccessibleText
michael@0 20 {
michael@0 21 public:
michael@0 22
michael@0 23 // IAccessibleText
michael@0 24 virtual HRESULT STDMETHODCALLTYPE addSelection(
michael@0 25 /* [in] */ long startOffset,
michael@0 26 /* [in] */ long endOffset);
michael@0 27
michael@0 28 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
michael@0 29 /* [in] */ long offset,
michael@0 30 /* [out] */ long *startOffset,
michael@0 31 /* [out] */ long *endOffset,
michael@0 32 /* [retval][out] */ BSTR *textAttributes);
michael@0 33
michael@0 34 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset(
michael@0 35 /* [retval][out] */ long *offset);
michael@0 36
michael@0 37 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents(
michael@0 38 /* [in] */ long offset,
michael@0 39 /* [in] */ enum IA2CoordinateType coordType,
michael@0 40 /* [out] */ long *x,
michael@0 41 /* [out] */ long *y,
michael@0 42 /* [out] */ long *width,
michael@0 43 /* [retval][out] */ long *height);
michael@0 44
michael@0 45 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections(
michael@0 46 /* [retval][out] */ long *nSelections);
michael@0 47
michael@0 48 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint(
michael@0 49 /* [in] */ long x,
michael@0 50 /* [in] */ long y,
michael@0 51 /* [in] */ enum IA2CoordinateType coordType,
michael@0 52 /* [retval][out] */ long *offset);
michael@0 53
michael@0 54 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection(
michael@0 55 /* [in] */ long selectionIndex,
michael@0 56 /* [out] */ long *startOffset,
michael@0 57 /* [retval][out] */ long *endOffset);
michael@0 58
michael@0 59 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text(
michael@0 60 /* [in] */ long startOffset,
michael@0 61 /* [in] */ long endOffset,
michael@0 62 /* [retval][out] */ BSTR *text);
michael@0 63
michael@0 64 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset(
michael@0 65 /* [in] */ long offset,
michael@0 66 /* [in] */ enum IA2TextBoundaryType boundaryType,
michael@0 67 /* [out] */ long *startOffset,
michael@0 68 /* [out] */ long *endOffset,
michael@0 69 /* [retval][out] */ BSTR *text);
michael@0 70
michael@0 71 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset(
michael@0 72 /* [in] */ long offset,
michael@0 73 /* [in] */ enum IA2TextBoundaryType boundaryType,
michael@0 74 /* [out] */ long *startOffset,
michael@0 75 /* [out] */ long *endOffset,
michael@0 76 /* [retval][out] */ BSTR *text);
michael@0 77
michael@0 78 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset(
michael@0 79 /* [in] */ long offset,
michael@0 80 /* [in] */ enum IA2TextBoundaryType boundaryType,
michael@0 81 /* [out] */ long *startOffset,
michael@0 82 /* [out] */ long *endOffset,
michael@0 83 /* [retval][out] */ BSTR *text);
michael@0 84
michael@0 85 virtual HRESULT STDMETHODCALLTYPE removeSelection(
michael@0 86 /* [in] */ long selectionIndex);
michael@0 87
michael@0 88 virtual HRESULT STDMETHODCALLTYPE setCaretOffset(
michael@0 89 /* [in] */ long offset);
michael@0 90
michael@0 91 virtual HRESULT STDMETHODCALLTYPE setSelection(
michael@0 92 /* [in] */ long selectionIndex,
michael@0 93 /* [in] */ long startOffset,
michael@0 94 /* [in] */ long endOffset);
michael@0 95
michael@0 96 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters(
michael@0 97 /* [retval][out] */ long *nCharacters);
michael@0 98
michael@0 99 virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(
michael@0 100 /* [in] */ long startIndex,
michael@0 101 /* [in] */ long endIndex,
michael@0 102 /* [in] */ enum IA2ScrollType scrollType);
michael@0 103
michael@0 104 virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(
michael@0 105 /* [in] */ long startIndex,
michael@0 106 /* [in] */ long endIndex,
michael@0 107 /* [in] */ enum IA2CoordinateType coordinateType,
michael@0 108 /* [in] */ long x,
michael@0 109 /* [in] */ long y);
michael@0 110
michael@0 111 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
michael@0 112 /* [retval][out] */ IA2TextSegment *newText);
michael@0 113
michael@0 114 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
michael@0 115 /* [retval][out] */ IA2TextSegment *oldText);
michael@0 116
michael@0 117 protected:
michael@0 118 virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
michael@0 119 uint32_t *aStartOffset,
michael@0 120 uint32_t *aEndOffset) = 0;
michael@0 121
michael@0 122 private:
michael@0 123 HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
michael@0 124 AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
michael@0 125 };
michael@0 126
michael@0 127 } // namespace a11y
michael@0 128 } // namespace mozilla
michael@0 129
michael@0 130
michael@0 131 #define FORWARD_IACCESSIBLETEXT(Class) \
michael@0 132 virtual HRESULT STDMETHODCALLTYPE addSelection(long startOffset, \
michael@0 133 long endOffset) \
michael@0 134 { \
michael@0 135 return Class::addSelection(startOffset, endOffset); \
michael@0 136 } \
michael@0 137 \
michael@0 138 virtual HRESULT STDMETHODCALLTYPE get_attributes(long offset, \
michael@0 139 long *startOffset, \
michael@0 140 long *endOffset, \
michael@0 141 BSTR *textAttributes) \
michael@0 142 { \
michael@0 143 return Class::get_attributes(offset, startOffset, endOffset, textAttributes);\
michael@0 144 } \
michael@0 145 \
michael@0 146 virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset) \
michael@0 147 { \
michael@0 148 return Class::get_caretOffset(offset); \
michael@0 149 } \
michael@0 150 \
michael@0 151 virtual HRESULT STDMETHODCALLTYPE get_characterExtents(long offset, \
michael@0 152 enum IA2CoordinateType coordType,\
michael@0 153 long *x, \
michael@0 154 long *y, \
michael@0 155 long *width, \
michael@0 156 long *height) \
michael@0 157 { \
michael@0 158 return Class::get_characterExtents(offset, coordType, x, y, width, height); \
michael@0 159 } \
michael@0 160 \
michael@0 161 virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections) \
michael@0 162 { \
michael@0 163 return Class::get_nSelections(nSelections); \
michael@0 164 } \
michael@0 165 \
michael@0 166 virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x, \
michael@0 167 long y, \
michael@0 168 enum IA2CoordinateType coordType,\
michael@0 169 long *offset) \
michael@0 170 { \
michael@0 171 return Class::get_offsetAtPoint(x, y, coordType, offset); \
michael@0 172 } \
michael@0 173 \
michael@0 174 virtual HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex, \
michael@0 175 long *startOffset, \
michael@0 176 long *endOffset) \
michael@0 177 { \
michael@0 178 return Class::get_selection(selectionIndex, startOffset, endOffset); \
michael@0 179 } \
michael@0 180 \
michael@0 181 virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset, \
michael@0 182 long endOffset, \
michael@0 183 BSTR *text) \
michael@0 184 { \
michael@0 185 return Class::get_text(startOffset, endOffset, text); \
michael@0 186 } \
michael@0 187 \
michael@0 188 virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset, \
michael@0 189 enum IA2TextBoundaryType boundaryType,\
michael@0 190 long *startOffset, \
michael@0 191 long *endOffset, \
michael@0 192 BSTR *text) \
michael@0 193 { \
michael@0 194 return Class::get_textBeforeOffset(offset, boundaryType, \
michael@0 195 startOffset, endOffset, text); \
michael@0 196 } \
michael@0 197 \
michael@0 198 virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset, \
michael@0 199 enum IA2TextBoundaryType boundaryType,\
michael@0 200 long *startOffset, \
michael@0 201 long *endOffset, \
michael@0 202 BSTR *text) \
michael@0 203 { \
michael@0 204 return Class::get_textAfterOffset(offset, boundaryType, \
michael@0 205 startOffset, endOffset, text); \
michael@0 206 } \
michael@0 207 \
michael@0 208 virtual HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset, \
michael@0 209 enum IA2TextBoundaryType boundaryType,\
michael@0 210 long *startOffset, \
michael@0 211 long *endOffset, \
michael@0 212 BSTR *text) \
michael@0 213 { \
michael@0 214 return Class::get_textAtOffset(offset, boundaryType, \
michael@0 215 startOffset, endOffset, text); \
michael@0 216 } \
michael@0 217 \
michael@0 218 virtual HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex) \
michael@0 219 { \
michael@0 220 return Class::removeSelection(selectionIndex); \
michael@0 221 } \
michael@0 222 \
michael@0 223 virtual HRESULT STDMETHODCALLTYPE setCaretOffset(long offset) \
michael@0 224 { \
michael@0 225 return Class::setCaretOffset(offset); \
michael@0 226 } \
michael@0 227 \
michael@0 228 virtual HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex, \
michael@0 229 long startOffset, \
michael@0 230 long endOffset) \
michael@0 231 { \
michael@0 232 return Class::setSelection(selectionIndex, startOffset, endOffset); \
michael@0 233 } \
michael@0 234 \
michael@0 235 virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters) \
michael@0 236 { \
michael@0 237 return Class::get_nCharacters(nCharacters); \
michael@0 238 } \
michael@0 239 \
michael@0 240 virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex, \
michael@0 241 long endIndex, \
michael@0 242 enum IA2ScrollType scrollType)\
michael@0 243 { \
michael@0 244 return Class::scrollSubstringTo(startIndex, endIndex, scrollType); \
michael@0 245 } \
michael@0 246 \
michael@0 247 virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex, \
michael@0 248 long endIndex, \
michael@0 249 enum IA2CoordinateType coordinateType,\
michael@0 250 long x, \
michael@0 251 long y) \
michael@0 252 { \
michael@0 253 return Class::scrollSubstringToPoint(startIndex, endIndex, \
michael@0 254 coordinateType, x, y); \
michael@0 255 } \
michael@0 256 \
michael@0 257 virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText) \
michael@0 258 { \
michael@0 259 return Class::get_newText(newText); \
michael@0 260 } \
michael@0 261 \
michael@0 262 virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText) \
michael@0 263 { \
michael@0 264 return Class::get_oldText(oldText); \
michael@0 265 } \
michael@0 266
michael@0 267 #endif
michael@0 268

mercurial