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

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

Issue 2022563002: Remove display item scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/platform/graphics/paint/README.md ('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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 #include "core/loader/FrameLoadRequest.h" 142 #include "core/loader/FrameLoadRequest.h"
143 #include "core/loader/FrameLoader.h" 143 #include "core/loader/FrameLoader.h"
144 #include "core/loader/HistoryItem.h" 144 #include "core/loader/HistoryItem.h"
145 #include "core/loader/MixedContentChecker.h" 145 #include "core/loader/MixedContentChecker.h"
146 #include "core/loader/NavigationScheduler.h" 146 #include "core/loader/NavigationScheduler.h"
147 #include "core/page/FocusController.h" 147 #include "core/page/FocusController.h"
148 #include "core/page/FrameTree.h" 148 #include "core/page/FrameTree.h"
149 #include "core/page/Page.h" 149 #include "core/page/Page.h"
150 #include "core/page/PrintContext.h" 150 #include "core/page/PrintContext.h"
151 #include "core/paint/PaintLayer.h" 151 #include "core/paint/PaintLayer.h"
152 #include "core/paint/ScopeRecorder.h"
153 #include "core/paint/TransformRecorder.h" 152 #include "core/paint/TransformRecorder.h"
154 #include "core/timing/DOMWindowPerformance.h" 153 #include "core/timing/DOMWindowPerformance.h"
155 #include "core/timing/Performance.h" 154 #include "core/timing/Performance.h"
156 #include "modules/app_banner/AppBannerController.h" 155 #include "modules/app_banner/AppBannerController.h"
157 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" 156 #include "modules/audio_output_devices/AudioOutputDeviceClient.h"
158 #include "modules/bluetooth/BluetoothSupplement.h" 157 #include "modules/bluetooth/BluetoothSupplement.h"
159 #include "modules/installedapp/InstalledAppController.h" 158 #include "modules/installedapp/InstalledAppController.h"
160 #include "modules/notifications/NotificationPermissionClient.h" 159 #include "modules/notifications/NotificationPermissionClient.h"
161 #include "modules/permissions/PermissionController.h" 160 #include "modules/permissions/PermissionController.h"
162 #include "modules/presentation/PresentationController.h" 161 #include "modules/presentation/PresentationController.h"
163 #include "modules/push_messaging/PushController.h" 162 #include "modules/push_messaging/PushController.h"
164 #include "modules/screen_orientation/ScreenOrientationController.h" 163 #include "modules/screen_orientation/ScreenOrientationController.h"
165 #include "modules/vr/VRController.h" 164 #include "modules/vr/VRController.h"
166 #include "modules/wake_lock/ScreenWakeLock.h" 165 #include "modules/wake_lock/ScreenWakeLock.h"
167 #include "platform/ScriptForbiddenScope.h" 166 #include "platform/ScriptForbiddenScope.h"
168 #include "platform/TraceEvent.h" 167 #include "platform/TraceEvent.h"
169 #include "platform/UserGestureIndicator.h" 168 #include "platform/UserGestureIndicator.h"
170 #include "platform/clipboard/ClipboardUtilities.h" 169 #include "platform/clipboard/ClipboardUtilities.h"
171 #include "platform/fonts/FontCache.h" 170 #include "platform/fonts/FontCache.h"
172 #include "platform/graphics/GraphicsContext.h" 171 #include "platform/graphics/GraphicsContext.h"
173 #include "platform/graphics/GraphicsLayerClient.h" 172 #include "platform/graphics/GraphicsLayerClient.h"
174 #include "platform/graphics/paint/ClipRecorder.h" 173 #include "platform/graphics/paint/ClipRecorder.h"
174 #include "platform/graphics/paint/DisplayItemCacheSkipper.h"
175 #include "platform/graphics/paint/DrawingRecorder.h" 175 #include "platform/graphics/paint/DrawingRecorder.h"
176 #include "platform/graphics/paint/SkPictureBuilder.h" 176 #include "platform/graphics/paint/SkPictureBuilder.h"
177 #include "platform/graphics/skia/SkiaUtils.h" 177 #include "platform/graphics/skia/SkiaUtils.h"
178 #include "platform/heap/Handle.h" 178 #include "platform/heap/Handle.h"
179 #include "platform/network/ResourceRequest.h" 179 #include "platform/network/ResourceRequest.h"
180 #include "platform/scroll/ScrollTypes.h" 180 #include "platform/scroll/ScrollTypes.h"
181 #include "platform/scroll/ScrollbarTheme.h" 181 #include "platform/scroll/ScrollbarTheme.h"
182 #include "platform/weborigin/KURL.h" 182 #include "platform/weborigin/KURL.h"
183 #include "platform/weborigin/SchemeRegistry.h" 183 #include "platform/weborigin/SchemeRegistry.h"
184 #include "platform/weborigin/SecurityPolicy.h" 184 #include "platform/weborigin/SecurityPolicy.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight); 331 computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight);
332 332
333 const float pageWidth = pageSizeInPixels.width(); 333 const float pageWidth = pageSizeInPixels.width();
334 size_t numPages = pageRects().size(); 334 size_t numPages = pageRects().size();
335 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; 335 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1;
336 IntRect allPagesRect(0, 0, pageWidth, totalHeight); 336 IntRect allPagesRect(0, 0, pageWidth, totalHeight);
337 337
338 SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas )); 338 SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas ));
339 pictureBuilder.context().setPrinting(true); 339 pictureBuilder.context().setPrinting(true);
340 340
341 GraphicsContext& context = pictureBuilder.context(); 341 {
342 GraphicsContext& context = pictureBuilder.context();
343 DisplayItemCacheSkipper skipper(context);
342 344
343 // Fill the whole background by white. 345 // Fill the whole background by white.
344 { 346 {
345 DrawingRecorder backgroundRecorder(context, pictureBuilder, DisplayI tem::PrintedContentBackground, allPagesRect); 347 DrawingRecorder backgroundRecorder(context, pictureBuilder, Disp layItem::PrintedContentBackground, allPagesRect);
346 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::whi te); 348 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color: :white);
347 }
348
349 int currentHeight = 0;
350 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
351 ScopeRecorder scopeRecorder(context);
352 // Draw a line for a page boundary if this isn't the first page.
353 if (pageIndex > 0) {
354 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder, Di splayItem::PrintedContentLineBoundary, allPagesRect);
355 context.save();
356 context.setStrokeColor(Color(0, 0, 255));
357 context.setFillColor(Color(0, 0, 255));
358 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth, currentHeight));
359 context.restore();
360 } 349 }
361 350
362 AffineTransform transform; 351
363 transform.translate(0, currentHeight); 352 int currentHeight = 0;
353 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
354 // Draw a line for a page boundary if this isn't the first page.
355 if (pageIndex > 0) {
356 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder , DisplayItem::PrintedContentLineBoundary, allPagesRect);
357 context.save();
358 context.setStrokeColor(Color(0, 0, 255));
359 context.setFillColor(Color(0, 0, 255));
360 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWi dth, currentHeight));
361 context.restore();
362 }
363
364 AffineTransform transform;
365 transform.translate(0, currentHeight);
364 #if OS(WIN) || OS(MACOSX) 366 #if OS(WIN) || OS(MACOSX)
365 // Account for the disabling of scaling in spoolPage. In the context 367 // Account for the disabling of scaling in spoolPage. In the con text
366 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied . 368 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-app lied.
367 float scale = getPageShrink(pageIndex); 369 float scale = getPageShrink(pageIndex);
368 transform.scale(scale, scale); 370 transform.scale(scale, scale);
369 #endif 371 #endif
370 TransformRecorder transformRecorder(context, pictureBuilder, transfo rm); 372 TransformRecorder transformRecorder(context, pictureBuilder, tra nsform);
371 spoolPage(pictureBuilder, pageIndex); 373 spoolPage(pictureBuilder, pageIndex);
372 374
373 currentHeight += pageSizeInPixels.height() + 1; 375 currentHeight += pageSizeInPixels.height() + 1;
376 }
374 } 377 }
375 pictureBuilder.endRecording()->playback(canvas); 378 pictureBuilder.endRecording()->playback(canvas);
376 } 379 }
377 380
378 protected: 381 protected:
379 // Spools the printed page, a subrect of frame(). Skip the scale step. 382 // Spools the printed page, a subrect of frame(). Skip the scale step.
380 // NativeTheme doesn't play well with scaling. Scaling is done browser side 383 // NativeTheme doesn't play well with scaling. Scaling is done browser side
381 // instead. Returns the scale to be applied. 384 // instead. Returns the scale to be applied.
382 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit 385 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit
383 // do the scaling and ignore the return value. 386 // do the scaling and ignore the return value.
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 return WebSandboxFlags::None; 2093 return WebSandboxFlags::None;
2091 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2094 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2092 } 2095 }
2093 2096
2094 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2097 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2095 { 2098 {
2096 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2099 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2097 } 2100 }
2098 2101
2099 } // namespace blink 2102 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698