OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "core/editing/VisiblePosition.h" | 33 #include "core/editing/VisiblePosition.h" |
34 #include "platform/geometry/FloatQuad.h" | 34 #include "platform/geometry/FloatQuad.h" |
35 #include "platform/geometry/LayoutRect.h" | 35 #include "platform/geometry/LayoutRect.h" |
36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class AXObject; | 42 class AXObject; |
43 class AXObjectCache; | |
43 class AXObjectCacheImpl; | 44 class AXObjectCacheImpl; |
44 class Element; | 45 class Element; |
45 class FrameView; | 46 class FrameView; |
46 class IntPoint; | 47 class IntPoint; |
47 class Node; | 48 class Node; |
48 class RenderObject; | 49 class RenderObject; |
49 class ScrollableArea; | 50 class ScrollableArea; |
50 class Widget; | 51 class Widget; |
51 | 52 |
52 typedef unsigned AXID; | 53 typedef unsigned AXID; |
53 | 54 |
54 enum AccessibilityRole { | 55 enum AccessibilityRole { |
56 NoRole = 0, | |
dmazzoni
2014/12/09 00:49:51
I still vote for reusing UnknownRole rather than i
aboxhall
2014/12/13 01:38:36
Is that accurate? It seems to compile and run fine
dmazzoni
2014/12/16 19:18:19
Switch statements on enums should always explicitl
aboxhall
2014/12/16 23:56:37
Done.
| |
55 AlertDialogRole = 1, | 57 AlertDialogRole = 1, |
56 AlertRole, | 58 AlertRole, |
57 AnnotationRole, | 59 AnnotationRole, |
58 ApplicationRole, | 60 ApplicationRole, |
59 ArticleRole, | 61 ArticleRole, |
60 BannerRole, | 62 BannerRole, |
61 BlockquoteRole, | 63 BlockquoteRole, |
62 BusyIndicatorRole, | 64 BusyIndicatorRole, |
63 ButtonRole, | 65 ButtonRole, |
64 CanvasRole, | 66 CanvasRole, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 TimerRole, | 162 TimerRole, |
161 ToggleButtonRole, | 163 ToggleButtonRole, |
162 ToolbarRole, | 164 ToolbarRole, |
163 TreeGridRole, | 165 TreeGridRole, |
164 TreeItemRole, | 166 TreeItemRole, |
165 TreeRole, | 167 TreeRole, |
166 UnknownRole, | 168 UnknownRole, |
167 UserInterfaceTooltipRole, | 169 UserInterfaceTooltipRole, |
168 WebAreaRole, | 170 WebAreaRole, |
169 WindowRole, | 171 WindowRole, |
172 NumRoles | |
170 }; | 173 }; |
171 | 174 |
172 enum AccessibilityTextSource { | 175 enum AccessibilityTextSource { |
173 AlternativeText, | 176 AlternativeText, |
174 ChildrenText, | 177 ChildrenText, |
175 SummaryText, | 178 SummaryText, |
176 HelpText, | 179 HelpText, |
177 VisibleText, | 180 VisibleText, |
178 TitleTagText, | 181 TitleTagText, |
179 PlaceholderText, | 182 PlaceholderText, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 | 277 |
275 PlainTextRange(unsigned s, unsigned l) | 278 PlainTextRange(unsigned s, unsigned l) |
276 : start(s) | 279 : start(s) |
277 , length(l) | 280 , length(l) |
278 { } | 281 { } |
279 | 282 |
280 bool isNull() const { return !start && !length; } | 283 bool isNull() const { return !start && !length; } |
281 }; | 284 }; |
282 | 285 |
283 protected: | 286 protected: |
284 AXObject(); | 287 AXObject(AXObjectCache*); |
285 | 288 |
286 public: | 289 public: |
287 virtual ~AXObject(); | 290 virtual ~AXObject(); |
288 | 291 |
289 // After constructing an AXObject, it must be given a | 292 // After constructing an AXObject, it must be given a |
290 // unique ID, then added to AXObjectCacheImpl, and finally init() must | 293 // unique ID, then added to AXObjectCacheImpl, and finally init() must |
291 // be called last. | 294 // be called last. |
292 void setAXObjectID(AXID axObjectID) { m_id = axObjectID; } | 295 void setAXObjectID(AXID axObjectID) { m_id = axObjectID; } |
293 virtual void init() { } | 296 virtual void init() { } |
294 | 297 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 virtual VisiblePosition visiblePositionForIndex(int) const { return VisibleP osition(); } | 572 virtual VisiblePosition visiblePositionForIndex(int) const { return VisibleP osition(); } |
570 int lineForPosition(const VisiblePosition&) const; | 573 int lineForPosition(const VisiblePosition&) const; |
571 virtual int index(const VisiblePosition&) const { return -1; } | 574 virtual int index(const VisiblePosition&) const { return -1; } |
572 virtual void lineBreaks(Vector<int>&) const { } | 575 virtual void lineBreaks(Vector<int>&) const { } |
573 | 576 |
574 // Static helper functions. | 577 // Static helper functions. |
575 static bool isARIAControl(AccessibilityRole); | 578 static bool isARIAControl(AccessibilityRole); |
576 static bool isARIAInput(AccessibilityRole); | 579 static bool isARIAInput(AccessibilityRole); |
577 static AccessibilityRole ariaRoleToWebCoreRole(const String&); | 580 static AccessibilityRole ariaRoleToWebCoreRole(const String&); |
578 static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&); | 581 static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&); |
582 static const AtomicString& roleName(const AccessibilityRole); | |
579 | 583 |
580 protected: | 584 protected: |
581 AXID m_id; | 585 AXID m_id; |
582 AccessibilityChildrenVector m_children; | 586 AccessibilityChildrenVector m_children; |
583 mutable bool m_haveChildren; | 587 mutable bool m_haveChildren; |
584 AccessibilityRole m_role; | 588 AccessibilityRole m_role; |
585 AXObjectInclusion m_lastKnownIsIgnoredValue; | 589 AXObjectInclusion m_lastKnownIsIgnoredValue; |
586 LayoutRect m_explicitElementRect; | 590 LayoutRect m_explicitElementRect; |
587 | 591 |
588 virtual bool computeAccessibilityIsIgnored() const { return true; } | 592 virtual bool computeAccessibilityIsIgnored() const { return true; } |
(...skipping 10 matching lines...) Expand all Loading... | |
599 bool m_detached; | 603 bool m_detached; |
600 | 604 |
601 mutable AXObject* m_parent; | 605 mutable AXObject* m_parent; |
602 | 606 |
603 // The following cached attribute values (the ones starting with m_cached*) | 607 // The following cached attribute values (the ones starting with m_cached*) |
604 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount(). | 608 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount(). |
605 mutable int m_lastModificationCount; | 609 mutable int m_lastModificationCount; |
606 mutable bool m_cachedIsIgnored; | 610 mutable bool m_cachedIsIgnored; |
607 mutable const AXObject* m_cachedLiveRegionRoot; | 611 mutable const AXObject* m_cachedLiveRegionRoot; |
608 | 612 |
613 AXObjectCacheImpl* m_axObjectCache; | |
614 | |
609 // Updates the cached attribute values. This may be recursive, so to prevent deadlocks, | 615 // Updates the cached attribute values. This may be recursive, so to prevent deadlocks, |
610 // functions called here may only search up the tree (ancestors), not down. | 616 // functions called here may only search up the tree (ancestors), not down. |
611 void updateCachedAttributeValuesIfNeeded() const; | 617 void updateCachedAttributeValuesIfNeeded() const; |
612 }; | 618 }; |
613 | 619 |
614 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ | 620 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ |
615 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate) | 621 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate) |
616 | 622 |
617 } // namespace blink | 623 } // namespace blink |
618 | 624 |
619 #endif // AXObject_h | 625 #endif // AXObject_h |
OLD | NEW |