Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 if ((scrolling_layer_impl == InnerViewportScrollLayer() && | 564 if ((scrolling_layer_impl == InnerViewportScrollLayer() && |
| 565 test_layer_impl == OuterViewportScrollLayer()) || | 565 test_layer_impl == OuterViewportScrollLayer()) || |
| 566 (scrolling_layer_impl == OuterViewportScrollLayer() && | 566 (scrolling_layer_impl == OuterViewportScrollLayer() && |
| 567 test_layer_impl == InnerViewportScrollLayer())) { | 567 test_layer_impl == InnerViewportScrollLayer())) { |
| 568 return true; | 568 return true; |
| 569 } | 569 } |
| 570 | 570 |
| 571 return false; | 571 return false; |
| 572 } | 572 } |
| 573 | 573 |
| 574 bool LayerTreeHostImpl::HaveWheelEventHandlersAt( | |
| 575 const gfx::Point& viewport_point) { | |
| 576 gfx::PointF device_viewport_point = gfx::ScalePoint( | |
| 577 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | |
| 578 | |
| 579 LayerImpl* layer_impl = | |
| 580 active_tree_->FindLayerWithWheelHandlerThatIsHitByPoint( | |
| 581 device_viewport_point); | |
| 582 | |
| 583 return layer_impl != NULL; | |
| 584 } | |
| 585 | |
| 586 static LayerImpl* NextLayerInScrollOrder(LayerImpl* layer) { | 574 static LayerImpl* NextLayerInScrollOrder(LayerImpl* layer) { |
| 587 if (layer->scroll_parent()) | 575 if (layer->scroll_parent()) |
| 588 return layer->scroll_parent(); | 576 return layer->scroll_parent(); |
| 589 | 577 |
| 590 return layer->parent(); | 578 return layer->parent(); |
| 591 } | 579 } |
| 592 | 580 |
| 593 static ScrollBlocksOn EffectiveScrollBlocksOn(LayerImpl* layer) { | 581 static ScrollBlocksOn EffectiveScrollBlocksOn(LayerImpl* layer) { |
| 594 ScrollBlocksOn blocks = SCROLL_BLOCKS_ON_NONE; | 582 ScrollBlocksOn blocks = SCROLL_BLOCKS_ON_NONE; |
| 595 for (; layer; layer = NextLayerInScrollOrder(layer)) { | 583 for (; layer; layer = NextLayerInScrollOrder(layer)) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 613 if (!(blocking & SCROLL_BLOCKS_ON_START_TOUCH)) | 601 if (!(blocking & SCROLL_BLOCKS_ON_START_TOUCH)) |
| 614 return false; | 602 return false; |
| 615 | 603 |
| 616 // Now determine if there are actually any handlers at that point. | 604 // Now determine if there are actually any handlers at that point. |
| 617 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272). | 605 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272). |
| 618 layer_impl = active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( | 606 layer_impl = active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( |
| 619 device_viewport_point); | 607 device_viewport_point); |
| 620 return layer_impl != NULL; | 608 return layer_impl != NULL; |
| 621 } | 609 } |
| 622 | 610 |
| 611 uint32_t LayerTreeHostImpl::EffectiveWheelEventListenerPropertiesAt( | |
| 612 const gfx::Point& viewport_point) { | |
| 613 gfx::PointF device_viewport_point = gfx::ScalePoint( | |
| 614 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | |
| 615 | |
| 616 LayerImpl* layer_impl = | |
| 617 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | |
| 618 | |
| 619 uint32_t result = EventListenerProperties::kNone; | |
| 620 for (; layer_impl; layer_impl = NextLayerInScrollOrder(layer_impl)) { | |
| 621 result |= layer_impl->wheel_event_properties(); | |
| 622 } | |
| 623 | |
| 624 return result; | |
| 625 } | |
| 626 | |
| 627 uint32_t LayerTreeHostImpl::EffectiveTouchEventListenerPropertiesAt( | |
| 628 const gfx::Point& viewport_point) { | |
| 629 gfx::PointF device_viewport_point = gfx::ScalePoint( | |
| 630 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | |
| 631 | |
| 632 LayerImpl* layer_impl = | |
| 633 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | |
| 634 | |
| 635 uint32_t result = EventListenerProperties::kNone; | |
|
tdresser
2016/01/26 16:34:37
Where is EventListenerProperties defined?
Could we
dtapuska
2016/01/26 16:53:15
Defined in dependent patch:
https://codereview.chr
tdresser
2016/01/26 18:45:42
What about something like:
struct EventListenerPro
dtapuska
2016/01/26 18:56:49
I think that limits the verbosity of the code. For
tdresser
2016/01/26 18:58:19
Good point.
SGTM
| |
| 636 for (; layer_impl; layer_impl = NextLayerInScrollOrder(layer_impl)) { | |
| 637 result |= layer_impl->touch_event_properties(); | |
| 638 } | |
| 639 | |
| 640 return result; | |
| 641 } | |
| 642 | |
| 623 scoped_ptr<SwapPromiseMonitor> | 643 scoped_ptr<SwapPromiseMonitor> |
| 624 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 644 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
| 625 ui::LatencyInfo* latency) { | 645 ui::LatencyInfo* latency) { |
| 626 return make_scoped_ptr( | 646 return make_scoped_ptr( |
| 627 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 647 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
| 628 } | 648 } |
| 629 | 649 |
| 630 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { | 650 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { |
| 631 DCHECK(!scroll_elasticity_helper_); | 651 DCHECK(!scroll_elasticity_helper_); |
| 632 if (settings_.enable_elastic_overscroll) { | 652 if (settings_.enable_elastic_overscroll) { |
| (...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3902 return task_runner_provider_->HasImplThread(); | 3922 return task_runner_provider_->HasImplThread(); |
| 3903 } | 3923 } |
| 3904 | 3924 |
| 3905 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3925 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3906 // In single threaded mode we skip the pending tree and commit directly to the | 3926 // In single threaded mode we skip the pending tree and commit directly to the |
| 3907 // active tree. | 3927 // active tree. |
| 3908 return !task_runner_provider_->HasImplThread(); | 3928 return !task_runner_provider_->HasImplThread(); |
| 3909 } | 3929 } |
| 3910 | 3930 |
| 3911 } // namespace cc | 3931 } // namespace cc |
| OLD | NEW |