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

Side by Side Diff: ui/aura/root_window.cc

Issue 14466005: Magnifier: Prevent the cursor jumping on HiDPI display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & use aura::test::EventGenerator::MoveMouseToInHost Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 scoped_ptr<RootWindowTransformer> transformer) { 521 scoped_ptr<RootWindowTransformer> transformer) {
522 transformer_ = transformer.Pass(); 522 transformer_ = transformer.Pass();
523 host_->SetInsets(transformer_->GetHostInsets()); 523 host_->SetInsets(transformer_->GetHostInsets());
524 Window::SetTransform(transformer_->GetTransform()); 524 Window::SetTransform(transformer_->GetTransform());
525 // If the layer is not animating, then we need to update the host size 525 // If the layer is not animating, then we need to update the host size
526 // immediately. 526 // immediately.
527 if (!layer()->GetAnimator()->is_animating()) 527 if (!layer()->GetAnimator()->is_animating())
528 OnHostResized(host_->GetBounds().size()); 528 OnHostResized(host_->GetBounds().size());
529 } 529 }
530 530
531 gfx::Transform RootWindow::GetRootTransform() const {
532 float scale = ui::GetDeviceScaleFactor(layer());
533 gfx::Transform transform;
534 transform.Scale(scale, scale);
535 transform *= transformer_->GetTransform();
536 return transform;
537 }
538
531 //////////////////////////////////////////////////////////////////////////////// 539 ////////////////////////////////////////////////////////////////////////////////
532 // RootWindow, ui::EventTarget implementation: 540 // RootWindow, ui::EventTarget implementation:
533 541
534 ui::EventTarget* RootWindow::GetParentTarget() { 542 ui::EventTarget* RootWindow::GetParentTarget() {
535 return client::GetEventClient(this) ? 543 return client::GetEventClient(this) ?
536 client::GetEventClient(this)->GetToplevelEventTarget() : 544 client::GetEventClient(this)->GetToplevelEventTarget() :
537 Env::GetInstance(); 545 Env::GetInstance();
538 } 546 }
539 547
540 //////////////////////////////////////////////////////////////////////////////// 548 ////////////////////////////////////////////////////////////////////////////////
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1160
1153 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's 1161 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's
1154 // currently broken. See/ crbug.com/107931. 1162 // currently broken. See/ crbug.com/107931.
1155 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 1163 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
1156 host_mouse_location, 1164 host_mouse_location,
1157 host_mouse_location, 1165 host_mouse_location,
1158 ui::EF_IS_SYNTHESIZED); 1166 ui::EF_IS_SYNTHESIZED);
1159 OnHostMouseEvent(&event); 1167 OnHostMouseEvent(&event);
1160 } 1168 }
1161 1169
1162 gfx::Transform RootWindow::GetRootTransform() const {
1163 float scale = ui::GetDeviceScaleFactor(layer());
1164 gfx::Transform transform;
1165 transform.Scale(scale, scale);
1166 transform *= transformer_->GetTransform();
1167 return transform;
1168 }
1169
1170 gfx::Transform RootWindow::GetInverseRootTransform() const { 1170 gfx::Transform RootWindow::GetInverseRootTransform() const {
1171 float scale = ui::GetDeviceScaleFactor(layer()); 1171 float scale = ui::GetDeviceScaleFactor(layer());
1172 gfx::Transform transform; 1172 gfx::Transform transform;
1173 transform.Scale(1.0f / scale, 1.0f / scale); 1173 transform.Scale(1.0f / scale, 1.0f / scale);
1174 return transformer_->GetInverseTransform() * transform; 1174 return transformer_->GetInverseTransform() * transform;
1175 } 1175 }
1176 1176
1177 } // namespace aura 1177 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698