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

Side by Side Diff: Source/web/PageWidgetDelegate.cpp

Issue 879993006: [Slimming Paint] Move PageWidgetDelegate scale to a transform display item. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "web/PageWidgetDelegate.h" 32 #include "web/PageWidgetDelegate.h"
33 33
34 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/page/AutoscrollController.h" 36 #include "core/page/AutoscrollController.h"
37 #include "core/page/EventHandler.h" 37 #include "core/page/EventHandler.h"
38 #include "core/page/Page.h" 38 #include "core/page/Page.h"
39 #include "core/paint/TransformRecorder.h"
39 #include "core/rendering/RenderView.h" 40 #include "core/rendering/RenderView.h"
40 #include "core/rendering/compositing/RenderLayerCompositor.h" 41 #include "core/rendering/compositing/RenderLayerCompositor.h"
41 #include "platform/Logging.h" 42 #include "platform/Logging.h"
42 #include "platform/graphics/GraphicsContext.h" 43 #include "platform/graphics/GraphicsContext.h"
43 #include "platform/graphics/paint/ClipRecorder.h" 44 #include "platform/graphics/paint/ClipRecorder.h"
44 #include "platform/graphics/paint/DisplayItemList.h" 45 #include "platform/graphics/paint/DisplayItemList.h"
45 #include "platform/graphics/paint/DrawingRecorder.h" 46 #include "platform/graphics/paint/DrawingRecorder.h"
47 #include "platform/transforms/AffineTransform.h"
46 #include "public/web/WebInputEvent.h" 48 #include "public/web/WebInputEvent.h"
47 #include "web/PageOverlayList.h" 49 #include "web/PageOverlayList.h"
48 #include "web/WebInputEventConversion.h" 50 #include "web/WebInputEventConversion.h"
49 #include "wtf/CurrentTime.h" 51 #include "wtf/CurrentTime.h"
50 52
51 namespace blink { 53 namespace blink {
52 54
53 void PageWidgetDelegate::animate(Page& page, double monotonicFrameBeginTime, Loc alFrame& root) 55 void PageWidgetDelegate::animate(Page& page, double monotonicFrameBeginTime, Loc alFrame& root)
54 { 56 {
55 RefPtrWillBeRawPtr<FrameView> view = root.view(); 57 RefPtrWillBeRawPtr<FrameView> view = root.view();
(...skipping 19 matching lines...) Expand all
75 displayItemList = DisplayItemList::create(); 77 displayItemList = DisplayItemList::create();
76 graphicsContext = adoptPtr(new GraphicsContext(nullptr, displayItemList. get())); 78 graphicsContext = adoptPtr(new GraphicsContext(nullptr, displayItemList. get()));
77 } else { 79 } else {
78 graphicsContext = adoptPtr(new GraphicsContext(canvas, nullptr)); 80 graphicsContext = adoptPtr(new GraphicsContext(canvas, nullptr));
79 } 81 }
80 82
81 // FIXME: opaqueness and device scale factor settings are layering violation s and should not 83 // FIXME: opaqueness and device scale factor settings are layering violation s and should not
82 // be used within Blink paint code. 84 // be used within Blink paint code.
83 graphicsContext->setCertainlyOpaque(background == Opaque); 85 graphicsContext->setCertainlyOpaque(background == Opaque);
84 float scaleFactor = page.deviceScaleFactor(); 86 float scaleFactor = page.deviceScaleFactor();
85 graphicsContext->scale(scaleFactor, scaleFactor);
86 graphicsContext->setDeviceScaleFactor(scaleFactor); 87 graphicsContext->setDeviceScaleFactor(scaleFactor);
88
89 AffineTransform scale;
90 scale.scale(scaleFactor);
91 TransformRecorder scaleRecorder(*graphicsContext, root.displayItemClient(), scale);
jbroman 2015/01/27 22:02:28 Is it fine to use the LocalFrame for this display
chrishtr 2015/01/28 01:50:21 It's fine. The only requirement is that the (Displ
92
87 IntRect dirtyRect(rect); 93 IntRect dirtyRect(rect);
88 FrameView* view = root.view(); 94 FrameView* view = root.view();
89 if (view) { 95 if (view) {
90 ClipRecorder clipRecorder(root.displayItemClient(), graphicsContext.get( ), DisplayItem::PageWidgetDelegateClip, dirtyRect); 96 ClipRecorder clipRecorder(root.displayItemClient(), graphicsContext.get( ), DisplayItem::PageWidgetDelegateClip, dirtyRect);
91 97
92 view->paint(graphicsContext.get(), dirtyRect); 98 view->paint(graphicsContext.get(), dirtyRect);
93 if (overlays) 99 if (overlays)
94 overlays->paintWebFrame(*graphicsContext); 100 overlays->paintWebFrame(*graphicsContext);
95 } else { 101 } else {
96 DrawingRecorder drawingRecorder(graphicsContext.get(), root.displayItemC lient(), DisplayItem::PageWidgetDelegateBackgroundFallback, dirtyRect); 102 DrawingRecorder drawingRecorder(graphicsContext.get(), root.displayItemC lient(), DisplayItem::PageWidgetDelegateBackgroundFallback, dirtyRect);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 { 215 {
210 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event)); 216 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event));
211 } 217 }
212 218
213 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event) 219 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event)
214 { 220 {
215 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event)); 221 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event));
216 } 222 }
217 223
218 } // namespace blink 224 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698