Index: ui/aura/root_window.cc |
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc |
index 7c95443b8a92cad7ce7b2ec2bb60d9b145fb4be2..89db56dd9e55cc6b91b063f79925662cccf829e2 100644 |
--- a/ui/aura/root_window.cc |
+++ b/ui/aura/root_window.cc |
@@ -671,6 +671,24 @@ void RootWindow::ClearMouseHandlers() { |
void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) { |
event->UpdateForRootTransform(GetRootTransform()); |
+#if defined(OS_CHROMEOS) |
oshima
2013/03/20 20:52:53
I put inside ifdef to avoid potential issues on wi
|
+ const gfx::Rect& root_bounds = bounds(); |
+ if (host_->GetBounds().Contains(event->system_location()) && |
+ !root_bounds.Contains(event->root_location())) { |
+ // Make sure that the mouse location inside the host window gets |
+ // translated inside root window. |
+ // TODO(oshima): This is (hopefully) short term bandaid to deal |
+ // with calculation error in inverted matrix. We'll try better |
+ // alternative (crbug.com/222483) for m28. |
+ int x = event->location().x(); |
+ int y = event->location().y(); |
+ x = std::min(std::max(x, root_bounds.x()), root_bounds.right()); |
+ y = std::min(std::max(y, root_bounds.y()), root_bounds.bottom()); |
+ const gfx::Point new_location(x, y); |
+ event->set_location(new_location); |
+ event->set_root_location(new_location); |
+ } |
+#endif // defined(OS_CHROMEOS) |
} |
void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { |