| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 #include "public/web/WebNode.h" | 212 #include "public/web/WebNode.h" |
| 213 #include "public/web/WebPerformance.h" | 213 #include "public/web/WebPerformance.h" |
| 214 #include "public/web/WebPlugin.h" | 214 #include "public/web/WebPlugin.h" |
| 215 #include "public/web/WebPrintParams.h" | 215 #include "public/web/WebPrintParams.h" |
| 216 #include "public/web/WebPrintPresetOptions.h" | 216 #include "public/web/WebPrintPresetOptions.h" |
| 217 #include "public/web/WebRange.h" | 217 #include "public/web/WebRange.h" |
| 218 #include "public/web/WebScriptSource.h" | 218 #include "public/web/WebScriptSource.h" |
| 219 #include "public/web/WebSerializedScriptValue.h" | 219 #include "public/web/WebSerializedScriptValue.h" |
| 220 #include "public/web/WebTestInterfaceFactory.h" | 220 #include "public/web/WebTestInterfaceFactory.h" |
| 221 #include "public/web/WebTreeScopeType.h" | 221 #include "public/web/WebTreeScopeType.h" |
| 222 #include "skia/ext/platform_device.h" | 222 #include "skia/ext/platform_canvas.h" |
| 223 #include "web/AssociatedURLLoader.h" | 223 #include "web/AssociatedURLLoader.h" |
| 224 #include "web/AudioOutputDeviceClientImpl.h" | 224 #include "web/AudioOutputDeviceClientImpl.h" |
| 225 #include "web/CompositionUnderlineVectorBuilder.h" | 225 #include "web/CompositionUnderlineVectorBuilder.h" |
| 226 #include "web/FindInPageCoordinates.h" | 226 #include "web/FindInPageCoordinates.h" |
| 227 #include "web/GeolocationClientProxy.h" | 227 #include "web/GeolocationClientProxy.h" |
| 228 #include "web/LocalFileSystemClient.h" | 228 #include "web/LocalFileSystemClient.h" |
| 229 #include "web/MIDIClientProxy.h" | 229 #include "web/MIDIClientProxy.h" |
| 230 #include "web/NavigatorContentUtilsClientImpl.h" | 230 #include "web/NavigatorContentUtilsClientImpl.h" |
| 231 #include "web/NotificationPermissionClientImpl.h" | 231 #include "web/NotificationPermissionClientImpl.h" |
| 232 #include "web/RemoteBridgeFrameOwner.h" | 232 #include "web/RemoteBridgeFrameOwner.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 { | 363 { |
| 364 dispatchEventsForPrintingOnAllFrames(); | 364 dispatchEventsForPrintingOnAllFrames(); |
| 365 if (!frame()->document() || !frame()->document()->layoutView()) | 365 if (!frame()->document() || !frame()->document()->layoutView()) |
| 366 return 0; | 366 return 0; |
| 367 | 367 |
| 368 frame()->view()->updateAllLifecyclePhases(); | 368 frame()->view()->updateAllLifecyclePhases(); |
| 369 if (!frame()->document() || !frame()->document()->layoutView()) | 369 if (!frame()->document() || !frame()->document()->layoutView()) |
| 370 return 0; | 370 return 0; |
| 371 | 371 |
| 372 IntRect pageRect = m_pageRects[pageNumber]; | 372 IntRect pageRect = m_pageRects[pageNumber]; |
| 373 SkPictureBuilder pictureBuilder(pageRect, &skia::getMetaData(*canvas)); | 373 SkPictureBuilder pictureBuilder(pageRect, &skia::GetMetaData(*canvas)); |
| 374 pictureBuilder.context().setPrinting(true); | 374 pictureBuilder.context().setPrinting(true); |
| 375 | 375 |
| 376 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 376 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 377 pictureBuilder.endRecording()->playback(canvas); | 377 pictureBuilder.endRecording()->playback(canvas); |
| 378 outputLinkedDestinations(canvas, pageRect); | 378 outputLinkedDestinations(canvas, pageRect); |
| 379 return scale; | 379 return scale; |
| 380 } | 380 } |
| 381 | 381 |
| 382 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 382 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 383 { | 383 { |
| 384 dispatchEventsForPrintingOnAllFrames(); | 384 dispatchEventsForPrintingOnAllFrames(); |
| 385 if (!frame()->document() || !frame()->document()->layoutView()) | 385 if (!frame()->document() || !frame()->document()->layoutView()) |
| 386 return; | 386 return; |
| 387 | 387 |
| 388 frame()->view()->updateAllLifecyclePhases(); | 388 frame()->view()->updateAllLifecyclePhases(); |
| 389 if (!frame()->document() || !frame()->document()->layoutView()) | 389 if (!frame()->document() || !frame()->document()->layoutView()) |
| 390 return; | 390 return; |
| 391 | 391 |
| 392 float pageHeight; | 392 float pageHeight; |
| 393 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); | 393 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); |
| 394 | 394 |
| 395 const float pageWidth = pageSizeInPixels.width(); | 395 const float pageWidth = pageSizeInPixels.width(); |
| 396 size_t numPages = pageRects().size(); | 396 size_t numPages = pageRects().size(); |
| 397 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; | 397 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; |
| 398 IntRect allPagesRect(0, 0, pageWidth, totalHeight); | 398 IntRect allPagesRect(0, 0, pageWidth, totalHeight); |
| 399 | 399 |
| 400 SkPictureBuilder pictureBuilder(allPagesRect, &skia::getMetaData(*canvas
)); | 400 SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas
)); |
| 401 pictureBuilder.context().setPrinting(true); | 401 pictureBuilder.context().setPrinting(true); |
| 402 | 402 |
| 403 GraphicsContext& context = pictureBuilder.context(); | 403 GraphicsContext& context = pictureBuilder.context(); |
| 404 | 404 |
| 405 // Fill the whole background by white. | 405 // Fill the whole background by white. |
| 406 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display
Item::PrintedContentBackground)) { | 406 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display
Item::PrintedContentBackground)) { |
| 407 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); | 407 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); |
| 408 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::whi
te); | 408 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::whi
te); |
| 409 } | 409 } |
| 410 | 410 |
| (...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2235 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
| 2236 { | 2236 { |
| 2237 if (!frame()) | 2237 if (!frame()) |
| 2238 return WebSandboxFlags::None; | 2238 return WebSandboxFlags::None; |
| 2239 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2239 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 } // namespace blink | 2242 } // namespace blink |
| OLD | NEW |