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

Unified Diff: cc/layers/layer_impl.cc

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/picture_image_layer.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..eae36859f35be17e6919cc056b5c2e9123d3b9cd 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());
@@ -1080,22 +1101,15 @@ void LayerImpl::PushScrollOffsetFromMainThread(
PushScrollOffset(&scroll_offset);
}
+void LayerImpl::PushScrollOffsetFromMainThreadAndClobberActiveValue(
+ const gfx::ScrollOffset& scroll_offset) {
+ scroll_offset_->set_clobber_active_value();
+ PushScrollOffset(&scroll_offset);
+}
+
gfx::ScrollOffset LayerImpl::PullDeltaForMainThread() {
RefreshFromScrollDelegate();
-
- // TODO(aelias, miletus): Remove all this temporary flooring machinery when
- // Blink fully supports fractional scrolls.
- gfx::ScrollOffset current_offset = CurrentScrollOffset();
- gfx::Vector2dF current_delta = ScrollDelta();
- gfx::Vector2dF floored_delta(floor(current_delta.x()),
- floor(current_delta.y()));
- gfx::Vector2dF diff_delta = floored_delta - current_delta;
- gfx::ScrollOffset tmp_offset = ScrollOffsetWithDelta(current_offset,
- diff_delta);
- scroll_offset_->SetCurrent(tmp_offset);
- gfx::ScrollOffset delta = scroll_offset_->PullDeltaForMainThread();
- scroll_offset_->SetCurrent(current_offset);
- return delta;
+ return scroll_offset_->PullDeltaForMainThread();
}
void LayerImpl::RefreshFromScrollDelegate() {
@@ -1140,8 +1154,6 @@ void LayerImpl::PushScrollOffset(const gfx::ScrollOffset* scroll_offset) {
}
if (IsActive()) {
changed |= scroll_offset_->PushPendingToActive();
- if (layer_animation_controller_->scroll_offset_animation_was_interrupted())
- SetScrollDelta(gfx::Vector2dF());
}
if (changed)
@@ -1177,6 +1189,9 @@ void LayerImpl::DidBeginTracing() {}
void LayerImpl::ReleaseResources() {}
+void LayerImpl::RecreateResources() {
+}
+
gfx::ScrollOffset LayerImpl::MaxScrollOffset() const {
if (!scroll_clip_layer_ || bounds().IsEmpty())
return gfx::ScrollOffset();
@@ -1440,6 +1455,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/picture_image_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698