Skip to content

Commit

Permalink
Rename AXObject to AXObjectImpl in modules/ and web/
Browse files Browse the repository at this point in the history
Rename AXObject to AXObjectImpl in modules/ and web/, and introduce an
empty abstract parent class in core/. This is pre-work to remove usages
of AXObjectImpl from web/, which will use AXObject instead.

This patch does not rename the usages in core/ since these should use
the new abstract object.

BUG=715382

Review-Url: https://codereview.chromium.org/2858493002
Cr-Original-Commit-Position: refs/heads/master@{#471663}
Committed: https://chromium.googlesource.com/chromium/src/+/234813ae8d52f622a1664e11365642751e8f26ba
Review-Url: https://codereview.chromium.org/2858493002
Cr-Commit-Position: refs/heads/master@{#472370}
  • Loading branch information
sashab authored and Commit bot committed May 17, 2017
1 parent 2ff93ad commit 0cd996b
Show file tree
Hide file tree
Showing 65 changed files with 807 additions and 738 deletions.
2 changes: 1 addition & 1 deletion docs/accessibility/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions third_party/WebKit/Source/core/dom/AXObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef AXObject_h
#define AXObject_h

#include "core/CoreExport.h"

namespace blink {

// TODO(sashab): Add pure virtual methods to this class to remove dependencies
// on AXObjectImpl from outside of modules/.
class CORE_EXPORT AXObject {};

} // namespace blink

#endif // AXObject_h
1 change: 1 addition & 0 deletions third_party/WebKit/Source/core/dom/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ blink_core_sources("dom") {
split_count = 5

sources = [
"AXObject.h",
"AXObjectCache.cpp",
"AXObjectCache.h",
"AccessibleNode.cpp",
Expand Down
15 changes: 8 additions & 7 deletions third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ AXARIAGrid* AXARIAGrid::Create(LayoutObject* layout_object,
return new AXARIAGrid(layout_object, ax_object_cache);
}

bool AXARIAGrid::AddTableRowChild(AXObject* child,
HeapHashSet<Member<AXObject>>& appended_rows,
unsigned& column_count) {
bool AXARIAGrid::AddTableRowChild(
AXObjectImpl* child,
HeapHashSet<Member<AXObjectImpl>>& appended_rows,
unsigned& column_count) {
if (!child || child->RoleValue() != kRowRole)
return false;

Expand Down Expand Up @@ -89,16 +90,16 @@ void AXARIAGrid::AddChildren() {
if (!layout_object_)
return;

HeapVector<Member<AXObject>> children;
for (AXObject* child = RawFirstChild(); child;
HeapVector<Member<AXObjectImpl>> children;
for (AXObjectImpl* child = RawFirstChild(); child;
child = child->RawNextSibling())
children.push_back(child);
ComputeAriaOwnsChildren(children);

AXObjectCacheImpl& ax_cache = AxObjectCache();

// Only add children that are actually rows.
HeapHashSet<Member<AXObject>> appended_rows;
HeapHashSet<Member<AXObjectImpl>> appended_rows;
unsigned column_count = 0;
for (const auto& child : children) {
if (!AddTableRowChild(child, appended_rows, column_count)) {
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions third_party/WebKit/Source/modules/accessibility/AXARIAGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Member<AXObject>>& appended_rows,
bool AddTableRowChild(AXObjectImpl*,
HeapHashSet<Member<AXObjectImpl>>& appended_rows,
unsigned& column_count);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -74,7 +74,7 @@ AXObject* AXARIAGridCell::ParentTable() const {
}

void AXARIAGridCell::RowIndexRange(std::pair<unsigned, unsigned>& row_range) {
AXObject* parent = ParentObjectUnignored();
AXObjectImpl* parent = ParentObjectUnignored();
if (!parent)
return;

Expand Down Expand Up @@ -104,7 +104,7 @@ void AXARIAGridCell::RowIndexRange(std::pair<unsigned, unsigned>& row_range) {

void AXARIAGridCell::ColumnIndexRange(
std::pair<unsigned, unsigned>& column_range) {
AXObject* parent = ParentObjectUnignored();
AXObjectImpl* parent = ParentObjectUnignored();
if (!parent)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ AXARIAGridRow* AXARIAGridRow::Create(LayoutObject* layout_object,
}

bool AXARIAGridRow::IsARIATreeGridRow() const {
AXObject* parent = ParentTable();
AXObjectImpl* parent = ParentTable();
if (!parent)
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ HTMLMapElement* AXImageMapLink::MapElement() const {
return Traversal<HTMLMapElement>::FirstAncestor(*area);
}

AXObject* AXImageMapLink::ComputeParent() const {
AXObjectImpl* AXImageMapLink::ComputeParent() const {
DCHECK(!IsDetached());
if (parent_)
return parent_;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
24 changes: 13 additions & 11 deletions third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ using namespace HTMLNames;
AXInlineTextBox::AXInlineTextBox(
PassRefPtr<AbstractInlineTextBox> 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<AbstractInlineTextBox> inline_text_box,
Expand All @@ -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;
Expand All @@ -81,7 +82,7 @@ void AXInlineTextBox::GetRelativeBounds(

bool AXInlineTextBox::ComputeAccessibilityIsIgnored(
IgnoredReasons* ignored_reasons) const {
AXObject* parent = ParentObject();
AXObjectImpl* parent = ParentObject();
if (!parent)
return false;

Expand Down Expand Up @@ -123,16 +124,17 @@ void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& 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();

name_from = kAXNameFromContents;
return inline_text_box_->GetText();
}

AXObject* AXInlineTextBox::ComputeParent() const {
AXObjectImpl* AXInlineTextBox::ComputeParent() const {
DCHECK(!IsDetached());
if (!inline_text_box_ || !ax_object_cache_)
return 0;
Expand All @@ -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:
Expand All @@ -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<AbstractInlineTextBox> next_on_line = inline_text_box_->NextOnLine();
if (next_on_line)
return ax_object_cache_->GetOrCreate(next_on_line.Get());
Expand All @@ -173,7 +175,7 @@ AXObject* AXInlineTextBox::NextOnLine() const {
return ParentObject()->NextOnLine();
}

AXObject* AXInlineTextBox::PreviousOnLine() const {
AXObjectImpl* AXInlineTextBox::PreviousOnLine() const {
RefPtr<AbstractInlineTextBox> previous_on_line =
inline_text_box_->PreviousOnLine();
if (previous_on_line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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<int>&) const override;
void GetWordBoundaries(Vector<AXRange>&) 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<AbstractInlineTextBox> inline_text_box_;
Expand Down
Loading

0 comments on commit 0cd996b

Please sign in to comment.