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

Side by Side Diff: third_party/WebKit/Source/web/tests/RootScrollerTest.cpp

Issue 2365173002: Detach PaintLayerScrollableArea from RootFrameViewport when disposed. (Closed)
Patch Set: Fixed ASAN failure in previous patch Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/frame/FrameHost.h" 5 #include "core/frame/FrameHost.h"
6 #include "core/frame/FrameView.h" 6 #include "core/frame/FrameView.h"
7 #include "core/frame/RootFrameViewport.h"
7 #include "core/frame/TopControls.h" 8 #include "core/frame/TopControls.h"
8 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
9 #include "core/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
10 #include "core/layout/api/LayoutViewItem.h" 11 #include "core/layout/api/LayoutViewItem.h"
11 #include "core/layout/compositing/PaintLayerCompositor.h" 12 #include "core/layout/compositing/PaintLayerCompositor.h"
12 #include "core/page/Page.h" 13 #include "core/page/Page.h"
13 #include "core/page/scrolling/RootScrollerController.h" 14 #include "core/page/scrolling/RootScrollerController.h"
14 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 15 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
15 #include "core/paint/PaintLayerScrollableArea.h" 16 #include "core/paint/PaintLayerScrollableArea.h"
16 #include "platform/testing/URLTestHelpers.h" 17 #include "platform/testing/URLTestHelpers.h"
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 944
944 EXPECT_FALSE(childCompositor->rootContentLayer()->platformLayer() 945 EXPECT_FALSE(childCompositor->rootContentLayer()->platformLayer()
945 ->masksToBounds()); 946 ->masksToBounds());
946 EXPECT_FALSE(childCompositor->rootGraphicsLayer()->platformLayer() 947 EXPECT_FALSE(childCompositor->rootGraphicsLayer()->platformLayer()
947 ->masksToBounds()); 948 ->masksToBounds());
948 EXPECT_FALSE(childCompositor->containerLayer()->platformLayer() 949 EXPECT_FALSE(childCompositor->containerLayer()->platformLayer()
949 ->masksToBounds()); 950 ->masksToBounds());
950 } 951 }
951 } 952 }
952 953
954 // Tests that removing the root scroller element from the DOM resets the
955 // effective root scroller without waiting for any lifecycle events.
956 TEST_F(RootScrollerTest, RemoveRootScrollerFromDom)
957 {
958 initialize("root-scroller-iframe.html");
959
960 {
961 HTMLFrameOwnerElement* iframe = toHTMLFrameOwnerElement(
962 mainFrame()->document()->getElementById("iframe"));
963 Element* innerContainer =
964 iframe->contentDocument()->getElementById("container");
965
966 NonThrowableExceptionState exceptionState;
967 mainFrame()->document()->setRootScroller(iframe, exceptionState);
968 iframe->contentDocument()->setRootScroller(
969 innerContainer, exceptionState);
970 mainFrameView()->updateAllLifecyclePhases();
971
972 ASSERT_EQ(iframe, mainFrame()->document()->rootScroller());
973 ASSERT_EQ(iframe, effectiveRootScroller(mainFrame()->document()));
974 ASSERT_EQ(innerContainer, iframe->contentDocument()->rootScroller());
975 ASSERT_EQ(innerContainer,
976 effectiveRootScroller(iframe->contentDocument()));
977
978 iframe->contentDocument()->body()->setInnerHTML("", exceptionState);
979
980 // If the root scroller wasn't updated by the DOM removal above, this
981 // will touch the disposed root scroller's ScrollableArea.
982 mainFrameView()->getRootFrameViewport()->serviceScrollAnimations(0);
983
984 EXPECT_EQ(iframe->contentDocument()->documentElement(),
985 effectiveRootScroller(iframe->contentDocument()));
986 }
987 }
988
989
953 } // namespace 990 } // namespace
954 991
955 } // namespace blink 992 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698