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

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

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 8 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "core/dom/shadow/ShadowRoot.h" 111 #include "core/dom/shadow/ShadowRoot.h"
112 #include "core/editing/EditingUtilities.h" 112 #include "core/editing/EditingUtilities.h"
113 #include "core/editing/Editor.h" 113 #include "core/editing/Editor.h"
114 #include "core/editing/FrameSelection.h" 114 #include "core/editing/FrameSelection.h"
115 #include "core/editing/InputMethodController.h" 115 #include "core/editing/InputMethodController.h"
116 #include "core/editing/PlainTextRange.h" 116 #include "core/editing/PlainTextRange.h"
117 #include "core/editing/TextAffinity.h" 117 #include "core/editing/TextAffinity.h"
118 #include "core/editing/iterators/TextIterator.h" 118 #include "core/editing/iterators/TextIterator.h"
119 #include "core/editing/serializers/Serialization.h" 119 #include "core/editing/serializers/Serialization.h"
120 #include "core/editing/spellcheck/SpellChecker.h" 120 #include "core/editing/spellcheck/SpellChecker.h"
121 #include "core/frame/Frame.h"
121 #include "core/frame/FrameHost.h" 122 #include "core/frame/FrameHost.h"
122 #include "core/frame/FrameView.h" 123 #include "core/frame/FrameView.h"
123 #include "core/frame/LocalDOMWindow.h" 124 #include "core/frame/LocalDOMWindow.h"
124 #include "core/frame/PageScaleConstraintsSet.h" 125 #include "core/frame/PageScaleConstraintsSet.h"
125 #include "core/frame/RemoteFrame.h" 126 #include "core/frame/RemoteFrame.h"
126 #include "core/frame/Settings.h" 127 #include "core/frame/Settings.h"
127 #include "core/frame/SmartClip.h" 128 #include "core/frame/SmartClip.h"
128 #include "core/frame/UseCounter.h" 129 #include "core/frame/UseCounter.h"
129 #include "core/frame/VisualViewport.h" 130 #include "core/frame/VisualViewport.h"
130 #include "core/html/HTMLAnchorElement.h" 131 #include "core/html/HTMLAnchorElement.h"
(...skipping 15 matching lines...) Expand all
146 #include "core/loader/DocumentLoader.h" 147 #include "core/loader/DocumentLoader.h"
147 #include "core/loader/FrameLoadRequest.h" 148 #include "core/loader/FrameLoadRequest.h"
148 #include "core/loader/FrameLoader.h" 149 #include "core/loader/FrameLoader.h"
149 #include "core/loader/HistoryItem.h" 150 #include "core/loader/HistoryItem.h"
150 #include "core/loader/MixedContentChecker.h" 151 #include "core/loader/MixedContentChecker.h"
151 #include "core/loader/NavigationScheduler.h" 152 #include "core/loader/NavigationScheduler.h"
152 #include "core/page/FocusController.h" 153 #include "core/page/FocusController.h"
153 #include "core/page/FrameTree.h" 154 #include "core/page/FrameTree.h"
154 #include "core/page/Page.h" 155 #include "core/page/Page.h"
155 #include "core/page/PrintContext.h" 156 #include "core/page/PrintContext.h"
157 #include "core/paint/PaintInfo.h"
156 #include "core/paint/PaintLayer.h" 158 #include "core/paint/PaintLayer.h"
159 #include "core/paint/PaintLayerPainter.h"
160 #include "core/paint/PaintLayerPaintingInfo.h"
157 #include "core/paint/TransformRecorder.h" 161 #include "core/paint/TransformRecorder.h"
158 #include "core/style/StyleInheritedData.h" 162 #include "core/style/StyleInheritedData.h"
159 #include "core/timing/DOMWindowPerformance.h" 163 #include "core/timing/DOMWindowPerformance.h"
160 #include "core/timing/Performance.h" 164 #include "core/timing/Performance.h"
161 #include "modules/app_banner/AppBannerController.h" 165 #include "modules/app_banner/AppBannerController.h"
162 #include "modules/installation/InstallationServiceImpl.h" 166 #include "modules/installation/InstallationServiceImpl.h"
163 #include "modules/screen_orientation/ScreenOrientationControllerImpl.h" 167 #include "modules/screen_orientation/ScreenOrientationControllerImpl.h"
164 #include "platform/ScriptForbiddenScope.h" 168 #include "platform/ScriptForbiddenScope.h"
165 #include "platform/UserGestureIndicator.h" 169 #include "platform/UserGestureIndicator.h"
166 #include "platform/WebFrameScheduler.h" 170 #include "platform/WebFrameScheduler.h"
167 #include "platform/clipboard/ClipboardUtilities.h" 171 #include "platform/clipboard/ClipboardUtilities.h"
168 #include "platform/fonts/FontCache.h" 172 #include "platform/fonts/FontCache.h"
169 #include "platform/graphics/GraphicsContext.h" 173 #include "platform/graphics/GraphicsContext.h"
170 #include "platform/graphics/GraphicsLayerClient.h" 174 #include "platform/graphics/GraphicsLayerClient.h"
171 #include "platform/graphics/paint/ClipRecorder.h" 175 #include "platform/graphics/paint/ClipRecorder.h"
176 #include "platform/graphics/paint/CullRect.h"
172 #include "platform/graphics/paint/DisplayItemCacheSkipper.h" 177 #include "platform/graphics/paint/DisplayItemCacheSkipper.h"
173 #include "platform/graphics/paint/DrawingRecorder.h" 178 #include "platform/graphics/paint/DrawingRecorder.h"
174 #include "platform/graphics/paint/PaintRecordBuilder.h" 179 #include "platform/graphics/paint/PaintRecordBuilder.h"
175 #include "platform/graphics/skia/SkiaUtils.h" 180 #include "platform/graphics/skia/SkiaUtils.h"
176 #include "platform/heap/Handle.h" 181 #include "platform/heap/Handle.h"
177 #include "platform/instrumentation/tracing/TraceEvent.h" 182 #include "platform/instrumentation/tracing/TraceEvent.h"
178 #include "platform/loader/fetch/ResourceFetcher.h" 183 #include "platform/loader/fetch/ResourceFetcher.h"
179 #include "platform/loader/fetch/SubstituteData.h" 184 #include "platform/loader/fetch/SubstituteData.h"
180 #include "platform/network/ResourceRequest.h" 185 #include "platform/network/ResourceRequest.h"
181 #include "platform/scroll/ScrollTypes.h" 186 #include "platform/scroll/ScrollTypes.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 #include "public/web/WebPlugin.h" 218 #include "public/web/WebPlugin.h"
214 #include "public/web/WebPrintParams.h" 219 #include "public/web/WebPrintParams.h"
215 #include "public/web/WebPrintPresetOptions.h" 220 #include "public/web/WebPrintPresetOptions.h"
216 #include "public/web/WebRange.h" 221 #include "public/web/WebRange.h"
217 #include "public/web/WebScriptSource.h" 222 #include "public/web/WebScriptSource.h"
218 #include "public/web/WebSerializedScriptValue.h" 223 #include "public/web/WebSerializedScriptValue.h"
219 #include "public/web/WebTreeScopeType.h" 224 #include "public/web/WebTreeScopeType.h"
220 #include "skia/ext/platform_canvas.h" 225 #include "skia/ext/platform_canvas.h"
221 #include "web/CompositionUnderlineVectorBuilder.h" 226 #include "web/CompositionUnderlineVectorBuilder.h"
222 #include "web/FindInPageCoordinates.h" 227 #include "web/FindInPageCoordinates.h"
228 #include "web/RemoteFrameClientImpl.h"
223 #include "web/RemoteFrameOwner.h" 229 #include "web/RemoteFrameOwner.h"
224 #include "web/SharedWorkerRepositoryClientImpl.h" 230 #include "web/SharedWorkerRepositoryClientImpl.h"
225 #include "web/SuspendableScriptExecutor.h" 231 #include "web/SuspendableScriptExecutor.h"
226 #include "web/TextFinder.h" 232 #include "web/TextFinder.h"
227 #include "web/WebAssociatedURLLoaderImpl.h" 233 #include "web/WebAssociatedURLLoaderImpl.h"
228 #include "web/WebDataSourceImpl.h" 234 #include "web/WebDataSourceImpl.h"
229 #include "web/WebDevToolsAgentImpl.h" 235 #include "web/WebDevToolsAgentImpl.h"
230 #include "web/WebFrameWidgetImpl.h" 236 #include "web/WebFrameWidgetImpl.h"
231 #include "web/WebPluginContainerImpl.h" 237 #include "web/WebPluginContainerImpl.h"
232 #include "web/WebRemoteFrameImpl.h" 238 #include "web/WebRemoteFrameImpl.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) 304 if (!frame()->document() || frame()->document()->layoutViewItem().isNull())
299 return 0; 305 return 0;
300 306
301 frame()->view()->updateAllLifecyclePhasesExceptPaint(); 307 frame()->view()->updateAllLifecyclePhasesExceptPaint();
302 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) 308 if (!frame()->document() || frame()->document()->layoutViewItem().isNull())
303 return 0; 309 return 0;
304 310
305 IntRect pageRect = m_pageRects[pageNumber]; 311 IntRect pageRect = m_pageRects[pageNumber];
306 PaintRecordBuilder builder(pageRect, &skia::GetMetaData(*canvas)); 312 PaintRecordBuilder builder(pageRect, &skia::GetMetaData(*canvas));
307 builder.context().setPrinting(true); 313 builder.context().setPrinting(true);
314 builder.context().setPrintPageNumber(pageNumber);
308 315
309 float scale = spoolPage(builder, pageNumber); 316 float scale = spoolPage(builder, pageNumber);
310 builder.endRecording()->playback(canvas); 317 canvas->drawDrawable(builder.endRecordingAsDrawable().get());
311 return scale; 318 return scale;
312 } 319 }
313 320
314 void spoolAllPagesWithBoundaries(WebCanvas* canvas, 321 void spoolAllPagesWithBoundaries(WebCanvas* canvas,
315 const FloatSize& pageSizeInPixels) { 322 const FloatSize& pageSizeInPixels) {
316 dispatchEventsForPrintingOnAllFrames(); 323 dispatchEventsForPrintingOnAllFrames();
317 if (!frame()->document() || frame()->document()->layoutViewItem().isNull()) 324 if (!frame()->document() || frame()->document()->layoutViewItem().isNull())
318 return; 325 return;
319 326
320 frame()->view()->updateAllLifecyclePhasesExceptPaint(); 327 frame()->view()->updateAllLifecyclePhasesExceptPaint();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 AffineTransform transform; 398 AffineTransform transform;
392 #if OS(POSIX) && !OS(MACOSX) 399 #if OS(POSIX) && !OS(MACOSX)
393 transform.scale(scale); 400 transform.scale(scale);
394 #endif 401 #endif
395 transform.translate(static_cast<float>(-pageRect.x()), 402 transform.translate(static_cast<float>(-pageRect.x()),
396 static_cast<float>(-pageRect.y())); 403 static_cast<float>(-pageRect.y()));
397 TransformRecorder transformRecorder(context, builder, transform); 404 TransformRecorder transformRecorder(context, builder, transform);
398 405
399 ClipRecorder clipRecorder(context, builder, DisplayItem::kClipPrintedPage, 406 ClipRecorder clipRecorder(context, builder, DisplayItem::kClipPrintedPage,
400 pageRect); 407 pageRect);
401 408 if (frame()->isCrossOriginSubframe()) {
402 frame()->view()->paintContents(context, GlobalPaintNormalPhase, pageRect); 409 frame()->view()->paint(context, GlobalPaintNormalPhase,
410 CullRect(pageRect));
411 } else {
412 frame()->view()->paintContents(context, GlobalPaintNormalPhase, pageRect);
413 }
403 414
404 { 415 {
405 DrawingRecorder lineBoundaryRecorder( 416 DrawingRecorder lineBoundaryRecorder(
406 context, builder, DisplayItem::kPrintedContentDestinationLocations, 417 context, builder, DisplayItem::kPrintedContentDestinationLocations,
407 pageRect); 418 pageRect);
408 outputLinkedDestinations(context, pageRect); 419 outputLinkedDestinations(context, pageRect);
409 } 420 }
410 421
411 return scale; 422 return scale;
412 } 423 }
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2422 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2412 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2423 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2413 } else { 2424 } else {
2414 clipHtml = 2425 clipHtml =
2415 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2426 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2416 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2427 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2417 } 2428 }
2418 } 2429 }
2419 2430
2420 } // namespace blink 2431 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp ('k') | third_party/WebKit/public/web/WebPrintParams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698