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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h

Issue 2858493002: Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Review feedback Created 3 years, 7 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 /* 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.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived 15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission. 16 * from this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef AXObject_h 30 #ifndef AXObjectImpl_h
31 #define AXObject_h 31 #define AXObjectImpl_h
32 32
33 #include "core/dom/AXObject.h"
33 #include "core/editing/VisiblePosition.h" 34 #include "core/editing/VisiblePosition.h"
34 #include "core/editing/markers/DocumentMarker.h" 35 #include "core/editing/markers/DocumentMarker.h"
35 #include "core/inspector/protocol/Accessibility.h" 36 #include "core/inspector/protocol/Accessibility.h"
36 #include "modules/ModulesExport.h" 37 #include "modules/ModulesExport.h"
37 #include "platform/geometry/FloatQuad.h" 38 #include "platform/geometry/FloatQuad.h"
38 #include "platform/geometry/LayoutRect.h" 39 #include "platform/geometry/LayoutRect.h"
39 #include "platform/graphics/Color.h" 40 #include "platform/graphics/Color.h"
40 #include "platform/wtf/Forward.h" 41 #include "platform/wtf/Forward.h"
41 #include "platform/wtf/Vector.h" 42 #include "platform/wtf/Vector.h"
42 43
43 class SkMatrix44; 44 class SkMatrix44;
44 45
45 namespace blink { 46 namespace blink {
46 47
47 class AXObject; 48 class AXObjectImpl;
48 class AXObjectCacheImpl; 49 class AXObjectCacheImpl;
49 class Element; 50 class Element;
50 class FrameView; 51 class FrameView;
51 class IntPoint; 52 class IntPoint;
52 class Node; 53 class Node;
53 class LayoutObject; 54 class LayoutObject;
54 class ScrollableArea; 55 class ScrollableArea;
55 56
56 enum class AOMStringProperty; 57 enum class AOMStringProperty;
57 58
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 class AccessibilityText final 225 class AccessibilityText final
225 : public GarbageCollectedFinalized<AccessibilityText> { 226 : public GarbageCollectedFinalized<AccessibilityText> {
226 WTF_MAKE_NONCOPYABLE(AccessibilityText); 227 WTF_MAKE_NONCOPYABLE(AccessibilityText);
227 228
228 public: 229 public:
229 DEFINE_INLINE_TRACE() { visitor->Trace(text_element_); } 230 DEFINE_INLINE_TRACE() { visitor->Trace(text_element_); }
230 231
231 private: 232 private:
232 AccessibilityText(const String& text, 233 AccessibilityText(const String& text,
233 const AccessibilityTextSource& source, 234 const AccessibilityTextSource& source,
234 AXObject* element) 235 AXObjectImpl* element)
235 : text_(text), text_element_(element) {} 236 : text_(text), text_element_(element) {}
236 237
237 String text_; 238 String text_;
238 Member<AXObject> text_element_; 239 Member<AXObjectImpl> text_element_;
239 }; 240 };
240 241
241 enum AccessibilityOrientation { 242 enum AccessibilityOrientation {
242 kAccessibilityOrientationUndefined = 0, 243 kAccessibilityOrientationUndefined = 0,
243 kAccessibilityOrientationVertical, 244 kAccessibilityOrientationVertical,
244 kAccessibilityOrientationHorizontal, 245 kAccessibilityOrientationHorizontal,
245 }; 246 };
246 247
247 enum AXObjectInclusion { 248 enum AXObjectInclusion {
248 kIncludeObject, 249 kIncludeObject,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 enum class AXObjectVectorAttribute { 345 enum class AXObjectVectorAttribute {
345 kAriaControls, 346 kAriaControls,
346 kAriaDetails, 347 kAriaDetails,
347 kAriaFlowTo, 348 kAriaFlowTo,
348 }; 349 };
349 350
350 class AXSparseAttributeClient { 351 class AXSparseAttributeClient {
351 public: 352 public:
352 virtual void AddBoolAttribute(AXBoolAttribute, bool) = 0; 353 virtual void AddBoolAttribute(AXBoolAttribute, bool) = 0;
353 virtual void AddStringAttribute(AXStringAttribute, const String&) = 0; 354 virtual void AddStringAttribute(AXStringAttribute, const String&) = 0;
354 virtual void AddObjectAttribute(AXObjectAttribute, AXObject&) = 0; 355 virtual void AddObjectAttribute(AXObjectAttribute, AXObjectImpl&) = 0;
355 virtual void AddObjectVectorAttribute(AXObjectVectorAttribute, 356 virtual void AddObjectVectorAttribute(AXObjectVectorAttribute,
356 HeapVector<Member<AXObject>>&) = 0; 357 HeapVector<Member<AXObjectImpl>>&) = 0;
357 }; 358 };
358 359
359 // The source of the accessible name of an element. This is needed 360 // The source of the accessible name of an element. This is needed
360 // because on some platforms this determines how the accessible name 361 // because on some platforms this determines how the accessible name
361 // is exposed. 362 // is exposed.
362 enum AXNameFrom { 363 enum AXNameFrom {
363 kAXNameFromUninitialized = -1, 364 kAXNameFromUninitialized = -1,
364 kAXNameFromAttribute = 0, 365 kAXNameFromAttribute = 0,
365 kAXNameFromAttributeExplicitlyEmpty, 366 kAXNameFromAttributeExplicitlyEmpty,
366 kAXNameFromCaption, 367 kAXNameFromCaption,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 kAXProbablyPresentational, 414 kAXProbablyPresentational,
414 kAXStaticTextUsedAsNameFor, 415 kAXStaticTextUsedAsNameFor,
415 kAXUninteresting 416 kAXUninteresting
416 }; 417 };
417 418
418 class IgnoredReason { 419 class IgnoredReason {
419 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 420 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
420 421
421 public: 422 public:
422 AXIgnoredReason reason; 423 AXIgnoredReason reason;
423 Member<const AXObject> related_object; 424 Member<const AXObjectImpl> related_object;
424 425
425 explicit IgnoredReason(AXIgnoredReason reason) 426 explicit IgnoredReason(AXIgnoredReason reason)
426 : reason(reason), related_object(nullptr) {} 427 : reason(reason), related_object(nullptr) {}
427 428
428 IgnoredReason(AXIgnoredReason r, const AXObject* obj) 429 IgnoredReason(AXIgnoredReason r, const AXObjectImpl* obj)
429 : reason(r), related_object(obj) {} 430 : reason(r), related_object(obj) {}
430 431
431 DEFINE_INLINE_TRACE() { visitor->Trace(related_object); } 432 DEFINE_INLINE_TRACE() { visitor->Trace(related_object); }
432 }; 433 };
433 434
434 class NameSourceRelatedObject 435 class NameSourceRelatedObject
435 : public GarbageCollectedFinalized<NameSourceRelatedObject> { 436 : public GarbageCollectedFinalized<NameSourceRelatedObject> {
436 WTF_MAKE_NONCOPYABLE(NameSourceRelatedObject); 437 WTF_MAKE_NONCOPYABLE(NameSourceRelatedObject);
437 438
438 public: 439 public:
439 WeakMember<AXObject> object; 440 WeakMember<AXObjectImpl> object;
440 String text; 441 String text;
441 442
442 NameSourceRelatedObject(AXObject* object, String text) 443 NameSourceRelatedObject(AXObjectImpl* object, String text)
443 : object(object), text(text) {} 444 : object(object), text(text) {}
444 445
445 DEFINE_INLINE_TRACE() { visitor->Trace(object); } 446 DEFINE_INLINE_TRACE() { visitor->Trace(object); }
446 }; 447 };
447 448
448 typedef HeapVector<Member<NameSourceRelatedObject>> AXRelatedObjectVector; 449 typedef HeapVector<Member<NameSourceRelatedObject>> AXRelatedObjectVector;
449 class NameSource { 450 class NameSource {
450 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 451 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
451 452
452 public: 453 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 }; 492 };
492 493
493 } // namespace blink 494 } // namespace blink
494 495
495 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason); 496 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason);
496 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource); 497 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource);
497 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::DescriptionSource); 498 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::DescriptionSource);
498 499
499 namespace blink { 500 namespace blink {
500 501
501 class MODULES_EXPORT AXObject : public GarbageCollectedFinalized<AXObject> { 502 class MODULES_EXPORT AXObjectImpl
502 WTF_MAKE_NONCOPYABLE(AXObject); 503 : public GarbageCollectedFinalized<AXObjectImpl>,
504 public AXObject {
505 WTF_MAKE_NONCOPYABLE(AXObjectImpl);
503 506
504 public: 507 public:
505 typedef HeapVector<Member<AXObject>> AXObjectVector; 508 typedef HeapVector<Member<AXObjectImpl>> AXObjectVector;
506 509
507 struct AXRange { 510 struct AXRange {
508 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 511 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
509 // The deepest descendant in which the range starts. 512 // The deepest descendant in which the range starts.
510 // (nullptr means the current object.) 513 // (nullptr means the current object.)
511 Persistent<AXObject> anchor_object; 514 Persistent<AXObjectImpl> anchor_object;
512 // The number of characters and child objects in the anchor object 515 // The number of characters and child objects in the anchor object
513 // before the range starts. 516 // before the range starts.
514 int anchor_offset; 517 int anchor_offset;
515 // When the same character offset could correspond to two possible 518 // When the same character offset could correspond to two possible
516 // cursor positions, upstream means it's on the previous line rather 519 // cursor positions, upstream means it's on the previous line rather
517 // than the next line. 520 // than the next line.
518 TextAffinity anchor_affinity; 521 TextAffinity anchor_affinity;
519 522
520 // The deepest descendant in which the range ends. 523 // The deepest descendant in which the range ends.
521 // (nullptr means the current object.) 524 // (nullptr means the current object.)
522 Persistent<AXObject> focus_object; 525 Persistent<AXObjectImpl> focus_object;
523 // The number of characters and child objects in the focus object 526 // The number of characters and child objects in the focus object
524 // before the range ends. 527 // before the range ends.
525 int focus_offset; 528 int focus_offset;
526 // When the same character offset could correspond to two possible 529 // When the same character offset could correspond to two possible
527 // cursor positions, upstream means it's on the previous line rather 530 // cursor positions, upstream means it's on the previous line rather
528 // than the next line. 531 // than the next line.
529 TextAffinity focus_affinity; 532 TextAffinity focus_affinity;
530 533
531 AXRange() 534 AXRange()
532 : anchor_object(nullptr), 535 : anchor_object(nullptr),
533 anchor_offset(-1), 536 anchor_offset(-1),
534 anchor_affinity(TextAffinity::kUpstream), 537 anchor_affinity(TextAffinity::kUpstream),
535 focus_object(nullptr), 538 focus_object(nullptr),
536 focus_offset(-1), 539 focus_offset(-1),
537 focus_affinity(TextAffinity::kDownstream) {} 540 focus_affinity(TextAffinity::kDownstream) {}
538 541
539 AXRange(int start_offset, int end_offset) 542 AXRange(int start_offset, int end_offset)
540 : anchor_object(nullptr), 543 : anchor_object(nullptr),
541 anchor_offset(start_offset), 544 anchor_offset(start_offset),
542 anchor_affinity(TextAffinity::kUpstream), 545 anchor_affinity(TextAffinity::kUpstream),
543 focus_object(nullptr), 546 focus_object(nullptr),
544 focus_offset(end_offset), 547 focus_offset(end_offset),
545 focus_affinity(TextAffinity::kDownstream) {} 548 focus_affinity(TextAffinity::kDownstream) {}
546 549
547 AXRange(AXObject* anchor_object, 550 AXRange(AXObjectImpl* anchor_object,
548 int anchor_offset, 551 int anchor_offset,
549 TextAffinity anchor_affinity, 552 TextAffinity anchor_affinity,
550 AXObject* focus_object, 553 AXObjectImpl* focus_object,
551 int focus_offset, 554 int focus_offset,
552 TextAffinity focus_affinity) 555 TextAffinity focus_affinity)
553 : anchor_object(anchor_object), 556 : anchor_object(anchor_object),
554 anchor_offset(anchor_offset), 557 anchor_offset(anchor_offset),
555 anchor_affinity(anchor_affinity), 558 anchor_affinity(anchor_affinity),
556 focus_object(focus_object), 559 focus_object(focus_object),
557 focus_offset(focus_offset), 560 focus_offset(focus_offset),
558 focus_affinity(focus_affinity) {} 561 focus_affinity(focus_affinity) {}
559 562
560 bool IsValid() const { 563 bool IsValid() const {
561 return ((anchor_object && focus_object) || 564 return ((anchor_object && focus_object) ||
562 (!anchor_object && !focus_object)) && 565 (!anchor_object && !focus_object)) &&
563 anchor_offset >= 0 && focus_offset >= 0; 566 anchor_offset >= 0 && focus_offset >= 0;
564 } 567 }
565 568
566 // Determines if the range only refers to text offsets under the current 569 // Determines if the range only refers to text offsets under the current
567 // object. 570 // object.
568 bool IsSimple() const { 571 bool IsSimple() const {
569 return anchor_object == focus_object || !anchor_object || !focus_object; 572 return anchor_object == focus_object || !anchor_object || !focus_object;
570 } 573 }
571 }; 574 };
572 575
573 protected: 576 protected:
574 AXObject(AXObjectCacheImpl&); 577 AXObjectImpl(AXObjectCacheImpl&);
575 578
576 public: 579 public:
577 virtual ~AXObject(); 580 virtual ~AXObjectImpl();
578 DECLARE_VIRTUAL_TRACE(); 581 DECLARE_VIRTUAL_TRACE();
579 582
580 static unsigned NumberOfLiveAXObjects() { return number_of_live_ax_objects_; } 583 static unsigned NumberOfLiveAXObjects() { return number_of_live_ax_objects_; }
581 584
582 // After constructing an AXObject, it must be given a 585 // After constructing an AXObjectImpl, it must be given a
583 // unique ID, then added to AXObjectCacheImpl, and finally init() must 586 // unique ID, then added to AXObjectCacheImpl, and finally init() must
584 // be called last. 587 // be called last.
585 void SetAXObjectID(AXID ax_object_id) { id_ = ax_object_id; } 588 void SetAXObjectID(AXID ax_object_id) { id_ = ax_object_id; }
586 virtual void Init() {} 589 virtual void Init() {}
587 590
588 // When the corresponding WebCore object that this AXObject 591 // When the corresponding WebCore object that this AXObjectImpl
589 // wraps is deleted, it must be detached. 592 // wraps is deleted, it must be detached.
590 virtual void Detach(); 593 virtual void Detach();
591 virtual bool IsDetached() const; 594 virtual bool IsDetached() const;
592 595
593 // If the parent of this object is known, this can be faster than using 596 // If the parent of this object is known, this can be faster than using
594 // computeParent(). 597 // computeParent().
595 virtual void SetParent(AXObject* parent) { parent_ = parent; } 598 virtual void SetParent(AXObjectImpl* parent) { parent_ = parent; }
596 599
597 // The AXObjectCacheImpl that owns this object, and its unique ID within this 600 // The AXObjectCacheImpl that owns this object, and its unique ID within this
598 // cache. 601 // cache.
599 AXObjectCacheImpl& AxObjectCache() const { 602 AXObjectCacheImpl& AxObjectCache() const {
600 DCHECK(ax_object_cache_); 603 DCHECK(ax_object_cache_);
601 return *ax_object_cache_; 604 return *ax_object_cache_;
602 } 605 }
603 606
604 AXID AxObjectID() const { return id_; } 607 AXID AxObjectID() const { return id_; }
605 608
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 bool AccessibilityIsIgnored() const; 718 bool AccessibilityIsIgnored() const;
716 typedef HeapVector<IgnoredReason> IgnoredReasons; 719 typedef HeapVector<IgnoredReason> IgnoredReasons;
717 virtual bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const { 720 virtual bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const {
718 return true; 721 return true;
719 } 722 }
720 bool AccessibilityIsIgnoredByDefault(IgnoredReasons* = nullptr) const; 723 bool AccessibilityIsIgnoredByDefault(IgnoredReasons* = nullptr) const;
721 AXObjectInclusion AccessibilityPlatformIncludesObject() const; 724 AXObjectInclusion AccessibilityPlatformIncludesObject() const;
722 virtual AXObjectInclusion DefaultObjectInclusion( 725 virtual AXObjectInclusion DefaultObjectInclusion(
723 IgnoredReasons* = nullptr) const; 726 IgnoredReasons* = nullptr) const;
724 bool IsInertOrAriaHidden() const; 727 bool IsInertOrAriaHidden() const;
725 const AXObject* AriaHiddenRoot() const; 728 const AXObjectImpl* AriaHiddenRoot() const;
726 bool ComputeIsInertOrAriaHidden(IgnoredReasons* = nullptr) const; 729 bool ComputeIsInertOrAriaHidden(IgnoredReasons* = nullptr) const;
727 bool IsDescendantOfLeafNode() const; 730 bool IsDescendantOfLeafNode() const;
728 AXObject* LeafNodeAncestor() const; 731 AXObjectImpl* LeafNodeAncestor() const;
729 bool IsDescendantOfDisabledNode() const; 732 bool IsDescendantOfDisabledNode() const;
730 const AXObject* DisabledAncestor() const; 733 const AXObjectImpl* DisabledAncestor() const;
731 bool LastKnownIsIgnoredValue(); 734 bool LastKnownIsIgnoredValue();
732 void SetLastKnownIsIgnoredValue(bool); 735 void SetLastKnownIsIgnoredValue(bool);
733 bool HasInheritedPresentationalRole() const; 736 bool HasInheritedPresentationalRole() const;
734 bool IsPresentationalChild() const; 737 bool IsPresentationalChild() const;
735 bool AncestorExposesActiveDescendant() const; 738 bool AncestorExposesActiveDescendant() const;
736 bool ComputeAncestorExposesActiveDescendant() const; 739 bool ComputeAncestorExposesActiveDescendant() const;
737 740
738 // 741 //
739 // Accessible name calculation 742 // Accessible name calculation
740 // 743 //
(...skipping 27 matching lines...) Expand all
768 AXRelatedObjectVector*) const { 771 AXRelatedObjectVector*) const {
769 return String(); 772 return String();
770 } 773 }
771 774
772 // Takes the result of nameFrom and descriptionFrom from calling |name| and 775 // Takes the result of nameFrom and descriptionFrom from calling |name| and
773 // |description|, above, and retrieves the placeholder of the object, if 776 // |description|, above, and retrieves the placeholder of the object, if
774 // present and if it wasn't already exposed by one of the two functions above. 777 // present and if it wasn't already exposed by one of the two functions above.
775 virtual String Placeholder(AXNameFrom) const { return String(); } 778 virtual String Placeholder(AXNameFrom) const { return String(); }
776 779
777 // Internal functions used by name and description, above. 780 // Internal functions used by name and description, above.
778 typedef HeapHashSet<Member<const AXObject>> AXObjectSet; 781 typedef HeapHashSet<Member<const AXObjectImpl>> AXObjectSet;
779 virtual String TextAlternative(bool recursive, 782 virtual String TextAlternative(bool recursive,
780 bool in_aria_labelled_by_traversal, 783 bool in_aria_labelled_by_traversal,
781 AXObjectSet& visited, 784 AXObjectSet& visited,
782 AXNameFrom& name_from, 785 AXNameFrom& name_from,
783 AXRelatedObjectVector* related_objects, 786 AXRelatedObjectVector* related_objects,
784 NameSources* name_sources) const { 787 NameSources* name_sources) const {
785 return String(); 788 return String();
786 } 789 }
787 virtual String TextFromDescendants(AXObjectSet& visited, 790 virtual String TextFromDescendants(AXObjectSet& visited,
788 bool recursive) const { 791 bool recursive) const {
(...skipping 28 matching lines...) Expand all
817 // Value should be 1-based. 0 means not supported. 820 // Value should be 1-based. 0 means not supported.
818 virtual int HeadingLevel() const { return 0; } 821 virtual int HeadingLevel() const { return 0; }
819 // Value should be 1-based. 0 means not supported. 822 // Value should be 1-based. 0 means not supported.
820 virtual unsigned HierarchicalLevel() const { return 0; } 823 virtual unsigned HierarchicalLevel() const { return 0; }
821 // Return the content of an image or canvas as an image data url in 824 // Return the content of an image or canvas as an image data url in
822 // PNG format. If |maxSize| is not empty and if the image is larger than 825 // PNG format. If |maxSize| is not empty and if the image is larger than
823 // those dimensions, the image will be resized proportionally first to fit. 826 // those dimensions, the image will be resized proportionally first to fit.
824 virtual String ImageDataUrl(const IntSize& max_size) const { 827 virtual String ImageDataUrl(const IntSize& max_size) const {
825 return g_null_atom; 828 return g_null_atom;
826 } 829 }
827 virtual AXObject* InPageLinkTarget() const { return nullptr; } 830 virtual AXObjectImpl* InPageLinkTarget() const { return nullptr; }
828 virtual AccessibilityOrientation Orientation() const; 831 virtual AccessibilityOrientation Orientation() const;
829 virtual String GetText() const { return String(); } 832 virtual String GetText() const { return String(); }
830 virtual AccessibilityTextDirection GetTextDirection() const { 833 virtual AccessibilityTextDirection GetTextDirection() const {
831 return kAccessibilityTextDirectionLTR; 834 return kAccessibilityTextDirectionLTR;
832 } 835 }
833 virtual int TextLength() const { return 0; } 836 virtual int TextLength() const { return 0; }
834 virtual TextStyle GetTextStyle() const { return kTextStyleNone; } 837 virtual TextStyle GetTextStyle() const { return kTextStyleNone; }
835 virtual AXObjectVector RadioButtonsInGroup() const { 838 virtual AXObjectVector RadioButtonsInGroup() const {
836 return AXObjectVector(); 839 return AXObjectVector();
837 } 840 }
838 virtual KURL Url() const { return KURL(); } 841 virtual KURL Url() const { return KURL(); }
839 842
840 // Load inline text boxes for just this node, even if 843 // Load inline text boxes for just this node, even if
841 // settings->inlineTextBoxAccessibilityEnabled() is false. 844 // settings->inlineTextBoxAccessibilityEnabled() is false.
842 virtual void LoadInlineTextBoxes() {} 845 virtual void LoadInlineTextBoxes() {}
843 846
844 // Walk the AXObjects on the same line. This is supported on any 847 // Walk the AXObjects on the same line. This is supported on any
845 // object type but primarily intended to be used for inline text boxes. 848 // object type but primarily intended to be used for inline text boxes.
846 virtual AXObject* NextOnLine() const { return nullptr; } 849 virtual AXObjectImpl* NextOnLine() const { return nullptr; }
847 virtual AXObject* PreviousOnLine() const { return nullptr; } 850 virtual AXObjectImpl* PreviousOnLine() const { return nullptr; }
848 851
849 // For all node objects. The start and end character offset of each 852 // For all node objects. The start and end character offset of each
850 // marker, such as spelling or grammar error. 853 // marker, such as spelling or grammar error.
851 virtual void Markers(Vector<DocumentMarker::MarkerType>&, 854 virtual void Markers(Vector<DocumentMarker::MarkerType>&,
852 Vector<AXRange>&) const {} 855 Vector<AXRange>&) const {}
853 // For an inline text box. 856 // For an inline text box.
854 // The integer horizontal pixel offset of each character in the string; 857 // The integer horizontal pixel offset of each character in the string;
855 // negative values for RTL. 858 // negative values for RTL.
856 virtual void TextCharacterOffsets(Vector<int>&) const {} 859 virtual void TextCharacterOffsets(Vector<int>&) const {}
857 // The start and end character offset of each word in the object's text. 860 // The start and end character offset of each word in the object's text.
(...skipping 10 matching lines...) Expand all
868 } 871 }
869 // Only used when invalidState() returns InvalidStateOther. 872 // Only used when invalidState() returns InvalidStateOther.
870 virtual String AriaInvalidValue() const { return String(); } 873 virtual String AriaInvalidValue() const { return String(); }
871 virtual String ValueDescription() const { return String(); } 874 virtual String ValueDescription() const { return String(); }
872 virtual float ValueForRange() const { return 0.0f; } 875 virtual float ValueForRange() const { return 0.0f; }
873 virtual float MaxValueForRange() const { return 0.0f; } 876 virtual float MaxValueForRange() const { return 0.0f; }
874 virtual float MinValueForRange() const { return 0.0f; } 877 virtual float MinValueForRange() const { return 0.0f; }
875 virtual String StringValue() const { return String(); } 878 virtual String StringValue() const { return String(); }
876 879
877 // ARIA attributes. 880 // ARIA attributes.
878 virtual AXObject* ActiveDescendant() { return nullptr; } 881 virtual AXObjectImpl* ActiveDescendant() { return nullptr; }
879 virtual String AriaAutoComplete() const { return String(); } 882 virtual String AriaAutoComplete() const { return String(); }
880 virtual void AriaOwnsElements(AXObjectVector& owns) const {} 883 virtual void AriaOwnsElements(AXObjectVector& owns) const {}
881 virtual void AriaDescribedbyElements(AXObjectVector&) const {} 884 virtual void AriaDescribedbyElements(AXObjectVector&) const {}
882 virtual void AriaLabelledbyElements(AXObjectVector&) const {} 885 virtual void AriaLabelledbyElements(AXObjectVector&) const {}
883 virtual bool AriaHasPopup() const { return false; } 886 virtual bool AriaHasPopup() const { return false; }
884 virtual bool IsEditable() const { return false; } 887 virtual bool IsEditable() const { return false; }
885 bool IsMultiline() const; 888 bool IsMultiline() const;
886 virtual bool IsRichlyEditable() const { return false; } 889 virtual bool IsRichlyEditable() const { return false; }
887 bool AriaPressedIsPresent() const; 890 bool AriaPressedIsPresent() const;
888 virtual AccessibilityRole AriaRoleAttribute() const { return kUnknownRole; } 891 virtual AccessibilityRole AriaRoleAttribute() const { return kUnknownRole; }
889 virtual bool AriaRoleHasPresentationalChildren() const { return false; } 892 virtual bool AriaRoleHasPresentationalChildren() const { return false; }
890 virtual AXObject* AncestorForWhichThisIsAPresentationalChild() const { 893 virtual AXObjectImpl* AncestorForWhichThisIsAPresentationalChild() const {
891 return 0; 894 return 0;
892 } 895 }
893 bool SupportsActiveDescendant() const; 896 bool SupportsActiveDescendant() const;
894 bool SupportsARIAAttributes() const; 897 bool SupportsARIAAttributes() const;
895 virtual bool SupportsARIADragging() const { return false; } 898 virtual bool SupportsARIADragging() const { return false; }
896 virtual bool SupportsARIADropping() const { return false; } 899 virtual bool SupportsARIADropping() const { return false; }
897 virtual bool SupportsARIAFlowTo() const { return false; } 900 virtual bool SupportsARIAFlowTo() const { return false; }
898 virtual bool SupportsARIAOwns() const { return false; } 901 virtual bool SupportsARIAOwns() const { return false; }
899 bool SupportsRangeValue() const; 902 bool SupportsRangeValue() const;
900 virtual SortDirection GetSortDirection() const { 903 virtual SortDirection GetSortDirection() const {
901 return kSortDirectionUndefined; 904 return kSortDirectionUndefined;
902 } 905 }
903 906
904 // Returns 0-based index. 907 // Returns 0-based index.
905 int IndexInParent() const; 908 int IndexInParent() const;
906 909
907 // Value should be 1-based. 0 means not supported. 910 // Value should be 1-based. 0 means not supported.
908 virtual int PosInSet() const { return 0; } 911 virtual int PosInSet() const { return 0; }
909 virtual int SetSize() const { return 0; } 912 virtual int SetSize() const { return 0; }
910 bool SupportsSetSizeAndPosInSet() const; 913 bool SupportsSetSizeAndPosInSet() const;
911 914
912 // ARIA live-region features. 915 // ARIA live-region features.
913 bool IsLiveRegion() const; 916 bool IsLiveRegion() const;
914 AXObject* LiveRegionRoot() const; 917 AXObjectImpl* LiveRegionRoot() const;
915 virtual const AtomicString& LiveRegionStatus() const { return g_null_atom; } 918 virtual const AtomicString& LiveRegionStatus() const { return g_null_atom; }
916 virtual const AtomicString& LiveRegionRelevant() const { return g_null_atom; } 919 virtual const AtomicString& LiveRegionRelevant() const { return g_null_atom; }
917 virtual bool LiveRegionAtomic() const { return false; } 920 virtual bool LiveRegionAtomic() const { return false; }
918 virtual bool LiveRegionBusy() const { return false; } 921 virtual bool LiveRegionBusy() const { return false; }
919 922
920 const AtomicString& ContainerLiveRegionStatus() const; 923 const AtomicString& ContainerLiveRegionStatus() const;
921 const AtomicString& ContainerLiveRegionRelevant() const; 924 const AtomicString& ContainerLiveRegionRelevant() const;
922 bool ContainerLiveRegionAtomic() const; 925 bool ContainerLiveRegionAtomic() const;
923 bool ContainerLiveRegionBusy() const; 926 bool ContainerLiveRegionBusy() const;
924 927
925 // Every object's bounding box is returned relative to a 928 // Every object's bounding box is returned relative to a
926 // container object (which is guaranteed to be an ancestor) and 929 // container object (which is guaranteed to be an ancestor) and
927 // optionally a transformation matrix that needs to be applied too. 930 // optionally a transformation matrix that needs to be applied too.
928 // To compute the absolute bounding box of an element, start with its 931 // To compute the absolute bounding box of an element, start with its
929 // boundsInContainer and apply the transform. Then as long as its container is 932 // boundsInContainer and apply the transform. Then as long as its container is
930 // not null, walk up to its container and offset by the container's offset 933 // not null, walk up to its container and offset by the container's offset
931 // from origin, the container's scroll position if any, and apply the 934 // from origin, the container's scroll position if any, and apply the
932 // container's transform. Do this until you reach the root of the tree. 935 // container's transform. Do this until you reach the root of the tree.
933 virtual void GetRelativeBounds(AXObject** out_container, 936 virtual void GetRelativeBounds(AXObjectImpl** out_container,
934 FloatRect& out_bounds_in_container, 937 FloatRect& out_bounds_in_container,
935 SkMatrix44& out_container_transform) const; 938 SkMatrix44& out_container_transform) const;
936 939
937 // Get the bounds in frame-relative coordinates as a LayoutRect. 940 // Get the bounds in frame-relative coordinates as a LayoutRect.
938 LayoutRect GetBoundsInFrameCoordinates() const; 941 LayoutRect GetBoundsInFrameCoordinates() const;
939 942
940 // Explicitly set an object's bounding rect and offset container. 943 // Explicitly set an object's bounding rect and offset container.
941 void SetElementRect(LayoutRect r, AXObject* container) { 944 void SetElementRect(LayoutRect r, AXObjectImpl* container) {
942 explicit_element_rect_ = r; 945 explicit_element_rect_ = r;
943 explicit_container_id_ = container->AxObjectID(); 946 explicit_container_id_ = container->AxObjectID();
944 } 947 }
945 948
946 // Hit testing. 949 // Hit testing.
947 // Called on the root AX object to return the deepest available element. 950 // Called on the root AX object to return the deepest available element.
948 virtual AXObject* AccessibilityHitTest(const IntPoint&) const { return 0; } 951 virtual AXObjectImpl* AccessibilityHitTest(const IntPoint&) const {
952 return 0;
953 }
949 // Called on the AX object after the layout tree determines which is the right 954 // Called on the AX object after the layout tree determines which is the right
950 // AXLayoutObject. 955 // AXLayoutObject.
951 virtual AXObject* ElementAccessibilityHitTest(const IntPoint&) const; 956 virtual AXObjectImpl* ElementAccessibilityHitTest(const IntPoint&) const;
952 957
953 // High-level accessibility tree access. Other modules should only use these 958 // High-level accessibility tree access. Other modules should only use these
954 // functions. 959 // functions.
955 const AXObjectVector& Children(); 960 const AXObjectVector& Children();
956 AXObject* ParentObject() const; 961 AXObjectImpl* ParentObject() const;
957 AXObject* ParentObjectIfExists() const; 962 AXObjectImpl* ParentObjectIfExists() const;
958 virtual AXObject* ComputeParent() const = 0; 963 virtual AXObjectImpl* ComputeParent() const = 0;
959 virtual AXObject* ComputeParentIfExists() const { return 0; } 964 virtual AXObjectImpl* ComputeParentIfExists() const { return 0; }
960 AXObject* CachedParentObject() const { return parent_; } 965 AXObjectImpl* CachedParentObject() const { return parent_; }
961 AXObject* ParentObjectUnignored() const; 966 AXObjectImpl* ParentObjectUnignored() const;
962 967
963 // Low-level accessibility tree exploration, only for use within the 968 // Low-level accessibility tree exploration, only for use within the
964 // accessibility module. 969 // accessibility module.
965 virtual AXObject* RawFirstChild() const { return 0; } 970 virtual AXObjectImpl* RawFirstChild() const { return 0; }
966 virtual AXObject* RawNextSibling() const { return 0; } 971 virtual AXObjectImpl* RawNextSibling() const { return 0; }
967 virtual void AddChildren() {} 972 virtual void AddChildren() {}
968 virtual bool CanHaveChildren() const { return true; } 973 virtual bool CanHaveChildren() const { return true; }
969 bool HasChildren() const { return have_children_; } 974 bool HasChildren() const { return have_children_; }
970 virtual void UpdateChildrenIfNecessary(); 975 virtual void UpdateChildrenIfNecessary();
971 virtual bool NeedsToUpdateChildren() const { return false; } 976 virtual bool NeedsToUpdateChildren() const { return false; }
972 virtual void SetNeedsToUpdateChildren() {} 977 virtual void SetNeedsToUpdateChildren() {}
973 virtual void ClearChildren(); 978 virtual void ClearChildren();
974 virtual void DetachFromParent() { parent_ = 0; } 979 virtual void DetachFromParent() { parent_ = 0; }
975 virtual AXObject* ScrollBar(AccessibilityOrientation) { return 0; } 980 virtual AXObjectImpl* ScrollBar(AccessibilityOrientation) { return 0; }
976 981
977 // Properties of the object's owning document or page. 982 // Properties of the object's owning document or page.
978 virtual double EstimatedLoadingProgress() const { return 0; } 983 virtual double EstimatedLoadingProgress() const { return 0; }
979 984
980 // DOM and layout tree access. 985 // DOM and layout tree access.
981 virtual Node* GetNode() const { return 0; } 986 virtual Node* GetNode() const { return 0; }
982 virtual LayoutObject* GetLayoutObject() const { return 0; } 987 virtual LayoutObject* GetLayoutObject() const { return 0; }
983 virtual Document* GetDocument() const; 988 virtual Document* GetDocument() const;
984 virtual FrameView* DocumentFrameView() const; 989 virtual FrameView* DocumentFrameView() const;
985 virtual Element* AnchorElement() const { return 0; } 990 virtual Element* AnchorElement() const { return 0; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 AXID id_; 1062 AXID id_;
1058 AXObjectVector children_; 1063 AXObjectVector children_;
1059 mutable bool have_children_; 1064 mutable bool have_children_;
1060 AccessibilityRole role_; 1065 AccessibilityRole role_;
1061 AXObjectInclusion last_known_is_ignored_value_; 1066 AXObjectInclusion last_known_is_ignored_value_;
1062 LayoutRect explicit_element_rect_; 1067 LayoutRect explicit_element_rect_;
1063 AXID explicit_container_id_; 1068 AXID explicit_container_id_;
1064 1069
1065 // Used only inside textAlternative(): 1070 // Used only inside textAlternative():
1066 static String CollapseWhitespace(const String&); 1071 static String CollapseWhitespace(const String&);
1067 static String RecursiveTextAlternative(const AXObject&, 1072 static String RecursiveTextAlternative(const AXObjectImpl&,
1068 bool in_aria_labelled_by_traversal, 1073 bool in_aria_labelled_by_traversal,
1069 AXObjectSet& visited); 1074 AXObjectSet& visited);
1070 bool IsHiddenForTextAlternativeCalculation() const; 1075 bool IsHiddenForTextAlternativeCalculation() const;
1071 String AriaTextAlternative(bool recursive, 1076 String AriaTextAlternative(bool recursive,
1072 bool in_aria_labelled_by_traversal, 1077 bool in_aria_labelled_by_traversal,
1073 AXObjectSet& visited, 1078 AXObjectSet& visited,
1074 AXNameFrom&, 1079 AXNameFrom&,
1075 AXRelatedObjectVector*, 1080 AXRelatedObjectVector*,
1076 NameSources*, 1081 NameSources*,
1077 bool* found_text_alternative) const; 1082 bool* found_text_alternative) const;
1078 String TextFromElements(bool in_aria_labelled_by_traversal, 1083 String TextFromElements(bool in_aria_labelled_by_traversal,
1079 AXObjectSet& visited, 1084 AXObjectSet& visited,
1080 HeapVector<Member<Element>>& elements, 1085 HeapVector<Member<Element>>& elements,
1081 AXRelatedObjectVector* related_objects) const; 1086 AXRelatedObjectVector* related_objects) const;
1082 void TokenVectorFromAttribute(Vector<String>&, const QualifiedName&) const; 1087 void TokenVectorFromAttribute(Vector<String>&, const QualifiedName&) const;
1083 void ElementsFromAttribute(HeapVector<Member<Element>>& elements, 1088 void ElementsFromAttribute(HeapVector<Member<Element>>& elements,
1084 const QualifiedName&) const; 1089 const QualifiedName&) const;
1085 void AriaLabelledbyElementVector(HeapVector<Member<Element>>& elements) const; 1090 void AriaLabelledbyElementVector(HeapVector<Member<Element>>& elements) const;
1086 String TextFromAriaLabelledby(AXObjectSet& visited, 1091 String TextFromAriaLabelledby(AXObjectSet& visited,
1087 AXRelatedObjectVector* related_objects) const; 1092 AXRelatedObjectVector* related_objects) const;
1088 String TextFromAriaDescribedby(AXRelatedObjectVector* related_objects) const; 1093 String TextFromAriaDescribedby(AXRelatedObjectVector* related_objects) const;
1089 1094
1090 virtual const AXObject* InheritsPresentationalRoleFrom() const { return 0; } 1095 virtual const AXObjectImpl* InheritsPresentationalRoleFrom() const {
1096 return 0;
1097 }
1091 1098
1092 virtual bool NameFromContents() const; 1099 virtual bool NameFromContents() const;
1093 1100
1094 AccessibilityRole ButtonRoleType() const; 1101 AccessibilityRole ButtonRoleType() const;
1095 1102
1096 virtual LayoutObject* LayoutObjectForRelativeBounds() const { 1103 virtual LayoutObject* LayoutObjectForRelativeBounds() const {
1097 return nullptr; 1104 return nullptr;
1098 } 1105 }
1099 1106
1100 mutable Member<AXObject> parent_; 1107 mutable Member<AXObjectImpl> parent_;
1101 1108
1102 // The following cached attribute values (the ones starting with m_cached*) 1109 // The following cached attribute values (the ones starting with m_cached*)
1103 // are only valid if m_lastModificationCount matches 1110 // are only valid if m_lastModificationCount matches
1104 // AXObjectCacheImpl::modificationCount(). 1111 // AXObjectCacheImpl::modificationCount().
1105 mutable int last_modification_count_; 1112 mutable int last_modification_count_;
1106 mutable RGBA32 cached_background_color_; 1113 mutable RGBA32 cached_background_color_;
1107 mutable bool cached_is_ignored_ : 1; 1114 mutable bool cached_is_ignored_ : 1;
1108 mutable bool cached_is_inert_or_aria_hidden_ : 1; 1115 mutable bool cached_is_inert_or_aria_hidden_ : 1;
1109 mutable bool cached_is_descendant_of_leaf_node_ : 1; 1116 mutable bool cached_is_descendant_of_leaf_node_ : 1;
1110 mutable bool cached_is_descendant_of_disabled_node_ : 1; 1117 mutable bool cached_is_descendant_of_disabled_node_ : 1;
1111 mutable bool cached_has_inherited_presentational_role_ : 1; 1118 mutable bool cached_has_inherited_presentational_role_ : 1;
1112 mutable bool cached_is_presentational_child_ : 1; 1119 mutable bool cached_is_presentational_child_ : 1;
1113 mutable bool cached_ancestor_exposes_active_descendant_ : 1; 1120 mutable bool cached_ancestor_exposes_active_descendant_ : 1;
1114 mutable Member<AXObject> cached_live_region_root_; 1121 mutable Member<AXObjectImpl> cached_live_region_root_;
1115 1122
1116 Member<AXObjectCacheImpl> ax_object_cache_; 1123 Member<AXObjectCacheImpl> ax_object_cache_;
1117 1124
1118 // Updates the cached attribute values. This may be recursive, so to prevent 1125 // Updates the cached attribute values. This may be recursive, so to prevent
1119 // deadlocks, 1126 // deadlocks,
1120 // functions called here may only search up the tree (ancestors), not down. 1127 // functions called here may only search up the tree (ancestors), not down.
1121 void UpdateCachedAttributeValuesIfNeeded() const; 1128 void UpdateCachedAttributeValuesIfNeeded() const;
1122 1129
1123 private: 1130 private:
1124 static bool IsNativeInputInMixedState(const Node*); 1131 static bool IsNativeInputInMixedState(const Node*);
1125 static bool IncludesARIAWidgetRole(const String&); 1132 static bool IncludesARIAWidgetRole(const String&);
1126 static bool HasInteractiveARIAAttribute(const Element&); 1133 static bool HasInteractiveARIAAttribute(const Element&);
1127 1134
1128 static unsigned number_of_live_ax_objects_; 1135 static unsigned number_of_live_ax_objects_;
1129 }; 1136 };
1130 1137
1131 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ 1138 // TODO(sashab): Remove this once callers in web/ can use AXObject directly.
sashab 2017/05/08 23:58:34 aboxhall - wdyt of this comment?
aboxhall 2017/05/09 02:01:02 We may not want or need to remove the ability to c
sashab 2017/05/10 04:24:43 Thanks; removed the comment and changed to use the
1132 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, \ 1139 inline AXObjectImpl* ToAXObjectImpl(AXObject* argument) {
1140 return static_cast<AXObjectImpl*>(argument);
1141 }
1142
1143 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \
1144 DEFINE_TYPE_CASTS(thisType, AXObjectImpl, object, object->predicate, \
1133 object.predicate) 1145 object.predicate)
1134 1146
1135 } // namespace blink 1147 } // namespace blink
1136 1148
1137 #endif // AXObject_h 1149 #endif // AXObjectImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698