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

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: more vector use fixes 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 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698