| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 #include "modules/vr/VRController.h" | 167 #include "modules/vr/VRController.h" |
| 168 #include "modules/wake_lock/ScreenWakeLock.h" | 168 #include "modules/wake_lock/ScreenWakeLock.h" |
| 169 #include "modules/webusb/USBController.h" | 169 #include "modules/webusb/USBController.h" |
| 170 #include "platform/ScriptForbiddenScope.h" | 170 #include "platform/ScriptForbiddenScope.h" |
| 171 #include "platform/TraceEvent.h" | 171 #include "platform/TraceEvent.h" |
| 172 #include "platform/UserGestureIndicator.h" | 172 #include "platform/UserGestureIndicator.h" |
| 173 #include "platform/clipboard/ClipboardUtilities.h" | 173 #include "platform/clipboard/ClipboardUtilities.h" |
| 174 #include "platform/fonts/FontCache.h" | 174 #include "platform/fonts/FontCache.h" |
| 175 #include "platform/graphics/GraphicsContext.h" | 175 #include "platform/graphics/GraphicsContext.h" |
| 176 #include "platform/graphics/GraphicsLayerClient.h" | 176 #include "platform/graphics/GraphicsLayerClient.h" |
| 177 #include "platform/graphics/GraphicsScreen.h" |
| 177 #include "platform/graphics/paint/ClipRecorder.h" | 178 #include "platform/graphics/paint/ClipRecorder.h" |
| 178 #include "platform/graphics/paint/DrawingRecorder.h" | 179 #include "platform/graphics/paint/DrawingRecorder.h" |
| 179 #include "platform/graphics/paint/SkPictureBuilder.h" | 180 #include "platform/graphics/paint/SkPictureBuilder.h" |
| 180 #include "platform/graphics/skia/SkiaUtils.h" | 181 #include "platform/graphics/skia/SkiaUtils.h" |
| 181 #include "platform/heap/Handle.h" | 182 #include "platform/heap/Handle.h" |
| 182 #include "platform/network/ResourceRequest.h" | 183 #include "platform/network/ResourceRequest.h" |
| 183 #include "platform/scroll/ScrollTypes.h" | 184 #include "platform/scroll/ScrollTypes.h" |
| 184 #include "platform/scroll/ScrollbarTheme.h" | 185 #include "platform/scroll/ScrollbarTheme.h" |
| 185 #include "platform/weborigin/KURL.h" | 186 #include "platform/weborigin/KURL.h" |
| 186 #include "platform/weborigin/SchemeRegistry.h" | 187 #include "platform/weborigin/SchemeRegistry.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 354 } |
| 354 | 355 |
| 355 virtual float getPageShrink(int pageNumber) const | 356 virtual float getPageShrink(int pageNumber) const |
| 356 { | 357 { |
| 357 IntRect pageRect = m_pageRects[pageNumber]; | 358 IntRect pageRect = m_pageRects[pageNumber]; |
| 358 return m_printedPageWidth / pageRect.width(); | 359 return m_printedPageWidth / pageRect.width(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 float spoolSinglePage(WebCanvas* canvas, int pageNumber) | 362 float spoolSinglePage(WebCanvas* canvas, int pageNumber) |
| 362 { | 363 { |
| 364 WillPaintForDevice device(ScreenDevice::sRGBPrint); // FIXME: pdfium. |
| 365 if (!frame()->page()) |
| 366 return 0; |
| 367 |
| 363 dispatchEventsForPrintingOnAllFrames(); | 368 dispatchEventsForPrintingOnAllFrames(); |
| 364 if (!frame()->document() || !frame()->document()->layoutView()) | 369 if (!frame()->document() || !frame()->document()->layoutView()) |
| 365 return 0; | 370 return 0; |
| 366 | 371 |
| 367 frame()->view()->updateAllLifecyclePhases(); | 372 frame()->view()->updateAllLifecyclePhases(); |
| 368 if (!frame()->document() || !frame()->document()->layoutView()) | 373 if (!frame()->document() || !frame()->document()->layoutView()) |
| 369 return 0; | 374 return 0; |
| 370 | 375 |
| 371 IntRect pageRect = m_pageRects[pageNumber]; | 376 IntRect pageRect = m_pageRects[pageNumber]; |
| 372 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); | 377 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); |
| 373 pictureBuilder.context().setPrinting(true); | 378 pictureBuilder.context().setPrinting(true); |
| 374 | 379 |
| 375 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 380 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 376 pictureBuilder.endRecording()->playback(canvas); | 381 pictureBuilder.endRecording()->playback(canvas); |
| 377 return scale; | 382 return scale; |
| 378 } | 383 } |
| 379 | 384 |
| 380 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 385 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 381 { | 386 { |
| 387 WillPaintForDevice device(ScreenDevice::sRGBPrint); // FIXME: pdfium. |
| 388 if (!frame()->page()) |
| 389 return; |
| 390 |
| 382 dispatchEventsForPrintingOnAllFrames(); | 391 dispatchEventsForPrintingOnAllFrames(); |
| 383 if (!frame()->document() || !frame()->document()->layoutView()) | 392 if (!frame()->document() || !frame()->document()->layoutView()) |
| 384 return; | 393 return; |
| 385 | 394 |
| 386 frame()->view()->updateAllLifecyclePhases(); | 395 frame()->view()->updateAllLifecyclePhases(); |
| 387 if (!frame()->document() || !frame()->document()->layoutView()) | 396 if (!frame()->document() || !frame()->document()->layoutView()) |
| 388 return; | 397 return; |
| 389 | 398 |
| 390 float pageHeight; | 399 float pageHeight; |
| 391 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); | 400 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); |
| (...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 return WebSandboxFlags::None; | 2275 return WebSandboxFlags::None; |
| 2267 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2276 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2268 } | 2277 } |
| 2269 | 2278 |
| 2270 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2279 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2271 { | 2280 { |
| 2272 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2281 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2273 } | 2282 } |
| 2274 | 2283 |
| 2275 } // namespace blink | 2284 } // namespace blink |
| OLD | NEW |