| Index: third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
|
| index 101e7151c738d80d0dbeacfd613849624cfc397c..0ae0336731114da462a5a57ceaed6946c7d5a759 100644
|
| --- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "core/frame/FrameHost.h"
|
| #include "core/frame/FrameView.h"
|
| +#include "core/frame/RootFrameViewport.h"
|
| #include "core/frame/TopControls.h"
|
| #include "core/html/HTMLFrameOwnerElement.h"
|
| #include "core/layout/LayoutBox.h"
|
| @@ -950,6 +951,42 @@ TEST_F(RootScrollerTest, RemoveClippingOnCompositorLayers)
|
| }
|
| }
|
|
|
| +// Tests that removing the root scroller element from the DOM resets the
|
| +// effective root scroller without waiting for any lifecycle events.
|
| +TEST_F(RootScrollerTest, RemoveRootScrollerFromDom)
|
| +{
|
| + initialize("root-scroller-iframe.html");
|
| +
|
| + {
|
| + HTMLFrameOwnerElement* iframe = toHTMLFrameOwnerElement(
|
| + mainFrame()->document()->getElementById("iframe"));
|
| + Element* innerContainer =
|
| + iframe->contentDocument()->getElementById("container");
|
| +
|
| + NonThrowableExceptionState exceptionState;
|
| + mainFrame()->document()->setRootScroller(iframe, exceptionState);
|
| + iframe->contentDocument()->setRootScroller(
|
| + innerContainer, exceptionState);
|
| + mainFrameView()->updateAllLifecyclePhases();
|
| +
|
| + ASSERT_EQ(iframe, mainFrame()->document()->rootScroller());
|
| + ASSERT_EQ(iframe, effectiveRootScroller(mainFrame()->document()));
|
| + ASSERT_EQ(innerContainer, iframe->contentDocument()->rootScroller());
|
| + ASSERT_EQ(innerContainer,
|
| + effectiveRootScroller(iframe->contentDocument()));
|
| +
|
| + iframe->contentDocument()->body()->setInnerHTML("", exceptionState);
|
| +
|
| + // If the root scroller wasn't updated by the DOM removal above, this
|
| + // will touch the disposed root scroller's ScrollableArea.
|
| + mainFrameView()->getRootFrameViewport()->serviceScrollAnimations(0);
|
| +
|
| + EXPECT_EQ(iframe->contentDocument()->documentElement(),
|
| + effectiveRootScroller(iframe->contentDocument()));
|
| + }
|
| +}
|
| +
|
| +
|
| } // namespace
|
|
|
| } // namespace blink
|
|
|