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

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

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

Powered by Google App Engine
This is Rietveld 408576698