| Index: third_party/WebKit/Source/core/page/PrintContextTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/PrintContextTest.cpp b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
|
| index d2b7edbae416e6804beb1a3b8bc57012abe75561..4a20be6737640f97857f2c71f4daf8ca4317895a 100644
|
| --- a/third_party/WebKit/Source/core/page/PrintContextTest.cpp
|
| +++ b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
|
| @@ -9,8 +9,10 @@
|
|
|
| #include "core/frame/FrameView.h"
|
| #include "core/html/HTMLElement.h"
|
| +#include "core/html/HTMLIFrameElement.h"
|
| #include "core/layout/LayoutTestHelper.h"
|
| #include "core/layout/LayoutView.h"
|
| +#include "core/loader/EmptyClients.h"
|
| #include "core/paint/PaintLayer.h"
|
| #include "core/paint/PaintLayerPainter.h"
|
| #include "core/testing/DummyPageHolder.h"
|
| @@ -253,9 +255,20 @@
|
| "<iframe id='frame' src='http://b.com/' width='500' height='500'"
|
| " style='border-width: 5px; margin: 5px; position: absolute; top: 90px; left: 90px'></iframe>");
|
|
|
| - setupChildIframe("frame", absoluteBlockHtmlForLink(50, 60, 70, 80, "#fragment")
|
| + HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById("frame"));
|
| + OwnPtrWillBeRawPtr<FrameLoaderClient> frameLoaderClient = FrameLoaderClientWithParent::create(document().frame());
|
| + RefPtrWillBePersistent<LocalFrame> subframe = LocalFrame::create(frameLoaderClient.get(), document().frame()->host(), &iframe);
|
| + subframe->setView(FrameView::create(subframe.get(), IntSize(500, 500)));
|
| + subframe->init();
|
| + static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(subframe.get());
|
| + document().frame()->host()->incrementSubframeCount();
|
| +
|
| + Document& frameDocument = *iframe.contentDocument();
|
| + frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://b.com/"));
|
| + frameDocument.body()->setInnerHTML(absoluteBlockHtmlForLink(50, 60, 70, 80, "#fragment")
|
| + absoluteBlockHtmlForLink(150, 160, 170, 180, "http://www.google.com")
|
| - + absoluteBlockHtmlForLink(250, 260, 270, 280, "http://www.google.com#fragment"));
|
| + + absoluteBlockHtmlForLink(250, 260, 270, 280, "http://www.google.com#fragment"),
|
| + ASSERT_NO_EXCEPTION);
|
|
|
| printSinglePage(canvas);
|
|
|
| @@ -265,6 +278,10 @@
|
| EXPECT_SKRECT_EQ(250, 260, 170, 180, operations[0].rect);
|
| EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
|
| EXPECT_SKRECT_EQ(350, 360, 270, 280, operations[1].rect);
|
| +
|
| + subframe->detach(FrameDetachType::Remove);
|
| + static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(nullptr);
|
| + document().frame()->host()->decrementSubframeCount();
|
| }
|
|
|
| TEST_F(PrintContextFrameTest, WithScrolledSubframe)
|
| @@ -275,13 +292,24 @@
|
| "<iframe id='frame' src='http://b.com/' width='500' height='500'"
|
| " style='border-width: 5px; margin: 5px; position: absolute; top: 90px; left: 90px'></iframe>");
|
|
|
| - Document& frameDocument = setupChildIframe("frame", absoluteBlockHtmlForLink(10, 10, 20, 20, "http://invisible.com")
|
| + HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById("frame"));
|
| + OwnPtrWillBeRawPtr<FrameLoaderClient> frameLoaderClient = FrameLoaderClientWithParent::create(document().frame());
|
| + RefPtrWillBePersistent<LocalFrame> subframe = LocalFrame::create(frameLoaderClient.get(), document().frame()->host(), &iframe);
|
| + subframe->setView(FrameView::create(subframe.get(), IntSize(500, 500)));
|
| + subframe->init();
|
| + static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(subframe.get());
|
| + document().frame()->host()->incrementSubframeCount();
|
| +
|
| + Document& frameDocument = *iframe.contentDocument();
|
| + frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://b.com/"));
|
| + frameDocument.body()->setInnerHTML(
|
| + absoluteBlockHtmlForLink(10, 10, 20, 20, "http://invisible.com")
|
| + absoluteBlockHtmlForLink(50, 60, 70, 80, "http://partly.visible.com")
|
| + absoluteBlockHtmlForLink(150, 160, 170, 180, "http://www.google.com")
|
| + absoluteBlockHtmlForLink(250, 260, 270, 280, "http://www.google.com#fragment")
|
| - + absoluteBlockHtmlForLink(850, 860, 70, 80, "http://another.invisible.com"));
|
| -
|
| - frameDocument.domWindow()->scrollTo(100, 100);
|
| + + absoluteBlockHtmlForLink(850, 860, 70, 80, "http://another.invisible.com"),
|
| + ASSERT_NO_EXCEPTION);
|
| + iframe.contentWindow()->scrollTo(100, 100);
|
|
|
| printSinglePage(canvas);
|
|
|
| @@ -293,6 +321,10 @@
|
| EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
|
| EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
|
| EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
|
| +
|
| + subframe->detach(FrameDetachType::Remove);
|
| + static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(nullptr);
|
| + document().frame()->host()->decrementSubframeCount();
|
| }
|
|
|
| } // namespace blink
|
|
|