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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 bounds.Offset(-scroll_x, -scroll_y); | 144 bounds.Offset(-scroll_x, -scroll_y); |
145 | 145 |
146 return bounds; | 146 return bounds; |
147 } | 147 } |
148 | 148 |
149 gfx::Rect BrowserAccessibility::GetGlobalBoundsRect() { | 149 gfx::Rect BrowserAccessibility::GetGlobalBoundsRect() { |
150 gfx::Rect bounds = GetLocalBoundsRect(); | 150 gfx::Rect bounds = GetLocalBoundsRect(); |
151 | 151 |
152 // Adjust the bounds by the top left corner of the containing view's bounds | 152 // Adjust the bounds by the top left corner of the containing view's bounds |
153 // in screen coordinates. | 153 // in screen coordinates. |
154 gfx::Point top_left = manager_->GetViewBounds().origin(); | 154 bounds.Offset(manager_->GetViewBounds().OffsetFromOrigin()); |
155 bounds.Offset(top_left); | |
156 | 155 |
157 return bounds; | 156 return bounds; |
158 } | 157 } |
159 | 158 |
160 BrowserAccessibility* BrowserAccessibility::BrowserAccessibilityForPoint( | 159 BrowserAccessibility* BrowserAccessibility::BrowserAccessibilityForPoint( |
161 const gfx::Point& point) { | 160 const gfx::Point& point) { |
162 // Walk the children recursively looking for the BrowserAccessibility that | 161 // Walk the children recursively looking for the BrowserAccessibility that |
163 // most tightly encloses the specified point. | 162 // most tightly encloses the specified point. |
164 for (int i = children_.size() - 1; i >= 0; --i) { | 163 for (int i = children_.size() - 1; i >= 0; --i) { |
165 BrowserAccessibility* child = children_[i]; | 164 BrowserAccessibility* child = children_[i]; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 for (size_t i = 0; i < children_.size(); ++i) | 315 for (size_t i = 0; i < children_.size(); ++i) |
317 result += children_[i]->GetTextRecursive(); | 316 result += children_[i]->GetTextRecursive(); |
318 return result; | 317 return result; |
319 } | 318 } |
320 | 319 |
321 void BrowserAccessibility::PreInitialize() { | 320 void BrowserAccessibility::PreInitialize() { |
322 instance_active_ = true; | 321 instance_active_ = true; |
323 } | 322 } |
324 | 323 |
325 } // namespace content | 324 } // namespace content |
OLD | NEW |