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

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

Powered by Google App Engine
This is Rietveld 408576698