| Index: third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
|
| index 9fdbe5e6c2bef7918ffc9de0700aec46f5e943f8..3a7abbe0e6913cb0c16d6f73f3a4bbc0172568bc 100644
|
| --- a/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "core/dom/ClientRect.h"
|
| #include "core/dom/Document.h"
|
| #include "core/dom/FrameRequestCallback.h"
|
| #include "core/html/HTMLIFrameElement.h"
|
| @@ -380,4 +381,43 @@ TEST_F(DocumentLoadingRenderingTest,
|
| EXPECT_TRUE(document().isRenderingReady());
|
| }
|
|
|
| +TEST_F(DocumentLoadingRenderingTest,
|
| + returnBoundingClientRectCorrectlyWhileLoadingImport) {
|
| + SimRequest mainResource("https://example.com/test.html", "text/html");
|
| + SimRequest importResource("https://example.com/import.css", "text/css");
|
| +
|
| + loadURL("https://example.com/test.html");
|
| +
|
| + webView().resize(WebSize(800, 600));
|
| +
|
| + mainResource.start();
|
| +
|
| + mainResource.write(
|
| + "<html><body>"
|
| + " <div id='test' style='font-size: 16px'>test</div>"
|
| + " <script>"
|
| + " var link = document.createElement('link');"
|
| + " link.rel = 'import';"
|
| + " link.href = 'import.css';"
|
| + " document.head.appendChild(link);"
|
| + " </script>");
|
| + importResource.start();
|
| +
|
| + // Import loader isn't finish, shoudn't paint.
|
| + EXPECT_FALSE(document().isRenderingReady());
|
| +
|
| + // If ignoringPendingStylesheets==true, element should get non-empty rect.
|
| + Element* element = document().getElementById("test");
|
| + ClientRect* rect = element->getBoundingClientRect();
|
| + EXPECT_TRUE(rect->width() > 0.f);
|
| + EXPECT_TRUE(rect->height() > 0.f);
|
| +
|
| + // After reset ignoringPendingStylesheets, we should block rendering again.
|
| + EXPECT_FALSE(document().isRenderingReady());
|
| +
|
| + importResource.write("div { color: red; }");
|
| + importResource.finish();
|
| + mainResource.finish();
|
| +}
|
| +
|
| } // namespace blink
|
|
|