| Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| index 509ce8f86163e0ec8cd3ac7de8d234f4e3b38783..efce3b5bbb192bc5e9d1773687d8b184c755ac76 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| @@ -145,6 +145,9 @@
|
| #include "web/WebRemoteFrameImpl.h"
|
| #include "web/WebViewImpl.h"
|
| #include "web/tests/FrameTestHelpers.h"
|
| +#include "web/tests/sim/SimDisplayItemList.h"
|
| +#include "web/tests/sim/SimRequest.h"
|
| +#include "web/tests/sim/SimTest.h"
|
| #include "wtf/Forward.h"
|
| #include "wtf/PtrUtil.h"
|
| #include "wtf/dtoa/utils.h"
|
| @@ -11302,6 +11305,63 @@ TEST_F(WebFrameTest, UniqueNames) {
|
| EXPECT_EQ(10u, names.size());
|
| }
|
|
|
| +class WebFrameSimTest : public SimTest {};
|
| +
|
| +TEST_F(WebFrameSimTest, DisplayNoneIFrameHasNoLayoutObjects) {
|
| + SimRequest mainResource("https://example.com/test.html", "text/html");
|
| + SimRequest frameResource("https://example.com/frame.html", "text/html");
|
| +
|
| + loadURL("https://example.com/test.html");
|
| + mainResource.complete(
|
| + "<!DOCTYPE html>"
|
| + "<iframe src=frame.html style='display: none'></iframe>");
|
| + frameResource.complete(
|
| + "<!DOCTYPE html>"
|
| + "<html><body>This is a visible iframe.</body></html>");
|
| +
|
| + Element* element = document().querySelector("iframe");
|
| + HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element);
|
| + Document* iframeDoc = frameOwnerElement->contentDocument();
|
| + EXPECT_FALSE(iframeDoc->documentElement()->layoutObject());
|
| +
|
| + // Changing the display from 'none' -> 'block' should cause layout objects to
|
| + // appear.
|
| + element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock);
|
| + compositor().beginFrame();
|
| + EXPECT_TRUE(iframeDoc->documentElement()->layoutObject());
|
| +
|
| + // Changing the display from 'block' -> 'none' should cause layout objects to
|
| + // disappear.
|
| + element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
|
| +
|
| + compositor().beginFrame();
|
| + EXPECT_FALSE(iframeDoc->documentElement()->layoutObject());
|
| +}
|
| +
|
| +TEST_F(WebFrameSimTest, NormalIFrameHasLayoutObjects) {
|
| + SimRequest mainResource("https://example.com/test.html", "text/html");
|
| + SimRequest frameResource("https://example.com/frame.html", "text/html");
|
| +
|
| + loadURL("https://example.com/test.html");
|
| + mainResource.complete(
|
| + "<!DOCTYPE html>"
|
| + "<iframe src=frame.html style='display: block'></iframe>");
|
| + frameResource.complete(
|
| + "<!DOCTYPE html>"
|
| + "<html><body>This is a visible iframe.</body></html>");
|
| +
|
| + Element* element = document().querySelector("iframe");
|
| + HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element);
|
| + Document* iframeDoc = frameOwnerElement->contentDocument();
|
| + EXPECT_TRUE(iframeDoc->documentElement()->layoutObject());
|
| +
|
| + // Changing the display from 'block' -> 'none' should cause layout objects to
|
| + // disappear.
|
| + element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
|
| + compositor().beginFrame();
|
| + EXPECT_FALSE(iframeDoc->documentElement()->layoutObject());
|
| +}
|
| +
|
| TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) {
|
| class LoadingObserverFrameClient
|
| : public FrameTestHelpers::TestWebFrameClient {
|
|
|