OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 gfx::Rect BrowserAccessibility::GetLocalBoundsRect() { | 136 gfx::Rect BrowserAccessibility::GetLocalBoundsRect() { |
137 gfx::Rect bounds = location_; | 137 gfx::Rect bounds = location_; |
138 | 138 |
139 // Walk up the parent chain. Every time we encounter a Web Area, offset | 139 // Walk up the parent chain. Every time we encounter a Web Area, offset |
140 // based on the scroll bars and then offset based on the origin of that | 140 // based on the scroll bars and then offset based on the origin of that |
141 // nested web area. | 141 // nested web area. |
142 BrowserAccessibility* parent = parent_; | 142 BrowserAccessibility* parent = parent_; |
143 bool need_to_offset_web_area = | 143 bool need_to_offset_web_area = |
144 (role_ == AccessibilityNodeData::ROLE_WEB_AREA); | 144 (role_ == AccessibilityNodeData::ROLE_WEB_AREA || |
| 145 role_ == AccessibilityNodeData::ROLE_ROOT_WEB_AREA); |
145 while (parent) { | 146 while (parent) { |
146 if (need_to_offset_web_area && | 147 if (need_to_offset_web_area && |
147 parent->location().width() > 0 && | 148 parent->location().width() > 0 && |
148 parent->location().height() > 0) { | 149 parent->location().height() > 0) { |
149 bounds.Offset(parent->location().x(), parent->location().y()); | 150 bounds.Offset(parent->location().x(), parent->location().y()); |
150 need_to_offset_web_area = false; | 151 need_to_offset_web_area = false; |
151 } | 152 } |
152 if (parent->role() == AccessibilityNodeData::ROLE_WEB_AREA) { | 153 if (parent->role() == AccessibilityNodeData::ROLE_WEB_AREA || |
| 154 parent->role() == AccessibilityNodeData::ROLE_ROOT_WEB_AREA) { |
153 int sx = 0; | 155 int sx = 0; |
154 int sy = 0; | 156 int sy = 0; |
155 if (parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &sx) && | 157 if (parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &sx) && |
156 parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_Y, &sy)) { | 158 parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_Y, &sy)) { |
157 bounds.Offset(-sx, -sy); | 159 bounds.Offset(-sx, -sy); |
158 } | 160 } |
159 need_to_offset_web_area = true; | 161 need_to_offset_web_area = true; |
160 } | 162 } |
161 parent = parent->parent(); | 163 parent = parent->parent(); |
162 } | 164 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 return name_; | 315 return name_; |
314 } | 316 } |
315 | 317 |
316 string16 result; | 318 string16 result; |
317 for (size_t i = 0; i < children_.size(); ++i) | 319 for (size_t i = 0; i < children_.size(); ++i) |
318 result += children_[i]->GetTextRecursive(); | 320 result += children_[i]->GetTextRecursive(); |
319 return result; | 321 return result; |
320 } | 322 } |
321 | 323 |
322 } // namespace content | 324 } // namespace content |
OLD | NEW |