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

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

Issue 1598583002: Fixed algorithms that compute bounding rectangles and word start offsets to take into account IA2 h… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // The following attributes are appropriate to use with this method: 280 // The following attributes are appropriate to use with this method:
281 // aria-selected (selectable) 281 // aria-selected (selectable)
282 // aria-grabbed (grabbable) 282 // aria-grabbed (grabbable)
283 // aria-expanded (expandable) 283 // aria-expanded (expandable)
284 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state 284 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state
285 // aria-checked (checkable) -- supports 4th "mixed state" 285 // aria-checked (checkable) -- supports 4th "mixed state"
286 bool GetAriaTristate(const char* attr_name, 286 bool GetAriaTristate(const char* attr_name,
287 bool* is_defined, 287 bool* is_defined,
288 bool* is_mixed) const; 288 bool* is_mixed) const;
289 289
290 virtual base::string16 GetText() const { return GetInnerText(); }
291 size_t GetTextLength() const;
292
290 // Returns true if the bit corresponding to the given state enum is 1. 293 // Returns true if the bit corresponding to the given state enum is 1.
291 bool HasState(ui::AXState state_enum) const; 294 bool HasState(ui::AXState state_enum) const;
292 295
293 // Returns true if this node is an cell or an table header. 296 // Returns true if this node is an cell or an table header.
294 bool IsCellOrTableHeaderRole() const; 297 bool IsCellOrTableHeaderRole() const;
295 298
296 // Returns true if the caret is active on this object. 299 // Returns true if the caret is active on this object.
297 bool HasCaret() const; 300 bool HasCaret() const;
298 301
299 // Returns true if this node is an editable text field of any kind.
300 bool IsEditableText() const;
301
302 // True if this is a web area, and its grandparent is a presentational iframe. 302 // True if this is a web area, and its grandparent is a presentational iframe.
303 bool IsWebAreaForPresentationalIframe() const; 303 bool IsWebAreaForPresentationalIframe() const;
304 304
305 bool IsControl() const; 305 bool IsControl() const;
306 bool IsSimpleTextControl() const; 306 bool IsSimpleTextControl() const;
307 // Indicates if this object is at the root of a rich edit text control. 307 // Indicates if this object is at the root of a rich edit text control.
308 bool IsRichTextControl() const; 308 bool IsRichTextControl() const;
309 309
310 // If an object is focusable but has no accessible name, use this 310 // If an object is focusable but has no accessible name, use this
311 // to compute a name from its descendants. 311 // to compute a name from its descendants.
312 std::string ComputeAccessibleNameFromDescendants(); 312 std::string ComputeAccessibleNameFromDescendants();
313 313
314 protected: 314 protected:
315 BrowserAccessibility(); 315 BrowserAccessibility();
316 316
317 // The manager of this tree of accessibility objects. 317 // The manager of this tree of accessibility objects.
318 BrowserAccessibilityManager* manager_; 318 BrowserAccessibilityManager* manager_;
319 319
320 // The underlying node. 320 // The underlying node.
321 ui::AXNode* node_; 321 ui::AXNode* node_;
322 322
323 private: 323 private:
324 // |GetInnerText| recursively includes all the text from descendants such as
325 // text found in any embedded object. In contrast, |GetText| might include a
326 // special character in the place of every embedded object instead of its
327 // text, depending on the platform.
324 base::string16 GetInnerText() const; 328 base::string16 GetInnerText() const;
325 int GetInnerTextLength() const; 329 size_t GetInnerTextLength() const;
326 330
327 // If a bounding rectangle is empty, compute it based on the union of its 331 // If a bounding rectangle is empty, compute it based on the union of its
328 // children, since most accessibility APIs don't like elements with no 332 // children, since most accessibility APIs don't like elements with no
329 // bounds, but "virtual" elements in the accessibility tree that don't 333 // bounds, but "virtual" elements in the accessibility tree that don't
330 // correspond to a layed-out element sometimes don't have bounds. 334 // correspond to a layed-out element sometimes don't have bounds.
331 void FixEmptyBounds(gfx::Rect* bounds) const; 335 void FixEmptyBounds(gfx::Rect* bounds) const;
332 336
333 // Convert the bounding rectangle of an element (which is relative to 337 // Convert the bounding rectangle of an element (which is relative to
334 // its nearest scrollable ancestor) to local bounds (which are relative 338 // its nearest scrollable ancestor) to local bounds (which are relative
335 // to the top of the web accessibility tree). 339 // to the top of the web accessibility tree).
336 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; 340 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const;
337 341
338 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 342 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
339 }; 343 };
340 344
341 } // namespace content 345 } // namespace content
342 346
343 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 347 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698