Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/browser/accessibility/browser_accessibility.h

Issue 2217363002: Use relative bounding boxes throughout Chrome accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from aboxhall Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Returns nullptr if there are no children. 136 // Returns nullptr if there are no children.
137 BrowserAccessibility* PlatformDeepestFirstChild() const; 137 BrowserAccessibility* PlatformDeepestFirstChild() const;
138 // Returns nullptr if there are no children. 138 // Returns nullptr if there are no children.
139 BrowserAccessibility* PlatformDeepestLastChild() const; 139 BrowserAccessibility* PlatformDeepestLastChild() const;
140 140
141 // Returns nullptr if there are no children. 141 // Returns nullptr if there are no children.
142 BrowserAccessibility* InternalDeepestFirstChild() const; 142 BrowserAccessibility* InternalDeepestFirstChild() const;
143 // Returns nullptr if there are no children. 143 // Returns nullptr if there are no children.
144 BrowserAccessibility* InternalDeepestLastChild() const; 144 BrowserAccessibility* InternalDeepestLastChild() const;
145 145
146 // Returns the bounds of this object in coordinates relative to this frame.
147 gfx::Rect GetFrameBoundsRect() const;
148
146 // Returns the bounds of this object in coordinates relative to the 149 // Returns the bounds of this object in coordinates relative to the
147 // top-left corner of the overall web area. 150 // page (specifically, the top-left corner of the topmost web contents).
148 gfx::Rect GetLocalBoundsRect() const; 151 gfx::Rect GetPageBoundsRect() const;
149 152
150 // Returns the bounds of this object in screen coordinates. 153 // Returns the bounds of this object in screen coordinates.
151 gfx::Rect GetGlobalBoundsRect() const; 154 gfx::Rect GetScreenBoundsRect() const;
152 155
153 // Returns the bounds of the given range in coordinates relative to the 156 // Returns the bounds of the given range in coordinates relative to the
154 // top-left corner of the overall web area. Only valid when the 157 // top-left corner of the overall web area. Only valid when the
155 // role is WebAXRoleStaticText. 158 // role is WebAXRoleStaticText.
156 gfx::Rect GetLocalBoundsForRange(int start, int len) const; 159 gfx::Rect GetPageBoundsForRange(int start, int len) const;
157 160
158 // Same as GetLocalBoundsForRange, in screen coordinates. Only valid when 161 // Same as GetPageBoundsForRange, in screen coordinates. Only valid when
159 // the role is WebAXRoleStaticText. 162 // the role is WebAXRoleStaticText.
160 gfx::Rect GetGlobalBoundsForRange(int start, int len) const; 163 gfx::Rect GetScreenBoundsForRange(int start, int len) const;
161 164
162 // This is to handle the cases such as ARIA textbox, where the value should 165 // This is to handle the cases such as ARIA textbox, where the value should
163 // be calculated from the object's inner text. 166 // be calculated from the object's inner text.
164 virtual base::string16 GetValue() const; 167 virtual base::string16 GetValue() const;
165 168
166 // Starting at the given character offset, locates the start of the next or 169 // Starting at the given character offset, locates the start of the next or
167 // previous line and returns its character offset. 170 // previous line and returns its character offset.
168 int GetLineStartBoundary(int start, 171 int GetLineStartBoundary(int start,
169 ui::TextBoundaryDirection direction, 172 ui::TextBoundaryDirection direction,
170 ui::AXTextAffinity affinity) const; 173 ui::AXTextAffinity affinity) const;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // accessibility APIs. 221 // accessibility APIs.
219 uint32_t InternalChildCount() const; 222 uint32_t InternalChildCount() const;
220 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; 223 BrowserAccessibility* InternalGetChild(uint32_t child_index) const;
221 BrowserAccessibility* InternalGetParent() const; 224 BrowserAccessibility* InternalGetParent() const;
222 225
223 BrowserAccessibility* GetParent() const; 226 BrowserAccessibility* GetParent() const;
224 int32_t GetIndexInParent() const; 227 int32_t GetIndexInParent() const;
225 228
226 int32_t GetId() const; 229 int32_t GetId() const;
227 const ui::AXNodeData& GetData() const; 230 const ui::AXNodeData& GetData() const;
228 gfx::Rect GetLocation() const; 231 gfx::RectF GetLocation() const;
229 int32_t GetRole() const; 232 int32_t GetRole() const;
230 int32_t GetState() const; 233 int32_t GetState() const;
231 234
232 typedef base::StringPairs HtmlAttributes; 235 typedef base::StringPairs HtmlAttributes;
233 const HtmlAttributes& GetHtmlAttributes() const; 236 const HtmlAttributes& GetHtmlAttributes() const;
234 237
235 // Returns true if this is a native platform-specific object, vs a 238 // Returns true if this is a native platform-specific object, vs a
236 // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if 239 // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if
237 // IsNative returns false. 240 // IsNative returns false.
238 virtual bool IsNative() const; 241 virtual bool IsNative() const;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // |GetInnerText| recursively includes all the text from descendants such as 360 // |GetInnerText| recursively includes all the text from descendants such as
358 // text found in any embedded object. In contrast, |GetText| might include a 361 // text found in any embedded object. In contrast, |GetText| might include a
359 // special character in the place of every embedded object instead of its 362 // special character in the place of every embedded object instead of its
360 // text, depending on the platform. 363 // text, depending on the platform.
361 base::string16 GetInnerText() const; 364 base::string16 GetInnerText() const;
362 365
363 // If a bounding rectangle is empty, compute it based on the union of its 366 // If a bounding rectangle is empty, compute it based on the union of its
364 // children, since most accessibility APIs don't like elements with no 367 // children, since most accessibility APIs don't like elements with no
365 // bounds, but "virtual" elements in the accessibility tree that don't 368 // bounds, but "virtual" elements in the accessibility tree that don't
366 // correspond to a layed-out element sometimes don't have bounds. 369 // correspond to a layed-out element sometimes don't have bounds.
367 void FixEmptyBounds(gfx::Rect* bounds) const; 370 void FixEmptyBounds(gfx::RectF* bounds) const;
368 371
369 // Convert the bounding rectangle of an element (which is relative to 372 // Convert the bounding rectangle of an element (which is relative to
370 // its nearest scrollable ancestor) to local bounds (which are relative 373 // its nearest scrollable ancestor) to absolute bounds, either in
371 // to the top of the web accessibility tree). 374 // page coordinates (when |frameOnly| is false), or in frame coordinates
372 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; 375 // (when |frameOnly| is true).
376 gfx::Rect RelativeToAbsoluteBounds(gfx::RectF bounds, bool frame_only) const;
373 377
374 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 378 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
375 }; 379 };
376 380
377 } // namespace content 381 } // namespace content
378 382
379 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 383 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698