| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 IntRect pageRect = m_pageRects[pageNumber]; | 296 IntRect pageRect = m_pageRects[pageNumber]; |
| 297 return m_printedPageWidth / pageRect.width(); | 297 return m_printedPageWidth / pageRect.width(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 float spoolSinglePage(WebCanvas* canvas, int pageNumber) | 300 float spoolSinglePage(WebCanvas* canvas, int pageNumber) |
| 301 { | 301 { |
| 302 dispatchEventsForPrintingOnAllFrames(); | 302 dispatchEventsForPrintingOnAllFrames(); |
| 303 if (!frame()->document() || !frame()->document()->layoutView()) | 303 if (!frame()->document() || !frame()->document()->layoutView()) |
| 304 return 0; | 304 return 0; |
| 305 | 305 |
| 306 // TODO(crbug.com/603230): Synchronized painting is unnecessary in this
lifecycle update. | 306 frame()->view()->updateAllLifecyclePhasesExceptPaint(); |
| 307 frame()->view()->updateAllLifecyclePhases(); | |
| 308 if (!frame()->document() || !frame()->document()->layoutView()) | 307 if (!frame()->document() || !frame()->document()->layoutView()) |
| 309 return 0; | 308 return 0; |
| 310 | 309 |
| 311 IntRect pageRect = m_pageRects[pageNumber]; | 310 IntRect pageRect = m_pageRects[pageNumber]; |
| 312 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); | 311 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); |
| 313 pictureBuilder.context().setPrinting(true); | 312 pictureBuilder.context().setPrinting(true); |
| 314 | 313 |
| 315 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 314 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 316 pictureBuilder.endRecording()->playback(canvas); | 315 pictureBuilder.endRecording()->playback(canvas); |
| 317 return scale; | 316 return scale; |
| 318 } | 317 } |
| 319 | 318 |
| 320 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 319 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 321 { | 320 { |
| 322 dispatchEventsForPrintingOnAllFrames(); | 321 dispatchEventsForPrintingOnAllFrames(); |
| 323 if (!frame()->document() || !frame()->document()->layoutView()) | 322 if (!frame()->document() || !frame()->document()->layoutView()) |
| 324 return; | 323 return; |
| 325 | 324 |
| 326 // TODO(crbug.com/603230): Synchronized painting is unnecessary in this
lifecycle update. | 325 frame()->view()->updateAllLifecyclePhasesExceptPaint(); |
| 327 frame()->view()->updateAllLifecyclePhases(); | |
| 328 if (!frame()->document() || !frame()->document()->layoutView()) | 326 if (!frame()->document() || !frame()->document()->layoutView()) |
| 329 return; | 327 return; |
| 330 | 328 |
| 331 float pageHeight; | 329 float pageHeight; |
| 332 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); | 330 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); |
| 333 | 331 |
| 334 const float pageWidth = pageSizeInPixels.width(); | 332 const float pageWidth = pageSizeInPixels.width(); |
| 335 size_t numPages = pageRects().size(); | 333 size_t numPages = pageRects().size(); |
| 336 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; | 334 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; |
| 337 IntRect allPagesRect(0, 0, pageWidth, totalHeight); | 335 IntRect allPagesRect(0, 0, pageWidth, totalHeight); |
| (...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 return WebSandboxFlags::None; | 2127 return WebSandboxFlags::None; |
| 2130 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2128 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2131 } | 2129 } |
| 2132 | 2130 |
| 2133 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2131 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2134 { | 2132 { |
| 2135 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2133 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2136 } | 2134 } |
| 2137 | 2135 |
| 2138 } // namespace blink | 2136 } // namespace blink |
| OLD | NEW |