OLD | NEW |
---|---|
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 Loading... | |
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 // @page rules and figure out what declarations apply on a given page (that may or may not exist). | |
264 printContext.begin(800, 1000); | |
263 document->updateLayout(); | 265 document->updateLayout(); |
rune
2015/12/10 09:44:50
printContext.begin() will update the style/layout.
mstensho (USE GERRIT)
2015/12/10 09:45:58
Done.
| |
264 RefPtr<ComputedStyle> style = document->styleForPage(pageNumber); | 266 RefPtr<ComputedStyle> style = document->styleForPage(pageNumber); |
265 | 267 |
266 // Implement formatters for properties we care about. | 268 // Implement formatters for properties we care about. |
267 if (!strcmp(propertyName, "margin-left")) { | 269 if (!strcmp(propertyName, "margin-left")) { |
268 if (style->marginLeft().isAuto()) | 270 if (style->marginLeft().isAuto()) |
269 return String("auto"); | 271 return String("auto"); |
270 return String::number(style->marginLeft().value()); | 272 return String::number(style->marginLeft().value()); |
271 } | 273 } |
272 if (!strcmp(propertyName, "line-height")) | 274 if (!strcmp(propertyName, "line-height")) |
273 return String::number(style->lineHeight().value()); | 275 return String::number(style->lineHeight().value()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 | 313 |
312 DEFINE_TRACE(PrintContext) | 314 DEFINE_TRACE(PrintContext) |
313 { | 315 { |
314 #if ENABLE(OILPAN) | 316 #if ENABLE(OILPAN) |
315 visitor->trace(m_frame); | 317 visitor->trace(m_frame); |
316 visitor->trace(m_linkedDestinations); | 318 visitor->trace(m_linkedDestinations); |
317 #endif | 319 #endif |
318 } | 320 } |
319 | 321 |
320 } | 322 } |
OLD | NEW |