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

Unified Diff: cc/layers/layer_impl.cc

Issue 784463002: Add initial CC support for scroll-blocks-on (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jdduke CR feedback Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/scroll_blocks_on.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 55ffa7fb994122e462ab07fe5099fa0bef581e6c..19f87e2b5f54256abdf29087eaf02ee98649d993 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -54,6 +54,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
should_scroll_on_main_thread_(false),
have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
+ scroll_blocks_on_(ScrollBlocksOnNone),
user_scrollable_horizontal_(true),
user_scrollable_vertical_(true),
stacking_order_changed_(false),
@@ -392,7 +393,8 @@ void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() {
InputHandler::ScrollStatus LayerImpl::TryScroll(
const gfx::PointF& screen_space_point,
- InputHandler::ScrollInputType type) const {
+ InputHandler::ScrollInputType type,
+ ScrollBlocksOn effective_block_mode) const {
if (should_scroll_on_main_thread()) {
TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread");
return InputHandler::ScrollOnMainThread;
@@ -430,7 +432,14 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
}
}
- if (type == InputHandler::Wheel && have_wheel_event_handlers()) {
+ if (have_scroll_event_handlers() &&
+ effective_block_mode & ScrollBlocksOnScrollEvent) {
+ TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers");
+ return InputHandler::ScrollOnMainThread;
+ }
+
+ if (type == InputHandler::Wheel && have_wheel_event_handlers() &&
+ effective_block_mode & ScrollBlocksOnWheelEvent) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
return InputHandler::ScrollOnMainThread;
}
@@ -487,6 +496,7 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
+ layer->SetScrollBlocksOn(scroll_blocks_on_);
layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
layer->SetContentsOpaque(contents_opaque_);
@@ -649,6 +659,17 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
result->Set("TouchRegion", region.release());
}
+ if (scroll_blocks_on_) {
+ list = new base::ListValue;
+ if (scroll_blocks_on_ & ScrollBlocksOnStartTouch)
+ list->AppendString("StartTouch");
+ if (scroll_blocks_on_ & ScrollBlocksOnWheelEvent)
+ list->AppendString("WheelEvent");
+ if (scroll_blocks_on_ & ScrollBlocksOnScrollEvent)
+ list->AppendString("ScrollEvent");
+ result->Set("ScrollBlocksOn", list);
+ }
+
list = new base::ListValue;
for (size_t i = 0; i < children_.size(); ++i)
list->Append(children_[i]->LayerTreeAsJson());
@@ -1440,6 +1461,9 @@ void LayerImpl::AsValueInto(base::debug::TracedValue* state) const {
non_fast_scrollable_region_.AsValueInto(state);
state->EndArray();
}
+ if (scroll_blocks_on_) {
+ state->SetInteger("scroll_blocks_on", scroll_blocks_on_);
+ }
state->BeginArray("children");
for (size_t i = 0; i < children_.size(); ++i) {
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/scroll_blocks_on.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698