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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp

Issue 2883203002: Revert of Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013, Google Inc. All rights reserved. 2 * Copyright (C) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 23 matching lines...) Expand all
34 #include "modules/accessibility/AXObjectCacheImpl.h" 34 #include "modules/accessibility/AXObjectCacheImpl.h"
35 #include "platform/LayoutUnit.h" 35 #include "platform/LayoutUnit.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 using namespace HTMLNames; 39 using namespace HTMLNames;
40 40
41 AXInlineTextBox::AXInlineTextBox( 41 AXInlineTextBox::AXInlineTextBox(
42 PassRefPtr<AbstractInlineTextBox> inline_text_box, 42 PassRefPtr<AbstractInlineTextBox> inline_text_box,
43 AXObjectCacheImpl& ax_object_cache) 43 AXObjectCacheImpl& ax_object_cache)
44 : AXObjectImpl(ax_object_cache), 44 : AXObject(ax_object_cache), inline_text_box_(std::move(inline_text_box)) {}
45 inline_text_box_(std::move(inline_text_box)) {}
46 45
47 AXInlineTextBox* AXInlineTextBox::Create( 46 AXInlineTextBox* AXInlineTextBox::Create(
48 PassRefPtr<AbstractInlineTextBox> inline_text_box, 47 PassRefPtr<AbstractInlineTextBox> inline_text_box,
49 AXObjectCacheImpl& ax_object_cache) { 48 AXObjectCacheImpl& ax_object_cache) {
50 return new AXInlineTextBox(std::move(inline_text_box), ax_object_cache); 49 return new AXInlineTextBox(std::move(inline_text_box), ax_object_cache);
51 } 50 }
52 51
53 void AXInlineTextBox::Init() {} 52 void AXInlineTextBox::Init() {}
54 53
55 void AXInlineTextBox::Detach() { 54 void AXInlineTextBox::Detach() {
56 AXObjectImpl::Detach(); 55 AXObject::Detach();
57 inline_text_box_ = nullptr; 56 inline_text_box_ = nullptr;
58 } 57 }
59 58
60 void AXInlineTextBox::GetRelativeBounds( 59 void AXInlineTextBox::GetRelativeBounds(
61 AXObjectImpl** out_container, 60 AXObject** out_container,
62 FloatRect& out_bounds_in_container, 61 FloatRect& out_bounds_in_container,
63 SkMatrix44& out_container_transform) const { 62 SkMatrix44& out_container_transform) const {
64 *out_container = nullptr; 63 *out_container = nullptr;
65 out_bounds_in_container = FloatRect(); 64 out_bounds_in_container = FloatRect();
66 out_container_transform.setIdentity(); 65 out_container_transform.setIdentity();
67 66
68 if (!inline_text_box_ || !ParentObject() || 67 if (!inline_text_box_ || !ParentObject() ||
69 !ParentObject()->GetLayoutObject()) 68 !ParentObject()->GetLayoutObject())
70 return; 69 return;
71 70
72 *out_container = ParentObject(); 71 *out_container = ParentObject();
73 out_bounds_in_container = FloatRect(inline_text_box_->LocalBounds()); 72 out_bounds_in_container = FloatRect(inline_text_box_->LocalBounds());
74 73
75 // Subtract the local bounding box of the parent because they're 74 // Subtract the local bounding box of the parent because they're
76 // both in the same coordinate system. 75 // both in the same coordinate system.
77 LayoutObject* parent_layout_object = ParentObject()->GetLayoutObject(); 76 LayoutObject* parent_layout_object = ParentObject()->GetLayoutObject();
78 FloatRect parent_bounding_box = 77 FloatRect parent_bounding_box =
79 parent_layout_object->LocalBoundingBoxRectForAccessibility(); 78 parent_layout_object->LocalBoundingBoxRectForAccessibility();
80 out_bounds_in_container.MoveBy(-parent_bounding_box.Location()); 79 out_bounds_in_container.MoveBy(-parent_bounding_box.Location());
81 } 80 }
82 81
83 bool AXInlineTextBox::ComputeAccessibilityIsIgnored( 82 bool AXInlineTextBox::ComputeAccessibilityIsIgnored(
84 IgnoredReasons* ignored_reasons) const { 83 IgnoredReasons* ignored_reasons) const {
85 AXObjectImpl* parent = ParentObject(); 84 AXObject* parent = ParentObject();
86 if (!parent) 85 if (!parent)
87 return false; 86 return false;
88 87
89 if (!parent->AccessibilityIsIgnored()) 88 if (!parent->AccessibilityIsIgnored())
90 return false; 89 return false;
91 90
92 if (ignored_reasons) 91 if (ignored_reasons)
93 parent->ComputeAccessibilityIsIgnored(ignored_reasons); 92 parent->ComputeAccessibilityIsIgnored(ignored_reasons);
94 93
95 return true; 94 return true;
(...skipping 21 matching lines...) Expand all
117 return; 116 return;
118 117
119 Vector<AbstractInlineTextBox::WordBoundaries> word_boundaries; 118 Vector<AbstractInlineTextBox::WordBoundaries> word_boundaries;
120 inline_text_box_->GetWordBoundaries(word_boundaries); 119 inline_text_box_->GetWordBoundaries(word_boundaries);
121 words.resize(word_boundaries.size()); 120 words.resize(word_boundaries.size());
122 for (unsigned i = 0; i < word_boundaries.size(); i++) 121 for (unsigned i = 0; i < word_boundaries.size(); i++)
123 words[i] = 122 words[i] =
124 AXRange(word_boundaries[i].start_index, word_boundaries[i].end_index); 123 AXRange(word_boundaries[i].start_index, word_boundaries[i].end_index);
125 } 124 }
126 125
127 String AXInlineTextBox::GetName( 126 String AXInlineTextBox::GetName(AXNameFrom& name_from,
128 AXNameFrom& name_from, 127 AXObject::AXObjectVector* name_objects) const {
129 AXObjectImpl::AXObjectVector* name_objects) const {
130 if (!inline_text_box_) 128 if (!inline_text_box_)
131 return String(); 129 return String();
132 130
133 name_from = kAXNameFromContents; 131 name_from = kAXNameFromContents;
134 return inline_text_box_->GetText(); 132 return inline_text_box_->GetText();
135 } 133 }
136 134
137 AXObjectImpl* AXInlineTextBox::ComputeParent() const { 135 AXObject* AXInlineTextBox::ComputeParent() const {
138 DCHECK(!IsDetached()); 136 DCHECK(!IsDetached());
139 if (!inline_text_box_ || !ax_object_cache_) 137 if (!inline_text_box_ || !ax_object_cache_)
140 return 0; 138 return 0;
141 139
142 LineLayoutText line_layout_text = inline_text_box_->GetLineLayoutItem(); 140 LineLayoutText line_layout_text = inline_text_box_->GetLineLayoutItem();
143 return ax_object_cache_->GetOrCreate( 141 return ax_object_cache_->GetOrCreate(
144 LineLayoutAPIShim::LayoutObjectFrom(line_layout_text)); 142 LineLayoutAPIShim::LayoutObjectFrom(line_layout_text));
145 } 143 }
146 144
147 // In addition to LTR and RTL direction, edit fields also support 145 // In addition to LTR and RTL direction, edit fields also support
148 // top to bottom and bottom to top via the CSS writing-mode property. 146 // top to bottom and bottom to top via the CSS writing-mode property.
149 AccessibilityTextDirection AXInlineTextBox::GetTextDirection() const { 147 AccessibilityTextDirection AXInlineTextBox::GetTextDirection() const {
150 if (!inline_text_box_) 148 if (!inline_text_box_)
151 return AXObjectImpl::GetTextDirection(); 149 return AXObject::GetTextDirection();
152 150
153 switch (inline_text_box_->GetDirection()) { 151 switch (inline_text_box_->GetDirection()) {
154 case AbstractInlineTextBox::kLeftToRight: 152 case AbstractInlineTextBox::kLeftToRight:
155 return kAccessibilityTextDirectionLTR; 153 return kAccessibilityTextDirectionLTR;
156 case AbstractInlineTextBox::kRightToLeft: 154 case AbstractInlineTextBox::kRightToLeft:
157 return kAccessibilityTextDirectionRTL; 155 return kAccessibilityTextDirectionRTL;
158 case AbstractInlineTextBox::kTopToBottom: 156 case AbstractInlineTextBox::kTopToBottom:
159 return kAccessibilityTextDirectionTTB; 157 return kAccessibilityTextDirectionTTB;
160 case AbstractInlineTextBox::kBottomToTop: 158 case AbstractInlineTextBox::kBottomToTop:
161 return kAccessibilityTextDirectionBTT; 159 return kAccessibilityTextDirectionBTT;
162 } 160 }
163 161
164 return AXObjectImpl::GetTextDirection(); 162 return AXObject::GetTextDirection();
165 } 163 }
166 164
167 AXObjectImpl* AXInlineTextBox::NextOnLine() const { 165 AXObject* AXInlineTextBox::NextOnLine() const {
168 RefPtr<AbstractInlineTextBox> next_on_line = inline_text_box_->NextOnLine(); 166 RefPtr<AbstractInlineTextBox> next_on_line = inline_text_box_->NextOnLine();
169 if (next_on_line) 167 if (next_on_line)
170 return ax_object_cache_->GetOrCreate(next_on_line.Get()); 168 return ax_object_cache_->GetOrCreate(next_on_line.Get());
171 169
172 if (!inline_text_box_->IsLast()) 170 if (!inline_text_box_->IsLast())
173 return 0; 171 return 0;
174 172
175 return ParentObject()->NextOnLine(); 173 return ParentObject()->NextOnLine();
176 } 174 }
177 175
178 AXObjectImpl* AXInlineTextBox::PreviousOnLine() const { 176 AXObject* AXInlineTextBox::PreviousOnLine() const {
179 RefPtr<AbstractInlineTextBox> previous_on_line = 177 RefPtr<AbstractInlineTextBox> previous_on_line =
180 inline_text_box_->PreviousOnLine(); 178 inline_text_box_->PreviousOnLine();
181 if (previous_on_line) 179 if (previous_on_line)
182 return ax_object_cache_->GetOrCreate(previous_on_line.Get()); 180 return ax_object_cache_->GetOrCreate(previous_on_line.Get());
183 181
184 if (!inline_text_box_->IsFirst()) 182 if (!inline_text_box_->IsFirst())
185 return 0; 183 return 0;
186 184
187 return ParentObject()->PreviousOnLine(); 185 return ParentObject()->PreviousOnLine();
188 } 186 }
189 187
190 } // namespace blink 188 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698