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

Unified Diff: third_party/WebKit/Source/core/frame/FrameViewTest.cpp

Issue 2720823002: Fix crash in FrameView::updateLayersAndCompositingAfterScrollIfNeeded (Closed)
Patch Set: Re-enabled RLS in test, use layoutViewportScrollableArea Created 3 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 | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/FrameViewTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
index a182ea5f845aad0dc09f447fab842d1f2f14a124..e4f7f9c0fcdcbc33ef9e45e0464e1d5d76d00923 100644
--- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -13,6 +13,7 @@
#include "core/layout/LayoutObject.h"
#include "core/loader/EmptyClients.h"
#include "core/page/Page.h"
+#include "core/paint/PaintLayer.h"
#include "core/testing/DummyPageHolder.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/geometry/IntSize.h"
@@ -139,6 +140,30 @@ TEST_P(FrameViewTest, NoOverflowInIncrementVisuallyNonEmptyPixelCount) {
EXPECT_TRUE(document().view()->isVisuallyNonEmpty());
}
+// This test addresses http://crbug.com/696173, in which a call to
+// FrameView::updateLayersAndCompositingAfterScrollIfNeeded during layout caused
+// a crash as the code was incorrectly assuming that the ancestor overflow layer
+// would always be valid.
+TEST_P(FrameViewTest, ViewportConstrainedObjectsHandledCorrectlyDuringLayout) {
+ document().body()->setInnerHTML(
+ "<style>.container { height: 200%; }"
+ "#sticky { position: sticky; top: 0; height: 50px; }</style>"
+ "<div class='container'><div id='sticky'></div></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ LayoutBoxModelObject* sticky = toLayoutBoxModelObject(
+ document().getElementById("sticky")->layoutObject());
+
+ // Deliberately invalidate the ancestor overflow layer. This approximates
+ // http://crbug.com/696173, in which the ancestor overflow layer can be null
+ // during layout.
+ sticky->layer()->updateAncestorOverflowLayer(nullptr);
+
+ // This call should not crash.
+ document().view()->layoutViewportScrollableArea()->setScrollOffset(
+ ScrollOffset(0, 100), ProgrammaticScroll);
+}
+
TEST_P(FrameViewTest, StyleChangeUpdatesViewportConstrainedObjects) {
// When using root layer scrolling there is no concept of viewport constrained
// objects, so skip this test.
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698