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

Side by Side Diff: content/browser/accessibility/browser_accessibility.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasefinal Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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
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 gfx::Vector2d view_offset = manager_->GetViewBounds().OffsetFromOrigin();
danakj 2012/10/29 19:17:20 inlined.
155 bounds.Offset(top_left); 155 bounds.Offset(view_offset);
156 156
157 return bounds; 157 return bounds;
158 } 158 }
159 159
160 BrowserAccessibility* BrowserAccessibility::BrowserAccessibilityForPoint( 160 BrowserAccessibility* BrowserAccessibility::BrowserAccessibilityForPoint(
161 const gfx::Point& point) { 161 const gfx::Point& point) {
162 // Walk the children recursively looking for the BrowserAccessibility that 162 // Walk the children recursively looking for the BrowserAccessibility that
163 // most tightly encloses the specified point. 163 // most tightly encloses the specified point.
164 for (int i = children_.size() - 1; i >= 0; --i) { 164 for (int i = children_.size() - 1; i >= 0; --i) {
165 BrowserAccessibility* child = children_[i]; 165 BrowserAccessibility* child = children_[i];
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 for (size_t i = 0; i < children_.size(); ++i) 316 for (size_t i = 0; i < children_.size(); ++i)
317 result += children_[i]->GetTextRecursive(); 317 result += children_[i]->GetTextRecursive();
318 return result; 318 return result;
319 } 319 }
320 320
321 void BrowserAccessibility::PreInitialize() { 321 void BrowserAccessibility::PreInitialize() {
322 instance_active_ = true; 322 instance_active_ = true;
323 } 323 }
324 324
325 } // namespace content 325 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698