| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 { | 354 { |
| 355 dispatchEventsForPrintingOnAllFrames(); | 355 dispatchEventsForPrintingOnAllFrames(); |
| 356 if (!frame()->document() || !frame()->document()->layoutView()) | 356 if (!frame()->document() || !frame()->document()->layoutView()) |
| 357 return 0; | 357 return 0; |
| 358 | 358 |
| 359 frame()->view()->updateLayoutAndStyleForPainting(); | 359 frame()->view()->updateLayoutAndStyleForPainting(); |
| 360 if (!frame()->document() || !frame()->document()->layoutView()) | 360 if (!frame()->document() || !frame()->document()->layoutView()) |
| 361 return 0; | 361 return 0; |
| 362 | 362 |
| 363 IntRect pageRect = m_pageRects[pageNumber]; | 363 IntRect pageRect = m_pageRects[pageNumber]; |
| 364 SkPictureBuilder pictureBuilder(pageRect, GraphicsContext::NothingDisabl
ed, &skia::getMetaData(*canvas)); | 364 SkPictureBuilder pictureBuilder(pageRect, &skia::getMetaData(*canvas)); |
| 365 pictureBuilder.context().setPrinting(true); | 365 pictureBuilder.context().setPrinting(true); |
| 366 | 366 |
| 367 float scale = spoolPage(pictureBuilder.context(), pageNumber); | 367 float scale = spoolPage(pictureBuilder.context(), pageNumber); |
| 368 pictureBuilder.endRecording()->playback(canvas); | 368 pictureBuilder.endRecording()->playback(canvas); |
| 369 outputLinkedDestinations(canvas, pageRect); | 369 outputLinkedDestinations(canvas, pageRect); |
| 370 return scale; | 370 return scale; |
| 371 } | 371 } |
| 372 | 372 |
| 373 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) | 373 void spoolAllPagesWithBoundaries(WebCanvas* canvas, const FloatSize& pageSiz
eInPixels) |
| 374 { | 374 { |
| 375 dispatchEventsForPrintingOnAllFrames(); | 375 dispatchEventsForPrintingOnAllFrames(); |
| 376 if (!frame()->document() || !frame()->document()->layoutView()) | 376 if (!frame()->document() || !frame()->document()->layoutView()) |
| 377 return; | 377 return; |
| 378 | 378 |
| 379 frame()->view()->updateLayoutAndStyleForPainting(); | 379 frame()->view()->updateLayoutAndStyleForPainting(); |
| 380 if (!frame()->document() || !frame()->document()->layoutView()) | 380 if (!frame()->document() || !frame()->document()->layoutView()) |
| 381 return; | 381 return; |
| 382 | 382 |
| 383 float pageHeight; | 383 float pageHeight; |
| 384 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); | 384 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1,
pageHeight); |
| 385 | 385 |
| 386 const float pageWidth = pageSizeInPixels.width(); | 386 const float pageWidth = pageSizeInPixels.width(); |
| 387 size_t numPages = pageRects().size(); | 387 size_t numPages = pageRects().size(); |
| 388 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; | 388 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; |
| 389 IntRect allPagesRect(0, 0, pageWidth, totalHeight); | 389 IntRect allPagesRect(0, 0, pageWidth, totalHeight); |
| 390 | 390 |
| 391 SkPictureBuilder pictureBuilder(allPagesRect, GraphicsContext::NothingDi
sabled, &skia::getMetaData(*canvas)); | 391 SkPictureBuilder pictureBuilder(allPagesRect, &skia::getMetaData(*canvas
)); |
| 392 pictureBuilder.context().setPrinting(true); | 392 pictureBuilder.context().setPrinting(true); |
| 393 | 393 |
| 394 GraphicsContext& context = pictureBuilder.context(); | 394 GraphicsContext& context = pictureBuilder.context(); |
| 395 | 395 |
| 396 // Fill the whole background by white. | 396 // Fill the whole background by white. |
| 397 { | 397 { |
| 398 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); | 398 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); |
| 399 if (!backgroundRecorder.canUseCachedDrawing()) | 399 if (!backgroundRecorder.canUseCachedDrawing()) |
| 400 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color:
:white); | 400 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color:
:white); |
| 401 } | 401 } |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 { | 2161 { |
| 2162 m_frameWidget = frameWidget; | 2162 m_frameWidget = frameWidget; |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const | 2165 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const |
| 2166 { | 2166 { |
| 2167 return m_frameWidget; | 2167 return m_frameWidget; |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 } // namespace blink | 2170 } // namespace blink |
| OLD | NEW |