| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 frame()->view()->updateAllLifecyclePhases(); | 306 frame()->view()->updateAllLifecyclePhases(); |
| 307 if (!frame()->document() || !frame()->document()->layoutView()) | 307 if (!frame()->document() || !frame()->document()->layoutView()) |
| 308 return 0; | 308 return 0; |
| 309 | 309 |
| 310 IntRect pageRect = m_pageRects[pageNumber]; | 310 IntRect pageRect = m_pageRects[pageNumber]; |
| 311 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); | 311 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); |
| 312 pictureBuilder.context().setPrinting(true); | 312 pictureBuilder.context().setPrinting(true); |
| 313 | 313 |
| 314 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 314 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 315 pictureBuilder.endRecording()->playback(canvas); | 315 RefPtr<const SkPicture> recording = pictureBuilder.endRecording(); |
| 316 if (recording) |
| 317 recording->playback(canvas); |
| 316 return scale; | 318 return scale; |
| 317 } | 319 } |
| 318 | 320 |
| 319 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 321 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 320 { | 322 { |
| 321 dispatchEventsForPrintingOnAllFrames(); | 323 dispatchEventsForPrintingOnAllFrames(); |
| 322 if (!frame()->document() || !frame()->document()->layoutView()) | 324 if (!frame()->document() || !frame()->document()->layoutView()) |
| 323 return; | 325 return; |
| 324 | 326 |
| 325 frame()->view()->updateAllLifecyclePhases(); | 327 frame()->view()->updateAllLifecyclePhases(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Account for the disabling of scaling in spoolPage. In the context | 366 // Account for the disabling of scaling in spoolPage. In the context |
| 365 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied
. | 367 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied
. |
| 366 float scale = getPageShrink(pageIndex); | 368 float scale = getPageShrink(pageIndex); |
| 367 transform.scale(scale, scale); | 369 transform.scale(scale, scale); |
| 368 #endif | 370 #endif |
| 369 TransformRecorder transformRecorder(context, *this, transform); | 371 TransformRecorder transformRecorder(context, *this, transform); |
| 370 spoolPage(context, pageIndex); | 372 spoolPage(context, pageIndex); |
| 371 | 373 |
| 372 currentHeight += pageSizeInPixels.height() + 1; | 374 currentHeight += pageSizeInPixels.height() + 1; |
| 373 } | 375 } |
| 374 pictureBuilder.endRecording()->playback(canvas); | 376 RefPtr<const SkPicture> recording = pictureBuilder.endRecording(); |
| 377 if (recording) |
| 378 recording->playback(canvas); |
| 375 } | 379 } |
| 376 | 380 |
| 377 // DisplayItemClient methods | 381 // DisplayItemClient methods |
| 378 String debugName() const final { return "ChromePrintContext"; } | 382 String debugName() const final { return "ChromePrintContext"; } |
| 379 LayoutRect visualRect() const override { return LayoutRect(); } | 383 LayoutRect visualRect() const override { return LayoutRect(); } |
| 380 | 384 |
| 381 protected: | 385 protected: |
| 382 // Spools the printed page, a subrect of frame(). Skip the scale step. | 386 // Spools the printed page, a subrect of frame(). Skip the scale step. |
| 383 // NativeTheme doesn't play well with scaling. Scaling is done browser side | 387 // NativeTheme doesn't play well with scaling. Scaling is done browser side |
| 384 // instead. Returns the scale to be applied. | 388 // instead. Returns the scale to be applied. |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 return WebSandboxFlags::None; | 2193 return WebSandboxFlags::None; |
| 2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2194 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2191 } | 2195 } |
| 2192 | 2196 |
| 2193 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2197 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2194 { | 2198 { |
| 2195 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2199 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2196 } | 2200 } |
| 2197 | 2201 |
| 2198 } // namespace blink | 2202 } // namespace blink |
| OLD | NEW |