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

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

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

Powered by Google App Engine
This is Rietveld 408576698