diff --git a/docs/accessibility/overview.md b/docs/accessibility/overview.md index c0c57797e44864..d052cec43b6bc6 100644 --- a/docs/accessibility/overview.md +++ b/docs/accessibility/overview.md @@ -411,15 +411,15 @@ means an ID that's globally unique. ## Blink Blink constructs an accessibility tree (a hierarchy of [WebAXObject]s) from the -page it is rendering. WebAXObject is the public API wrapper around [AXObject], -which is the core class of Blink's accessibility tree. AXObject is an abstract +page it is rendering. WebAXObject is the public API wrapper around [AXObjectImpl], +which is the core class of Blink's accessibility tree. AXObjectImpl is an abstract class; the most commonly used concrete subclass of it is [AXNodeObject], which wraps a [Node]. In turn, most AXNodeObjects are actually [AXLayoutObject]s, which wrap both a [Node] and a [LayoutObject]. Access to the LayoutObject is -important because some elements are only in the AXObject tree depending on their +important because some elements are only in the AXObjectImpl tree depending on their visibility, geometry, linewrapping, and so on. There are some subclasses of AXLayoutObject that implement special-case logic for specific types of Node. -There are also other subclasses of AXObject, which are mostly used for testing. +There are also other subclasses of AXObjectImpl, which are mostly used for testing. Note that not all AXLayoutObjects correspond to actual Nodes; some are synthetic layout objects which group related inline elements or similar. @@ -493,7 +493,7 @@ is defined by [automation.idl], which must be kept synchronized with [AXContentNodeData]: https://cs.chromium.org/chromium/src/content/common/ax_content_node_data.h [AXLayoutObject]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h [AXNodeObject]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h -[AXObject]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXObject.h +[AXObjectImpl]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h [AXObjectCacheImpl]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h [AXPlatformNode]: https://cs.chromium.org/chromium/src/ui/accessibility/platform/ax_platform_node.h [AXTreeSerializer]: https://cs.chromium.org/chromium/src/ui/accessibility/ax_tree_serializer.h diff --git a/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash-expected.txt b/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash-expected.txt index 3b68714c095923..fc064511717792 100644 --- a/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash-expected.txt @@ -1,4 +1,4 @@ -Make sure that a debug assert is not triggered when a call to LayoutBlockFlow::deleteLineBoxTree calls AccessibilityRenderObject::accessibilityIsIgnored which may require the AXObject for a node that is being deleted. +Make sure that a debug assert is not triggered when a call to LayoutBlockFlow::deleteLineBoxTree calls AccessibilityRenderObject::accessibilityIsIgnored which may require the AXObjectImpl for a node that is being deleted. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". diff --git a/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash.html b/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash.html index b35c787be971ef..53300740aec2b1 100644 --- a/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash.html +++ b/third_party/WebKit/LayoutTests/accessibility/corresponding-control-deleted-crash.html @@ -10,7 +10,7 @@
diff --git a/third_party/WebKit/Source/core/dom/AXObjectCache.h b/third_party/WebKit/Source/core/dom/AXObjectCache.h index 3456531426ef46..b9b7a62cfc9059 100644 --- a/third_party/WebKit/Source/core/dom/AXObjectCache.h +++ b/third_party/WebKit/Source/core/dom/AXObjectCache.h @@ -110,7 +110,7 @@ class CORE_EXPORT AXObjectCache // changed. virtual void TextChanged(LayoutObject*) = 0; // Called when a node has just been attached, so we can make sure we have the - // right subclass of AXObject. + // right subclass of AXObjectImpl. virtual void UpdateCacheAfterNodeIsAttached(Node*) = 0; virtual void HandleAttributeChanged(const QualifiedName& attr_name, diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index ecf025f9b8bbdf..4c5698d9b2f75e 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp @@ -4291,8 +4291,8 @@ bool Document::SetFocusedElement(Element* new_focused_element, } if (!focus_change_blocked && focused_element_) { - // Create the AXObject cache in a focus change because Chromium relies on - // it. + // Create the AXObjectImpl cache in a focus change because Chromium relies + // on it. if (AXObjectCache* cache = AxObjectCache()) cache->HandleFocusedUIElementChanged(old_focused_element, new_focused_element); diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h index 826d0875039b5a..066e466fadd389 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.h +++ b/third_party/WebKit/Source/core/frame/FrameView.h @@ -425,7 +425,7 @@ class CORE_EXPORT FrameView final bool IsActive() const override; - // Override scrollbar notifications to update the AXObject cache. + // Override scrollbar notifications to update the AXObjectImpl cache. void DidAddScrollbar(Scrollbar&, ScrollbarOrientation) override; // FIXME: This should probably be renamed as the 'inSubtreeLayout' parameter diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp index 07ff516abc5fca..f97e04b432e20a 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp @@ -1886,7 +1886,7 @@ void HTMLInputElement::DidNotifySubtreeInsertionsToDocument() { ListAttributeTargetChanged(); } -AXObject* HTMLInputElement::PopupRootAXObject() { +AXObjectImpl* HTMLInputElement::PopupRootAXObject() { return input_type_view_->PopupRootAXObject(); } diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.h b/third_party/WebKit/Source/core/html/HTMLInputElement.h index 5503e26ef7773d..1656743ed9ecbb 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElement.h +++ b/third_party/WebKit/Source/core/html/HTMLInputElement.h @@ -33,7 +33,7 @@ namespace blink { -class AXObject; +class AXObjectImpl; class DragData; class ExceptionState; class FileList; @@ -282,7 +282,7 @@ class CORE_EXPORT HTMLInputElement : public TextControlElement { void SetShouldRevealPassword(bool value); bool ShouldRevealPassword() const { return should_reveal_password_; } - AXObject* PopupRootAXObject(); + AXObjectImpl* PopupRootAXObject(); void DidNotifySubtreeInsertionsToDocument() override; virtual void EnsureFallbackContent(); diff --git a/third_party/WebKit/Source/core/html/forms/ColorChooser.h b/third_party/WebKit/Source/core/html/forms/ColorChooser.h index 6e289954248d40..c3054a6ce7ba18 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorChooser.h +++ b/third_party/WebKit/Source/core/html/forms/ColorChooser.h @@ -35,7 +35,7 @@ namespace blink { -class AXObject; +class AXObjectImpl; class Color; class CORE_EXPORT ColorChooser : public GarbageCollectedMixin { @@ -46,8 +46,8 @@ class CORE_EXPORT ColorChooser : public GarbageCollectedMixin { virtual void SetSelectedColor(const Color&) {} virtual void EndChooser() {} - // Returns a root AXObject in the ColorChooser if it's available. - virtual AXObject* RootAXObject() = 0; + // Returns a root AXObjectImpl in the ColorChooser if it's available. + virtual AXObjectImpl* RootAXObject() = 0; }; } // namespace blink diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp index 50e53b418cf2d4..086d84c40bd651 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp @@ -262,7 +262,7 @@ Vector ColorInputType::Suggestions() const { return suggestions; } -AXObject* ColorInputType::PopupRootAXObject() { +AXObjectImpl* ColorInputType::PopupRootAXObject() { return chooser_ ? chooser_->RootAXObject() : nullptr; } diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.h b/third_party/WebKit/Source/core/html/forms/ColorInputType.h index 50ce410307deed..a1633558608717 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorInputType.h +++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.h @@ -77,7 +77,7 @@ class ColorInputType final : public InputType, bool TypeMismatchFor(const String&) const override; void WarnIfValueIsInvalid(const String&) const override; void UpdateView() override; - AXObject* PopupRootAXObject() override; + AXObjectImpl* PopupRootAXObject() override; Color ValueAsColor() const; void EndColorChooser(); diff --git a/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h b/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h index ed6dbe5cad08a8..0fff433dc62afc 100644 --- a/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h +++ b/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h @@ -39,7 +39,7 @@ namespace blink { -class AXObject; +class AXObjectImpl; struct DateTimeSuggestion { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); @@ -73,8 +73,8 @@ class CORE_EXPORT DateTimeChooser virtual ~DateTimeChooser(); virtual void EndChooser() = 0; - // Returns a root AXObject in the DateTimeChooser if it's available. - virtual AXObject* RootAXObject() = 0; + // Returns a root AXObjectImpl in the DateTimeChooser if it's available. + virtual AXObjectImpl* RootAXObject() = 0; DEFINE_INLINE_VIRTUAL_TRACE() {} }; diff --git a/third_party/WebKit/Source/core/html/forms/InputTypeView.cpp b/third_party/WebKit/Source/core/html/forms/InputTypeView.cpp index feaa3c959fc1ea..da1763b7885aac 100644 --- a/third_party/WebKit/Source/core/html/forms/InputTypeView.cpp +++ b/third_party/WebKit/Source/core/html/forms/InputTypeView.cpp @@ -165,7 +165,7 @@ void InputTypeView::UpdateClearButtonVisibility() {} void InputTypeView::UpdatePlaceholderText() {} -AXObject* InputTypeView::PopupRootAXObject() { +AXObjectImpl* InputTypeView::PopupRootAXObject() { return nullptr; } diff --git a/third_party/WebKit/Source/core/html/forms/InputTypeView.h b/third_party/WebKit/Source/core/html/forms/InputTypeView.h index a11f1c1001176b..a3c0132ab47618 100644 --- a/third_party/WebKit/Source/core/html/forms/InputTypeView.h +++ b/third_party/WebKit/Source/core/html/forms/InputTypeView.h @@ -44,7 +44,7 @@ namespace blink { -class AXObject; +class AXObjectImpl; class BeforeTextInsertedEvent; class Element; class Event; @@ -124,7 +124,7 @@ class CORE_EXPORT InputTypeView : public GarbageCollectedMixin { virtual void ListAttributeTargetChanged(); virtual void UpdateClearButtonVisibility(); virtual void UpdatePlaceholderText(); - virtual AXObject* PopupRootAXObject(); + virtual AXObjectImpl* PopupRootAXObject(); virtual void EnsureFallbackContent() {} virtual void EnsurePrimaryContent() {} virtual bool HasFallbackContent() const { return false; } diff --git a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp index 9424aeececfd71..81d810e65c2648 100644 --- a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp +++ b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp @@ -635,7 +635,7 @@ TextDirection MultipleFieldsTemporalInputTypeView::ComputedTextDirection() { : TextDirection::kLtr; } -AXObject* MultipleFieldsTemporalInputTypeView::PopupRootAXObject() { +AXObjectImpl* MultipleFieldsTemporalInputTypeView::PopupRootAXObject() { if (PickerIndicatorElement* picker = GetPickerIndicatorElement()) return picker->PopupRootAXObject(); return nullptr; diff --git a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.h b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.h index 28c3110dae2105..06aad5ca01e535 100644 --- a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.h +++ b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.h @@ -118,7 +118,7 @@ class MultipleFieldsTemporalInputTypeView final void ListAttributeTargetChanged() final; void UpdateClearButtonVisibility() final; TextDirection ComputedTextDirection() final; - AXObject* PopupRootAXObject() final; + AXObjectImpl* PopupRootAXObject() final; DateTimeEditElement* GetDateTimeEditElement() const; SpinButtonElement* GetSpinButtonElement() const; diff --git a/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.cpp b/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.cpp index ea87cf392ae675..071229be789506 100644 --- a/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.cpp +++ b/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.cpp @@ -143,7 +143,7 @@ void PickerIndicatorElement::DetachLayoutTree(const AttachContext& context) { HTMLDivElement::DetachLayoutTree(context); } -AXObject* PickerIndicatorElement::PopupRootAXObject() const { +AXObjectImpl* PickerIndicatorElement::PopupRootAXObject() const { return chooser_ ? chooser_->RootAXObject() : 0; } diff --git a/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.h b/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.h index 1261d5e9a3731f..6fe4b4200f149a 100644 --- a/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.h +++ b/third_party/WebKit/Source/core/html/forms/PickerIndicatorElement.h @@ -65,7 +65,7 @@ class PickerIndicatorElement final : public HTMLDivElement, void ClosePopup(); bool WillRespondToMouseClickEvents() override; void RemovePickerIndicatorOwner() { picker_indicator_owner_ = nullptr; } - AXObject* PopupRootAXObject() const; + AXObjectImpl* PopupRootAXObject() const; // DateTimeChooserClient implementation. Element& OwnerElement() const override; diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h index 6911fe640cf35d..eca1174829a683 100644 --- a/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/third_party/WebKit/Source/core/page/ChromeClient.h @@ -51,7 +51,7 @@ namespace blink { -class AXObject; +class AXObjectImpl; class ColorChooser; class ColorChooserClient; class CompositorWorkerProxyClient; @@ -283,7 +283,7 @@ class CORE_EXPORT ChromeClient : public PlatformChromeClient { virtual PopupMenu* OpenPopupMenu(LocalFrame&, HTMLSelectElement&) = 0; virtual DOMWindow* PagePopupWindowForTesting() const = 0; - virtual void PostAccessibilityNotification(AXObject*, + virtual void PostAccessibilityNotification(AXObjectImpl*, AXObjectCache::AXNotification) {} virtual String AcceptLanguages() = 0; diff --git a/third_party/WebKit/Source/core/page/PagePopup.h b/third_party/WebKit/Source/core/page/PagePopup.h index 2a07f514110820..1ae1a5b4bf1e56 100644 --- a/third_party/WebKit/Source/core/page/PagePopup.h +++ b/third_party/WebKit/Source/core/page/PagePopup.h @@ -38,14 +38,14 @@ namespace blink { -class AXObject; +class AXObjectImpl; class IntRect; // A PagePopup object is created by ChromeClient::openPagePopup(), and deleted // by ChromeClient::closePagePopup(). class PagePopup { public: - virtual AXObject* RootAXObject() = 0; + virtual AXObjectImpl* RootAXObject() = 0; virtual void SetWindowRect(const IntRect&) = 0; virtual void PostMessage(const String& message) = 0; diff --git a/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp b/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp index 4bb9d3daff3cf1..b0f9208bb4569d 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp @@ -45,9 +45,10 @@ AXARIAGrid* AXARIAGrid::Create(LayoutObject* layout_object, return new AXARIAGrid(layout_object, ax_object_cache); } -bool AXARIAGrid::AddTableRowChild(AXObject* child, - HeapHashSet>& appended_rows, - unsigned& column_count) { +bool AXARIAGrid::AddTableRowChild( + AXObjectImpl* child, + HeapHashSet>& appended_rows, + unsigned& column_count) { if (!child || child->RoleValue() != kRowRole) return false; @@ -89,8 +90,8 @@ void AXARIAGrid::AddChildren() { if (!layout_object_) return; - HeapVector> children; - for (AXObject* child = RawFirstChild(); child; + HeapVector> children; + for (AXObjectImpl* child = RawFirstChild(); child; child = child->RawNextSibling()) children.push_back(child); ComputeAriaOwnsChildren(children); @@ -98,7 +99,7 @@ void AXARIAGrid::AddChildren() { AXObjectCacheImpl& ax_cache = AxObjectCache(); // Only add children that are actually rows. - HeapHashSet> appended_rows; + HeapHashSet> appended_rows; unsigned column_count = 0; for (const auto& child : children) { if (!AddTableRowChild(child, appended_rows, column_count)) { @@ -125,7 +126,7 @@ void AXARIAGrid::AddChildren() { children_.push_back(column); } - AXObject* header_container_object = HeaderContainer(); + AXObjectImpl* header_container_object = HeaderContainer(); if (header_container_object && !header_container_object->AccessibilityIsIgnored()) children_.push_back(header_container_object); diff --git a/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.h b/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.h index f21c07cc162ac5..523abbfe00bd16 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.h +++ b/third_party/WebKit/Source/modules/accessibility/AXARIAGrid.h @@ -60,8 +60,8 @@ class AXARIAGrid final : public AXTable { bool IsMultiSelectable() const override { return true; } bool IsTableExposableThroughAccessibility() const override { return true; } - bool AddTableRowChild(AXObject*, - HeapHashSet>& appended_rows, + bool AddTableRowChild(AXObjectImpl*, + HeapHashSet>& appended_rows, unsigned& column_count); }; diff --git a/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.cpp b/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.cpp index 21fe2a9458da93..2a37099382793a 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.cpp @@ -55,8 +55,8 @@ bool AXARIAGridCell::IsAriaRowHeader() const { return EqualIgnoringASCIICase(role, "rowheader"); } -AXObject* AXARIAGridCell::ParentTable() const { - AXObject* parent = ParentObjectUnignored(); +AXObjectImpl* AXARIAGridCell::ParentTable() const { + AXObjectImpl* parent = ParentObjectUnignored(); if (!parent) return 0; @@ -74,7 +74,7 @@ AXObject* AXARIAGridCell::ParentTable() const { } void AXARIAGridCell::RowIndexRange(std::pair& row_range) { - AXObject* parent = ParentObjectUnignored(); + AXObjectImpl* parent = ParentObjectUnignored(); if (!parent) return; @@ -104,7 +104,7 @@ void AXARIAGridCell::RowIndexRange(std::pair& row_range) { void AXARIAGridCell::ColumnIndexRange( std::pair& column_range) { - AXObject* parent = ParentObjectUnignored(); + AXObjectImpl* parent = ParentObjectUnignored(); if (!parent) return; diff --git a/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.h b/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.h index 71eff9860ac6f4..c1214a508614b3 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.h +++ b/third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.h @@ -54,7 +54,7 @@ class AXARIAGridCell final : public AXTableCell { protected: bool IsAriaColumnHeader() const; bool IsAriaRowHeader() const; - AXObject* ParentTable() const override; + AXObjectImpl* ParentTable() const override; }; } // namespace blink diff --git a/third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp b/third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp index 092adf80c44d66..75b59061c0613a 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp @@ -45,7 +45,7 @@ AXARIAGridRow* AXARIAGridRow::Create(LayoutObject* layout_object, } bool AXARIAGridRow::IsARIATreeGridRow() const { - AXObject* parent = ParentTable(); + AXObjectImpl* parent = ParentTable(); if (!parent) return false; diff --git a/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.cpp b/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.cpp index b8bca55ac86555..fcfa4ab73e95cc 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.cpp @@ -57,7 +57,7 @@ HTMLMapElement* AXImageMapLink::MapElement() const { return Traversal::FirstAncestor(*area); } -AXObject* AXImageMapLink::ComputeParent() const { +AXObjectImpl* AXImageMapLink::ComputeParent() const { DCHECK(!IsDetached()); if (parent_) return parent_; @@ -72,7 +72,7 @@ AccessibilityRole AXImageMapLink::RoleValue() const { const AtomicString& aria_role = GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); if (!aria_role.IsEmpty()) - return AXObject::AriaRoleToWebCoreRole(aria_role); + return AXObjectImpl::AriaRoleToWebCoreRole(aria_role); return kLinkRole; } @@ -98,7 +98,7 @@ KURL AXImageMapLink::Url() const { } void AXImageMapLink::GetRelativeBounds( - AXObject** out_container, + AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const { *out_container = nullptr; diff --git a/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.h b/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.h index a52ba7071f605e..cf7b9dfaf24d7f 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.h +++ b/third_party/WebKit/Source/modules/accessibility/AXImageMapLink.h @@ -61,8 +61,8 @@ class AXImageMapLink final : public AXNodeObject { KURL Url() const override; bool IsLink() const override { return true; } bool IsLinked() const override { return true; } - AXObject* ComputeParent() const override; - void GetRelativeBounds(AXObject** out_container, + AXObjectImpl* ComputeParent() const override; + void GetRelativeBounds(AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const override; diff --git a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp index 068a1d7b27b3a6..305dfbc8c7b761 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp @@ -41,7 +41,8 @@ using namespace HTMLNames; AXInlineTextBox::AXInlineTextBox( PassRefPtr inline_text_box, AXObjectCacheImpl& ax_object_cache) - : AXObject(ax_object_cache), inline_text_box_(std::move(inline_text_box)) {} + : AXObjectImpl(ax_object_cache), + inline_text_box_(std::move(inline_text_box)) {} AXInlineTextBox* AXInlineTextBox::Create( PassRefPtr inline_text_box, @@ -52,12 +53,12 @@ AXInlineTextBox* AXInlineTextBox::Create( void AXInlineTextBox::Init() {} void AXInlineTextBox::Detach() { - AXObject::Detach(); + AXObjectImpl::Detach(); inline_text_box_ = nullptr; } void AXInlineTextBox::GetRelativeBounds( - AXObject** out_container, + AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const { *out_container = nullptr; @@ -81,7 +82,7 @@ void AXInlineTextBox::GetRelativeBounds( bool AXInlineTextBox::ComputeAccessibilityIsIgnored( IgnoredReasons* ignored_reasons) const { - AXObject* parent = ParentObject(); + AXObjectImpl* parent = ParentObject(); if (!parent) return false; @@ -123,8 +124,9 @@ void AXInlineTextBox::GetWordBoundaries(Vector& words) const { AXRange(word_boundaries[i].start_index, word_boundaries[i].end_index); } -String AXInlineTextBox::GetName(AXNameFrom& name_from, - AXObject::AXObjectVector* name_objects) const { +String AXInlineTextBox::GetName( + AXNameFrom& name_from, + AXObjectImpl::AXObjectVector* name_objects) const { if (!inline_text_box_) return String(); @@ -132,7 +134,7 @@ String AXInlineTextBox::GetName(AXNameFrom& name_from, return inline_text_box_->GetText(); } -AXObject* AXInlineTextBox::ComputeParent() const { +AXObjectImpl* AXInlineTextBox::ComputeParent() const { DCHECK(!IsDetached()); if (!inline_text_box_ || !ax_object_cache_) return 0; @@ -146,7 +148,7 @@ AXObject* AXInlineTextBox::ComputeParent() const { // top to bottom and bottom to top via the CSS writing-mode property. AccessibilityTextDirection AXInlineTextBox::GetTextDirection() const { if (!inline_text_box_) - return AXObject::GetTextDirection(); + return AXObjectImpl::GetTextDirection(); switch (inline_text_box_->GetDirection()) { case AbstractInlineTextBox::kLeftToRight: @@ -159,10 +161,10 @@ AccessibilityTextDirection AXInlineTextBox::GetTextDirection() const { return kAccessibilityTextDirectionBTT; } - return AXObject::GetTextDirection(); + return AXObjectImpl::GetTextDirection(); } -AXObject* AXInlineTextBox::NextOnLine() const { +AXObjectImpl* AXInlineTextBox::NextOnLine() const { RefPtr next_on_line = inline_text_box_->NextOnLine(); if (next_on_line) return ax_object_cache_->GetOrCreate(next_on_line.Get()); @@ -173,7 +175,7 @@ AXObject* AXInlineTextBox::NextOnLine() const { return ParentObject()->NextOnLine(); } -AXObject* AXInlineTextBox::PreviousOnLine() const { +AXObjectImpl* AXInlineTextBox::PreviousOnLine() const { RefPtr previous_on_line = inline_text_box_->PreviousOnLine(); if (previous_on_line) diff --git a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.h b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.h index 923cbcf2640518..ca75ce53764b19 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.h +++ b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.h @@ -30,14 +30,14 @@ #define AXInlineTextBox_h #include "core/layout/line/AbstractInlineTextBox.h" -#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXObjectImpl.h" namespace blink { class Node; class AXObjectCacheImpl; -class AXInlineTextBox final : public AXObject { +class AXInlineTextBox final : public AXObjectImpl { WTF_MAKE_NONCOPYABLE(AXInlineTextBox); private: @@ -56,17 +56,17 @@ class AXInlineTextBox final : public AXObject { public: AccessibilityRole RoleValue() const override { return kInlineTextBoxRole; } String GetName(AXNameFrom&, - AXObject::AXObjectVector* name_objects) const override; + AXObjectImpl::AXObjectVector* name_objects) const override; void TextCharacterOffsets(Vector&) const override; void GetWordBoundaries(Vector&) const override; - void GetRelativeBounds(AXObject** out_container, + void GetRelativeBounds(AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const override; - AXObject* ComputeParent() const override; + AXObjectImpl* ComputeParent() const override; AccessibilityTextDirection GetTextDirection() const override; Node* GetNode() const override { return inline_text_box_->GetNode(); } - AXObject* NextOnLine() const override; - AXObject* PreviousOnLine() const override; + AXObjectImpl* NextOnLine() const override; + AXObjectImpl* PreviousOnLine() const override; private: RefPtr inline_text_box_; diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp index 30b7c7859f29bc..2a1e5801392ea8 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp @@ -327,7 +327,7 @@ void AXLayoutObject::Detach() { // Check object role or purpose. // -static bool IsLinkable(const AXObject& object) { +static bool IsLinkable(const AXObjectImpl& object) { if (!object.GetLayoutObject()) return false; @@ -350,7 +350,7 @@ bool AXLayoutObject::IsEditable() const { Document& document = GetLayoutObject()->GetDocument(); HTMLElement* body = document.body(); if (body && HasEditableStyle(*body)) { - AXObject* ax_body = AxObjectCache().GetOrCreate(body); + AXObjectImpl* ax_body = AxObjectCache().GetOrCreate(body); return ax_body && ax_body != ax_body->AriaHiddenRoot(); } @@ -370,7 +370,7 @@ bool AXLayoutObject::IsRichlyEditable() const { Document& document = layout_object_->GetDocument(); HTMLElement* body = document.body(); if (body && HasRichlyEditableStyle(*body)) { - AXObject* ax_body = AxObjectCache().GetOrCreate(body); + AXObjectImpl* ax_body = AxObjectCache().GetOrCreate(body); return ax_body && ax_body != ax_body->AriaHiddenRoot(); } @@ -412,7 +412,7 @@ bool AXLayoutObject::IsReadOnly() const { Document& document = layout_object_->GetDocument(); HTMLElement* body = document.body(); if (body && HasEditableStyle(*body)) { - AXObject* ax_body = AxObjectCache().GetOrCreate(body); + AXObjectImpl* ax_body = AxObjectCache().GetOrCreate(body); return !ax_body || ax_body == ax_body->AriaHiddenRoot(); } @@ -441,7 +441,7 @@ bool AXLayoutObject::IsFocused() const { Element* focused_element = GetDocument()->FocusedElement(); if (!focused_element) return false; - AXObject* focused_object = AxObjectCache().GetOrCreate(focused_element); + AXObjectImpl* focused_object = AxObjectCache().GetOrCreate(focused_element); if (!focused_object || !focused_object->IsAXLayoutObject()) return false; @@ -463,7 +463,7 @@ bool AXLayoutObject::IsSelected() const { if (EqualIgnoringASCIICase(aria_selected, "true")) return true; - AXObject* focused_object = AxObjectCache().FocusedObject(); + AXObjectImpl* focused_object = AxObjectCache().FocusedObject(); if (AriaRoleAttribute() == kListBoxOptionRole && focused_object && focused_object->ActiveDescendant() == this) { return true; @@ -501,7 +501,7 @@ AXObjectInclusion AXLayoutObject::DefaultObjectInclusion( return kIgnoreObject; } - return AXObject::DefaultObjectInclusion(ignored_reasons); + return AXObjectImpl::DefaultObjectInclusion(ignored_reasons); } bool AXLayoutObject::ComputeAccessibilityIsIgnored( @@ -542,7 +542,7 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored( if (HasInheritedPresentationalRole()) { if (ignored_reasons) { - const AXObject* inherits_from = InheritsPresentationalRoleFrom(); + const AXObjectImpl* inherits_from = InheritsPresentationalRoleFrom(); if (inherits_from == this) ignored_reasons->push_back(IgnoredReason(kAXPresentationalRole)); else @@ -553,7 +553,7 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored( } // An ARIA tree can only have tree items and static text as children. - if (AXObject* tree_ancestor = TreeAncestorDisallowingChild()) { + if (AXObjectImpl* tree_ancestor = TreeAncestorDisallowingChild()) { if (ignored_reasons) ignored_reasons->push_back( IgnoredReason(kAXAncestorDisallowsChild, tree_ancestor)); @@ -572,13 +572,13 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored( // Find out if this element is inside of a label element. If so, it may be // ignored because it's the label for a checkbox or radio button. - AXObject* control_object = CorrespondingControlForLabelElement(); + AXObjectImpl* control_object = CorrespondingControlForLabelElement(); if (control_object && control_object->IsCheckboxOrRadio() && control_object->NameFromLabelElement()) { if (ignored_reasons) { HTMLLabelElement* label = LabelElementContainer(); if (label && label != GetNode()) { - AXObject* label_ax_object = AxObjectCache().GetOrCreate(label); + AXObjectImpl* label_ax_object = AxObjectCache().GetOrCreate(label); ignored_reasons->push_back( IgnoredReason(kAXLabelContainer, label_ax_object)); } @@ -600,7 +600,7 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored( if (layout_object_->IsText()) { // Static text beneath MenuItems and MenuButtons are just reported along // with the menu item, so it's ignored on an individual level. - AXObject* parent = ParentObjectUnignored(); + AXObjectImpl* parent = ParentObjectUnignored(); if (parent && (parent->AriaRoleAttribute() == kMenuItemRole || parent->AriaRoleAttribute() == kMenuButtonRole)) { if (ignored_reasons) @@ -616,7 +616,7 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored( } // Don't ignore static text in editable text controls. - for (AXObject* parent = ParentObject(); parent; + for (AXObjectImpl* parent = ParentObject(); parent; parent = parent->ParentObject()) { if (parent->RoleValue() == kTextFieldRole) return false; @@ -809,7 +809,7 @@ RGBA32 AXLayoutObject::ComputeBackgroundColor() const { // Color::blend should be called like this: background.blend(foreground). for (LayoutObject* layout_object = GetLayoutObject(); layout_object; layout_object = layout_object->Parent()) { - const AXObject* ax_parent = AxObjectCache().GetOrCreate(layout_object); + const AXObjectImpl* ax_parent = AxObjectCache().GetOrCreate(layout_object); if (ax_parent && ax_parent != this) { Color parent_color = ax_parent->BackgroundColor(); blended_color = parent_color.Blend(blended_color); @@ -1080,13 +1080,13 @@ void AXLayoutObject::LoadInlineTextBoxes() { } } -AXObject* AXLayoutObject::NextOnLine() const { +AXObjectImpl* AXLayoutObject::NextOnLine() const { if (!GetLayoutObject()) return nullptr; - AXObject* result = nullptr; + AXObjectImpl* result = nullptr; if (GetLayoutObject()->IsListMarker()) { - AXObject* next_sibling = RawNextSibling(); + AXObjectImpl* next_sibling = RawNextSibling(); if (!next_sibling || !next_sibling->Children().size()) return nullptr; result = next_sibling->Children()[0].Get(); @@ -1119,7 +1119,7 @@ AXObject* AXLayoutObject::NextOnLine() const { return result; } -AXObject* AXLayoutObject::PreviousOnLine() const { +AXObjectImpl* AXLayoutObject::PreviousOnLine() const { if (!GetLayoutObject()) return nullptr; @@ -1132,7 +1132,7 @@ AXObject* AXLayoutObject::PreviousOnLine() const { if (!inline_box) return nullptr; - AXObject* result = nullptr; + AXObjectImpl* result = nullptr; for (InlineBox* prev = inline_box->PrevOnLine(); prev; prev = prev->PrevOnLine()) { LayoutObject* layout_object = @@ -1291,9 +1291,10 @@ bool AXLayoutObject::AriaRoleHasPresentationalChildren() const { } } -AXObject* AXLayoutObject::AncestorForWhichThisIsAPresentationalChild() const { +AXObjectImpl* AXLayoutObject::AncestorForWhichThisIsAPresentationalChild() + const { // Walk the parent chain looking for a parent that has presentational children - AXObject* parent = ParentObjectIfExists(); + AXObjectImpl* parent = ParentObjectIfExists(); while (parent) { if (parent->AriaRoleHasPresentationalChildren()) break; @@ -1397,7 +1398,8 @@ bool AXLayoutObject::LiveRegionBusy() const { // Hit testing. // -AXObject* AXLayoutObject::AccessibilityHitTest(const IntPoint& point) const { +AXObjectImpl* AXLayoutObject::AccessibilityHitTest( + const IntPoint& point) const { if (!layout_object_ || !layout_object_->HasLayer()) return nullptr; @@ -1424,7 +1426,7 @@ AXObject* AXLayoutObject::AccessibilityHitTest(const IntPoint& point) const { if (!obj) return nullptr; - AXObject* result = AxObjectCache().GetOrCreate(obj); + AXObjectImpl* result = AxObjectCache().GetOrCreate(obj); result->UpdateChildrenIfNecessary(); // Allow the element to perform any hit-testing it might need to do to reach @@ -1434,7 +1436,7 @@ AXObject* AXLayoutObject::AccessibilityHitTest(const IntPoint& point) const { // If this element is the label of a control, a hit test should return the // control. if (result->IsAXLayoutObject()) { - AXObject* control_object = + AXObjectImpl* control_object = ToAXLayoutObject(result)->CorrespondingControlForLabelElement(); if (control_object && control_object->NameFromLabelElement()) return control_object; @@ -1446,19 +1448,19 @@ AXObject* AXLayoutObject::AccessibilityHitTest(const IntPoint& point) const { return result; } -AXObject* AXLayoutObject::ElementAccessibilityHitTest( +AXObjectImpl* AXLayoutObject::ElementAccessibilityHitTest( const IntPoint& point) const { if (IsSVGImage()) return RemoteSVGElementHitTest(point); - return AXObject::ElementAccessibilityHitTest(point); + return AXObjectImpl::ElementAccessibilityHitTest(point); } // // High-level accessibility tree access. // -AXObject* AXLayoutObject::ComputeParent() const { +AXObjectImpl* AXLayoutObject::ComputeParent() const { DCHECK(!IsDetached()); if (!layout_object_) return 0; @@ -1469,7 +1471,7 @@ AXObject* AXLayoutObject::ComputeParent() const { // menuButton and its corresponding menu are DOM siblings, but Accessibility // needs them to be parent/child. if (AriaRoleAttribute() == kMenuRole) { - AXObject* parent = MenuButtonForMenu(); + AXObjectImpl* parent = MenuButtonForMenu(); if (parent) return parent; } @@ -1487,7 +1489,7 @@ AXObject* AXLayoutObject::ComputeParent() const { return 0; } -AXObject* AXLayoutObject::ComputeParentIfExists() const { +AXObjectImpl* AXLayoutObject::ComputeParentIfExists() const { if (!layout_object_) return 0; @@ -1497,7 +1499,7 @@ AXObject* AXLayoutObject::ComputeParentIfExists() const { // menuButton and its corresponding menu are DOM siblings, but Accessibility // needs them to be parent/child. if (AriaRoleAttribute() == kMenuRole) { - AXObject* parent = MenuButtonForMenu(); + AXObjectImpl* parent = MenuButtonForMenu(); if (parent) return parent; } @@ -1520,7 +1522,7 @@ AXObject* AXLayoutObject::ComputeParentIfExists() const { // accessibility module. // -AXObject* AXLayoutObject::RawFirstChild() const { +AXObjectImpl* AXLayoutObject::RawFirstChild() const { if (!layout_object_) return 0; @@ -1532,7 +1534,7 @@ AXObject* AXLayoutObject::RawFirstChild() const { return AxObjectCache().GetOrCreate(first_child); } -AXObject* AXLayoutObject::RawNextSibling() const { +AXObjectImpl* AXLayoutObject::RawNextSibling() const { if (!layout_object_) return 0; @@ -1600,10 +1602,10 @@ void AXLayoutObject::AddChildren() { if (!CanHaveChildren()) return; - HeapVector> owned_children; + HeapVector> owned_children; ComputeAriaOwnsChildren(owned_children); - for (AXObject* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { + for (AXObjectImpl* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { if (!AxObjectCache().IsAriaOwned(obj)) { obj->SetParent(this); AddChild(obj); @@ -1638,11 +1640,11 @@ void AXLayoutObject::UpdateChildrenIfNecessary() { if (NeedsToUpdateChildren()) ClearChildren(); - AXObject::UpdateChildrenIfNecessary(); + AXObjectImpl::UpdateChildrenIfNecessary(); } void AXLayoutObject::ClearChildren() { - AXObject::ClearChildren(); + AXObjectImpl::ClearChildren(); children_dirty_ = false; } @@ -1729,7 +1731,7 @@ Element* AXLayoutObject::AnchorElement() const { // Functions that retrieve the current selection. // -AXObject::AXRange AXLayoutObject::Selection() const { +AXObjectImpl::AXRange AXLayoutObject::Selection() const { AXRange text_selection = TextControlSelection(); if (text_selection.IsValid()) return text_selection; @@ -1756,7 +1758,7 @@ AXObject::AXRange AXLayoutObject::Selection() const { DCHECK(anchor_node); AXLayoutObject* anchor_object = nullptr; - // Find the closest node that has a corresponding AXObject. + // Find the closest node that has a corresponding AXObjectImpl. // This is because some nodes may be aria hidden or might not even have // a layout object if they are part of the shadow DOM. while (anchor_node) { @@ -1799,7 +1801,7 @@ AXObject::AXRange AXLayoutObject::Selection() const { // Gets only the start and end offsets of the selection computed using the // current object as the starting point. Returns a null selection if there is // no selection in the subtree rooted at this object. -AXObject::AXRange AXLayoutObject::SelectionUnderObject() const { +AXObjectImpl::AXRange AXLayoutObject::SelectionUnderObject() const { AXRange text_selection = TextControlSelection(); if (text_selection.IsValid()) return text_selection; @@ -1833,7 +1835,7 @@ AXObject::AXRange AXLayoutObject::SelectionUnderObject() const { return AXRange(start, end); } -AXObject::AXRange AXLayoutObject::TextControlSelection() const { +AXObjectImpl::AXRange AXLayoutObject::TextControlSelection() const { if (!GetLayoutObject()) return AXRange(); @@ -1850,7 +1852,7 @@ AXObject::AXRange AXLayoutObject::TextControlSelection() const { if (!layout) return AXRange(); - AXObject* ax_object = AxObjectCache().GetOrCreate(layout); + AXObjectImpl* ax_object = AxObjectCache().GetOrCreate(layout); if (!ax_object || !ax_object->IsAXLayoutObject()) return AXRange(); @@ -1895,7 +1897,7 @@ AXLayoutObject* AXLayoutObject::GetUnignoredObjectFromNode(Node& node) const { if (IsDetached()) return nullptr; - AXObject* ax_object = AxObjectCache().GetOrCreate(&node); + AXObjectImpl* ax_object = AxObjectCache().GetOrCreate(&node); if (!ax_object) return nullptr; @@ -1910,7 +1912,7 @@ AXLayoutObject* AXLayoutObject::GetUnignoredObjectFromNode(Node& node) const { // // Convert from an accessible object and offset to a VisiblePosition. -static VisiblePosition ToVisiblePosition(AXObject* obj, int offset) { +static VisiblePosition ToVisiblePosition(AXObjectImpl* obj, int offset) { if (!obj->GetNode()) return VisiblePosition(); @@ -1936,7 +1938,7 @@ static VisiblePosition ToVisiblePosition(AXObject* obj, int offset) { static_cast(offset) > (obj->Children().size() - 1) ? offset - 1 : offset; - AXObject* child_obj = obj->Children()[clamped_offset]; + AXObjectImpl* child_obj = obj->Children()[clamped_offset]; Node* child_node = child_obj->GetNode(); if (!child_node || !child_node->parentNode()) return VisiblePosition(); @@ -1969,9 +1971,9 @@ void AXLayoutObject::SetSelection(const AXRange& selection) { if (!GetLayoutObject() || !selection.IsValid()) return; - AXObject* anchor_object = + AXObjectImpl* anchor_object = selection.anchor_object ? selection.anchor_object.Get() : this; - AXObject* focus_object = + AXObjectImpl* focus_object = selection.focus_object ? selection.focus_object.Get() : this; if (!IsValidSelectionBound(anchor_object) || @@ -2023,7 +2025,8 @@ void AXLayoutObject::SetSelection(const AXRange& selection) { .Build()); } -bool AXLayoutObject::IsValidSelectionBound(const AXObject* bound_object) const { +bool AXLayoutObject::IsValidSelectionBound( + const AXObjectImpl* bound_object) const { return GetLayoutObject() && bound_object && !bound_object->IsDetached() && bound_object->IsAXLayoutObject() && bound_object->GetLayoutObject() && bound_object->GetLayoutObject()->GetFrame() == @@ -2054,7 +2057,7 @@ void AXLayoutObject::HandleActiveDescendantChanged() { if (!GetLayoutObject()) return; - AXObject* focused_object = AxObjectCache().FocusedObject(); + AXObjectImpl* focused_object = AxObjectCache().FocusedObject(); if (focused_object == this && SupportsActiveDescendant()) { AxObjectCache().PostNotification( GetLayoutObject(), AXObjectCacheImpl::kAXActiveDescendantChanged); @@ -2063,7 +2066,7 @@ void AXLayoutObject::HandleActiveDescendantChanged() { void AXLayoutObject::HandleAriaExpandedChanged() { // Find if a parent of this object should handle aria-expanded changes. - AXObject* container_parent = this->ParentObject(); + AXObjectImpl* container_parent = this->ParentObject(); while (container_parent) { bool found_parent = false; @@ -2183,7 +2186,7 @@ void AXLayoutObject::AddInlineTextBoxChildren(bool force) { for (RefPtr box = layout_text->FirstAbstractInlineTextBox(); box.Get(); box = box->NextInlineTextBox()) { - AXObject* ax_object = AxObjectCache().GetOrCreate(box.Get()); + AXObjectImpl* ax_object = AxObjectCache().GetOrCreate(box.Get()); if (!ax_object->AccessibilityIsIgnored()) children_.push_back(ax_object); } @@ -2216,11 +2219,11 @@ void AXLayoutObject::LineBreaks(Vector& line_breaks) const { // Private. // -AXObject* AXLayoutObject::TreeAncestorDisallowingChild() const { +AXObjectImpl* AXLayoutObject::TreeAncestorDisallowingChild() const { // Determine if this is in a tree. If so, we apply special behavior to make it // work like an AXOutline. - AXObject* ax_obj = ParentObject(); - AXObject* tree_ancestor = 0; + AXObjectImpl* ax_obj = ParentObject(); + AXObjectImpl* tree_ancestor = 0; while (ax_obj) { if (ax_obj->IsTree()) { tree_ancestor = ax_obj; @@ -2250,7 +2253,7 @@ bool AXLayoutObject::IsTabItemSelected() const { // The ARIA spec says a tab item can also be selected if it is aria-labeled by // a tabpanel that has keyboard focus inside of it, or if a tabpanel in its // aria-controls list has KB focus inside of it. - AXObject* focused_element = AxObjectCache().FocusedObject(); + AXObjectImpl* focused_element = AxObjectCache().FocusedObject(); if (!focused_element) return false; @@ -2258,13 +2261,13 @@ bool AXLayoutObject::IsTabItemSelected() const { ElementsFromAttribute(elements, aria_controlsAttr); for (const auto& element : elements) { - AXObject* tab_panel = AxObjectCache().GetOrCreate(element); + AXObjectImpl* tab_panel = AxObjectCache().GetOrCreate(element); // A tab item should only control tab panels. if (!tab_panel || tab_panel->RoleValue() != kTabPanelRole) continue; - AXObject* check_focus_element = focused_element; + AXObjectImpl* check_focus_element = focused_element; // Check if the focused element is a descendant of the element controlled by // the tab item. while (check_focus_element) { @@ -2277,13 +2280,13 @@ bool AXLayoutObject::IsTabItemSelected() const { return false; } -AXObject* AXLayoutObject::AccessibilityImageMapHitTest( +AXObjectImpl* AXLayoutObject::AccessibilityImageMapHitTest( HTMLAreaElement* area, const IntPoint& point) const { if (!area) return 0; - AXObject* parent = AxObjectCache().GetOrCreate(area->ImageElement()); + AXObjectImpl* parent = AxObjectCache().GetOrCreate(area->ImageElement()); if (!parent) return 0; @@ -2361,8 +2364,9 @@ AXSVGRoot* AXLayoutObject::RemoteSVGRootElement() const { return 0; } -AXObject* AXLayoutObject::RemoteSVGElementHitTest(const IntPoint& point) const { - AXObject* remote = RemoteSVGRootElement(); +AXObjectImpl* AXLayoutObject::RemoteSVGElementHitTest( + const IntPoint& point) const { + AXObjectImpl* remote = RemoteSVGRootElement(); if (!remote) return 0; @@ -2376,7 +2380,7 @@ AXObject* AXLayoutObject::RemoteSVGElementHitTest(const IntPoint& point) const { // coordinates only. void AXLayoutObject::OffsetBoundingBoxForRemoteSVGElement( LayoutRect& rect) const { - for (AXObject* parent = ParentObject(); parent; + for (AXObjectImpl* parent = ParentObject(); parent; parent = parent->ParentObject()) { if (parent->IsAXSVGRoot()) { rect.MoveBy( @@ -2415,7 +2419,7 @@ void AXLayoutObject::AddHiddenChildren() { for (Node& child : NodeTraversal::ChildrenOf(*node)) { if (child.GetLayoutObject()) { // Find out where the last layout sibling is located within m_children. - if (AXObject* child_object = + if (AXObjectImpl* child_object = AxObjectCache().Get(child.GetLayoutObject())) { if (child_object->AccessibilityIsIgnored()) { const auto& children = child_object->Children(); @@ -2470,7 +2474,7 @@ void AXLayoutObject::AddImageMapChildren() { for (HTMLAreaElement& area : Traversal::DescendantsOf(*map)) { // add an element for this child if it has a link - AXObject* obj = AxObjectCache().GetOrCreate(&area); + AXObjectImpl* obj = AxObjectCache().GetOrCreate(&area); if (obj) { AXImageMapLink* area_object = ToAXImageMapLink(obj); area_object->SetParent(this); @@ -2498,7 +2502,8 @@ void AXLayoutObject::AddCanvasChildren() { void AXLayoutObject::AddPopupChildren() { if (!isHTMLInputElement(GetNode())) return; - if (AXObject* ax_popup = toHTMLInputElement(GetNode())->PopupRootAXObject()) + if (AXObjectImpl* ax_popup = + toHTMLInputElement(GetNode())->PopupRootAXObject()) children_.push_back(ax_popup); } diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h index 66a5f3e413872a..817a9769fb7b85 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h @@ -54,7 +54,7 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { static AXLayoutObject* Create(LayoutObject*, AXObjectCacheImpl&); ~AXLayoutObject() override; - // Public, overridden from AXObject. + // Public, overridden from AXObjectImpl. LayoutObject* GetLayoutObject() const final { return layout_object_; } LayoutBoxModelObject* GetLayoutBoxModelObject() const; ScrollableArea* GetScrollableAreaIfScrollable() const final; @@ -69,7 +69,7 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { } // - // Overridden from AXObject. + // Overridden from AXObjectImpl. // void Init() override; @@ -111,8 +111,8 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { // Inline text boxes. void LoadInlineTextBoxes() override; - AXObject* NextOnLine() const override; - AXObject* PreviousOnLine() const override; + AXObjectImpl* NextOnLine() const override; + AXObjectImpl* PreviousOnLine() const override; // Properties of interactive elements. String StringValue() const override; @@ -124,7 +124,7 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { bool AriaHasPopup() const override; bool AriaRoleHasPresentationalChildren() const override; - AXObject* AncestorForWhichThisIsAPresentationalChild() const override; + AXObjectImpl* AncestorForWhichThisIsAPresentationalChild() const override; bool SupportsARIADragging() const override; bool SupportsARIADropping() const override; bool SupportsARIAFlowTo() const override; @@ -151,18 +151,18 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { void SetSelection(const AXRange&) override; // Hit testing. - AXObject* AccessibilityHitTest(const IntPoint&) const override; - AXObject* ElementAccessibilityHitTest(const IntPoint&) const override; + AXObjectImpl* AccessibilityHitTest(const IntPoint&) const override; + AXObjectImpl* ElementAccessibilityHitTest(const IntPoint&) const override; // High-level accessibility tree access. Other modules should only use these // functions. - AXObject* ComputeParent() const override; - AXObject* ComputeParentIfExists() const override; + AXObjectImpl* ComputeParent() const override; + AXObjectImpl* ComputeParentIfExists() const override; // Low-level accessibility tree exploration, only for use within the // accessibility module. - AXObject* RawFirstChild() const override; - AXObject* RawNextSibling() const override; + AXObjectImpl* RawFirstChild() const override; + AXObjectImpl* RawNextSibling() const override; void AddChildren() override; bool CanHaveChildren() const override; void UpdateChildrenIfNecessary() override; @@ -192,16 +192,16 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { void LineBreaks(Vector&) const final; private: - AXObject* TreeAncestorDisallowingChild() const; + AXObjectImpl* TreeAncestorDisallowingChild() const; bool IsTabItemSelected() const; - bool IsValidSelectionBound(const AXObject*) const; - AXObject* AccessibilityImageMapHitTest(HTMLAreaElement*, - const IntPoint&) const; + bool IsValidSelectionBound(const AXObjectImpl*) const; + AXObjectImpl* AccessibilityImageMapHitTest(HTMLAreaElement*, + const IntPoint&) const; LayoutObject* LayoutParentObject() const; bool IsSVGImage() const; void DetachRemoteSVGRoot(); AXSVGRoot* RemoteSVGRootElement() const; - AXObject* RemoteSVGElementHitTest(const IntPoint&) const; + AXObjectImpl* RemoteSVGElementHitTest(const IntPoint&) const; void OffsetBoundingBoxForRemoteSVGElement(LayoutRect&) const; void AddHiddenChildren(); void AddTextFieldChildren(); diff --git a/third_party/WebKit/Source/modules/accessibility/AXListBox.cpp b/third_party/WebKit/Source/modules/accessibility/AXListBox.cpp index af73e43d0da5a3..763a72fb58dba9 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXListBox.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXListBox.cpp @@ -57,7 +57,7 @@ AccessibilityRole AXListBox::DetermineAccessibilityRole() { return kListBoxRole; } -AXObject* AXListBox::ActiveDescendant() { +AXObjectImpl* AXListBox::ActiveDescendant() { if (!isHTMLSelectElement(GetNode())) return nullptr; diff --git a/third_party/WebKit/Source/modules/accessibility/AXListBox.h b/third_party/WebKit/Source/modules/accessibility/AXListBox.h index d2853e9ca11494..d40e283f80d095 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXListBox.h +++ b/third_party/WebKit/Source/modules/accessibility/AXListBox.h @@ -47,7 +47,7 @@ class AXListBox final : public AXLayoutObject { AccessibilityRole DetermineAccessibilityRole() final; bool IsAXListBox() const override { return true; } - AXObject* ActiveDescendant() final; + AXObjectImpl* ActiveDescendant() final; void ActiveIndexChanged(); diff --git a/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp index a1524f98aaf8e9..aea93ad7247a43 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp @@ -64,7 +64,7 @@ AccessibilityRole AXListBoxOption::DetermineAccessibilityRole() { } bool AXListBoxOption::IsParentPresentationalRole() const { - AXObject* parent = ParentObject(); + AXObjectImpl* parent = ParentObject(); if (!parent) return false; diff --git a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.cpp b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.cpp index d00ae6c1a38582..70c0bad4de7fd0 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.cpp @@ -46,7 +46,7 @@ AccessibilityMediaControl::AccessibilityMediaControl( AXObjectCacheImpl& ax_object_cache) : AXLayoutObject(layout_object, ax_object_cache) {} -AXObject* AccessibilityMediaControl::Create( +AXObjectImpl* AccessibilityMediaControl::Create( LayoutObject* layout_object, AXObjectCacheImpl& ax_object_cache) { DCHECK(layout_object->GetNode()); @@ -276,8 +276,9 @@ AXMediaControlsContainer::AXMediaControlsContainer( AXObjectCacheImpl& ax_object_cache) : AccessibilityMediaControl(layout_object, ax_object_cache) {} -AXObject* AXMediaControlsContainer::Create(LayoutObject* layout_object, - AXObjectCacheImpl& ax_object_cache) { +AXObjectImpl* AXMediaControlsContainer::Create( + LayoutObject* layout_object, + AXObjectCacheImpl& ax_object_cache) { return new AXMediaControlsContainer(layout_object, ax_object_cache); } @@ -321,7 +322,7 @@ AccessibilityMediaTimeline::AccessibilityMediaTimeline( AXObjectCacheImpl& ax_object_cache) : AXSlider(layout_object, ax_object_cache) {} -AXObject* AccessibilityMediaTimeline::Create( +AXObjectImpl* AccessibilityMediaTimeline::Create( LayoutObject* layout_object, AXObjectCacheImpl& ax_object_cache) { return new AccessibilityMediaTimeline(layout_object, ax_object_cache); @@ -353,7 +354,7 @@ AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay( AXObjectCacheImpl& ax_object_cache) : AccessibilityMediaControl(layout_object, ax_object_cache) {} -AXObject* AccessibilityMediaTimeDisplay::Create( +AXObjectImpl* AccessibilityMediaTimeDisplay::Create( LayoutObject* layout_object, AXObjectCacheImpl& ax_object_cache) { return new AccessibilityMediaTimeDisplay(layout_object, ax_object_cache); diff --git a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h index 07b70bf5be6842..353aec4406e261 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h @@ -40,7 +40,7 @@ class AccessibilityMediaControl : public AXLayoutObject { WTF_MAKE_NONCOPYABLE(AccessibilityMediaControl); public: - static AXObject* Create(LayoutObject*, AXObjectCacheImpl&); + static AXObjectImpl* Create(LayoutObject*, AXObjectCacheImpl&); ~AccessibilityMediaControl() override {} AccessibilityRole RoleValue() const override; @@ -65,7 +65,7 @@ class AccessibilityMediaTimeline final : public AXSlider { WTF_MAKE_NONCOPYABLE(AccessibilityMediaTimeline); public: - static AXObject* Create(LayoutObject*, AXObjectCacheImpl&); + static AXObjectImpl* Create(LayoutObject*, AXObjectCacheImpl&); ~AccessibilityMediaTimeline() override {} String Description(AXNameFrom, @@ -81,7 +81,7 @@ class AXMediaControlsContainer final : public AccessibilityMediaControl { WTF_MAKE_NONCOPYABLE(AXMediaControlsContainer); public: - static AXObject* Create(LayoutObject*, AXObjectCacheImpl&); + static AXObjectImpl* Create(LayoutObject*, AXObjectCacheImpl&); ~AXMediaControlsContainer() override {} AccessibilityRole RoleValue() const override { return kToolbarRole; } @@ -105,7 +105,7 @@ class AccessibilityMediaTimeDisplay final : public AccessibilityMediaControl { WTF_MAKE_NONCOPYABLE(AccessibilityMediaTimeDisplay); public: - static AXObject* Create(LayoutObject*, AXObjectCacheImpl&); + static AXObjectImpl* Create(LayoutObject*, AXObjectCacheImpl&); ~AccessibilityMediaTimeDisplay() override {} AccessibilityRole RoleValue() const override { return kStaticTextRole; } diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuList.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuList.cpp index 96477a55aea5f6..c2b966eed7a2b5 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuList.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuList.cpp @@ -82,7 +82,7 @@ void AXMenuList::AddChildren() { AXObjectCacheImpl& cache = AxObjectCache(); - AXObject* list = cache.GetOrCreate(kMenuListPopupRole); + AXObjectImpl* list = cache.GetOrCreate(kMenuListPopupRole); if (!list) return; diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp index 9676ad9ddce2b7..43739e3bac6286 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp @@ -107,19 +107,19 @@ bool AXMenuListOption::ComputeAccessibilityIsIgnored( } void AXMenuListOption::GetRelativeBounds( - AXObject** out_container, + AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const { *out_container = nullptr; out_bounds_in_container = FloatRect(); out_container_transform.setIdentity(); - AXObject* parent = ParentObject(); + AXObjectImpl* parent = ParentObject(); if (!parent) return; DCHECK(parent->IsMenuListPopup()); - AXObject* grandparent = parent->ParentObject(); + AXObjectImpl* grandparent = parent->ParentObject(); if (!grandparent) return; DCHECK(grandparent->IsMenuList()); diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h index 76c954a3b4aa5a..3447fee4fbce6d 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h @@ -62,7 +62,7 @@ class AXMenuListOption final : public AXMockObject { bool IsSelected() const override; void SetSelected(bool) override; bool CanSetSelectedAttribute() const override; - void GetRelativeBounds(AXObject** out_container, + void GetRelativeBounds(AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const override; String TextAlternative(bool recursive, diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp index 713c4e5c42bba3..7ef8e0e8ba2061 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp @@ -65,7 +65,7 @@ AXMenuListOption* AXMenuListPopup::MenuListOptionAXObject( if (!isHTMLOptionElement(*element)) return 0; - AXObject* object = AxObjectCache().GetOrCreate(element); + AXObjectImpl* object = AxObjectCache().GetOrCreate(element); if (!object || !object->IsMenuListOption()) return 0; @@ -130,13 +130,13 @@ void AXMenuListPopup::DidUpdateActiveOption(int option_index) { AXObjectCacheImpl& cache = AxObjectCache(); if (active_index_ != option_index && active_index_ >= 0 && active_index_ < static_cast(children_.size())) { - AXObject* previous_child = children_[active_index_].Get(); + AXObjectImpl* previous_child = children_[active_index_].Get(); cache.PostNotification(previous_child, AXObjectCacheImpl::kAXMenuListItemUnselected); } if (option_index >= 0 && option_index < static_cast(children_.size())) { - AXObject* child = children_[option_index].Get(); + AXObjectImpl* child = children_[option_index].Get(); cache.PostNotification(this, AXObjectCacheImpl::kAXActiveDescendantChanged); cache.PostNotification(child, AXObjectCacheImpl::kAXMenuListItemSelected); } @@ -167,7 +167,7 @@ void AXMenuListPopup::DidShow() { AXObjectCacheImpl::kAXFocusedUIElementChanged); } -AXObject* AXMenuListPopup::ActiveDescendant() { +AXObjectImpl* AXMenuListPopup::ActiveDescendant() { if (active_index_ < 0 || active_index_ >= static_cast(Children().size())) return nullptr; diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h index 0db27902e24e96..7eaee49968094f 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h @@ -48,7 +48,7 @@ class AXMenuListPopup final : public AXMockObject { void DidUpdateActiveOption(int option_index); void DidShow(); void DidHide(); - AXObject* ActiveDescendant() final; + AXObjectImpl* ActiveDescendant() final; private: explicit AXMenuListPopup(AXObjectCacheImpl&); diff --git a/third_party/WebKit/Source/modules/accessibility/AXMockObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXMockObject.cpp index 1c46fa2c28689f..bb2adde356df0f 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMockObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMockObject.cpp @@ -30,7 +30,7 @@ namespace blink { AXMockObject::AXMockObject(AXObjectCacheImpl& ax_object_cache) - : AXObject(ax_object_cache) {} + : AXObjectImpl(ax_object_cache) {} AXMockObject::~AXMockObject() {} diff --git a/third_party/WebKit/Source/modules/accessibility/AXMockObject.h b/third_party/WebKit/Source/modules/accessibility/AXMockObject.h index e83ff1a619f2fb..29afc406deabe8 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMockObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMockObject.h @@ -27,13 +27,13 @@ #define AXMockObject_h #include "modules/ModulesExport.h" -#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXObjectImpl.h" namespace blink { class AXObjectCacheImpl; -class MODULES_EXPORT AXMockObject : public AXObject { +class MODULES_EXPORT AXMockObject : public AXObjectImpl { WTF_MAKE_NONCOPYABLE(AXMockObject); protected: @@ -42,8 +42,8 @@ class MODULES_EXPORT AXMockObject : public AXObject { public: ~AXMockObject() override; - // AXObject overrides. - AXObject* ComputeParent() const override { return parent_; } + // AXObjectImpl overrides. + AXObjectImpl* ComputeParent() const override { return parent_; } bool IsEnabled() const override { return true; } private: diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp index 8ac8fb39133b09..55b2fbcefa4cb0 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp @@ -80,7 +80,7 @@ class SparseAttributeSetter { USING_FAST_MALLOC(SparseAttributeSetter); public: - virtual void Run(const AXObject&, + virtual void Run(const AXObjectImpl&, AXSparseAttributeClient&, const AtomicString& value) = 0; }; @@ -92,7 +92,7 @@ class BoolAttributeSetter : public SparseAttributeSetter { private: AXBoolAttribute attribute_; - void Run(const AXObject& obj, + void Run(const AXObjectImpl& obj, AXSparseAttributeClient& attribute_map, const AtomicString& value) override { attribute_map.AddBoolAttribute(attribute_, @@ -107,7 +107,7 @@ class StringAttributeSetter : public SparseAttributeSetter { private: AXStringAttribute attribute_; - void Run(const AXObject& obj, + void Run(const AXObjectImpl& obj, AXSparseAttributeClient& attribute_map, const AtomicString& value) override { attribute_map.AddStringAttribute(attribute_, value); @@ -121,7 +121,7 @@ class ObjectAttributeSetter : public SparseAttributeSetter { private: AXObjectAttribute attribute_; - void Run(const AXObject& obj, + void Run(const AXObjectImpl& obj, AXSparseAttributeClient& attribute_map, const AtomicString& value) override { if (value.IsNull() || value.IsEmpty()) @@ -133,7 +133,7 @@ class ObjectAttributeSetter : public SparseAttributeSetter { Element* target = ToElement(node)->GetTreeScope().getElementById(value); if (!target) return; - AXObject* ax_target = obj.AxObjectCache().GetOrCreate(target); + AXObjectImpl* ax_target = obj.AxObjectCache().GetOrCreate(target); if (ax_target) attribute_map.AddObjectAttribute(attribute_, *ax_target); } @@ -147,7 +147,7 @@ class ObjectVectorAttributeSetter : public SparseAttributeSetter { private: AXObjectVectorAttribute attribute_; - void Run(const AXObject& obj, + void Run(const AXObjectImpl& obj, AXSparseAttributeClient& attribute_map, const AtomicString& value) override { Node* node = obj.GetNode(); @@ -164,11 +164,12 @@ class ObjectVectorAttributeSetter : public SparseAttributeSetter { if (ids.IsEmpty()) return; - HeapVector> objects; + HeapVector> objects; TreeScope& scope = node->GetTreeScope(); for (const auto& id : ids) { if (Element* id_element = scope.getElementById(AtomicString(id))) { - AXObject* ax_id_element = obj.AxObjectCache().GetOrCreate(id_element); + AXObjectImpl* ax_id_element = + obj.AxObjectCache().GetOrCreate(id_element); if (ax_id_element && !ax_id_element->AccessibilityIsIgnored()) objects.push_back(ax_id_element); } @@ -215,7 +216,7 @@ static AXSparseAttributeSetterMap& GetSparseAttributeSetterMap() { } AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& ax_object_cache) - : AXObject(ax_object_cache), + : AXObjectImpl(ax_object_cache), aria_role_(kUnknownRole), children_dirty_(false), node_(node) {} @@ -243,7 +244,7 @@ void AXNodeObject::AlterSliderValue(bool increase) { AXObjectCacheImpl::kAXValueChanged); } -AXObject* AXNodeObject::ActiveDescendant() { +AXObjectImpl* AXNodeObject::ActiveDescendant() { if (!node_ || !node_->IsElementNode()) return nullptr; @@ -258,14 +259,14 @@ AXObject* AXNodeObject::ActiveDescendant() { if (!descendant) return nullptr; - AXObject* ax_descendant = AxObjectCache().GetOrCreate(descendant); + AXObjectImpl* ax_descendant = AxObjectCache().GetOrCreate(descendant); return ax_descendant; } bool AXNodeObject::ComputeAccessibilityIsIgnored( IgnoredReasons* ignored_reasons) const { #if DCHECK_IS_ON() - // Double-check that an AXObject is never accessed before + // Double-check that an AXObjectImpl is never accessed before // it's been initialized. DCHECK(initialized_); #endif @@ -280,13 +281,13 @@ bool AXNodeObject::ComputeAccessibilityIsIgnored( } // Ignore labels that are already referenced by a control. - AXObject* control_object = CorrespondingControlForLabelElement(); + AXObjectImpl* control_object = CorrespondingControlForLabelElement(); if (control_object && control_object->IsCheckboxOrRadio() && control_object->NameFromLabelElement()) { if (ignored_reasons) { HTMLLabelElement* label = LabelElementContainer(); if (label && label != GetNode()) { - AXObject* label_ax_object = AxObjectCache().GetOrCreate(label); + AXObjectImpl* label_ax_object = AxObjectCache().GetOrCreate(label); ignored_reasons->push_back( IgnoredReason(kAXLabelContainer, label_ax_object)); } @@ -318,7 +319,7 @@ static bool IsListElement(Node* node) { isHTMLDListElement(*node); } -static bool IsPresentationalInTable(AXObject* parent, +static bool IsPresentationalInTable(AXObjectImpl* parent, HTMLElement* current_element) { if (!current_element) return false; @@ -345,7 +346,7 @@ static bool IsPresentationalInTable(AXObject* parent, IsHTMLTableSectionElement(ToHTMLElement(*parent_node))) { // Because TableSections have ignored role, presentation should be checked // with its parent node. - AXObject* table_object = parent->ParentObject(); + AXObjectImpl* table_object = parent->ParentObject(); Node* table_node = table_object ? table_object->GetNode() : 0; return isHTMLTableElement(table_node) && table_object->HasInheritedPresentationalRole(); @@ -353,7 +354,7 @@ static bool IsPresentationalInTable(AXObject* parent, return false; } -static bool IsRequiredOwnedElement(AXObject* parent, +static bool IsRequiredOwnedElement(AXObjectImpl* parent, AccessibilityRole current_role, HTMLElement* current_element) { Node* parent_node = parent->GetNode(); @@ -383,7 +384,7 @@ static bool IsRequiredOwnedElement(AXObject* parent, return false; } -const AXObject* AXNodeObject::InheritsPresentationalRoleFrom() const { +const AXObjectImpl* AXNodeObject::InheritsPresentationalRoleFrom() const { // ARIA states if an item can get focus, it should not be presentational. if (CanSetFocusAttribute()) return 0; @@ -398,7 +399,7 @@ const AXObject* AXNodeObject::InheritsPresentationalRoleFrom() const { if (AriaRoleAttribute() != kUnknownRole) return 0; - AXObject* parent = ParentObject(); + AXObjectImpl* parent = ParentObject(); if (!parent) return 0; @@ -723,13 +724,13 @@ AccessibilityRole AXNodeObject::DetermineAriaRoleAttribute() const { void AXNodeObject::AccessibilityChildrenFromAttribute( QualifiedName attr, - AXObject::AXObjectVector& children) const { + AXObjectImpl::AXObjectVector& children) const { HeapVector> elements; ElementsFromAttribute(elements, attr); AXObjectCacheImpl& cache = AxObjectCache(); for (const auto& element : elements) { - if (AXObject* child = cache.GetOrCreate(element)) { + if (AXObjectImpl* child = cache.GetOrCreate(element)) { // Only aria-labelledby and aria-describedby can target hidden elements. if (child->AccessibilityIsIgnored() && attr != aria_labelledbyAttr && attr != aria_labeledbyAttr && attr != aria_describedbyAttr) { @@ -803,13 +804,13 @@ bool AXNodeObject::IsGenericFocusableElement() const { return true; } -AXObject* AXNodeObject::MenuButtonForMenu() const { +AXObjectImpl* AXNodeObject::MenuButtonForMenu() const { Element* menu_item = MenuItemElementForMenu(); if (menu_item) { // ARIA just has generic menu items. AppKit needs to know if this is a top // level items like MenuBarButton or MenuBarItem - AXObject* menu_item_ax = AxObjectCache().GetOrCreate(menu_item); + AXObjectImpl* menu_item_ax = AxObjectCache().GetOrCreate(menu_item); if (menu_item_ax && menu_item_ax->IsMenuButton()) return menu_item_ax; } @@ -879,7 +880,7 @@ AccessibilityRole AXNodeObject::RemapAriaRoleDueToParent( if (role != kListBoxOptionRole && role != kMenuItemRole) return role; - for (AXObject* parent = ParentObject(); + for (AXObjectImpl* parent = ParentObject(); parent && !parent->AccessibilityIsIgnored(); parent = parent->ParentObject()) { AccessibilityRole parent_aria_role = parent->AriaRoleAttribute(); @@ -911,7 +912,7 @@ void AXNodeObject::Init() { } void AXNodeObject::Detach() { - AXObject::Detach(); + AXObjectImpl::Detach(); node_ = nullptr; } @@ -959,7 +960,7 @@ bool AXNodeObject::IsControl() const { return false; return ((node->IsElementNode() && ToElement(node)->IsFormControlElement()) || - AXObject::IsARIAControl(AriaRoleAttribute())); + AXObjectImpl::IsARIAControl(AriaRoleAttribute())); } bool AXNodeObject::IsControllingVideoElement() const { @@ -1160,7 +1161,7 @@ bool AXNodeObject::IsClickable() const { return true; } - return AXObject::IsClickable(); + return AXObjectImpl::IsClickable(); } bool AXNodeObject::IsEnabled() const { @@ -1303,7 +1304,7 @@ bool AXNodeObject::CanSetSelectedAttribute() const { if (AriaRoleAttribute() == kListBoxOptionRole && AncestorExposesActiveDescendant()) return true; - return AXObject::CanSetSelectedAttribute(); + return AXObjectImpl::CanSetSelectedAttribute(); } bool AXNodeObject::CanvasHasFallbackContent() const { @@ -1379,7 +1380,7 @@ unsigned AXNodeObject::HierarchicalLevel() const { // Hierarchy leveling starts at 1, to match the aria-level spec. // We measure tree hierarchy by the number of groups that the item is within. unsigned level = 1; - for (AXObject* parent = ParentObject(); parent; + for (AXObjectImpl* parent = ParentObject(); parent; parent = parent->ParentObject()) { AccessibilityRole parent_role = parent->RoleValue(); if (parent_role == kGroupRole) @@ -1430,29 +1431,29 @@ void AXNodeObject::Markers(Vector& marker_types, } } -AXObject* AXNodeObject::InPageLinkTarget() const { +AXObjectImpl* AXNodeObject::InPageLinkTarget() const { if (!node_ || !isHTMLAnchorElement(node_) || !GetDocument()) - return AXObject::InPageLinkTarget(); + return AXObjectImpl::InPageLinkTarget(); HTMLAnchorElement* anchor = toHTMLAnchorElement(node_); DCHECK(anchor); KURL link_url = anchor->Href(); if (!link_url.IsValid()) - return AXObject::InPageLinkTarget(); + return AXObjectImpl::InPageLinkTarget(); String fragment = link_url.FragmentIdentifier(); if (fragment.IsEmpty()) - return AXObject::InPageLinkTarget(); + return AXObjectImpl::InPageLinkTarget(); KURL document_url = GetDocument()->Url(); if (!document_url.IsValid() || !EqualIgnoringFragmentIdentifier(document_url, link_url)) { - return AXObject::InPageLinkTarget(); + return AXObjectImpl::InPageLinkTarget(); } TreeScope& tree_scope = anchor->GetTreeScope(); Element* target = tree_scope.FindAnchor(fragment); if (!target) - return AXObject::InPageLinkTarget(); + return AXObjectImpl::InPageLinkTarget(); // If the target is not in the accessibility tree, get the first unignored // sibling. return AxObjectCache().FirstAccessibleObjectFromNode(target); @@ -1490,11 +1491,11 @@ AccessibilityOrientation AXNodeObject::Orientation() const { case kTreeGridRole: return orientation; default: - return AXObject::Orientation(); + return AXObjectImpl::Orientation(); } } -AXObject::AXObjectVector AXNodeObject::RadioButtonsInGroup() const { +AXObjectImpl::AXObjectVector AXNodeObject::RadioButtonsInGroup() const { AXObjectVector radio_buttons; if (!node_ || RoleValue() != kRadioButtonRole) return radio_buttons; @@ -1504,7 +1505,7 @@ AXObject::AXObjectVector AXNodeObject::RadioButtonsInGroup() const { HeapVector> html_radio_buttons = FindAllRadioButtonsWithSameName(radio_button); for (size_t i = 0; i < html_radio_buttons.size(); ++i) { - AXObject* ax_radio_button = + AXObjectImpl* ax_radio_button = AxObjectCache().GetOrCreate(html_radio_buttons[i]); if (ax_radio_button) radio_buttons.push_back(ax_radio_button); @@ -1514,10 +1515,10 @@ AXObject::AXObjectVector AXNodeObject::RadioButtonsInGroup() const { // If the immediate parent is a radio group, return all its children that are // radio buttons. - AXObject* parent = ParentObject(); + AXObjectImpl* parent = ParentObject(); if (parent && parent->RoleValue() == kRadioGroupRole) { for (size_t i = 0; i < parent->Children().size(); ++i) { - AXObject* child = parent->Children()[i]; + AXObjectImpl* child = parent->Children()[i]; DCHECK(child); if (child->RoleValue() == kRadioButtonRole && !child->AccessibilityIsIgnored()) { @@ -1579,12 +1580,12 @@ String AXNodeObject::GetText() const { RGBA32 AXNodeObject::ColorValue() const { if (!isHTMLInputElement(GetNode()) || !IsColorWell()) - return AXObject::ColorValue(); + return AXObjectImpl::ColorValue(); HTMLInputElement* input = toHTMLInputElement(GetNode()); const AtomicString& type = input->getAttribute(typeAttr); if (!EqualIgnoringASCIICase(type, "color")) - return AXObject::ColorValue(); + return AXObjectImpl::ColorValue(); // HTMLInputElement::value always returns a string parseable by Color. Color color; @@ -1617,7 +1618,7 @@ AriaCurrentState AXNodeObject::GetAriaCurrentState() const { if (!attribute_value.IsEmpty()) return kAriaCurrentStateTrue; - return AXObject::GetAriaCurrentState(); + return AXObjectImpl::GetAriaCurrentState(); } InvalidState AXNodeObject::GetInvalidState() const { @@ -1644,7 +1645,7 @@ InvalidState AXNodeObject::GetInvalidState() const { return is_invalid ? kInvalidStateTrue : kInvalidStateFalse; } - return AXObject::GetInvalidState(); + return AXObjectImpl::GetInvalidState(); } int AXNodeObject::PosInSet() const { @@ -1657,7 +1658,7 @@ int AXNodeObject::PosInSet() const { return 1; } - return AXObject::IndexInParent() + 1; + return AXObjectImpl::IndexInParent() + 1; } return 0; @@ -1936,20 +1937,20 @@ String AXNodeObject::TextFromDescendants(AXObjectSet& visited, return String(); StringBuilder accumulated_text; - AXObject* previous = nullptr; + AXObjectImpl* previous = nullptr; AXObjectVector children; - HeapVector> owned_children; + HeapVector> owned_children; ComputeAriaOwnsChildren(owned_children); - for (AXObject* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { + for (AXObjectImpl* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { if (!AxObjectCache().IsAriaOwned(obj)) children.push_back(obj); } for (const auto& owned_child : owned_children) children.push_back(owned_child); - for (AXObject* child : children) { + for (AXObjectImpl* child : children) { // Don't recurse into children that are explicitly marked as aria-hidden. // Note that we don't call isInertOrAriaHidden because that would return // true if any ancestor is hidden, but we need to be able to compute the @@ -2026,23 +2027,23 @@ bool AXNodeObject::NameFromLabelElement() const { bool AXNodeObject::NameFromContents() const { Node* node = GetNode(); if (!node || !node->IsElementNode()) - return AXObject::NameFromContents(); - // AXObject::nameFromContents determines whether an element should take its - // name from its descendant contents based on role. However, is a // special case, as unlike a typical pop-up button it contains its own pop-up // menu's contents, which should not be used as the name. if (isHTMLSelectElement(node)) return false; - return AXObject::NameFromContents(); + return AXObjectImpl::NameFromContents(); } void AXNodeObject::GetRelativeBounds( - AXObject** out_container, + AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const { if (LayoutObjectForRelativeBounds()) { - AXObject::GetRelativeBounds(out_container, out_bounds_in_container, - out_container_transform); + AXObjectImpl::GetRelativeBounds(out_container, out_bounds_in_container, + out_container_transform); return; } @@ -2068,8 +2069,8 @@ void AXNodeObject::GetRelativeBounds( Vector rects; for (Node& child : NodeTraversal::ChildrenOf(*GetNode())) { if (child.IsHTMLElement()) { - if (AXObject* obj = AxObjectCache().Get(&child)) { - AXObject* container; + if (AXObjectImpl* obj = AxObjectCache().Get(&child)) { + AXObjectImpl* container; FloatRect bounds; obj->GetRelativeBounds(&container, bounds, out_container_transform); if (container) { @@ -2090,7 +2091,7 @@ void AXNodeObject::GetRelativeBounds( // children, for now, let's return the position of the ancestor that does have // a position, and make it the width of that parent, and about the height of a // line of text, so that it's clear the object is a child of the parent. - for (AXObject* position_provider = ParentObject(); position_provider; + for (AXObjectImpl* position_provider = ParentObject(); position_provider; position_provider = position_provider->ParentObject()) { if (position_provider->IsAXLayoutObject()) { position_provider->GetRelativeBounds( @@ -2121,7 +2122,7 @@ static Node* GetParentNodeForComputeParent(Node* node) { return parent_node; } -AXObject* AXNodeObject::ComputeParent() const { +AXObjectImpl* AXNodeObject::ComputeParent() const { DCHECK(!IsDetached()); if (Node* parent_node = GetParentNodeForComputeParent(GetNode())) return AxObjectCache().GetOrCreate(parent_node); @@ -2129,14 +2130,14 @@ AXObject* AXNodeObject::ComputeParent() const { return nullptr; } -AXObject* AXNodeObject::ComputeParentIfExists() const { +AXObjectImpl* AXNodeObject::ComputeParentIfExists() const { if (Node* parent_node = GetParentNodeForComputeParent(GetNode())) return AxObjectCache().Get(parent_node); return nullptr; } -AXObject* AXNodeObject::RawFirstChild() const { +AXObjectImpl* AXNodeObject::RawFirstChild() const { if (!GetNode()) return 0; @@ -2148,7 +2149,7 @@ AXObject* AXNodeObject::RawFirstChild() const { return AxObjectCache().GetOrCreate(first_child); } -AXObject* AXNodeObject::RawNextSibling() const { +AXObjectImpl* AXNodeObject::RawNextSibling() const { if (!GetNode()) return 0; @@ -2176,11 +2177,11 @@ void AXNodeObject::AddChildren() { if (GetLayoutObject() && !isHTMLCanvasElement(*node_)) return; - HeapVector> owned_children; + HeapVector> owned_children; ComputeAriaOwnsChildren(owned_children); for (Node& child : NodeTraversal::ChildrenOf(*node_)) { - AXObject* child_obj = AxObjectCache().GetOrCreate(&child); + AXObjectImpl* child_obj = AxObjectCache().GetOrCreate(&child); if (child_obj && !AxObjectCache().IsAriaOwned(child_obj)) AddChild(child_obj); } @@ -2192,11 +2193,11 @@ void AXNodeObject::AddChildren() { child->SetParent(this); } -void AXNodeObject::AddChild(AXObject* child) { +void AXNodeObject::AddChild(AXObjectImpl* child) { InsertChild(child, children_.size()); } -void AXNodeObject::InsertChild(AXObject* child, unsigned index) { +void AXNodeObject::InsertChild(AXObjectImpl* child, unsigned index) { if (!child) return; @@ -2272,7 +2273,7 @@ Element* AXNodeObject::ActionElement() const { return ToElement(node); } - if (AXObject::IsARIAInput(AriaRoleAttribute())) + if (AXObjectImpl::IsARIAInput(AriaRoleAttribute())) return ToElement(node); if (IsImageButton()) @@ -2331,7 +2332,7 @@ void AXNodeObject::SetNode(Node* node) { node_ = node; } -AXObject* AXNodeObject::CorrespondingControlForLabelElement() const { +AXObjectImpl* AXNodeObject::CorrespondingControlForLabelElement() const { HTMLLabelElement* label_element = LabelElementContainer(); if (!label_element) return 0; @@ -2430,7 +2431,7 @@ void AXNodeObject::ChildrenChanged() { // If AX elements are created now, they could interrogate the layout tree // while it's in a funky state. At the same time, process ARIA live region // changes. - for (AXObject* parent = this; parent; + for (AXObjectImpl* parent = this; parent; parent = parent->ParentObjectIfExists()) { parent->SetNeedsToUpdateChildren(); @@ -2462,12 +2463,13 @@ void AXNodeObject::SelectionChanged() { AxObjectCache().PostNotification(this, AXObjectCacheImpl::kAXSelectedTextChanged); if (GetDocument()) { - AXObject* document_object = AxObjectCache().GetOrCreate(GetDocument()); + AXObjectImpl* document_object = + AxObjectCache().GetOrCreate(GetDocument()); AxObjectCache().PostNotification( document_object, AXObjectCacheImpl::kAXDocumentSelectionChanged); } } else { - AXObject::SelectionChanged(); // Calls selectionChanged on parent. + AXObjectImpl::SelectionChanged(); // Calls selectionChanged on parent. } } @@ -2477,7 +2479,7 @@ void AXNodeObject::TextChanged() { AXObjectCacheImpl& cache = AxObjectCache(); for (Node* parent_node = GetNode(); parent_node; parent_node = parent_node->parentNode()) { - AXObject* parent = cache.Get(parent_node); + AXObjectImpl* parent = cache.Get(parent_node); if (!parent) continue; @@ -2504,7 +2506,7 @@ void AXNodeObject::UpdateAccessibilityRole() { } void AXNodeObject::ComputeAriaOwnsChildren( - HeapVector>& owned_children) const { + HeapVector>& owned_children) const { if (!HasAttribute(aria_ownsAttr)) return; @@ -2756,7 +2758,8 @@ String AXNodeObject::NativeTextAlternative( } } if (figcaption) { - AXObject* figcaption_ax_object = AxObjectCache().GetOrCreate(figcaption); + AXObjectImpl* figcaption_ax_object = + AxObjectCache().GetOrCreate(figcaption); if (figcaption_ax_object) { text_alternative = RecursiveTextAlternative(*figcaption_ax_object, false, visited); @@ -2820,7 +2823,7 @@ String AXNodeObject::NativeTextAlternative( } HTMLTableCaptionElement* caption = table_element->caption(); if (caption) { - AXObject* caption_ax_object = AxObjectCache().GetOrCreate(caption); + AXObjectImpl* caption_ax_object = AxObjectCache().GetOrCreate(caption); if (caption_ax_object) { text_alternative = RecursiveTextAlternative(*caption_ax_object, false, visited); @@ -2877,7 +2880,7 @@ String AXNodeObject::NativeTextAlternative( ToContainerNode(*(GetNode())), HasTagName(SVGNames::titleTag)); if (title) { - AXObject* title_ax_object = AxObjectCache().GetOrCreate(title); + AXObjectImpl* title_ax_object = AxObjectCache().GetOrCreate(title); if (title_ax_object && !visited.Contains(title_ax_object)) { text_alternative = RecursiveTextAlternative(*title_ax_object, false, visited); @@ -2909,7 +2912,7 @@ String AXNodeObject::NativeTextAlternative( } HTMLElement* legend = toHTMLFieldSetElement(GetNode())->Legend(); if (legend) { - AXObject* legend_ax_object = AxObjectCache().GetOrCreate(legend); + AXObjectImpl* legend_ax_object = AxObjectCache().GetOrCreate(legend); // Avoid an infinite loop if (legend_ax_object && !visited.Contains(legend_ax_object)) { text_alternative = @@ -2971,7 +2974,8 @@ String AXNodeObject::NativeTextAlternative( text_alternative = document->title(); Element* title_element = document->TitleElement(); - AXObject* title_ax_object = AxObjectCache().GetOrCreate(title_element); + AXObjectImpl* title_ax_object = + AxObjectCache().GetOrCreate(title_element); if (title_ax_object) { if (related_objects) { local_related_objects.push_back( @@ -3098,7 +3102,7 @@ String AXNodeObject::Description(AXNameFrom name_from, } HTMLTableCaptionElement* caption = table_element->caption(); if (caption) { - AXObject* caption_ax_object = AxObjectCache().GetOrCreate(caption); + AXObjectImpl* caption_ax_object = AxObjectCache().GetOrCreate(caption); if (caption_ax_object) { AXObjectSet visited; description = @@ -3229,7 +3233,7 @@ String AXNodeObject::PlaceholderFromNativeAttribute() const { DEFINE_TRACE(AXNodeObject) { visitor->Trace(node_); - AXObject::Trace(visitor); + AXObjectImpl::Trace(visitor); } } // namespace blink diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h index 3a27ceecf3c364..8ecc92e9e52a10 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h @@ -30,7 +30,7 @@ #define AXNodeObject_h #include "modules/ModulesExport.h" -#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXObjectImpl.h" #include "platform/wtf/Forward.h" namespace blink { @@ -40,7 +40,7 @@ class Element; class HTMLLabelElement; class Node; -class MODULES_EXPORT AXNodeObject : public AXObject { +class MODULES_EXPORT AXNodeObject : public AXObjectImpl { WTF_MAKE_NONCOPYABLE(AXNodeObject); protected: @@ -60,35 +60,35 @@ class MODULES_EXPORT AXNodeObject : public AXObject { #endif bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const override; - const AXObject* InheritsPresentationalRoleFrom() const override; + const AXObjectImpl* InheritsPresentationalRoleFrom() const override; virtual AccessibilityRole DetermineAccessibilityRole(); virtual AccessibilityRole NativeAccessibilityRoleIgnoringAria() const; String AccessibilityDescriptionForElements( HeapVector>& elements) const; void AlterSliderValue(bool increase); - AXObject* ActiveDescendant() override; + AXObjectImpl* ActiveDescendant() override; String AriaAccessibilityDescription() const; String AriaAutoComplete() const; AccessibilityRole DetermineAriaRoleAttribute() const; void AccessibilityChildrenFromAttribute(QualifiedName attr, - AXObject::AXObjectVector&) const; + AXObjectImpl::AXObjectVector&) const; bool HasContentEditableAttributeSet() const; bool IsTextControl() const override; // This returns true if it's focusable but it's not content editable and it's // not a control or ARIA control. bool IsGenericFocusableElement() const; - AXObject* MenuButtonForMenu() const; + AXObjectImpl* MenuButtonForMenu() const; Element* MenuItemElementForMenu() const; Element* MouseButtonListener() const; AccessibilityRole RemapAriaRoleDueToParent(AccessibilityRole) const; bool IsNativeCheckboxOrRadio() const; void SetNode(Node*); - AXObject* CorrespondingControlForLabelElement() const; + AXObjectImpl* CorrespondingControlForLabelElement() const; HTMLLabelElement* LabelElementContainer() const; // - // Overridden from AXObject. + // Overridden from AXObjectImpl. // void Init() override; @@ -146,7 +146,7 @@ class MODULES_EXPORT AXNodeObject : public AXObject { unsigned HierarchicalLevel() const final; void Markers(Vector&, Vector&) const override; - AXObject* InPageLinkTarget() const override; + AXObjectImpl* InPageLinkTarget() const override; AccessibilityOrientation Orientation() const override; AXObjectVector RadioButtonsInGroup() const override; static HeapVector> FindAllRadioButtonsWithSameName( @@ -186,21 +186,21 @@ class MODULES_EXPORT AXNodeObject : public AXObject { bool NameFromContents() const override; // Location - void GetRelativeBounds(AXObject** out_container, + void GetRelativeBounds(AXObjectImpl** out_container, FloatRect& out_bounds_in_container, SkMatrix44& out_container_transform) const override; // High-level accessibility tree access. - AXObject* ComputeParent() const override; - AXObject* ComputeParentIfExists() const override; + AXObjectImpl* ComputeParent() const override; + AXObjectImpl* ComputeParentIfExists() const override; // Low-level accessibility tree exploration. - AXObject* RawFirstChild() const override; - AXObject* RawNextSibling() const override; + AXObjectImpl* RawFirstChild() const override; + AXObjectImpl* RawNextSibling() const override; void AddChildren() override; bool CanHaveChildren() const override; - void AddChild(AXObject*); - void InsertChild(AXObject*, unsigned index); + void AddChild(AXObjectImpl*); + void InsertChild(AXObjectImpl*, unsigned index); // DOM and Render tree access. Element* ActionElement() const override; @@ -226,7 +226,7 @@ class MODULES_EXPORT AXNodeObject : public AXObject { // Aria-owns. void ComputeAriaOwnsChildren( - HeapVector>& owned_children) const; + HeapVector>& owned_children) const; private: Member node_; diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp index 4f14f3e06d7d08..35846b08e61e13 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp @@ -109,7 +109,7 @@ void AXObjectCacheImpl::Dispose() { notification_post_timer_.Stop(); for (auto& entry : objects_) { - AXObject* obj = entry.value; + AXObjectImpl* obj = entry.value; obj->Detach(); RemoveAXID(obj); } @@ -119,11 +119,11 @@ void AXObjectCacheImpl::Dispose() { #endif } -AXObject* AXObjectCacheImpl::Root() { +AXObjectImpl* AXObjectCacheImpl::Root() { return GetOrCreate(document_); } -AXObject* AXObjectCacheImpl::FocusedImageMapUIElement( +AXObjectImpl* AXObjectCacheImpl::FocusedImageMapUIElement( HTMLAreaElement* area_element) { // Find the corresponding accessibility object for the HTMLAreaElement. This // should be in the list of children for its corresponding image. @@ -134,14 +134,15 @@ AXObject* AXObjectCacheImpl::FocusedImageMapUIElement( if (!image_element) return 0; - AXObject* ax_layout_image = GetOrCreate(image_element); + AXObjectImpl* ax_layout_image = GetOrCreate(image_element); if (!ax_layout_image) return 0; - const AXObject::AXObjectVector& image_children = ax_layout_image->Children(); + const AXObjectImpl::AXObjectVector& image_children = + ax_layout_image->Children(); unsigned count = image_children.size(); for (unsigned k = 0; k < count; ++k) { - AXObject* child = image_children[k]; + AXObjectImpl* child = image_children[k]; if (!child->IsImageMapLink()) continue; @@ -152,7 +153,7 @@ AXObject* AXObjectCacheImpl::FocusedImageMapUIElement( return 0; } -AXObject* AXObjectCacheImpl::FocusedObject() { +AXObjectImpl* AXObjectCacheImpl::FocusedObject() { if (!AccessibilityEnabled()) return nullptr; @@ -167,7 +168,7 @@ AXObject* AXObjectCacheImpl::FocusedObject() { // See if there's a page popup, for example a calendar picker. Element* adjusted_focused_element = document_->AdjustedFocusedElement(); if (isHTMLInputElement(adjusted_focused_element)) { - if (AXObject* ax_popup = + if (AXObjectImpl* ax_popup = toHTMLInputElement(adjusted_focused_element)->PopupRootAXObject()) { if (Element* focused_element_in_popup = ax_popup->GetDocument()->FocusedElement()) @@ -175,7 +176,7 @@ AXObject* AXObjectCacheImpl::FocusedObject() { } } - AXObject* obj = GetOrCreate(focused_node); + AXObjectImpl* obj = GetOrCreate(focused_node); if (!obj) return nullptr; @@ -187,7 +188,7 @@ AXObject* AXObjectCacheImpl::FocusedObject() { return obj; } -AXObject* AXObjectCacheImpl::Get(LayoutObject* layout_object) { +AXObjectImpl* AXObjectCacheImpl::Get(LayoutObject* layout_object) { if (!layout_object) return 0; @@ -211,7 +212,7 @@ static bool IsMenuListOption(Node* node) { return layout_object && layout_object->IsMenuList(); } -AXObject* AXObjectCacheImpl::Get(Node* node) { +AXObjectImpl* AXObjectCacheImpl::Get(Node* node) { if (!node) return 0; @@ -244,7 +245,7 @@ AXObject* AXObjectCacheImpl::Get(Node* node) { return objects_.at(node_id); } -AXObject* AXObjectCacheImpl::Get(AbstractInlineTextBox* inline_text_box) { +AXObjectImpl* AXObjectCacheImpl::Get(AbstractInlineTextBox* inline_text_box) { if (!inline_text_box) return 0; @@ -265,7 +266,8 @@ bool NodeHasRole(Node* node, const String& role) { return EqualIgnoringASCIICase(ToElement(node)->getAttribute(roleAttr), role); } -AXObject* AXObjectCacheImpl::CreateFromRenderer(LayoutObject* layout_object) { +AXObjectImpl* AXObjectCacheImpl::CreateFromRenderer( + LayoutObject* layout_object) { // FIXME: How could layoutObject->node() ever not be an Element? Node* node = layout_object->GetNode(); @@ -327,7 +329,7 @@ AXObject* AXObjectCacheImpl::CreateFromRenderer(LayoutObject* layout_object) { return AXLayoutObject::Create(layout_object, *this); } -AXObject* AXObjectCacheImpl::CreateFromNode(Node* node) { +AXObjectImpl* AXObjectCacheImpl::CreateFromNode(Node* node) { if (IsMenuListOption(node)) return AXMenuListOption::Create(toHTMLOptionElement(node), *this); @@ -337,21 +339,21 @@ AXObject* AXObjectCacheImpl::CreateFromNode(Node* node) { return AXNodeObject::Create(node, *this); } -AXObject* AXObjectCacheImpl::CreateFromInlineTextBox( +AXObjectImpl* AXObjectCacheImpl::CreateFromInlineTextBox( AbstractInlineTextBox* inline_text_box) { return AXInlineTextBox::Create(inline_text_box, *this); } -AXObject* AXObjectCacheImpl::GetOrCreate(Node* node) { +AXObjectImpl* AXObjectCacheImpl::GetOrCreate(Node* node) { if (!node) return 0; - if (AXObject* obj = Get(node)) + if (AXObjectImpl* obj = Get(node)) return obj; // If the node has a layout object, prefer using that as the primary key for - // the AXObject, with the exception of an HTMLAreaElement, which is created - // based on its node. + // the AXObjectImpl, with the exception of an HTMLAreaElement, which is + // created based on its node. if (node->GetLayoutObject() && !isHTMLAreaElement(node)) return GetOrCreate(node->GetLayoutObject()); @@ -361,7 +363,7 @@ AXObject* AXObjectCacheImpl::GetOrCreate(Node* node) { if (isHTMLHeadElement(node)) return 0; - AXObject* new_obj = CreateFromNode(node); + AXObjectImpl* new_obj = CreateFromNode(node); // Will crash later if we have two objects for the same node. DCHECK(!Get(node)); @@ -378,14 +380,14 @@ AXObject* AXObjectCacheImpl::GetOrCreate(Node* node) { return new_obj; } -AXObject* AXObjectCacheImpl::GetOrCreate(LayoutObject* layout_object) { +AXObjectImpl* AXObjectCacheImpl::GetOrCreate(LayoutObject* layout_object) { if (!layout_object) return 0; - if (AXObject* obj = Get(layout_object)) + if (AXObjectImpl* obj = Get(layout_object)) return obj; - AXObject* new_obj = CreateFromRenderer(layout_object); + AXObjectImpl* new_obj = CreateFromRenderer(layout_object); // Will crash later if we have two objects for the same layoutObject. DCHECK(!Get(layout_object)); @@ -399,15 +401,15 @@ AXObject* AXObjectCacheImpl::GetOrCreate(LayoutObject* layout_object) { return new_obj; } -AXObject* AXObjectCacheImpl::GetOrCreate( +AXObjectImpl* AXObjectCacheImpl::GetOrCreate( AbstractInlineTextBox* inline_text_box) { if (!inline_text_box) return 0; - if (AXObject* obj = Get(inline_text_box)) + if (AXObjectImpl* obj = Get(inline_text_box)) return obj; - AXObject* new_obj = CreateFromInlineTextBox(inline_text_box); + AXObjectImpl* new_obj = CreateFromInlineTextBox(inline_text_box); // Will crash later if we have two objects for the same inlineTextBox. DCHECK(!Get(inline_text_box)); @@ -421,8 +423,8 @@ AXObject* AXObjectCacheImpl::GetOrCreate( return new_obj; } -AXObject* AXObjectCacheImpl::GetOrCreate(AccessibilityRole role) { - AXObject* obj = nullptr; +AXObjectImpl* AXObjectCacheImpl::GetOrCreate(AccessibilityRole role) { + AXObjectImpl* obj = nullptr; // will be filled in... switch (role) { @@ -462,7 +464,7 @@ void AXObjectCacheImpl::Remove(AXID ax_id) { return; // first fetch object to operate some cleanup functions on it - AXObject* obj = objects_.at(ax_id); + AXObjectImpl* obj = objects_.at(ax_id); if (!obj) return; @@ -524,7 +526,7 @@ AXID AXObjectCacheImpl::GenerateAXID() const { return obj_id; } -AXID AXObjectCacheImpl::GetOrCreateAXID(AXObject* obj) { +AXID AXObjectCacheImpl::GetOrCreateAXID(AXObjectImpl* obj) { // check for already-assigned ID const AXID existing_axid = obj->AxObjectID(); if (existing_axid) { @@ -541,7 +543,7 @@ AXID AXObjectCacheImpl::GetOrCreateAXID(AXObject* obj) { return new_axid; } -void AXObjectCacheImpl::RemoveAXID(AXObject* object) { +void AXObjectCacheImpl::RemoveAXID(AXObjectImpl* object) { if (!object) return; @@ -568,7 +570,7 @@ void AXObjectCacheImpl::SelectionChanged(Node* node) { // Find the nearest ancestor that already has an accessibility object, since // we might be in the middle of a layout. while (node) { - if (AXObject* obj = Get(node)) { + if (AXObjectImpl* obj = Get(node)) { obj->SelectionChanged(); return; } @@ -584,7 +586,7 @@ void AXObjectCacheImpl::TextChanged(LayoutObject* layout_object) { TextChanged(GetOrCreate(layout_object)); } -void AXObjectCacheImpl::TextChanged(AXObject* obj) { +void AXObjectCacheImpl::TextChanged(AXObjectImpl* obj) { if (!obj) return; @@ -612,7 +614,7 @@ void AXObjectCacheImpl::ChildrenChanged(LayoutObject* layout_object) { ChildrenChanged(Get(layout_object)); } -void AXObjectCacheImpl::ChildrenChanged(AXObject* obj) { +void AXObjectCacheImpl::ChildrenChanged(AXObjectImpl* obj) { if (!obj) return; @@ -624,7 +626,7 @@ void AXObjectCacheImpl::NotificationPostTimerFired(TimerBase*) { unsigned i = 0, count = notifications_to_post_.size(); for (i = 0; i < count; ++i) { - AXObject* obj = notifications_to_post_[i].first; + AXObjectImpl* obj = notifications_to_post_[i].first; if (!obj->AxObjectID()) continue; @@ -668,7 +670,7 @@ void AXObjectCacheImpl::PostNotification(Node* node, PostNotification(Get(node), notification); } -void AXObjectCacheImpl::PostNotification(AXObject* object, +void AXObjectCacheImpl::PostNotification(AXObjectImpl* object, AXNotification notification) { if (!object) return; @@ -679,19 +681,20 @@ void AXObjectCacheImpl::PostNotification(AXObject* object, notification_post_timer_.StartOneShot(0, BLINK_FROM_HERE); } -bool AXObjectCacheImpl::IsAriaOwned(const AXObject* child) const { +bool AXObjectCacheImpl::IsAriaOwned(const AXObjectImpl* child) const { return aria_owned_child_to_owner_mapping_.Contains(child->AxObjectID()); } -AXObject* AXObjectCacheImpl::GetAriaOwnedParent(const AXObject* child) const { +AXObjectImpl* AXObjectCacheImpl::GetAriaOwnedParent( + const AXObjectImpl* child) const { return ObjectFromAXID( aria_owned_child_to_owner_mapping_.at(child->AxObjectID())); } void AXObjectCacheImpl::UpdateAriaOwns( - const AXObject* owner, + const AXObjectImpl* owner, const Vector& id_vector, - HeapVector>& owned_children) { + HeapVector>& owned_children) { // // Update the map from the AXID of this element to the ids of the owned // children, and the reverse map from ids to possible AXID owners. @@ -741,7 +744,7 @@ void AXObjectCacheImpl::UpdateAriaOwns( if (!element) continue; - AXObject* child = GetOrCreate(element); + AXObjectImpl* child = GetOrCreate(element); if (!child) continue; @@ -759,7 +762,7 @@ void AXObjectCacheImpl::UpdateAriaOwns( // Walk up the parents of the owner object, make sure that this child // doesn't appear there, as that would create a cycle. bool found_cycle = false; - for (AXObject* parent = owner->ParentObject(); parent && !found_cycle; + for (AXObjectImpl* parent = owner->ParentObject(); parent && !found_cycle; parent = parent->ParentObject()) { if (parent == child) found_cycle = true; @@ -791,9 +794,9 @@ void AXObjectCacheImpl::UpdateAriaOwns( // to be safe and handle all cases we remove all of the current owned children // and add the new list of owned children. for (size_t i = 0; i < current_child_axi_ds.size(); ++i) { - // Find the AXObject for the child that this owner no longer owns. + // Find the AXObjectImpl for the child that this owner no longer owns. AXID removed_child_id = current_child_axi_ds[i]; - AXObject* removed_child = ObjectFromAXID(removed_child_id); + AXObjectImpl* removed_child = ObjectFromAXID(removed_child_id); // It's possible that this child has already been owned by some other owner, // in which case we don't need to do anything. @@ -811,7 +814,7 @@ void AXObjectCacheImpl::UpdateAriaOwns( removed_child->DetachFromParent(); AXID real_parent_id = aria_owned_child_to_real_parent_mapping_.at(removed_child_id); - AXObject* real_parent = ObjectFromAXID(real_parent_id); + AXObjectImpl* real_parent = ObjectFromAXID(real_parent_id); ChildrenChanged(real_parent); } @@ -821,9 +824,10 @@ void AXObjectCacheImpl::UpdateAriaOwns( } for (size_t i = 0; i < new_child_axi_ds.size(); ++i) { - // Find the AXObject for the child that will now be a child of this owner. + // Find the AXObjectImpl for the child that will now be a child of this + // owner. AXID added_child_id = new_child_axi_ds[i]; - AXObject* added_child = ObjectFromAXID(added_child_id); + AXObjectImpl* added_child = ObjectFromAXID(added_child_id); // Add this child to the mapping from child to owner. aria_owned_child_to_owner_mapping_.Set(added_child_id, owner->AxObjectID()); @@ -831,7 +835,7 @@ void AXObjectCacheImpl::UpdateAriaOwns( // Add its parent object to a mapping from child to real parent. If later // this owner doesn't own this child anymore, we need to return it to its // original parent. - AXObject* original_parent = added_child->ParentObject(); + AXObjectImpl* original_parent = added_child->ParentObject(); aria_owned_child_to_real_parent_mapping_.Set(added_child_id, original_parent->AxObjectID()); @@ -854,14 +858,14 @@ void AXObjectCacheImpl::UpdateTreeIfElementIdIsAriaOwned(Element* element) { if (!owners) return; - AXObject* ax_element = GetOrCreate(element); + AXObjectImpl* ax_element = GetOrCreate(element); if (!ax_element) return; // If it's already owned, call childrenChanged on the owner to make sure it's // still an owner. if (IsAriaOwned(ax_element)) { - AXObject* owned_parent = GetAriaOwnedParent(ax_element); + AXObjectImpl* owned_parent = GetAriaOwnedParent(ax_element); DCHECK(owned_parent); ChildrenChanged(owned_parent); return; @@ -870,7 +874,7 @@ void AXObjectCacheImpl::UpdateTreeIfElementIdIsAriaOwned(Element* element) { // If it's not already owned, check the possible owners based on our mapping // from ids to elements that have that id listed in their aria-owns attribute. for (const auto& ax_id : *owners) { - AXObject* owner = ObjectFromAXID(ax_id); + AXObjectImpl* owner = ObjectFromAXID(ax_id); if (owner) ChildrenChanged(owner); } @@ -890,7 +894,7 @@ void AXObjectCacheImpl::ListboxSelectedChildrenChanged( } void AXObjectCacheImpl::ListboxActiveIndexChanged(HTMLSelectElement* select) { - AXObject* obj = Get(select); + AXObjectImpl* obj = Get(select); if (!obj || !obj->IsAXListBox()) return; @@ -899,7 +903,7 @@ void AXObjectCacheImpl::ListboxActiveIndexChanged(HTMLSelectElement* select) { void AXObjectCacheImpl::RadiobuttonRemovedFromGroup( HTMLInputElement* group_member) { - AXObject* obj = Get(group_member); + AXObjectImpl* obj = Get(group_member); if (!obj || !obj->IsAXRadioInput()) return; @@ -907,7 +911,7 @@ void AXObjectCacheImpl::RadiobuttonRemovedFromGroup( // node, as the removed node is already detached from tree. HTMLInputElement* first_radio = ToAXRadioInput(obj)->FindFirstRadioButtonInGroup(group_member); - AXObject* first_obj = Get(first_radio); + AXObjectImpl* first_obj = Get(first_radio); if (!first_obj || !first_obj->IsAXRadioInput()) return; @@ -922,31 +926,31 @@ void AXObjectCacheImpl::HandleLayoutComplete(LayoutObject* layout_object) { modification_count_++; - // Create the AXObject if it didn't yet exist - that's always safe at the end - // of a layout, and it allows an AX notification to be sent when a page has - // its first layout, rather than when the document first loads. - if (AXObject* obj = GetOrCreate(layout_object)) + // Create the AXObjectImpl if it didn't yet exist - that's always safe at the + // end of a layout, and it allows an AX notification to be sent when a page + // has its first layout, rather than when the document first loads. + if (AXObjectImpl* obj = GetOrCreate(layout_object)) PostNotification(obj, kAXLayoutComplete); } void AXObjectCacheImpl::HandleClicked(Node* node) { - if (AXObject* obj = GetOrCreate(node)) + if (AXObjectImpl* obj = GetOrCreate(node)) PostNotification(obj, kAXClicked); } void AXObjectCacheImpl::HandleAriaExpandedChange(Node* node) { - if (AXObject* obj = GetOrCreate(node)) + if (AXObjectImpl* obj = GetOrCreate(node)) obj->HandleAriaExpandedChanged(); } void AXObjectCacheImpl::HandleAriaSelectedChanged(Node* node) { - AXObject* obj = Get(node); + AXObjectImpl* obj = Get(node); if (!obj) return; PostNotification(obj, kAXCheckedStateChanged); - AXObject* listbox = obj->ParentObjectUnignored(); + AXObjectImpl* listbox = obj->ParentObjectUnignored(); if (listbox && listbox->RoleValue() == kListBoxRole) PostNotification(listbox, kAXSelectedChildrenChanged); } @@ -957,12 +961,12 @@ void AXObjectCacheImpl::HandleActiveDescendantChanged(Node* node) { // it can affect what's focusable or not. modification_count_++; - if (AXObject* obj = GetOrCreate(node)) + if (AXObjectImpl* obj = GetOrCreate(node)) obj->HandleActiveDescendantChanged(); } void AXObjectCacheImpl::HandleAriaRoleChanged(Node* node) { - if (AXObject* obj = GetOrCreate(node)) { + if (AXObjectImpl* obj = GetOrCreate(node)) { obj->UpdateAccessibilityRole(); modification_count_++; obj->NotifyIfIgnoredValueChanged(); @@ -1020,7 +1024,7 @@ void AXObjectCacheImpl::InlineTextBoxesUpdated( // Only update if the accessibility object already exists and it's // not already marked as dirty. - if (AXObject* obj = Get(layout_object)) { + if (AXObjectImpl* obj = Get(layout_object)) { if (!obj->NeedsToUpdateChildren()) { obj->SetNeedsToUpdateChildren(); PostNotification(layout_object, kAXChildrenChanged); @@ -1059,11 +1063,12 @@ const Element* AXObjectCacheImpl::RootAXEditableElement(const Node* node) { return result; } -AXObject* AXObjectCacheImpl::FirstAccessibleObjectFromNode(const Node* node) { +AXObjectImpl* AXObjectCacheImpl::FirstAccessibleObjectFromNode( + const Node* node) { if (!node) return 0; - AXObject* accessible_object = GetOrCreate(node->GetLayoutObject()); + AXObjectImpl* accessible_object = GetOrCreate(node->GetLayoutObject()); while (accessible_object && accessible_object->AccessibilityIsIgnored()) { node = NodeTraversal::Next(*node); @@ -1083,7 +1088,7 @@ bool AXObjectCacheImpl::NodeIsTextControl(const Node* node) { if (!node) return false; - const AXObject* ax_object = GetOrCreate(const_cast(node)); + const AXObjectImpl* ax_object = GetOrCreate(const_cast(node)); return ax_object && ax_object->IsTextControl(); } @@ -1098,7 +1103,7 @@ bool IsNodeAriaVisible(Node* node) { "false"); } -void AXObjectCacheImpl::PostPlatformNotification(AXObject* obj, +void AXObjectCacheImpl::PostPlatformNotification(AXObjectImpl* obj, AXNotification notification) { if (!obj || !obj->GetDocument() || !obj->DocumentFrameView() || !obj->DocumentFrameView()->GetFrame().GetPage()) @@ -1118,11 +1123,11 @@ void AXObjectCacheImpl::HandleFocusedUIElementChanged(Node* old_focused_node, if (!page) return; - AXObject* focused_object = this->FocusedObject(); + AXObjectImpl* focused_object = this->FocusedObject(); if (!focused_object) return; - AXObject* old_focused_object = Get(old_focused_node); + AXObjectImpl* old_focused_object = Get(old_focused_node); PostPlatformNotification(old_focused_object, kAXBlur); PostPlatformNotification(focused_object, kAXFocusedUIElementChanged); @@ -1133,7 +1138,7 @@ void AXObjectCacheImpl::HandleInitialFocus() { } void AXObjectCacheImpl::HandleEditableTextContentChanged(Node* node) { - AXObject* obj = Get(node); + AXObjectImpl* obj = Get(node); while (obj && !obj->IsNativeTextControl() && !obj->IsNonNativeTextControl()) obj = obj->ParentObject(); PostNotification(obj, AXObjectCache::kAXValueChanged); @@ -1149,7 +1154,7 @@ void AXObjectCacheImpl::HandleValueChanged(Node* node) { void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, int option_index) { - AXObject* obj = Get(menu_list); + AXObjectImpl* obj = Get(menu_list); if (!obj || !obj->IsMenuList()) return; @@ -1157,7 +1162,7 @@ void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, } void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { - AXObject* obj = Get(menu_list); + AXObjectImpl* obj = Get(menu_list); if (!obj || !obj->IsMenuList()) return; @@ -1165,7 +1170,7 @@ void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { } void AXObjectCacheImpl::DidHideMenuListPopup(LayoutMenuList* menu_list) { - AXObject* obj = Get(menu_list); + AXObjectImpl* obj = Get(menu_list); if (!obj || !obj->IsMenuList()) return; @@ -1183,7 +1188,7 @@ void AXObjectCacheImpl::HandleLayoutComplete(Document* document) { void AXObjectCacheImpl::HandleScrolledToAnchor(const Node* anchor_node) { if (!anchor_node) return; - AXObject* obj = GetOrCreate(anchor_node->GetLayoutObject()); + AXObjectImpl* obj = GetOrCreate(anchor_node->GetLayoutObject()); if (!obj) return; if (obj->AccessibilityIsIgnored()) @@ -1192,7 +1197,7 @@ void AXObjectCacheImpl::HandleScrolledToAnchor(const Node* anchor_node) { } void AXObjectCacheImpl::HandleScrollPositionChanged(FrameView* frame_view) { - AXObject* target_ax_object = + AXObjectImpl* target_ax_object = GetOrCreate(frame_view->GetFrame().GetDocument()); PostPlatformNotification(target_ax_object, kAXScrollPositionChanged); } @@ -1204,14 +1209,14 @@ void AXObjectCacheImpl::HandleScrollPositionChanged( } const AtomicString& AXObjectCacheImpl::ComputedRoleForNode(Node* node) { - AXObject* obj = GetOrCreate(node); + AXObjectImpl* obj = GetOrCreate(node); if (!obj) - return AXObject::RoleName(kUnknownRole); - return AXObject::RoleName(obj->RoleValue()); + return AXObjectImpl::RoleName(kUnknownRole); + return AXObjectImpl::RoleName(obj->RoleValue()); } String AXObjectCacheImpl::ComputedNameForNode(Node* node) { - AXObject* obj = GetOrCreate(node); + AXObjectImpl* obj = GetOrCreate(node); if (!obj) return ""; @@ -1219,7 +1224,7 @@ String AXObjectCacheImpl::ComputedNameForNode(Node* node) { } void AXObjectCacheImpl::OnTouchAccessibilityHover(const IntPoint& location) { - AXObject* hit = Root()->AccessibilityHitTest(location); + AXObjectImpl* hit = Root()->AccessibilityHitTest(location); if (hit) { // Ignore events on a frame or plug-in, because the touch events // will be re-targeted there and we don't want to fire duplicate @@ -1234,11 +1239,11 @@ void AXObjectCacheImpl::OnTouchAccessibilityHover(const IntPoint& location) { void AXObjectCacheImpl::SetCanvasObjectBounds(HTMLCanvasElement* canvas, Element* element, const LayoutRect& rect) { - AXObject* obj = GetOrCreate(element); + AXObjectImpl* obj = GetOrCreate(element); if (!obj) return; - AXObject* ax_canvas = GetOrCreate(canvas); + AXObjectImpl* ax_canvas = GetOrCreate(canvas); if (!ax_canvas) return; diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h index c01b3fb41058cd..6e130da47b23c2 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h @@ -32,7 +32,7 @@ #include #include "core/dom/AXObjectCache.h" #include "modules/ModulesExport.h" -#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXObjectImpl.h" #include "platform/wtf/Forward.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/HashSet.h" @@ -54,7 +54,7 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { ~AXObjectCacheImpl(); DECLARE_VIRTUAL_TRACE(); - AXObject* FocusedObject(); + AXObjectImpl* FocusedObject(); void Dispose() override; @@ -76,9 +76,9 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { // Called by a node when text or a text equivalent (e.g. alt) attribute is // changed. void TextChanged(LayoutObject*) override; - void TextChanged(AXObject*); + void TextChanged(AXObjectImpl*); // Called when a node has just been attached, so we can make sure we have the - // right subclass of AXObject. + // right subclass of AXObjectImpl. void UpdateCacheAfterNodeIsAttached(Node*) override; void HandleAttributeChanged(const QualifiedName& attr_name, @@ -116,27 +116,27 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { void OnTouchAccessibilityHover(const IntPoint&) override; // Returns the root object for the entire document. - AXObject* RootObject(); + AXObjectImpl* RootObject(); - AXObject* ObjectFromAXID(AXID id) const { return objects_.at(id); } - AXObject* Root(); + AXObjectImpl* ObjectFromAXID(AXID id) const { return objects_.at(id); } + AXObjectImpl* Root(); // used for objects without backing elements - AXObject* GetOrCreate(AccessibilityRole); - AXObject* GetOrCreate(LayoutObject*); - AXObject* GetOrCreate(Node*); - AXObject* GetOrCreate(AbstractInlineTextBox*); + AXObjectImpl* GetOrCreate(AccessibilityRole); + AXObjectImpl* GetOrCreate(LayoutObject*); + AXObjectImpl* GetOrCreate(Node*); + AXObjectImpl* GetOrCreate(AbstractInlineTextBox*); - // will only return the AXObject if it already exists - AXObject* Get(Node*); - AXObject* Get(LayoutObject*); - AXObject* Get(AbstractInlineTextBox*); + // will only return the AXObjectImpl if it already exists + AXObjectImpl* Get(Node*); + AXObjectImpl* Get(LayoutObject*); + AXObjectImpl* Get(AbstractInlineTextBox*); - AXObject* FirstAccessibleObjectFromNode(const Node*); + AXObjectImpl* FirstAccessibleObjectFromNode(const Node*); void Remove(AXID); - void ChildrenChanged(AXObject*); + void ChildrenChanged(AXObjectImpl*); void HandleActiveDescendantChanged(Node*); void HandleAriaRoleChanged(Node*); @@ -146,7 +146,7 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { bool AccessibilityEnabled(); bool InlineTextBoxAccessibilityEnabled(); - void RemoveAXID(AXObject*); + void RemoveAXID(AXObjectImpl*); AXID GenerateAXID() const; @@ -156,7 +156,7 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { void PostNotification(LayoutObject*, AXNotification); void PostNotification(Node*, AXNotification); - void PostNotification(AXObject*, AXNotification); + void PostNotification(AXObjectImpl*, AXNotification); // // Aria-owns support. @@ -164,10 +164,10 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { // Returns true if the given object's position in the tree was due to // aria-owns. - bool IsAriaOwned(const AXObject*) const; + bool IsAriaOwned(const AXObjectImpl*) const; // Returns the parent of the given object due to aria-owns. - AXObject* GetAriaOwnedParent(const AXObject*) const; + AXObjectImpl* GetAriaOwnedParent(const AXObjectImpl*) const; // Given an object that has an aria-owns attributes, and a vector of ids from // the value of that attribute, updates the internal state to reflect the new @@ -178,9 +178,9 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { // If one or more ids aren't found, they're added to a lookup table so that if // an element with that id appears later, it can be added when you call // updateTreeIfElementIdIsAriaOwned. - void UpdateAriaOwns(const AXObject* owner, + void UpdateAriaOwns(const AXObjectImpl* owner, const Vector& id_vector, - HeapVector>& owned_children); + HeapVector>& owned_children); // Given an element in the DOM tree that was either just added or whose id // just changed, check to see if another object wants to be its parent due to @@ -189,16 +189,16 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { void UpdateTreeIfElementIdIsAriaOwned(Element*); protected: - void PostPlatformNotification(AXObject*, AXNotification); + void PostPlatformNotification(AXObjectImpl*, AXNotification); void LabelChanged(Element*); - AXObject* CreateFromRenderer(LayoutObject*); - AXObject* CreateFromNode(Node*); - AXObject* CreateFromInlineTextBox(AbstractInlineTextBox*); + AXObjectImpl* CreateFromRenderer(LayoutObject*); + AXObjectImpl* CreateFromNode(Node*); + AXObjectImpl* CreateFromInlineTextBox(AbstractInlineTextBox*); private: Member document_; - HeapHashMap> objects_; + HeapHashMap> objects_; // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we // do not use HeapHashMap for those mappings. HashMap layout_object_mapping_; @@ -243,13 +243,13 @@ class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { HashMap>> id_to_aria_owners_mapping_; TaskRunnerTimer notification_post_timer_; - HeapVector, AXNotification>> + HeapVector, AXNotification>> notifications_to_post_; void NotificationPostTimerFired(TimerBase*); - AXObject* FocusedImageMapUIElement(HTMLAreaElement*); + AXObjectImpl* FocusedImageMapUIElement(HTMLAreaElement*); - AXID GetOrCreateAXID(AXObject*); + AXID GetOrCreateAXID(AXObjectImpl*); void TextChanged(Node*); bool NodeIsTextControl(const Node*); diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp similarity index 86% rename from third_party/WebKit/Source/modules/accessibility/AXObject.cpp rename to third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp index 2cae448cea5924..39bfb8dde2daae 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXObjectImpl.h" #include "SkMatrix44.h" #include "core/InputTypeNames.h" @@ -291,13 +291,15 @@ static Vector* CreateRoleNameVector() { for (int i = 0; i < kNumRoles; i++) (*role_name_vector)[i] = g_null_atom; - for (size_t i = 0; i < WTF_ARRAY_LENGTH(kRoles); ++i) + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kRoles); ++i) { (*role_name_vector)[kRoles[i].webcore_role] = AtomicString(kRoles[i].aria_role); + } - for (size_t i = 0; i < WTF_ARRAY_LENGTH(kReverseRoles); ++i) + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kReverseRoles); ++i) { (*role_name_vector)[kReverseRoles[i].webcore_role] = AtomicString(kReverseRoles[i].aria_role); + } return role_name_vector; } @@ -305,9 +307,10 @@ static Vector* CreateRoleNameVector() { static Vector* CreateInternalRoleNameVector() { Vector* internal_role_name_vector = new Vector(kNumRoles); - for (size_t i = 0; i < WTF_ARRAY_LENGTH(kInternalRoles); i++) + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kInternalRoles); i++) { (*internal_role_name_vector)[kInternalRoles[i].webcore_role] = AtomicString(kInternalRoles[i].internal_role_name); + } return internal_role_name_vector; } @@ -344,9 +347,9 @@ HTMLDialogElement* GetActiveDialogElement(Node* node) { } // namespace -unsigned AXObject::number_of_live_ax_objects_ = 0; +unsigned AXObjectImpl::number_of_live_ax_objects_ = 0; -AXObject::AXObject(AXObjectCacheImpl& ax_object_cache) +AXObjectImpl::AXObjectImpl(AXObjectCacheImpl& ax_object_cache) : id_(0), have_children_(false), role_(kUnknownRole), @@ -366,12 +369,12 @@ AXObject::AXObject(AXObjectCacheImpl& ax_object_cache) ++number_of_live_ax_objects_; } -AXObject::~AXObject() { +AXObjectImpl::~AXObjectImpl() { DCHECK(IsDetached()); --number_of_live_ax_objects_; } -void AXObject::Detach() { +void AXObjectImpl::Detach() { // Clear any children and call detachFromParent on them so that // no children are left with dangling pointers to their parent. ClearChildren(); @@ -379,11 +382,11 @@ void AXObject::Detach() { ax_object_cache_ = nullptr; } -bool AXObject::IsDetached() const { +bool AXObjectImpl::IsDetached() const { return !ax_object_cache_; } -const AtomicString& AXObject::GetAOMPropertyOrARIAAttribute( +const AtomicString& AXObjectImpl::GetAOMPropertyOrARIAAttribute( AOMStringProperty property) const { Node* node = this->GetNode(); if (!node || !node->IsElementNode()) @@ -392,20 +395,20 @@ const AtomicString& AXObject::GetAOMPropertyOrARIAAttribute( return AccessibleNode::GetPropertyOrARIAAttribute(ToElement(node), property); } -bool AXObject::IsARIATextControl() const { +bool AXObjectImpl::IsARIATextControl() const { return AriaRoleAttribute() == kTextFieldRole || AriaRoleAttribute() == kSearchBoxRole || AriaRoleAttribute() == kComboBoxRole; } -bool AXObject::IsButton() const { +bool AXObjectImpl::IsButton() const { AccessibilityRole role = RoleValue(); return role == kButtonRole || role == kPopUpButtonRole || role == kToggleButtonRole; } -bool AXObject::IsCheckable() const { +bool AXObjectImpl::IsCheckable() const { switch (RoleValue()) { case kCheckBoxRole: case kMenuItemCheckBoxRole: @@ -422,7 +425,7 @@ bool AXObject::IsCheckable() const { // Because an AXMenuListOption (