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

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

Issue 2838343003: Blink Rename follow-up: Rename PrintContext::begin/end to Begin/EndPrintMode. (Closed)
Patch Set: Fix compilation of PrintContextTest.cpp Created 3 years, 7 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
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 "core/page/PrintContext.h" 5 #include "core/page/PrintContext.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 MockPrintContext& PrintContext() { return *print_context_.Get(); } 84 MockPrintContext& PrintContext() { return *print_context_.Get(); }
85 85
86 void SetBodyInnerHTML(String body_content) { 86 void SetBodyInnerHTML(String body_content) {
87 GetDocument().body()->setAttribute(HTMLNames::styleAttr, "margin: 0"); 87 GetDocument().body()->setAttribute(HTMLNames::styleAttr, "margin: 0");
88 GetDocument().body()->setInnerHTML(body_content); 88 GetDocument().body()->setInnerHTML(body_content);
89 } 89 }
90 90
91 void PrintSinglePage(MockCanvas& canvas) { 91 void PrintSinglePage(MockCanvas& canvas) {
92 IntRect page_rect(0, 0, kPageWidth, kPageHeight); 92 IntRect page_rect(0, 0, kPageWidth, kPageHeight);
93 PrintContext().begin(page_rect.Width(), page_rect.Height()); 93 PrintContext().BeginPrintMode(page_rect.Width(), page_rect.Height());
94 GetDocument().View()->UpdateAllLifecyclePhases(); 94 GetDocument().View()->UpdateAllLifecyclePhases();
95 PaintRecordBuilder builder(page_rect); 95 PaintRecordBuilder builder(page_rect);
96 GraphicsContext& context = builder.Context(); 96 GraphicsContext& context = builder.Context();
97 context.SetPrinting(true); 97 context.SetPrinting(true);
98 GetDocument().View()->PaintContents(context, kGlobalPaintPrinting, 98 GetDocument().View()->PaintContents(context, kGlobalPaintPrinting,
99 page_rect); 99 page_rect);
100 { 100 {
101 DrawingRecorder recorder(context, *GetDocument().GetLayoutView(), 101 DrawingRecorder recorder(context, *GetDocument().GetLayoutView(),
102 DisplayItem::kPrintedContentDestinationLocations, 102 DisplayItem::kPrintedContentDestinationLocations,
103 page_rect); 103 page_rect);
104 PrintContext().OutputLinkedDestinations(context, page_rect); 104 PrintContext().OutputLinkedDestinations(context, page_rect);
105 } 105 }
106 builder.EndRecording()->playback(&canvas); 106 builder.EndRecording()->playback(&canvas);
107 PrintContext().end(); 107 PrintContext().EndPrintMode();
108 } 108 }
109 109
110 static String AbsoluteBlockHtmlForLink(int x, 110 static String AbsoluteBlockHtmlForLink(int x,
111 int y, 111 int y,
112 int width, 112 int width,
113 int height, 113 int height,
114 const char* url, 114 const char* url,
115 const char* children = nullptr) { 115 const char* children = nullptr) {
116 TextStream ts; 116 TextStream ts;
117 ts << "<a style='position: absolute; left: " << x << "px; top: " << y 117 ts << "<a style='position: absolute; left: " << x << "px; top: " << y
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_EQ(MockCanvas::kDrawRect, operations[0].type); 352 EXPECT_EQ(MockCanvas::kDrawRect, operations[0].type);
353 EXPECT_SKRECT_EQ(50, 60, 70, 80, 353 EXPECT_SKRECT_EQ(50, 60, 70, 80,
354 operations[0].rect); // FIXME: the rect should be clipped. 354 operations[0].rect); // FIXME: the rect should be clipped.
355 EXPECT_EQ(MockCanvas::kDrawRect, operations[1].type); 355 EXPECT_EQ(MockCanvas::kDrawRect, operations[1].type);
356 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 356 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
357 EXPECT_EQ(MockCanvas::kDrawRect, operations[2].type); 357 EXPECT_EQ(MockCanvas::kDrawRect, operations[2].type);
358 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 358 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
359 } 359 }
360 360
361 } // namespace blink 361 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698