Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2755183002: Change drawPicture calls to playback to avoid culling (Closed)
Patch Set: Address review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/PageWidgetDelegate.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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());
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
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());
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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2515 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2516 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2516 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2517 } else { 2517 } else {
2518 clipHtml = 2518 clipHtml =
2519 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2519 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2520 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2520 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2521 } 2521 }
2522 } 2522 }
2523 2523
2524 } // namespace blink 2524 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/PageWidgetDelegate.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698