OLD | NEW |
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 #ifndef UI_AURA_ROOT_WINDOW_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_H_ |
6 #define UI_AURA_ROOT_WINDOW_H_ | 6 #define UI_AURA_ROOT_WINDOW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ui/base/events/event_constants.h" | 21 #include "ui/base/events/event_constants.h" |
22 #include "ui/base/events/event_dispatcher.h" | 22 #include "ui/base/events/event_dispatcher.h" |
23 #include "ui/base/gestures/gesture_recognizer.h" | 23 #include "ui/base/gestures/gesture_recognizer.h" |
24 #include "ui/base/gestures/gesture_types.h" | 24 #include "ui/base/gestures/gesture_types.h" |
25 #include "ui/compositor/compositor.h" | 25 #include "ui/compositor/compositor.h" |
26 #include "ui/compositor/compositor_observer.h" | 26 #include "ui/compositor/compositor_observer.h" |
27 #include "ui/compositor/layer_animation_observer.h" | 27 #include "ui/compositor/layer_animation_observer.h" |
28 #include "ui/gfx/insets.h" | 28 #include "ui/gfx/insets.h" |
29 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
30 #include "ui/gfx/point.h" | 30 #include "ui/gfx/point.h" |
| 31 #include "ui/gfx/transform.h" |
31 | 32 |
32 class SkCanvas; | 33 class SkCanvas; |
33 | 34 |
34 namespace gfx { | 35 namespace gfx { |
35 class Size; | 36 class Size; |
36 class Transform; | 37 class Transform; |
37 } | 38 } |
38 | 39 |
39 namespace ui { | 40 namespace ui { |
40 class GestureEvent; | 41 class GestureEvent; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 virtual void SetNativeCapture() OVERRIDE; | 287 virtual void SetNativeCapture() OVERRIDE; |
287 virtual void ReleaseNativeCapture() OVERRIDE; | 288 virtual void ReleaseNativeCapture() OVERRIDE; |
288 | 289 |
289 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. | 290 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. |
290 bool QueryMouseLocationForTest(gfx::Point* point) const; | 291 bool QueryMouseLocationForTest(gfx::Point* point) const; |
291 | 292 |
292 // Clears internal mouse state (such as mouse ups should be sent to the same | 293 // Clears internal mouse state (such as mouse ups should be sent to the same |
293 // window that ate mouse downs). | 294 // window that ate mouse downs). |
294 void ClearMouseHandlers(); | 295 void ClearMouseHandlers(); |
295 | 296 |
| 297 // Sets the window's transform and inverted transform. This is necessary |
| 298 // to reverse translate the point without computation error. |
| 299 // TODO(oshima): Remove this once the computation error is resolved. |
| 300 // crbug.com/222483. |
| 301 void SetTransformPair(const gfx::Transform& transform, |
| 302 const gfx::Transform& inverted); |
| 303 |
296 private: | 304 private: |
297 FRIEND_TEST_ALL_PREFIXES(RootWindowTest, KeepTranslatedEventInRoot); | 305 FRIEND_TEST_ALL_PREFIXES(RootWindowTest, KeepTranslatedEventInRoot); |
298 | 306 |
299 friend class Window; | 307 friend class Window; |
300 friend class TestScreen; | 308 friend class TestScreen; |
301 | 309 |
302 // The parameter for OnWindowHidden() to specify why window is hidden. | 310 // The parameter for OnWindowHidden() to specify why window is hidden. |
303 enum WindowHiddenReason { | 311 enum WindowHiddenReason { |
304 WINDOW_DESTROYED, // Window is destroyed. | 312 WINDOW_DESTROYED, // Window is destroyed. |
305 WINDOW_HIDDEN, // Window is hidden. | 313 WINDOW_HIDDEN, // Window is hidden. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 RootWindow* new_root); | 351 RootWindow* new_root); |
344 | 352 |
345 // Cleans up the gesture recognizer for all windows in |window| (including | 353 // Cleans up the gesture recognizer for all windows in |window| (including |
346 // |window| itself). | 354 // |window| itself). |
347 void CleanupGestureRecognizerState(Window* window); | 355 void CleanupGestureRecognizerState(Window* window); |
348 | 356 |
349 // Updates the root window's size using |host_size|, current | 357 // Updates the root window's size using |host_size|, current |
350 // transform and insets. | 358 // transform and insets. |
351 void UpdateWindowSize(const gfx::Size& host_size); | 359 void UpdateWindowSize(const gfx::Size& host_size); |
352 | 360 |
353 void SetTransformInternal(const gfx::Transform& transform); | 361 void SetTransformInternal(const gfx::Transform& transform, |
| 362 const gfx::Transform& insert); |
354 | 363 |
355 // Overridden from ui::EventDispatcherDelegate. | 364 // Overridden from ui::EventDispatcherDelegate. |
356 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; | 365 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; |
357 | 366 |
358 // Overridden from ui::GestureEventHelper. | 367 // Overridden from ui::GestureEventHelper. |
359 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; | 368 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; |
360 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; | 369 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; |
361 | 370 |
362 // Overridden from ui::LayerAnimationObserver: | 371 // Overridden from ui::LayerAnimationObserver: |
363 virtual void OnLayerAnimationEnded( | 372 virtual void OnLayerAnimationEnded( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 408 |
400 // Posts a task to send synthesized mouse move event if there | 409 // Posts a task to send synthesized mouse move event if there |
401 // is no a pending task. | 410 // is no a pending task. |
402 void PostMouseMoveEventAfterWindowChange(); | 411 void PostMouseMoveEventAfterWindowChange(); |
403 | 412 |
404 // Creates and dispatches synthesized mouse move event using the | 413 // Creates and dispatches synthesized mouse move event using the |
405 // current mouse location. | 414 // current mouse location. |
406 void SynthesizeMouseMoveEvent(); | 415 void SynthesizeMouseMoveEvent(); |
407 | 416 |
408 gfx::Transform GetRootTransform() const; | 417 gfx::Transform GetRootTransform() const; |
| 418 gfx::Transform GetInvertedRootTransform() const; |
409 | 419 |
410 scoped_ptr<ui::Compositor> compositor_; | 420 scoped_ptr<ui::Compositor> compositor_; |
411 | 421 |
412 scoped_ptr<RootWindowHost> host_; | 422 scoped_ptr<RootWindowHost> host_; |
413 | 423 |
414 // Used to schedule painting. | 424 // Used to schedule painting. |
415 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; | 425 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; |
416 | 426 |
417 // Use to post mouse move event. | 427 // Use to post mouse move event. |
418 base::WeakPtrFactory<RootWindow> event_factory_; | 428 base::WeakPtrFactory<RootWindow> event_factory_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 base::WeakPtrFactory<RootWindow> repostable_event_factory_; | 465 base::WeakPtrFactory<RootWindow> repostable_event_factory_; |
456 | 466 |
457 scoped_ptr<ui::ViewProp> prop_; | 467 scoped_ptr<ui::ViewProp> prop_; |
458 | 468 |
459 // The scale of the root window. This is used to expand the | 469 // The scale of the root window. This is used to expand the |
460 // area of the root window (useful in HighDPI display). | 470 // area of the root window (useful in HighDPI display). |
461 // Note that this should not be confused with the device scale | 471 // Note that this should not be confused with the device scale |
462 // factor, which specfies the pixel density of the display. | 472 // factor, which specfies the pixel density of the display. |
463 float root_window_scale_; | 473 float root_window_scale_; |
464 | 474 |
| 475 // The invert of |layer()|'s transform. |
| 476 gfx::Transform invert_transform_; |
| 477 |
465 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 478 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
466 }; | 479 }; |
467 | 480 |
468 } // namespace aura | 481 } // namespace aura |
469 | 482 |
470 #endif // UI_AURA_ROOT_WINDOW_H_ | 483 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |