| 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 "core/page/PrintContext.h" | 5 #include "core/page/PrintContext.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/html/HTMLElement.h" | 9 #include "core/html/HTMLElement.h" |
| 10 #include "core/layout/LayoutTestHelper.h" | 10 #include "core/layout/LayoutTestHelper.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void printSinglePage(SkCanvas& canvas) | 92 void printSinglePage(SkCanvas& canvas) |
| 93 { | 93 { |
| 94 IntRect pageRect(0, 0, kPageWidth, kPageHeight); | 94 IntRect pageRect(0, 0, kPageWidth, kPageHeight); |
| 95 printContext().begin(pageRect.width(), pageRect.height()); | 95 printContext().begin(pageRect.width(), pageRect.height()); |
| 96 document().view()->updateAllLifecyclePhases(); | 96 document().view()->updateAllLifecyclePhases(); |
| 97 SkPictureBuilder pictureBuilder(pageRect); | 97 SkPictureBuilder pictureBuilder(pageRect); |
| 98 GraphicsContext& context = pictureBuilder.context(); | 98 GraphicsContext& context = pictureBuilder.context(); |
| 99 context.setPrinting(true); | 99 context.setPrinting(true); |
| 100 document().view()->paintContents(context, GlobalPaintPrinting, pageRect)
; | 100 document().view()->paintContents(context, GlobalPaintPrinting, pageRect)
; |
| 101 { | 101 { |
| 102 DrawingRecorder recorder(context, *document().layoutView(), DisplayI
tem::PrintedContentDestinationLocations, pageRect); | 102 DrawingRecorder recorder(context, *document().layoutView(), DisplayI
tem::kPrintedContentDestinationLocations, pageRect); |
| 103 printContext().outputLinkedDestinations(context, pageRect); | 103 printContext().outputLinkedDestinations(context, pageRect); |
| 104 } | 104 } |
| 105 pictureBuilder.endRecording()->playback(&canvas); | 105 pictureBuilder.endRecording()->playback(&canvas); |
| 106 printContext().end(); | 106 printContext().end(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static String absoluteBlockHtmlForLink(int x, int y, int width, int height,
const char* url, const char* children = nullptr) | 109 static String absoluteBlockHtmlForLink(int x, int y, int width, int height,
const char* url, const char* children = nullptr) |
| 110 { | 110 { |
| 111 TextStream ts; | 111 TextStream ts; |
| 112 ts << "<a style='position: absolute; left: " << x << "px; top: " << y <<
"px; width: " << width << "px; height: " << height | 112 ts << "<a style='position: absolute; left: " << x << "px; top: " << y <<
"px; width: " << width << "px; height: " << height |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 ASSERT_EQ(3u, operations.size()); | 323 ASSERT_EQ(3u, operations.size()); |
| 324 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); | 324 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); |
| 325 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho
uld be clipped. | 325 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho
uld be clipped. |
| 326 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); | 326 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); |
| 327 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 327 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
| 328 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 328 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
| 329 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 329 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace blink | 332 } // namespace blink |
| OLD | NEW |