Commit e11d27a9 authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

View accessibility bounds should be in pixels, not DIPs

The bounding box highlighted by assistive technology
like ZoomText is wrong if the display resolution is not
set to 100%.

BUG=812892,820298

Change-Id: Id488583666c5e01e7aaed5ade7a5a3faeff900cd
Reviewed-on: https://chromium-review.googlesource.com/955545
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542202}
parent bdce7085
...@@ -353,10 +353,6 @@ const ui::AXUniqueId& NativeViewAccessibilityBase::GetUniqueId() const { ...@@ -353,10 +353,6 @@ const ui::AXUniqueId& NativeViewAccessibilityBase::GetUniqueId() const {
return ViewAccessibility::GetUniqueId(); return ViewAccessibility::GetUniqueId();
} }
gfx::RectF NativeViewAccessibilityBase::GetBoundsInScreen() const {
return gfx::RectF(view()->GetBoundsInScreen());
}
void NativeViewAccessibilityBase::PopulateChildWidgetVector( void NativeViewAccessibilityBase::PopulateChildWidgetVector(
std::vector<Widget*>* result_child_widgets) { std::vector<Widget*>* result_child_widgets) {
// Only attach child widgets to the root view. // Only attach child widgets to the root view.
......
...@@ -67,9 +67,6 @@ class VIEWS_EXPORT NativeViewAccessibilityBase ...@@ -67,9 +67,6 @@ class VIEWS_EXPORT NativeViewAccessibilityBase
protected: protected:
explicit NativeViewAccessibilityBase(View* view); explicit NativeViewAccessibilityBase(View* view);
protected:
virtual gfx::RectF GetBoundsInScreen() const;
private: private:
void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ui/base/layout.h" #include "ui/base/layout.h"
#include "ui/base/win/accessibility_misc_utils.h" #include "ui/base/win/accessibility_misc_utils.h"
#include "ui/base/win/atl_module.h" #include "ui/base/win/atl_module.h"
#include "ui/display/win/screen_win.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/win/hwnd_util.h" #include "ui/views/win/hwnd_util.h"
...@@ -100,12 +101,14 @@ NativeViewAccessibilityWin::GetTargetForNativeAccessibilityEvent() { ...@@ -100,12 +101,14 @@ NativeViewAccessibilityWin::GetTargetForNativeAccessibilityEvent() {
return HWNDForView(view()); return HWNDForView(view());
} }
gfx::RectF NativeViewAccessibilityWin::GetBoundsInScreen() const { gfx::Rect NativeViewAccessibilityWin::GetClippedScreenBoundsRect() const {
gfx::RectF bounds = gfx::RectF(view()->GetBoundsInScreen()); // We could optionally add clipping here if ever needed.
gfx::NativeView native_view = view()->GetWidget()->GetNativeView(); return GetUnclippedScreenBoundsRect();
float device_scale = ui::GetScaleFactorForNativeView(native_view); }
bounds.Scale(device_scale);
return bounds; gfx::Rect NativeViewAccessibilityWin::GetUnclippedScreenBoundsRect() const {
gfx::Rect bounds = view()->GetBoundsInScreen();
return display::win::ScreenWin::DIPToScreenRect(HWNDForView(view()), bounds);
} }
} // namespace views } // namespace views
...@@ -19,7 +19,8 @@ class NativeViewAccessibilityWin : public NativeViewAccessibilityBase { ...@@ -19,7 +19,8 @@ class NativeViewAccessibilityWin : public NativeViewAccessibilityBase {
// NativeViewAccessibilityBase: // NativeViewAccessibilityBase:
gfx::NativeViewAccessible GetParent() override; gfx::NativeViewAccessible GetParent() override;
gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
gfx::RectF GetBoundsInScreen() const override; gfx::Rect GetClippedScreenBoundsRect() const override;
gfx::Rect GetUnclippedScreenBoundsRect() const override;
DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment