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

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

Issue 2759903002: Accessible bounds should include device scale factor on Windows. (Closed)
Patch Set: Rename to use_custom_device_scale_factor_for_testing Created 3 years, 9 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 4234 matching lines...) Expand 10 before | Expand all | Expand 10 after
4245 } 4245 }
4246 4246
4247 bool BrowserAccessibilityWin::IsNative() const { 4247 bool BrowserAccessibilityWin::IsNative() const {
4248 return true; 4248 return true;
4249 } 4249 }
4250 4250
4251 void BrowserAccessibilityWin::OnLocationChanged() { 4251 void BrowserAccessibilityWin::OnLocationChanged() {
4252 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE); 4252 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE);
4253 } 4253 }
4254 4254
4255 gfx::Rect BrowserAccessibilityWin::RelativeToAbsoluteBounds(
4256 gfx::RectF bounds,
4257 bool frame_only) const {
4258 gfx::Rect result =
4259 BrowserAccessibility::RelativeToAbsoluteBounds(bounds, frame_only);
4260
4261 // On Windows, we have to divide by the device scale factor to get
4262 // pixels in the coordinates that MSAA clients expect.
4263 float device_scale_factor = manager()->device_scale_factor();
4264 if (device_scale_factor > 0.0 && device_scale_factor != 1.0) {
4265 result = ScaleToEnclosingRect(result, 1.0 / device_scale_factor,
4266 1.0 / device_scale_factor);
4267 }
4268 return result;
4269 }
4270
4255 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes() 4271 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes()
4256 const { 4272 const {
4257 std::vector<base::string16> attributes; 4273 std::vector<base::string16> attributes;
4258 4274
4259 // We include list markers for now, but there might be other objects that are 4275 // We include list markers for now, but there might be other objects that are
4260 // auto generated. 4276 // auto generated.
4261 // TODO(nektar): Compute what objects are auto-generated in Blink. 4277 // TODO(nektar): Compute what objects are auto-generated in Blink.
4262 if (GetRole() == ui::AX_ROLE_LIST_MARKER) 4278 if (GetRole() == ui::AX_ROLE_LIST_MARKER)
4263 attributes.push_back(L"auto-generated:true"); 4279 attributes.push_back(L"auto-generated:true");
4264 else 4280 else
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
5791 return static_cast<BrowserAccessibilityWin*>(obj); 5807 return static_cast<BrowserAccessibilityWin*>(obj);
5792 } 5808 }
5793 5809
5794 const BrowserAccessibilityWin* 5810 const BrowserAccessibilityWin*
5795 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5811 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5796 DCHECK(!obj || obj->IsNative()); 5812 DCHECK(!obj || obj->IsNative());
5797 return static_cast<const BrowserAccessibilityWin*>(obj); 5813 return static_cast<const BrowserAccessibilityWin*>(obj);
5798 } 5814 }
5799 5815
5800 } // namespace content 5816 } // 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