| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 IntRect pageRect = m_pageRects[pageNumber]; | 297 IntRect pageRect = m_pageRects[pageNumber]; |
| 298 return m_printedPageWidth / pageRect.width(); | 298 return m_printedPageWidth / pageRect.width(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 float spoolSinglePage(WebCanvas* canvas, int pageNumber) | 301 float spoolSinglePage(WebCanvas* canvas, int pageNumber) |
| 302 { | 302 { |
| 303 dispatchEventsForPrintingOnAllFrames(); | 303 dispatchEventsForPrintingOnAllFrames(); |
| 304 if (!frame()->document() || !frame()->document()->layoutView()) | 304 if (!frame()->document() || !frame()->document()->layoutView()) |
| 305 return 0; | 305 return 0; |
| 306 | 306 |
| 307 frame()->view()->updateAllLifecyclePhases(); | 307 frame()->view()->updateLifecycleToCompositingCleanPlusScrolling(); |
| 308 if (!frame()->document() || !frame()->document()->layoutView()) | 308 if (!frame()->document() || !frame()->document()->layoutView()) |
| 309 return 0; | 309 return 0; |
| 310 | 310 |
| 311 IntRect pageRect = m_pageRects[pageNumber]; | 311 IntRect pageRect = m_pageRects[pageNumber]; |
| 312 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); | 312 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); |
| 313 pictureBuilder.context().setPrinting(true); | 313 pictureBuilder.context().setPrinting(true); |
| 314 | 314 |
| 315 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 315 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 316 pictureBuilder.endRecording()->playback(canvas); | 316 pictureBuilder.endRecording()->playback(canvas); |
| 317 return scale; | 317 return scale; |
| 318 } | 318 } |
| 319 | 319 |
| 320 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 320 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 321 { | 321 { |
| 322 dispatchEventsForPrintingOnAllFrames(); | 322 dispatchEventsForPrintingOnAllFrames(); |
| 323 if (!frame()->document() || !frame()->document()->layoutView()) | 323 if (!frame()->document() || !frame()->document()->layoutView()) |
| 324 return; | 324 return; |
| 325 | 325 |
| 326 // TODO(chrishtr): this should be updateLifecycleToCompositingCleanPlusS
crolling, but |
| 327 // for some reason it makes printing/absolute-position-headers-and-foote
rs.html fail. |
| 326 frame()->view()->updateAllLifecyclePhases(); | 328 frame()->view()->updateAllLifecyclePhases(); |
| 327 if (!frame()->document() || !frame()->document()->layoutView()) | 329 if (!frame()->document() || !frame()->document()->layoutView()) |
| 328 return; | 330 return; |
| 329 | 331 |
| 330 float pageHeight; | 332 float pageHeight; |
| 331 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); | 333 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); |
| 332 | 334 |
| 333 const float pageWidth = pageSizeInPixels.width(); | 335 const float pageWidth = pageSizeInPixels.width(); |
| 334 size_t numPages = pageRects().size(); | 336 size_t numPages = pageRects().size(); |
| 335 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; | 337 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 return WebSandboxFlags::None; | 2177 return WebSandboxFlags::None; |
| 2176 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2178 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2177 } | 2179 } |
| 2178 | 2180 |
| 2179 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2181 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2180 { | 2182 { |
| 2181 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2183 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2182 } | 2184 } |
| 2183 | 2185 |
| 2184 } // namespace blink | 2186 } // namespace blink |
| OLD | NEW |