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 | 9 |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 void printSinglePage(SkCanvas& canvas) | 95 void printSinglePage(SkCanvas& canvas) |
96 { | 96 { |
97 IntRect pageRect(0, 0, kPageWidth, kPageHeight); | 97 IntRect pageRect(0, 0, kPageWidth, kPageHeight); |
98 printContext().begin(pageRect.width(), pageRect.height()); | 98 printContext().begin(pageRect.width(), pageRect.height()); |
99 document().view()->updateAllLifecyclePhases(); | 99 document().view()->updateAllLifecyclePhases(); |
100 SkPictureBuilder pictureBuilder(pageRect); | 100 SkPictureBuilder pictureBuilder(pageRect); |
101 GraphicsContext& context = pictureBuilder.context(); | 101 GraphicsContext& context = pictureBuilder.context(); |
102 context.setPrinting(true); | 102 context.setPrinting(true); |
103 document().view()->paintContents(&context, GlobalPaintPrinting, pageRect
); | 103 document().view()->paintContents(context, GlobalPaintPrinting, pageRect)
; |
104 { | 104 { |
105 DrawingRecorder recorder(context, *document().layoutView(), DisplayI
tem::PrintedContentDestinationLocations, pageRect); | 105 DrawingRecorder recorder(context, *document().layoutView(), DisplayI
tem::PrintedContentDestinationLocations, pageRect); |
106 printContext().outputLinkedDestinations(context, pageRect); | 106 printContext().outputLinkedDestinations(context, pageRect); |
107 } | 107 } |
108 pictureBuilder.endRecording()->playback(&canvas); | 108 pictureBuilder.endRecording()->playback(&canvas); |
109 printContext().end(); | 109 printContext().end(); |
110 } | 110 } |
111 | 111 |
112 static String absoluteBlockHtmlForLink(int x, int y, int width, int height,
const char* url, const char* children = nullptr) | 112 static String absoluteBlockHtmlForLink(int x, int y, int width, int height,
const char* url, const char* children = nullptr) |
113 { | 113 { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 341 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
342 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 342 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
343 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 343 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
344 | 344 |
345 subframe->detach(FrameDetachType::Remove); | 345 subframe->detach(FrameDetachType::Remove); |
346 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(nullptr); | 346 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(nullptr); |
347 document().frame()->host()->decrementSubframeCount(); | 347 document().frame()->host()->decrementSubframeCount(); |
348 } | 348 } |
349 | 349 |
350 } // namespace blink | 350 } // namespace blink |
OLD | NEW |