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

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

Issue 1592493002: Fix links in inline continuations in printed PDF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an extra condition Created 4 years, 11 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 "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 8
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/html/HTMLElement.h" 10 #include "core/html/HTMLElement.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 MockCanvas canvas; 257 MockCanvas canvas;
258 setBodyInnerHTML(absoluteBlockHtmlForLink(50, 60, 70, 20, "http://www.google .com", "<img style='width: 200px; height: 100px'>")); 258 setBodyInnerHTML(absoluteBlockHtmlForLink(50, 60, 70, 20, "http://www.google .com", "<img style='width: 200px; height: 100px'>"));
259 printSinglePage(canvas); 259 printSinglePage(canvas);
260 260
261 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( ); 261 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
262 ASSERT_EQ(1u, operations.size()); 262 ASSERT_EQ(1u, operations.size());
263 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 263 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
264 EXPECT_SKRECT_EQ(50, 60, 200, 100, operations[0].rect); 264 EXPECT_SKRECT_EQ(50, 60, 200, 100, operations[0].rect);
265 } 265 }
266 266
267 TEST_F(PrintContextTest, InlineContinuation)
268 {
269 MockCanvas canvas;
270 setBodyInnerHTML("<a href='http://www.google.com'><div>Target</div></a>");
271 printSinglePage(canvas);
272
273 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
274 ASSERT_EQ(1u, operations.size());
275 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
276 EXPECT_FALSE(operations[0].rect.isEmpty());
277 }
278
267 TEST_F(PrintContextFrameTest, WithSubframe) 279 TEST_F(PrintContextFrameTest, WithSubframe)
268 { 280 {
269 MockCanvas canvas; 281 MockCanvas canvas;
270 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/")); 282 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/"));
271 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>" 283 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>"
272 "<iframe id='frame' src='http://b.com/' width='500' height='500'" 284 "<iframe id='frame' src='http://b.com/' width='500' height='500'"
273 " style='border-width: 5px; margin: 5px; position: absolute; top: 90px; left: 90px'></iframe>"); 285 " style='border-width: 5px; margin: 5px; position: absolute; top: 90px; left: 90px'></iframe>");
274 286
275 setupChildIframe("frame", absoluteBlockHtmlForLink(50, 60, 70, 80, "#fragmen t") 287 setupChildIframe("frame", absoluteBlockHtmlForLink(50, 60, 70, 80, "#fragmen t")
276 + absoluteBlockHtmlForLink(150, 160, 170, 180, "http://www.google.com") 288 + absoluteBlockHtmlForLink(150, 160, 170, 180, "http://www.google.com")
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ASSERT_EQ(3u, operations.size()); 320 ASSERT_EQ(3u, operations.size());
309 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 321 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
310 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped. 322 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped.
311 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 323 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
312 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 324 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
313 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 325 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
314 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 326 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
315 } 327 }
316 328
317 } // namespace blink 329 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698