| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) | 303 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) |
| 304 return 0; | 304 return 0; |
| 305 | 305 |
| 306 // The page rect gets scaled and translated, so specify the entire | 306 // The page rect gets scaled and translated, so specify the entire |
| 307 // print content area here as the recording rect. | 307 // print content area here as the recording rect. |
| 308 IntRect printedPageRect(0, 0, m_printedPageHeight, m_printedPageWidth); | 308 IntRect printedPageRect(0, 0, m_printedPageHeight, m_printedPageWidth); |
| 309 PaintRecordBuilder builder(printedPageRect, &canvas->getMetaData()); | 309 PaintRecordBuilder builder(printedPageRect, &canvas->getMetaData()); |
| 310 builder.context().setPrinting(true); | 310 builder.context().setPrinting(true); |
| 311 | 311 |
| 312 float scale = spoolPage(builder, pageNumber); | 312 float scale = spoolPage(builder, pageNumber); |
| 313 canvas->drawPicture(builder.endRecording()); | 313 canvas->PlaybackPaintRecord(builder.endRecording().get()); |
| 314 return scale; | 314 return scale; |
| 315 } | 315 } |
| 316 | 316 |
| 317 void spoolAllPagesWithBoundaries(WebCanvas* canvas, | 317 void spoolAllPagesWithBoundaries(WebCanvas* canvas, |
| 318 const FloatSize& pageSizeInPixels) { | 318 const FloatSize& pageSizeInPixels) { |
| 319 dispatchEventsForPrintingOnAllFrames(); | 319 dispatchEventsForPrintingOnAllFrames(); |
| 320 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) | 320 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) |
| 321 return; | 321 return; |
| 322 | 322 |
| 323 frame()->view()->updateAllLifecyclePhasesExceptPaint(); | 323 frame()->view()->updateAllLifecyclePhasesExceptPaint(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied. | 370 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied. |
| 371 float scale = getPageShrink(pageIndex); | 371 float scale = getPageShrink(pageIndex); |
| 372 transform.scale(scale, scale); | 372 transform.scale(scale, scale); |
| 373 #endif | 373 #endif |
| 374 TransformRecorder transformRecorder(context, builder, transform); | 374 TransformRecorder transformRecorder(context, builder, transform); |
| 375 spoolPage(builder, pageIndex); | 375 spoolPage(builder, pageIndex); |
| 376 | 376 |
| 377 currentHeight += pageSizeInPixels.height() + 1; | 377 currentHeight += pageSizeInPixels.height() + 1; |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 canvas->drawPicture(builder.endRecording()); | 380 canvas->PlaybackPaintRecord(builder.endRecording().get()); |
| 381 } | 381 } |
| 382 | 382 |
| 383 protected: | 383 protected: |
| 384 // Spools the printed page, a subrect of frame(). Skip the scale step. | 384 // Spools the printed page, a subrect of frame(). Skip the scale step. |
| 385 // NativeTheme doesn't play well with scaling. Scaling is done browser side | 385 // NativeTheme doesn't play well with scaling. Scaling is done browser side |
| 386 // instead. Returns the scale to be applied. | 386 // instead. Returns the scale to be applied. |
| 387 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit | 387 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit |
| 388 // do the scaling and ignore the return value. | 388 // do the scaling and ignore the return value. |
| 389 virtual float spoolPage(PaintRecordBuilder& builder, int pageNumber) { | 389 virtual float spoolPage(PaintRecordBuilder& builder, int pageNumber) { |
| 390 IntRect pageRect = m_pageRects[pageNumber]; | 390 IntRect pageRect = m_pageRects[pageNumber]; |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2480 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2482 } else { | 2482 } else { |
| 2483 clipHtml = | 2483 clipHtml = |
| 2484 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2484 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2485 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2485 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2486 } | 2486 } |
| 2487 } | 2487 } |
| 2488 | 2488 |
| 2489 } // namespace blink | 2489 } // namespace blink |
| OLD | NEW |