Fix crash when scrolling to the bottom of an iframe with --root-layer-scrolls

This commit is contained in:
Marshall Greenblatt
2016-08-22 17:17:23 +03:00
parent d538cf683e
commit a9f5c8bfb2
2 changed files with 31 additions and 0 deletions

View File

@@ -291,4 +291,11 @@ patches = [
'name': 'browser_compositor_mac', 'name': 'browser_compositor_mac',
'path': '../', 'path': '../',
}, },
{
# Fix crash when scrolling to the bottom of an iframe with
# --root-layer-scrolls
# https://codereview.chromium.org/2150153002
'name': 'viewport_2150153002',
'path': '../',
},
] ]

View File

@@ -0,0 +1,24 @@
diff --git cc/layers/viewport.cc cc/layers/viewport.cc
index d80d40c..30984592 100644
--- cc/layers/viewport.cc
+++ cc/layers/viewport.cc
@@ -36,6 +36,9 @@ Viewport::ScrollResult Viewport::ScrollBy(const gfx::Vector2dF& delta,
const gfx::Point& viewport_point,
bool is_direct_manipulation,
bool affect_top_controls) {
+ if (!OuterScrollLayer())
+ return ScrollResult();
+
gfx::Vector2dF content_delta = delta;
if (affect_top_controls && ShouldTopControlsConsumeScroll(delta))
@@ -74,6 +77,9 @@ bool Viewport::ShouldAnimateViewport(const gfx::Vector2dF& viewport_delta,
}
gfx::Vector2dF Viewport::ScrollAnimated(const gfx::Vector2dF& delta) {
+ if (!OuterScrollLayer())
+ return gfx::Vector2dF(0, 0);
+
ScrollTree& scroll_tree =
host_impl_->active_tree()->property_trees()->scroll_tree;