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

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

Issue 2789963002: Accessible bounds should include device scale factor on Windows (again) (Closed)
Patch Set: Fix const Created 3 years, 8 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 // 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_win.h" 5 #include "content/browser/accessibility/browser_accessibility_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <UIAutomationCoreApi.h> 8 #include <UIAutomationCoreApi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after
4267 } 4267 }
4268 4268
4269 bool BrowserAccessibilityWin::IsNative() const { 4269 bool BrowserAccessibilityWin::IsNative() const {
4270 return true; 4270 return true;
4271 } 4271 }
4272 4272
4273 void BrowserAccessibilityWin::OnLocationChanged() { 4273 void BrowserAccessibilityWin::OnLocationChanged() {
4274 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE); 4274 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE);
4275 } 4275 }
4276 4276
4277 gfx::Rect BrowserAccessibilityWin::RelativeToAbsoluteBounds(
4278 gfx::RectF bounds,
4279 bool frame_only) const {
4280 gfx::Rect result =
4281 BrowserAccessibility::RelativeToAbsoluteBounds(bounds, frame_only);
4282
4283 // On Windows, we have to divide by the device scale factor to get
4284 // pixels in the coordinates that MSAA clients expect.
4285 float device_scale_factor = manager()->device_scale_factor();
4286 if (device_scale_factor > 0.0 && device_scale_factor != 1.0) {
4287 result = ScaleToEnclosingRect(result, 1.0 / device_scale_factor,
4288 1.0 / device_scale_factor);
4289 }
4290 return result;
4291 }
4292
4293 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes() 4277 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes()
4294 const { 4278 const {
4295 std::vector<base::string16> attributes; 4279 std::vector<base::string16> attributes;
4296 4280
4297 // We include list markers for now, but there might be other objects that are 4281 // We include list markers for now, but there might be other objects that are
4298 // auto generated. 4282 // auto generated.
4299 // TODO(nektar): Compute what objects are auto-generated in Blink. 4283 // TODO(nektar): Compute what objects are auto-generated in Blink.
4300 if (GetRole() == ui::AX_ROLE_LIST_MARKER) 4284 if (GetRole() == ui::AX_ROLE_LIST_MARKER)
4301 attributes.push_back(L"auto-generated:true"); 4285 attributes.push_back(L"auto-generated:true");
4302 else 4286 else
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
5833 return static_cast<BrowserAccessibilityWin*>(obj); 5817 return static_cast<BrowserAccessibilityWin*>(obj);
5834 } 5818 }
5835 5819
5836 const BrowserAccessibilityWin* 5820 const BrowserAccessibilityWin*
5837 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5821 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5838 DCHECK(!obj || obj->IsNative()); 5822 DCHECK(!obj || obj->IsNative());
5839 return static_cast<const BrowserAccessibilityWin*>(obj); 5823 return static_cast<const BrowserAccessibilityWin*>(obj);
5840 } 5824 }
5841 5825
5842 } // namespace content 5826 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.h ('k') | content/browser/accessibility/hit_testing_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698