| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/page/PrintContext.h" | 6 #include "core/page/PrintContext.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void setBodyInnerHTML(String bodyContent) | 88 void setBodyInnerHTML(String bodyContent) |
| 89 { | 89 { |
| 90 document().body()->setAttribute(HTMLNames::styleAttr, "margin: 0"); | 90 document().body()->setAttribute(HTMLNames::styleAttr, "margin: 0"); |
| 91 document().body()->setInnerHTML(bodyContent, ASSERT_NO_EXCEPTION); | 91 document().body()->setInnerHTML(bodyContent, ASSERT_NO_EXCEPTION); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void printSinglePage(SkCanvas& canvas) | 94 void printSinglePage(SkCanvas& canvas) |
| 95 { | 95 { |
| 96 IntRect pageRect(0, 0, kPageWidth, kPageHeight); | 96 IntRect pageRect(0, 0, kPageWidth, kPageHeight); |
| 97 document().view()->updateAllLifecyclePhases(); | 97 document().view()->updateLayoutAndStyleForPainting(); |
| 98 document().setPrinting(true); | 98 document().setPrinting(true); |
| 99 SkPictureBuilder pictureBuilder(pageRect); | 99 SkPictureBuilder pictureBuilder(pageRect); |
| 100 GraphicsContext& context = pictureBuilder.context(); | 100 GraphicsContext& context = pictureBuilder.context(); |
| 101 context.setPrinting(true); | 101 context.setPrinting(true); |
| 102 DeprecatedPaintLayer& rootLayer = *document().view()->layoutView()->laye
r(); | 102 DeprecatedPaintLayer& rootLayer = *document().view()->layoutView()->laye
r(); |
| 103 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(pag
eRect), PaintBehaviorNormal, LayoutSize()); | 103 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(pag
eRect), PaintBehaviorNormal, LayoutSize()); |
| 104 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, pain
tingInfo, PaintLayerPaintingCompositingAllPhases); | 104 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, pain
tingInfo, PaintLayerPaintingCompositingAllPhases); |
| 105 printContext().begin(kPageWidth, kPageHeight); | 105 printContext().begin(kPageWidth, kPageHeight); |
| 106 printContext().end(); | 106 printContext().end(); |
| 107 pictureBuilder.endRecording()->playback(&canvas); | 107 pictureBuilder.endRecording()->playback(&canvas); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
| 377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
| 378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
| 379 | 379 |
| 380 subframe->detach(FrameDetachType::Remove); | 380 subframe->detach(FrameDetachType::Remove); |
| 381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(nullptr); | 381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(nullptr); |
| 382 document().frame()->host()->decrementSubframeCount(); | 382 document().frame()->host()->decrementSubframeCount(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace blink | 385 } // namespace blink |
| OLD | NEW |