| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 frame()->view()->updateAllLifecyclePhasesExceptPaint(); | 301 frame()->view()->updateAllLifecyclePhasesExceptPaint(); |
| 302 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) | 302 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) |
| 303 return 0; | 303 return 0; |
| 304 | 304 |
| 305 IntRect pageRect = m_pageRects[pageNumber]; | 305 IntRect pageRect = m_pageRects[pageNumber]; |
| 306 PaintRecordBuilder builder(pageRect, &canvas->getMetaData()); | 306 PaintRecordBuilder builder(pageRect, &canvas->getMetaData()); |
| 307 builder.context().setPrinting(true); | 307 builder.context().setPrinting(true); |
| 308 | 308 |
| 309 float scale = spoolPage(builder, pageNumber); | 309 float scale = spoolPage(builder, pageNumber); |
| 310 builder.endRecording()->playback(canvas); | 310 canvas->drawPicture(builder.endRecording()); |
| 311 return scale; | 311 return scale; |
| 312 } | 312 } |
| 313 | 313 |
| 314 void spoolAllPagesWithBoundaries(WebCanvas* canvas, | 314 void spoolAllPagesWithBoundaries(WebCanvas* canvas, |
| 315 const FloatSize& pageSizeInPixels) { | 315 const FloatSize& pageSizeInPixels) { |
| 316 dispatchEventsForPrintingOnAllFrames(); | 316 dispatchEventsForPrintingOnAllFrames(); |
| 317 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) | 317 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) |
| 318 return; | 318 return; |
| 319 | 319 |
| 320 frame()->view()->updateAllLifecyclePhasesExceptPaint(); | 320 frame()->view()->updateAllLifecyclePhasesExceptPaint(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied. | 367 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied. |
| 368 float scale = getPageShrink(pageIndex); | 368 float scale = getPageShrink(pageIndex); |
| 369 transform.scale(scale, scale); | 369 transform.scale(scale, scale); |
| 370 #endif | 370 #endif |
| 371 TransformRecorder transformRecorder(context, builder, transform); | 371 TransformRecorder transformRecorder(context, builder, transform); |
| 372 spoolPage(builder, pageIndex); | 372 spoolPage(builder, pageIndex); |
| 373 | 373 |
| 374 currentHeight += pageSizeInPixels.height() + 1; | 374 currentHeight += pageSizeInPixels.height() + 1; |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 builder.endRecording()->playback(canvas); | 377 canvas->drawPicture(builder.endRecording()); |
| 378 } | 378 } |
| 379 | 379 |
| 380 protected: | 380 protected: |
| 381 // Spools the printed page, a subrect of frame(). Skip the scale step. | 381 // Spools the printed page, a subrect of frame(). Skip the scale step. |
| 382 // NativeTheme doesn't play well with scaling. Scaling is done browser side | 382 // NativeTheme doesn't play well with scaling. Scaling is done browser side |
| 383 // instead. Returns the scale to be applied. | 383 // instead. Returns the scale to be applied. |
| 384 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit | 384 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit |
| 385 // do the scaling and ignore the return value. | 385 // do the scaling and ignore the return value. |
| 386 virtual float spoolPage(PaintRecordBuilder& builder, int pageNumber) { | 386 virtual float spoolPage(PaintRecordBuilder& builder, int pageNumber) { |
| 387 IntRect pageRect = m_pageRects[pageNumber]; | 387 IntRect pageRect = m_pageRects[pageNumber]; |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2460 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2461 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2461 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2462 } else { | 2462 } else { |
| 2463 clipHtml = | 2463 clipHtml = |
| 2464 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2464 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2465 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2465 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2466 } | 2466 } |
| 2467 } | 2467 } |
| 2468 | 2468 |
| 2469 } // namespace blink | 2469 } // namespace blink |
| OLD | NEW |