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

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: Fixed rebase 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 bool AccessibilityIsIgnored() const; 719 bool AccessibilityIsIgnored() const;
717 typedef HeapVector<IgnoredReason> IgnoredReasons; 720 typedef HeapVector<IgnoredReason> IgnoredReasons;
718 virtual bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const { 721 virtual bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const {
719 return true; 722 return true;
720 } 723 }
721 bool AccessibilityIsIgnoredByDefault(IgnoredReasons* = nullptr) const; 724 bool AccessibilityIsIgnoredByDefault(IgnoredReasons* = nullptr) const;
722 AXObjectInclusion AccessibilityPlatformIncludesObject() const; 725 AXObjectInclusion AccessibilityPlatformIncludesObject() const;
723 virtual AXObjectInclusion DefaultObjectInclusion( 726 virtual AXObjectInclusion DefaultObjectInclusion(
724 IgnoredReasons* = nullptr) const; 727 IgnoredReasons* = nullptr) const;
725 bool IsInertOrAriaHidden() const; 728 bool IsInertOrAriaHidden() const;
726 const AXObject* AriaHiddenRoot() const; 729 const AXObjectImpl* AriaHiddenRoot() const;
727 bool ComputeIsInertOrAriaHidden(IgnoredReasons* = nullptr) const; 730 bool ComputeIsInertOrAriaHidden(IgnoredReasons* = nullptr) const;
728 bool IsDescendantOfLeafNode() const; 731 bool IsDescendantOfLeafNode() const;
729 AXObject* LeafNodeAncestor() const; 732 AXObjectImpl* LeafNodeAncestor() const;
730 bool IsDescendantOfDisabledNode() const; 733 bool IsDescendantOfDisabledNode() const;
731 const AXObject* DisabledAncestor() const; 734 const AXObjectImpl* DisabledAncestor() const;
732 bool LastKnownIsIgnoredValue(); 735 bool LastKnownIsIgnoredValue();
733 void SetLastKnownIsIgnoredValue(bool); 736 void SetLastKnownIsIgnoredValue(bool);
734 bool HasInheritedPresentationalRole() const; 737 bool HasInheritedPresentationalRole() const;
735 bool IsPresentationalChild() const; 738 bool IsPresentationalChild() const;
736 bool AncestorExposesActiveDescendant() const; 739 bool AncestorExposesActiveDescendant() const;
737 bool ComputeAncestorExposesActiveDescendant() const; 740 bool ComputeAncestorExposesActiveDescendant() const;
738 741
739 // 742 //
740 // Accessible name calculation 743 // Accessible name calculation
741 // 744 //
(...skipping 27 matching lines...) Expand all
769 AXRelatedObjectVector*) const { 772 AXRelatedObjectVector*) const {
770 return String(); 773 return String();
771 } 774 }
772 775
773 // Takes the result of nameFrom and descriptionFrom from calling |name| and 776 // Takes the result of nameFrom and descriptionFrom from calling |name| and
774 // |description|, above, and retrieves the placeholder of the object, if 777 // |description|, above, and retrieves the placeholder of the object, if
775 // present and if it wasn't already exposed by one of the two functions above. 778 // present and if it wasn't already exposed by one of the two functions above.
776 virtual String Placeholder(AXNameFrom) const { return String(); } 779 virtual String Placeholder(AXNameFrom) const { return String(); }
777 780
778 // Internal functions used by name and description, above. 781 // Internal functions used by name and description, above.
779 typedef HeapHashSet<Member<const AXObject>> AXObjectSet; 782 typedef HeapHashSet<Member<const AXObjectImpl>> AXObjectSet;
780 virtual String TextAlternative(bool recursive, 783 virtual String TextAlternative(bool recursive,
781 bool in_aria_labelled_by_traversal, 784 bool in_aria_labelled_by_traversal,
782 AXObjectSet& visited, 785 AXObjectSet& visited,
783 AXNameFrom& name_from, 786 AXNameFrom& name_from,
784 AXRelatedObjectVector* related_objects, 787 AXRelatedObjectVector* related_objects,
785 NameSources* name_sources) const { 788 NameSources* name_sources) const {
786 return String(); 789 return String();
787 } 790 }
788 virtual String TextFromDescendants(AXObjectSet& visited, 791 virtual String TextFromDescendants(AXObjectSet& visited,
789 bool recursive) const { 792 bool recursive) const {
(...skipping 28 matching lines...) Expand all
818 // Value should be 1-based. 0 means not supported. 821 // Value should be 1-based. 0 means not supported.
819 virtual int HeadingLevel() const { return 0; } 822 virtual int HeadingLevel() const { return 0; }
820 // Value should be 1-based. 0 means not supported. 823 // Value should be 1-based. 0 means not supported.
821 virtual unsigned HierarchicalLevel() const { return 0; } 824 virtual unsigned HierarchicalLevel() const { return 0; }
822 // Return the content of an image or canvas as an image data url in 825 // Return the content of an image or canvas as an image data url in
823 // PNG format. If |maxSize| is not empty and if the image is larger than 826 // PNG format. If |maxSize| is not empty and if the image is larger than
824 // those dimensions, the image will be resized proportionally first to fit. 827 // those dimensions, the image will be resized proportionally first to fit.
825 virtual String ImageDataUrl(const IntSize& max_size) const { 828 virtual String ImageDataUrl(const IntSize& max_size) const {
826 return g_null_atom; 829 return g_null_atom;
827 } 830 }
828 virtual AXObject* InPageLinkTarget() const { return nullptr; } 831 virtual AXObjectImpl* InPageLinkTarget() const { return nullptr; }
829 virtual AccessibilityOrientation Orientation() const; 832 virtual AccessibilityOrientation Orientation() const;
830 virtual String GetText() const { return String(); } 833 virtual String GetText() const { return String(); }
831 virtual AccessibilityTextDirection GetTextDirection() const { 834 virtual AccessibilityTextDirection GetTextDirection() const {
832 return kAccessibilityTextDirectionLTR; 835 return kAccessibilityTextDirectionLTR;
833 } 836 }
834 virtual int TextLength() const { return 0; } 837 virtual int TextLength() const { return 0; }
835 virtual TextStyle GetTextStyle() const { return kTextStyleNone; } 838 virtual TextStyle GetTextStyle() const { return kTextStyleNone; }
836 virtual AXObjectVector RadioButtonsInGroup() const { 839 virtual AXObjectVector RadioButtonsInGroup() const {
837 return AXObjectVector(); 840 return AXObjectVector();
838 } 841 }
839 virtual KURL Url() const { return KURL(); } 842 virtual KURL Url() const { return KURL(); }
840 843
841 // Load inline text boxes for just this node, even if 844 // Load inline text boxes for just this node, even if
842 // settings->inlineTextBoxAccessibilityEnabled() is false. 845 // settings->inlineTextBoxAccessibilityEnabled() is false.
843 virtual void LoadInlineTextBoxes() {} 846 virtual void LoadInlineTextBoxes() {}
844 847
845 // Walk the AXObjects on the same line. This is supported on any 848 // Walk the AXObjects on the same line. This is supported on any
846 // object type but primarily intended to be used for inline text boxes. 849 // object type but primarily intended to be used for inline text boxes.
847 virtual AXObject* NextOnLine() const { return nullptr; } 850 virtual AXObjectImpl* NextOnLine() const { return nullptr; }
848 virtual AXObject* PreviousOnLine() const { return nullptr; } 851 virtual AXObjectImpl* PreviousOnLine() const { return nullptr; }
849 852
850 // For all node objects. The start and end character offset of each 853 // For all node objects. The start and end character offset of each
851 // marker, such as spelling or grammar error. 854 // marker, such as spelling or grammar error.
852 virtual void Markers(Vector<DocumentMarker::MarkerType>&, 855 virtual void Markers(Vector<DocumentMarker::MarkerType>&,
853 Vector<AXRange>&) const {} 856 Vector<AXRange>&) const {}
854 // For an inline text box. 857 // For an inline text box.
855 // The integer horizontal pixel offset of each character in the string; 858 // The integer horizontal pixel offset of each character in the string;
856 // negative values for RTL. 859 // negative values for RTL.
857 virtual void TextCharacterOffsets(Vector<int>&) const {} 860 virtual void TextCharacterOffsets(Vector<int>&) const {}
858 // The start and end character offset of each word in the object's text. 861 // The start and end character offset of each word in the object's text.
(...skipping 10 matching lines...) Expand all
869 } 872 }
870 // Only used when invalidState() returns InvalidStateOther. 873 // Only used when invalidState() returns InvalidStateOther.
871 virtual String AriaInvalidValue() const { return String(); } 874 virtual String AriaInvalidValue() const { return String(); }
872 virtual String ValueDescription() const { return String(); } 875 virtual String ValueDescription() const { return String(); }
873 virtual float ValueForRange() const { return 0.0f; } 876 virtual float ValueForRange() const { return 0.0f; }
874 virtual float MaxValueForRange() const { return 0.0f; } 877 virtual float MaxValueForRange() const { return 0.0f; }
875 virtual float MinValueForRange() const { return 0.0f; } 878 virtual float MinValueForRange() const { return 0.0f; }
876 virtual String StringValue() const { return String(); } 879 virtual String StringValue() const { return String(); }
877 880
878 // ARIA attributes. 881 // ARIA attributes.
879 virtual AXObject* ActiveDescendant() { return nullptr; } 882 virtual AXObjectImpl* ActiveDescendant() { return nullptr; }
880 virtual String AriaAutoComplete() const { return String(); } 883 virtual String AriaAutoComplete() const { return String(); }
881 virtual void AriaOwnsElements(AXObjectVector& owns) const {} 884 virtual void AriaOwnsElements(AXObjectVector& owns) const {}
882 virtual void AriaDescribedbyElements(AXObjectVector&) const {} 885 virtual void AriaDescribedbyElements(AXObjectVector&) const {}
883 virtual void AriaLabelledbyElements(AXObjectVector&) const {} 886 virtual void AriaLabelledbyElements(AXObjectVector&) const {}
884 virtual bool AriaHasPopup() const { return false; } 887 virtual bool AriaHasPopup() const { return false; }
885 virtual bool IsEditable() const { return false; } 888 virtual bool IsEditable() const { return false; }
886 bool IsMultiline() const; 889 bool IsMultiline() const;
887 virtual bool IsRichlyEditable() const { return false; } 890 virtual bool IsRichlyEditable() const { return false; }
888 bool AriaPressedIsPresent() const; 891 bool AriaPressedIsPresent() const;
889 virtual AccessibilityRole AriaRoleAttribute() const { return kUnknownRole; } 892 virtual AccessibilityRole AriaRoleAttribute() const { return kUnknownRole; }
890 virtual bool AriaRoleHasPresentationalChildren() const { return false; } 893 virtual bool AriaRoleHasPresentationalChildren() const { return false; }
891 virtual AXObject* AncestorForWhichThisIsAPresentationalChild() const { 894 virtual AXObjectImpl* AncestorForWhichThisIsAPresentationalChild() const {
892 return 0; 895 return 0;
893 } 896 }
894 bool SupportsActiveDescendant() const; 897 bool SupportsActiveDescendant() const;
895 bool SupportsARIAAttributes() const; 898 bool SupportsARIAAttributes() const;
896 virtual bool SupportsARIADragging() const { return false; } 899 virtual bool SupportsARIADragging() const { return false; }
897 virtual bool SupportsARIADropping() const { return false; } 900 virtual bool SupportsARIADropping() const { return false; }
898 virtual bool SupportsARIAFlowTo() const { return false; } 901 virtual bool SupportsARIAFlowTo() const { return false; }
899 virtual bool SupportsARIAOwns() const { return false; } 902 virtual bool SupportsARIAOwns() const { return false; }
900 bool SupportsRangeValue() const; 903 bool SupportsRangeValue() const;
901 virtual SortDirection GetSortDirection() const { 904 virtual SortDirection GetSortDirection() const {
902 return kSortDirectionUndefined; 905 return kSortDirectionUndefined;
903 } 906 }
904 907
905 // Returns 0-based index. 908 // Returns 0-based index.
906 int IndexInParent() const; 909 int IndexInParent() const;
907 910
908 // Value should be 1-based. 0 means not supported. 911 // Value should be 1-based. 0 means not supported.
909 virtual int PosInSet() const { return 0; } 912 virtual int PosInSet() const { return 0; }
910 virtual int SetSize() const { return 0; } 913 virtual int SetSize() const { return 0; }
911 bool SupportsSetSizeAndPosInSet() const; 914 bool SupportsSetSizeAndPosInSet() const;
912 915
913 // ARIA live-region features. 916 // ARIA live-region features.
914 bool IsLiveRegion() const; 917 bool IsLiveRegion() const;
915 AXObject* LiveRegionRoot() const; 918 AXObjectImpl* LiveRegionRoot() const;
916 virtual const AtomicString& LiveRegionStatus() const { return g_null_atom; } 919 virtual const AtomicString& LiveRegionStatus() const { return g_null_atom; }
917 virtual const AtomicString& LiveRegionRelevant() const { return g_null_atom; } 920 virtual const AtomicString& LiveRegionRelevant() const { return g_null_atom; }
918 virtual bool LiveRegionAtomic() const { return false; } 921 virtual bool LiveRegionAtomic() const { return false; }
919 virtual bool LiveRegionBusy() const { return false; } 922 virtual bool LiveRegionBusy() const { return false; }
920 923
921 const AtomicString& ContainerLiveRegionStatus() const; 924 const AtomicString& ContainerLiveRegionStatus() const;
922 const AtomicString& ContainerLiveRegionRelevant() const; 925 const AtomicString& ContainerLiveRegionRelevant() const;
923 bool ContainerLiveRegionAtomic() const; 926 bool ContainerLiveRegionAtomic() const;
924 bool ContainerLiveRegionBusy() const; 927 bool ContainerLiveRegionBusy() const;
925 928
926 // Every object's bounding box is returned relative to a 929 // Every object's bounding box is returned relative to a
927 // container object (which is guaranteed to be an ancestor) and 930 // container object (which is guaranteed to be an ancestor) and
928 // optionally a transformation matrix that needs to be applied too. 931 // optionally a transformation matrix that needs to be applied too.
929 // To compute the absolute bounding box of an element, start with its 932 // To compute the absolute bounding box of an element, start with its
930 // boundsInContainer and apply the transform. Then as long as its container is 933 // boundsInContainer and apply the transform. Then as long as its container is
931 // not null, walk up to its container and offset by the container's offset 934 // not null, walk up to its container and offset by the container's offset
932 // from origin, the container's scroll position if any, and apply the 935 // from origin, the container's scroll position if any, and apply the
933 // container's transform. Do this until you reach the root of the tree. 936 // container's transform. Do this until you reach the root of the tree.
934 virtual void GetRelativeBounds(AXObject** out_container, 937 virtual void GetRelativeBounds(AXObjectImpl** out_container,
935 FloatRect& out_bounds_in_container, 938 FloatRect& out_bounds_in_container,
936 SkMatrix44& out_container_transform) const; 939 SkMatrix44& out_container_transform) const;
937 940
938 // Get the bounds in frame-relative coordinates as a LayoutRect. 941 // Get the bounds in frame-relative coordinates as a LayoutRect.
939 LayoutRect GetBoundsInFrameCoordinates() const; 942 LayoutRect GetBoundsInFrameCoordinates() const;
940 943
941 // Explicitly set an object's bounding rect and offset container. 944 // Explicitly set an object's bounding rect and offset container.
942 void SetElementRect(LayoutRect r, AXObject* container) { 945 void SetElementRect(LayoutRect r, AXObjectImpl* container) {
943 explicit_element_rect_ = r; 946 explicit_element_rect_ = r;
944 explicit_container_id_ = container->AxObjectID(); 947 explicit_container_id_ = container->AxObjectID();
945 } 948 }
946 949
947 // Hit testing. 950 // Hit testing.
948 // Called on the root AX object to return the deepest available element. 951 // Called on the root AX object to return the deepest available element.
949 virtual AXObject* AccessibilityHitTest(const IntPoint&) const { return 0; } 952 virtual AXObjectImpl* AccessibilityHitTest(const IntPoint&) const {
953 return 0;
954 }
950 // Called on the AX object after the layout tree determines which is the right 955 // Called on the AX object after the layout tree determines which is the right
951 // AXLayoutObject. 956 // AXLayoutObject.
952 virtual AXObject* ElementAccessibilityHitTest(const IntPoint&) const; 957 virtual AXObjectImpl* ElementAccessibilityHitTest(const IntPoint&) const;
953 958
954 // High-level accessibility tree access. Other modules should only use these 959 // High-level accessibility tree access. Other modules should only use these
955 // functions. 960 // functions.
956 const AXObjectVector& Children(); 961 const AXObjectVector& Children();
957 AXObject* ParentObject() const; 962 AXObjectImpl* ParentObject() const;
958 AXObject* ParentObjectIfExists() const; 963 AXObjectImpl* ParentObjectIfExists() const;
959 virtual AXObject* ComputeParent() const = 0; 964 virtual AXObjectImpl* ComputeParent() const = 0;
960 virtual AXObject* ComputeParentIfExists() const { return 0; } 965 virtual AXObjectImpl* ComputeParentIfExists() const { return 0; }
961 AXObject* CachedParentObject() const { return parent_; } 966 AXObjectImpl* CachedParentObject() const { return parent_; }
962 AXObject* ParentObjectUnignored() const; 967 AXObjectImpl* ParentObjectUnignored() const;
963 968
964 // Low-level accessibility tree exploration, only for use within the 969 // Low-level accessibility tree exploration, only for use within the
965 // accessibility module. 970 // accessibility module.
966 virtual AXObject* RawFirstChild() const { return 0; } 971 virtual AXObjectImpl* RawFirstChild() const { return 0; }
967 virtual AXObject* RawNextSibling() const { return 0; } 972 virtual AXObjectImpl* RawNextSibling() const { return 0; }
968 virtual void AddChildren() {} 973 virtual void AddChildren() {}
969 virtual bool CanHaveChildren() const { return true; } 974 virtual bool CanHaveChildren() const { return true; }
970 bool HasChildren() const { return have_children_; } 975 bool HasChildren() const { return have_children_; }
971 virtual void UpdateChildrenIfNecessary(); 976 virtual void UpdateChildrenIfNecessary();
972 virtual bool NeedsToUpdateChildren() const { return false; } 977 virtual bool NeedsToUpdateChildren() const { return false; }
973 virtual void SetNeedsToUpdateChildren() {} 978 virtual void SetNeedsToUpdateChildren() {}
974 virtual void ClearChildren(); 979 virtual void ClearChildren();
975 virtual void DetachFromParent() { parent_ = 0; } 980 virtual void DetachFromParent() { parent_ = 0; }
976 virtual AXObject* ScrollBar(AccessibilityOrientation) { return 0; } 981 virtual AXObjectImpl* ScrollBar(AccessibilityOrientation) { return 0; }
977 982
978 // Properties of the object's owning document or page. 983 // Properties of the object's owning document or page.
979 virtual double EstimatedLoadingProgress() const { return 0; } 984 virtual double EstimatedLoadingProgress() const { return 0; }
980 985
981 // DOM and layout tree access. 986 // DOM and layout tree access.
982 virtual Node* GetNode() const { return 0; } 987 virtual Node* GetNode() const { return 0; }
983 virtual LayoutObject* GetLayoutObject() const { return 0; } 988 virtual LayoutObject* GetLayoutObject() const { return 0; }
984 virtual Document* GetDocument() const; 989 virtual Document* GetDocument() const;
985 virtual FrameView* DocumentFrameView() const; 990 virtual FrameView* DocumentFrameView() const;
986 virtual Element* AnchorElement() const { return 0; } 991 virtual Element* AnchorElement() const { return 0; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 AXID id_; 1063 AXID id_;
1059 AXObjectVector children_; 1064 AXObjectVector children_;
1060 mutable bool have_children_; 1065 mutable bool have_children_;
1061 AccessibilityRole role_; 1066 AccessibilityRole role_;
1062 AXObjectInclusion last_known_is_ignored_value_; 1067 AXObjectInclusion last_known_is_ignored_value_;
1063 LayoutRect explicit_element_rect_; 1068 LayoutRect explicit_element_rect_;
1064 AXID explicit_container_id_; 1069 AXID explicit_container_id_;
1065 1070
1066 // Used only inside textAlternative(): 1071 // Used only inside textAlternative():
1067 static String CollapseWhitespace(const String&); 1072 static String CollapseWhitespace(const String&);
1068 static String RecursiveTextAlternative(const AXObject&, 1073 static String RecursiveTextAlternative(const AXObjectImpl&,
1069 bool in_aria_labelled_by_traversal, 1074 bool in_aria_labelled_by_traversal,
1070 AXObjectSet& visited); 1075 AXObjectSet& visited);
1071 bool IsHiddenForTextAlternativeCalculation() const; 1076 bool IsHiddenForTextAlternativeCalculation() const;
1072 String AriaTextAlternative(bool recursive, 1077 String AriaTextAlternative(bool recursive,
1073 bool in_aria_labelled_by_traversal, 1078 bool in_aria_labelled_by_traversal,
1074 AXObjectSet& visited, 1079 AXObjectSet& visited,
1075 AXNameFrom&, 1080 AXNameFrom&,
1076 AXRelatedObjectVector*, 1081 AXRelatedObjectVector*,
1077 NameSources*, 1082 NameSources*,
1078 bool* found_text_alternative) const; 1083 bool* found_text_alternative) const;
1079 String TextFromElements(bool in_aria_labelled_by_traversal, 1084 String TextFromElements(bool in_aria_labelled_by_traversal,
1080 AXObjectSet& visited, 1085 AXObjectSet& visited,
1081 HeapVector<Member<Element>>& elements, 1086 HeapVector<Member<Element>>& elements,
1082 AXRelatedObjectVector* related_objects) const; 1087 AXRelatedObjectVector* related_objects) const;
1083 void TokenVectorFromAttribute(Vector<String>&, const QualifiedName&) const; 1088 void TokenVectorFromAttribute(Vector<String>&, const QualifiedName&) const;
1084 void ElementsFromAttribute(HeapVector<Member<Element>>& elements, 1089 void ElementsFromAttribute(HeapVector<Member<Element>>& elements,
1085 const QualifiedName&) const; 1090 const QualifiedName&) const;
1086 void AriaLabelledbyElementVector(HeapVector<Member<Element>>& elements) const; 1091 void AriaLabelledbyElementVector(HeapVector<Member<Element>>& elements) const;
1087 String TextFromAriaLabelledby(AXObjectSet& visited, 1092 String TextFromAriaLabelledby(AXObjectSet& visited,
1088 AXRelatedObjectVector* related_objects) const; 1093 AXRelatedObjectVector* related_objects) const;
1089 String TextFromAriaDescribedby(AXRelatedObjectVector* related_objects) const; 1094 String TextFromAriaDescribedby(AXRelatedObjectVector* related_objects) const;
1090 1095
1091 virtual const AXObject* InheritsPresentationalRoleFrom() const { return 0; } 1096 virtual const AXObjectImpl* InheritsPresentationalRoleFrom() const {
1097 return 0;
1098 }
1092 1099
1093 virtual bool NameFromContents() const; 1100 virtual bool NameFromContents() const;
1094 1101
1095 AccessibilityRole ButtonRoleType() const; 1102 AccessibilityRole ButtonRoleType() const;
1096 1103
1097 virtual LayoutObject* LayoutObjectForRelativeBounds() const { 1104 virtual LayoutObject* LayoutObjectForRelativeBounds() const {
1098 return nullptr; 1105 return nullptr;
1099 } 1106 }
1100 1107
1101 mutable Member<AXObject> parent_; 1108 mutable Member<AXObjectImpl> parent_;
1102 1109
1103 // The following cached attribute values (the ones starting with m_cached*) 1110 // The following cached attribute values (the ones starting with m_cached*)
1104 // are only valid if m_lastModificationCount matches 1111 // are only valid if m_lastModificationCount matches
1105 // AXObjectCacheImpl::modificationCount(). 1112 // AXObjectCacheImpl::modificationCount().
1106 mutable int last_modification_count_; 1113 mutable int last_modification_count_;
1107 mutable RGBA32 cached_background_color_; 1114 mutable RGBA32 cached_background_color_;
1108 mutable bool cached_is_ignored_ : 1; 1115 mutable bool cached_is_ignored_ : 1;
1109 mutable bool cached_is_inert_or_aria_hidden_ : 1; 1116 mutable bool cached_is_inert_or_aria_hidden_ : 1;
1110 mutable bool cached_is_descendant_of_leaf_node_ : 1; 1117 mutable bool cached_is_descendant_of_leaf_node_ : 1;
1111 mutable bool cached_is_descendant_of_disabled_node_ : 1; 1118 mutable bool cached_is_descendant_of_disabled_node_ : 1;
1112 mutable bool cached_has_inherited_presentational_role_ : 1; 1119 mutable bool cached_has_inherited_presentational_role_ : 1;
1113 mutable bool cached_is_presentational_child_ : 1; 1120 mutable bool cached_is_presentational_child_ : 1;
1114 mutable bool cached_ancestor_exposes_active_descendant_ : 1; 1121 mutable bool cached_ancestor_exposes_active_descendant_ : 1;
1115 mutable Member<AXObject> cached_live_region_root_; 1122 mutable Member<AXObjectImpl> cached_live_region_root_;
1116 1123
1117 Member<AXObjectCacheImpl> ax_object_cache_; 1124 Member<AXObjectCacheImpl> ax_object_cache_;
1118 1125
1119 // Updates the cached attribute values. This may be recursive, so to prevent 1126 // Updates the cached attribute values. This may be recursive, so to prevent
1120 // deadlocks, 1127 // deadlocks,
1121 // functions called here may only search up the tree (ancestors), not down. 1128 // functions called here may only search up the tree (ancestors), not down.
1122 void UpdateCachedAttributeValuesIfNeeded() const; 1129 void UpdateCachedAttributeValuesIfNeeded() const;
1123 1130
1124 private: 1131 private:
1125 static bool IsNativeInputInMixedState(const Node*); 1132 static bool IsNativeInputInMixedState(const Node*);
1126 static bool IncludesARIAWidgetRole(const String&); 1133 static bool IncludesARIAWidgetRole(const String&);
1127 static bool HasInteractiveARIAAttribute(const Element&); 1134 static bool HasInteractiveARIAAttribute(const Element&);
1128 1135
1129 static unsigned number_of_live_ax_objects_; 1136 static unsigned number_of_live_ax_objects_;
1130 }; 1137 };
1131 1138
1132 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ 1139 DEFINE_TYPE_CASTS(AXObjectImpl, AXObject, obj, true, true);
1133 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, \ 1140
1141 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \
1142 DEFINE_TYPE_CASTS(thisType, AXObjectImpl, object, object->predicate, \
1134 object.predicate) 1143 object.predicate)
1135 1144
1136 } // namespace blink 1145 } // namespace blink
1137 1146
1138 #endif // AXObject_h 1147 #endif // AXObjectImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698