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

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

Issue 1510353002: PrintContext::pageProperty() shouldn't use 0 as page height. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No need to call updateLayout() manually. PrintContext::begin() does it for us. Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
3 * Copyright (C) 2007 Apple Inc. 3 * Copyright (C) 2007 Apple Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 continue; 252 continue;
253 point.clampNegativeToZero(); 253 point.clampNegativeToZero();
254 context.setURLDestinationLocation(entry.key, point); 254 context.setURLDestinationLocation(entry.key, point);
255 } 255 }
256 } 256 }
257 257
258 String PrintContext::pageProperty(LocalFrame* frame, const char* propertyName, i nt pageNumber) 258 String PrintContext::pageProperty(LocalFrame* frame, const char* propertyName, i nt pageNumber)
259 { 259 {
260 Document* document = frame->document(); 260 Document* document = frame->document();
261 PrintContext printContext(frame); 261 PrintContext printContext(frame);
262 printContext.begin(800); // Any width is OK here. 262 // Any non-zero size is OK here. We don't care about actual layout. We just want to collect
263 document->updateLayout(); 263 // @page rules and figure out what declarations apply on a given page (that may or may not exist).
264 printContext.begin(800, 1000);
264 RefPtr<ComputedStyle> style = document->styleForPage(pageNumber); 265 RefPtr<ComputedStyle> style = document->styleForPage(pageNumber);
265 266
266 // Implement formatters for properties we care about. 267 // Implement formatters for properties we care about.
267 if (!strcmp(propertyName, "margin-left")) { 268 if (!strcmp(propertyName, "margin-left")) {
268 if (style->marginLeft().isAuto()) 269 if (style->marginLeft().isAuto())
269 return String("auto"); 270 return String("auto");
270 return String::number(style->marginLeft().value()); 271 return String::number(style->marginLeft().value());
271 } 272 }
272 if (!strcmp(propertyName, "line-height")) 273 if (!strcmp(propertyName, "line-height"))
273 return String::number(style->lineHeight().value()); 274 return String::number(style->lineHeight().value());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 312
312 DEFINE_TRACE(PrintContext) 313 DEFINE_TRACE(PrintContext)
313 { 314 {
314 #if ENABLE(OILPAN) 315 #if ENABLE(OILPAN)
315 visitor->trace(m_frame); 316 visitor->trace(m_frame);
316 visitor->trace(m_linkedDestinations); 317 visitor->trace(m_linkedDestinations);
317 #endif 318 #endif
318 } 319 }
319 320
320 } 321 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698