Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: Source/core/page/PrintContextTest.cpp

Issue 1236183003: Add 'printing' flag to PaintInfo (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move flag to PaintInfo. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/paint/BlockPainter.cpp » ('j') | Source/core/paint/PaintInfo.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 printContext().begin(pageRect.width(), pageRect.height());
97 document().view()->updateAllLifecyclePhases(); 98 document().view()->updateAllLifecyclePhases();
98 document().setPrinting(true);
Julien - ping for review 2015/07/15 17:14:25 Should we remove Document::setPrinting if we're no
fs 2015/07/15 18:25:58 Document::setPrinting(...) is still called, only v
Julien - ping for review 2015/07/16 14:32:01 I am just concerned about having several sites hol
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 document().view()->paintContents(&context, pageRect);
103 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(pag eRect), PaintBehaviorNormal, LayoutSize());
104 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, pain tingInfo, PaintLayerPaintingCompositingAllPhases);
105 printContext().begin(kPageWidth, kPageHeight);
106 printContext().end();
107 pictureBuilder.endRecording()->playback(&canvas); 103 pictureBuilder.endRecording()->playback(&canvas);
108 printContext().outputLinkedDestinations(&canvas, pageRect); 104 printContext().outputLinkedDestinations(&canvas, pageRect);
109 document().setPrinting(false); 105 printContext().end();
110 } 106 }
111 107
112 static String absoluteBlockHtmlForLink(int x, int y, int width, int height, const char* url, const char* children = nullptr) 108 static String absoluteBlockHtmlForLink(int x, int y, int width, int height, const char* url, const char* children = nullptr)
113 { 109 {
114 TextStream ts; 110 TextStream ts;
115 ts << "<a style='position: absolute; left: " << x << "px; top: " << y << "px; width: " << width << "px; height: " << height 111 ts << "<a style='position: absolute; left: " << x << "px; top: " << y << "px; width: " << width << "px; height: " << height
116 << "px' href='" << url << "'>" << (children ? children : url) << "</ a>"; 112 << "px' href='" << url << "'>" << (children ? children : url) << "</ a>";
117 return ts.release(); 113 return ts.release();
118 } 114 }
119 115
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 372 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 373 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 374 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
379 375
380 subframe->detach(FrameDetachType::Remove); 376 subframe->detach(FrameDetachType::Remove);
381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 377 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
382 document().frame()->host()->decrementSubframeCount(); 378 document().frame()->host()->decrementSubframeCount();
383 } 379 }
384 380
385 } // namespace blink 381 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/paint/BlockPainter.cpp » ('j') | Source/core/paint/PaintInfo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698