Commit 3ea46ce5 authored by Hiroki Sato's avatar Hiroki Sato Committed by Commit Bot

Clean up ARC++ a11y bounds computation

This CL cleans up the a11y bounds computations in ARC++;
- Aggregate the bounds computation logic inside
  AccessibilityInfoDataWrapper.
- Explicitly use |offset_container_id| of AXRelativeBounds.
_ Keep the device scale factor in AXTreeSourceArc. Set and update it
  from ArcAccessibilityHelperBridge.

This CL also fixes the bounds computation of notification window and
input method window, which were currently not adjusted by device
scaling.

Bug: b:147707554
Test: manual. Open PlayStore, change device scale factor by Ctrl +/-, bounds are correct.
Test: manual. Open TalkBack-test app, create notification windows, bounds are correct.
Change-Id: Ie5f6904fcf8c18fd86d9fc1e99a1db7970a14be9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066411
Commit-Queue: Hiroki Sato <hirokisato@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Reviewed-by: default avatarSara Kato <sarakato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746603}
parent c55478f5
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
#include "chrome/browser/chromeos/arc/accessibility/accessibility_info_data_wrapper.h" #include "chrome/browser/chromeos/arc/accessibility/accessibility_info_data_wrapper.h"
#include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h" #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h"
#include "chrome/browser/chromeos/arc/accessibility/geometry_util.h"
#include "components/exo/wm_helper.h" #include "components/exo/wm_helper.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
namespace arc { namespace arc {
...@@ -16,33 +20,47 @@ AccessibilityInfoDataWrapper::AccessibilityInfoDataWrapper( ...@@ -16,33 +20,47 @@ AccessibilityInfoDataWrapper::AccessibilityInfoDataWrapper(
void AccessibilityInfoDataWrapper::Serialize(ui::AXNodeData* out_data) const { void AccessibilityInfoDataWrapper::Serialize(ui::AXNodeData* out_data) const {
out_data->id = GetId(); out_data->id = GetId();
PopulateAXRole(out_data); PopulateAXRole(out_data);
PopulateBounds(out_data);
}
void AccessibilityInfoDataWrapper::PopulateBounds(
ui::AXNodeData* out_data) const {
AccessibilityInfoDataWrapper* root = tree_source_->GetRoot();
gfx::Rect info_data_bounds = GetBounds();
gfx::RectF& out_bounds = out_data->relative_bounds.bounds;
if (root && exo::WMHelper::HasInstance()) {
if (tree_source_->is_notification() ||
tree_source_->is_input_method_window() || root->GetId() != GetId()) {
// By default, populate the bounds relative to the tree root.
const gfx::Rect& root_bounds = root->GetBounds();
exo::WMHelper* wm_helper = info_data_bounds.Offset(-1 * root_bounds.x(), -1 * root_bounds.y());
exo::WMHelper::HasInstance() ? exo::WMHelper::GetInstance() : nullptr; out_bounds = ToChromeScale(info_data_bounds);
out_data->relative_bounds.offset_container_id = root->GetId();
if (tree_source_->GetRoot() && wm_helper) { } else {
// This is the computed bounds which relies upon the existence of an // For the root node of application tree, populate the bounds to be
// associated focused window and a root node. // relative to its container View.
aura::Window* active_window = (tree_source_->is_notification() || views::Widget* widget = views::Widget::GetWidgetForNativeView(
tree_source_->is_input_method_window()) exo::WMHelper::GetInstance()->GetActiveWindow());
? nullptr DCHECK(widget);
: wm_helper->GetActiveWindow(); DCHECK(widget->widget_delegate());
const gfx::Rect& local_bounds = tree_source_->GetBounds( DCHECK(widget->widget_delegate()->GetContentsView());
tree_source_->GetFromId(GetId()), active_window); const gfx::Rect& root_bounds =
out_data->relative_bounds.bounds.SetRect(local_bounds.x(), local_bounds.y(), widget->widget_delegate()->GetContentsView()->GetBoundsInScreen();
local_bounds.width(),
local_bounds.height()); out_bounds = ToChromeBounds(info_data_bounds, widget);
out_bounds.Offset(-1 * root_bounds.x(), -1 * root_bounds.y());
}
// |out_bounds| is in Chrome DPI here. As ARC is considered the same as web
// in Chrome automation, scale the bounds by device scale factor.
out_bounds.Scale(tree_source_->device_scale_factor());
} else { } else {
// We cannot compute global bounds, so use the raw bounds. // We cannot compute global bounds, so use the raw bounds.
const auto& bounds = GetBounds(); out_bounds.SetRect(info_data_bounds.x(), info_data_bounds.y(),
out_data->relative_bounds.bounds.SetRect(bounds.x(), bounds.y(), info_data_bounds.width(), info_data_bounds.height());
bounds.width(), bounds.height());
} }
// TODO(hirokisato): Try using offset_container_id to make bounds calculations
// more efficient. If this is the child of the root, set the
// offset_container_id to be the root. Otherwise, set it to the first node
// child of the root.
} }
} // namespace arc } // namespace arc
...@@ -43,6 +43,14 @@ class AccessibilityInfoDataWrapper { ...@@ -43,6 +43,14 @@ class AccessibilityInfoDataWrapper {
protected: protected:
AXTreeSourceArc* tree_source_; AXTreeSourceArc* tree_source_;
private:
// Populate bounds of a node which can be passed to AXNodeData.location.
// Bounds are returned in the following coordinates depending on whether it's
// root or not.
// - Root node is relative to its container, i.e. focused window.
// - Non-root node is relative to the root node of this tree.
void PopulateBounds(ui::AXNodeData* out_data) const;
}; };
} // namespace arc } // namespace arc
......
...@@ -46,6 +46,12 @@ using ash::ArcNotificationSurfaceManager; ...@@ -46,6 +46,12 @@ using ash::ArcNotificationSurfaceManager;
namespace { namespace {
float DeviceScaleFactorFromWindow(aura::Window* window) {
if (!window || !window->GetToplevelWindow())
return 1.0;
return window->GetToplevelWindow()->layer()->device_scale_factor();
}
void DispatchFocusChange(arc::mojom::AccessibilityNodeInfoData* node_data, void DispatchFocusChange(arc::mojom::AccessibilityNodeInfoData* node_data,
Profile* profile) { Profile* profile) {
chromeos::AccessibilityManager* accessibility_manager = chromeos::AccessibilityManager* accessibility_manager =
...@@ -388,16 +394,25 @@ void ArcAccessibilityHelperBridge::OnNotificationStateChanged( ...@@ -388,16 +394,25 @@ void ArcAccessibilityHelperBridge::OnNotificationStateChanged(
auto key = KeyForNotification(notification_key); auto key = KeyForNotification(notification_key);
switch (state) { switch (state) {
case arc::mojom::AccessibilityNotificationStateType::SURFACE_CREATED: { case arc::mojom::AccessibilityNotificationStateType::SURFACE_CREATED: {
if (GetFromKey(key)) aura::Window* window = nullptr;
return; auto* surface_manager = ArcNotificationSurfaceManager::Get();
if (surface_manager) {
ArcNotificationSurface* surface =
surface_manager->GetArcSurface(notification_key);
if (surface)
window = surface->GetWindow();
}
AXTreeSourceArc* tree_source = CreateFromKey(std::move(key)); AXTreeSourceArc* tree_source = GetFromKey(key);
ui::AXTreeData tree_data; if (tree_source) {
if (!tree_source->GetTreeData(&tree_data)) { tree_source->set_device_scale_factor(
NOTREACHED(); DeviceScaleFactorFromWindow(window));
return; return;
} }
UpdateTreeIdOfNotificationSurface(notification_key, tree_data.tree_id);
tree_source = CreateFromKey(std::move(key), window);
UpdateTreeIdOfNotificationSurface(notification_key,
tree_source->ax_tree_id());
break; break;
} }
case arc::mojom::AccessibilityNotificationStateType::SURFACE_REMOVED: case arc::mojom::AccessibilityNotificationStateType::SURFACE_REMOVED:
...@@ -499,11 +514,9 @@ void ArcAccessibilityHelperBridge::OnNotificationSurfaceAdded( ...@@ -499,11 +514,9 @@ void ArcAccessibilityHelperBridge::OnNotificationSurfaceAdded(
if (!tree) if (!tree)
return; return;
ui::AXTreeData tree_data; surface->SetAXTreeId(tree->ax_tree_id());
if (!tree->GetTreeData(&tree_data)) tree->set_device_scale_factor(
return; DeviceScaleFactorFromWindow(surface->GetWindow()));
surface->SetAXTreeId(tree_data.tree_id);
// Dispatch ax::mojom::Event::kChildrenChanged to force AXNodeData of the // Dispatch ax::mojom::Event::kChildrenChanged to force AXNodeData of the
// notification updated. As order of OnNotificationSurfaceAdded call is not // notification updated. As order of OnNotificationSurfaceAdded call is not
...@@ -624,7 +637,7 @@ ArcAccessibilityHelperBridge::OnGetTextLocationDataResultInternal( ...@@ -624,7 +637,7 @@ ArcAccessibilityHelperBridge::OnGetTextLocationDataResultInternal(
return base::nullopt; return base::nullopt;
gfx::RectF rect_f = arc::ToChromeScale(*result_rect); gfx::RectF rect_f = arc::ToChromeScale(*result_rect);
arc::ScaleDeviceFactor(rect_f, active_window->GetToplevelWindow()); rect_f.Scale(DeviceScaleFactorFromWindow(active_window));
return gfx::ToEnclosingRect(rect_f); return gfx::ToEnclosingRect(rect_f);
} }
...@@ -716,7 +729,7 @@ void ArcAccessibilityHelperBridge::UpdateWindowProperties( ...@@ -716,7 +729,7 @@ void ArcAccessibilityHelperBridge::UpdateWindowProperties(
TreeKey key = KeyForTaskId(task_id); TreeKey key = KeyForTaskId(task_id);
AXTreeSourceArc* tree = GetFromKey(key); AXTreeSourceArc* tree = GetFromKey(key);
if (!tree) if (!tree)
tree = CreateFromKey(std::move(key)); tree = CreateFromKey(std::move(key), window);
// Just after the creation of window, widget has not been set yet and this // Just after the creation of window, widget has not been set yet and this
// is not dispatched to ShellSurfaceBase. Thus, call this every time. // is not dispatched to ShellSurfaceBase. Thus, call this every time.
...@@ -804,10 +817,9 @@ void ArcAccessibilityHelperBridge::HandleFilterTypeAllEvent( ...@@ -804,10 +817,9 @@ void ArcAccessibilityHelperBridge::HandleFilterTypeAllEvent(
return; return;
if (!trees_.count(KeyForInputMethod())) { if (!trees_.count(KeyForInputMethod())) {
auto* tree = CreateFromKey(KeyForInputMethod()); auto* tree = CreateFromKey(KeyForInputMethod(),
ui::AXTreeData tree_data; input_method_surface->host_window());
tree->GetTreeData(&tree_data); input_method_surface->SetChildAxTreeId(tree->ax_tree_id());
input_method_surface->SetChildAxTreeId(tree_data.tree_id);
} }
tree_source = GetFromKey(KeyForInputMethod()); tree_source = GetFromKey(KeyForInputMethod());
...@@ -832,8 +844,11 @@ void ArcAccessibilityHelperBridge::HandleFilterTypeAllEvent( ...@@ -832,8 +844,11 @@ void ArcAccessibilityHelperBridge::HandleFilterTypeAllEvent(
tree_source = GetFromKey(key); tree_source = GetFromKey(key);
if (!tree_source) { if (!tree_source) {
tree_source = CreateFromKey(key); tree_source = CreateFromKey(key, active_window);
SetChildAxTreeIDForWindow(active_window, tree_source->ax_tree_id()); SetChildAxTreeIDForWindow(active_window, tree_source->ax_tree_id());
} else {
tree_source->set_device_scale_factor(
DeviceScaleFactorFromWindow(active_window));
} }
} }
...@@ -884,8 +899,11 @@ void ArcAccessibilityHelperBridge::DispatchCustomSpokenFeedbackToggled( ...@@ -884,8 +899,11 @@ void ArcAccessibilityHelperBridge::DispatchCustomSpokenFeedbackToggled(
GetEventRouter()->BroadcastEvent(std::move(event)); GetEventRouter()->BroadcastEvent(std::move(event));
} }
AXTreeSourceArc* ArcAccessibilityHelperBridge::CreateFromKey(TreeKey key) { AXTreeSourceArc* ArcAccessibilityHelperBridge::CreateFromKey(
auto tree = std::make_unique<AXTreeSourceArc>(this); TreeKey key,
aura::Window* window) {
auto tree = std::make_unique<AXTreeSourceArc>(
this, DeviceScaleFactorFromWindow(window));
auto* tree_ptr = tree.get(); auto* tree_ptr = tree.get();
trees_.insert(std::make_pair(std::move(key), std::move(tree))); trees_.insert(std::make_pair(std::move(key), std::move(tree)));
return tree_ptr; return tree_ptr;
......
...@@ -158,7 +158,7 @@ class ArcAccessibilityHelperBridge ...@@ -158,7 +158,7 @@ class ArcAccessibilityHelperBridge
void DispatchCustomSpokenFeedbackToggled(bool enabled) const; void DispatchCustomSpokenFeedbackToggled(bool enabled) const;
AXTreeSourceArc* CreateFromKey(TreeKey); AXTreeSourceArc* CreateFromKey(TreeKey, aura::Window* window);
AXTreeSourceArc* GetFromKey(const TreeKey&); AXTreeSourceArc* GetFromKey(const TreeKey&);
AXTreeSourceArc* GetFromTreeId(ui::AXTreeID tree_id) const; AXTreeSourceArc* GetFromTreeId(ui::AXTreeID tree_id) const;
......
...@@ -18,13 +18,7 @@ ...@@ -18,13 +18,7 @@
#include "extensions/browser/api/automation_internal/automation_event_router.h" #include "extensions/browser/api/automation_internal/automation_event_router.h"
#include "extensions/common/extension_messages.h" #include "extensions/common/extension_messages.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/platform/ax_android_constants.h" #include "ui/gfx/geometry/rect.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
namespace arc { namespace arc {
...@@ -53,8 +47,9 @@ bool IsDrawerLayout(AXNodeInfoData* node) { ...@@ -53,8 +47,9 @@ bool IsDrawerLayout(AXNodeInfoData* node) {
} }
} // namespace } // namespace
AXTreeSourceArc::AXTreeSourceArc(Delegate* delegate) AXTreeSourceArc::AXTreeSourceArc(Delegate* delegate, float device_scale_factor)
: current_tree_serializer_(new AXTreeArcSerializer(this)), : device_scale_factor_(device_scale_factor),
current_tree_serializer_(new AXTreeArcSerializer(this)),
is_notification_(false), is_notification_(false),
is_input_method_window_(false), is_input_method_window_(false),
delegate_(delegate) {} delegate_(delegate) {}
...@@ -221,12 +216,17 @@ void AXTreeSourceArc::NotifyAccessibilityEvent(AXEventData* event_data) { ...@@ -221,12 +216,17 @@ void AXTreeSourceArc::NotifyAccessibilityEvent(AXEventData* event_data) {
event_bundle.updates.emplace_back(); event_bundle.updates.emplace_back();
// Force the tree, starting at the target of the event, to update, so // Force the tree, to update, so unignored fields get updated.
// unignored fields get updated. // On event type of WINDOW_STATE_CHANGED, update the entire tree so that
event_bundle.updates[0].node_id_to_clear = event_data->source_id; // window location is correctly calculated.
current_tree_serializer_->InvalidateSubtree(GetFromId(event_data->source_id)); int32_t node_id_to_clear =
(event_data->event_type == AXEventType::WINDOW_STATE_CHANGED)
current_tree_serializer_->SerializeChanges(GetFromId(event_data->source_id), ? *root_id_
: event_data->source_id;
event_bundle.updates[0].node_id_to_clear = node_id_to_clear;
current_tree_serializer_->InvalidateSubtree(GetFromId(node_id_to_clear));
current_tree_serializer_->SerializeChanges(GetFromId(node_id_to_clear),
&event_bundle.updates.back()); &event_bundle.updates.back());
GetAutomationEventRouter()->DispatchAccessibilityEvents(event_bundle); GetAutomationEventRouter()->DispatchAccessibilityEvents(event_bundle);
...@@ -251,48 +251,6 @@ void AXTreeSourceArc::UpdateAccessibilityFocusLocation(int32_t id) { ...@@ -251,48 +251,6 @@ void AXTreeSourceArc::UpdateAccessibilityFocusLocation(int32_t id) {
chrome_focused_bounds_ = node->GetBounds(); chrome_focused_bounds_ = node->GetBounds();
} }
const gfx::Rect AXTreeSourceArc::GetBounds(
AccessibilityInfoDataWrapper* info_data,
aura::Window* active_window) const {
DCHECK(root_id_.has_value());
gfx::Rect info_data_bounds = info_data->GetBounds();
if (!active_window) {
const gfx::Rect root_bounds = GetRoot()->GetBounds();
info_data_bounds.Offset(-1 * root_bounds.x(), -1 * root_bounds.y());
return info_data_bounds;
}
// By default, the node bounds is relative to the tree root.
if (info_data->GetId() != root_id_) {
const gfx::Rect root_bounds = GetRoot()->GetBounds();
info_data_bounds.Offset(-1 * root_bounds.x(), -1 * root_bounds.y());
gfx::RectF info_data_bounds_f = ToChromeScale(info_data_bounds);
arc::ScaleDeviceFactor(info_data_bounds_f,
active_window->GetToplevelWindow());
return gfx::ToEnclosingRect(info_data_bounds_f);
}
// For the root node, the node bounds is relative to its container View.
views::Widget* widget = views::Widget::GetWidgetForNativeView(active_window);
DCHECK(widget);
gfx::RectF info_data_bounds_f = arc::ToChromeBounds(info_data_bounds, widget);
DCHECK(widget->widget_delegate());
DCHECK(widget->widget_delegate()->GetContentsView());
const gfx::Rect root_bounds =
widget->widget_delegate()->GetContentsView()->GetBoundsInScreen();
info_data_bounds_f.Offset(-1 * root_bounds.x(), -1 * root_bounds.y());
arc::ScaleDeviceFactor(info_data_bounds_f,
active_window->GetToplevelWindow());
return gfx::ToEnclosingRect(info_data_bounds_f);
}
void AXTreeSourceArc::InvalidateTree() { void AXTreeSourceArc::InvalidateTree() {
current_tree_serializer_->Reset(); current_tree_serializer_->Reset();
} }
......
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include "ui/accessibility/ax_tree_source.h" #include "ui/accessibility/ax_tree_source.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace aura {
class Window;
}
namespace ui { namespace ui {
struct AXEvent; struct AXEvent;
} }
...@@ -47,7 +43,7 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*, ...@@ -47,7 +43,7 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*,
virtual void OnAction(const ui::AXActionData& data) const = 0; virtual void OnAction(const ui::AXActionData& data) const = 0;
}; };
explicit AXTreeSourceArc(Delegate* delegate); AXTreeSourceArc(Delegate* delegate, float device_scale_factor);
~AXTreeSourceArc() override; ~AXTreeSourceArc() override;
// Notify automation of an accessibility event. // Notify automation of an accessibility event.
...@@ -63,16 +59,6 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*, ...@@ -63,16 +59,6 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*,
// Update Chrome's accessibility focused node by id. // Update Chrome's accessibility focused node by id.
void UpdateAccessibilityFocusLocation(int32_t id); void UpdateAccessibilityFocusLocation(int32_t id);
// Returns bounds of a node which can be passed to AXNodeData.location. Bounds
// are returned in the following coordinates depending on whether it's root or
// not.
// - Root node is relative to its container, i.e. focused window.
// - Non-root node is relative to the root node of this tree.
//
// focused_window is nullptr for notification.
const gfx::Rect GetBounds(AccessibilityInfoDataWrapper* info_data,
aura::Window* focused_window) const;
// Invalidates the tree serializer. // Invalidates the tree serializer.
void InvalidateTree(); void InvalidateTree();
...@@ -89,6 +75,9 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*, ...@@ -89,6 +75,9 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*,
void SerializeNode(AccessibilityInfoDataWrapper* info_data, void SerializeNode(AccessibilityInfoDataWrapper* info_data,
ui::AXNodeData* out_data) const override; ui::AXNodeData* out_data) const override;
float device_scale_factor() const { return device_scale_factor_; }
void set_device_scale_factor(float dsf) { device_scale_factor_ = dsf; }
bool is_notification() { return is_notification_; } bool is_notification() { return is_notification_; }
bool is_input_method_window() { return is_input_method_window_; } bool is_input_method_window() { return is_input_method_window_; }
...@@ -166,6 +155,9 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*, ...@@ -166,6 +155,9 @@ class AXTreeSourceArc : public ui::AXTreeSource<AccessibilityInfoDataWrapper*,
// Maps an AccessibilityInfoDataWrapper ID to its tree data. // Maps an AccessibilityInfoDataWrapper ID to its tree data.
std::map<int32_t, std::unique_ptr<AccessibilityInfoDataWrapper>> tree_map_; std::map<int32_t, std::unique_ptr<AccessibilityInfoDataWrapper>> tree_map_;
// The device scale factor of the display which the window is on.
float device_scale_factor_;
// Maps an AccessibilityInfoDataWrapper ID to its parent. // Maps an AccessibilityInfoDataWrapper ID to its parent.
std::map<int32_t, int32_t> parent_map_; std::map<int32_t, int32_t> parent_map_;
......
...@@ -142,7 +142,7 @@ class AXTreeSourceArcTest : public testing::Test, ...@@ -142,7 +142,7 @@ class AXTreeSourceArcTest : public testing::Test,
public: public:
TestAXTreeSourceArc(AXTreeSourceArc::Delegate* delegate, TestAXTreeSourceArc(AXTreeSourceArc::Delegate* delegate,
MockAutomationEventRouter* router) MockAutomationEventRouter* router)
: AXTreeSourceArc(delegate), router_(router) {} : AXTreeSourceArc(delegate, 1.0), router_(router) {}
private: private:
extensions::AutomationEventRouterInterface* GetAutomationEventRouter() extensions::AutomationEventRouterInterface* GetAutomationEventRouter()
......
...@@ -35,11 +35,6 @@ gfx::RectF ToChromeBounds(const gfx::Rect& bounds, views::Widget* widget) { ...@@ -35,11 +35,6 @@ gfx::RectF ToChromeBounds(const gfx::Rect& bounds, views::Widget* widget) {
return chrome_bounds; return chrome_bounds;
} }
void ScaleDeviceFactor(gfx::RectF& bounds, aura::Window* toplevel_window) {
DCHECK(toplevel_window);
bounds.Scale(toplevel_window->layer()->device_scale_factor());
}
} // namespace arc } // namespace arc
#endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_GEOMETRY_UTIL_H_ #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_GEOMETRY_UTIL_H_
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
// TODO(hirokisato) support multiple display. // TODO(hirokisato) support multiple display.
namespace aura {
class Window;
}
namespace gfx { namespace gfx {
class RectF; class RectF;
} }
...@@ -27,9 +23,6 @@ gfx::RectF ToChromeScale(const gfx::Rect& rect); ...@@ -27,9 +23,6 @@ gfx::RectF ToChromeScale(const gfx::Rect& rect);
// Given ARC pixels in screen coordinate, returns DIPs in Chrome OS main // Given ARC pixels in screen coordinate, returns DIPs in Chrome OS main
// display. This function adjusts differences between ARC and Chrome. // display. This function adjusts differences between ARC and Chrome.
gfx::RectF ToChromeBounds(const gfx::Rect& rect, views::Widget* widget); gfx::RectF ToChromeBounds(const gfx::Rect& rect, views::Widget* widget);
// Given DIPs in Chrome OS main display, scales it into pixels.
void ScaleDeviceFactor(gfx::RectF& rect, aura::Window* toplevel_window);
} // namespace arc } // namespace arc
#endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_GEOMETRY_UTIL_H_ #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_GEOMETRY_UTIL_H_
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