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

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

Issue 600823005: Revert of Remove default args to several PageWidgetDelegate members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | « Source/web/PageWidgetDelegate.h ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | 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 29 matching lines...) Expand all
40 #include "core/rendering/compositing/RenderLayerCompositor.h" 40 #include "core/rendering/compositing/RenderLayerCompositor.h"
41 #include "platform/Logging.h" 41 #include "platform/Logging.h"
42 #include "platform/graphics/GraphicsContext.h" 42 #include "platform/graphics/GraphicsContext.h"
43 #include "public/web/WebInputEvent.h" 43 #include "public/web/WebInputEvent.h"
44 #include "web/PageOverlayList.h" 44 #include "web/PageOverlayList.h"
45 #include "web/WebInputEventConversion.h" 45 #include "web/WebInputEventConversion.h"
46 #include "wtf/CurrentTime.h" 46 #include "wtf/CurrentTime.h"
47 47
48 namespace blink { 48 namespace blink {
49 49
50 void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime, Loc alFrame* root) 50 static inline FrameView* rootFrameView(Page* page, LocalFrame* rootFrame)
51 { 51 {
52 RefPtr<FrameView> view = root->view(); 52 if (rootFrame)
53 return rootFrame->view();
54 if (!page)
55 return 0;
56 if (!page->mainFrame()->isLocalFrame())
57 return 0;
58 return toLocalFrame(page->mainFrame())->view();
59 }
60
61 void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime, Loc alFrame* rootFrame)
62 {
63 RefPtr<FrameView> view = rootFrameView(page, rootFrame);
53 if (!view) 64 if (!view)
54 return; 65 return;
55 page->autoscrollController().animate(monotonicFrameBeginTime); 66 page->autoscrollController().animate(monotonicFrameBeginTime);
56 page->animator().serviceScriptedAnimations(monotonicFrameBeginTime); 67 page->animator().serviceScriptedAnimations(monotonicFrameBeginTime);
57 } 68 }
58 69
59 void PageWidgetDelegate::layout(Page* page, LocalFrame* root) 70 void PageWidgetDelegate::layout(Page* page, LocalFrame* rootFrame)
60 { 71 {
61 if (!page) 72 if (!page)
62 return; 73 return;
63 74
64 page->animator().updateLayoutAndStyleForPainting(root); 75 if (!rootFrame) {
76 if (!page->mainFrame() || !page->mainFrame()->isLocalFrame())
77 return;
78 rootFrame = toLocalFrame(page->mainFrame());
79 }
80
81 page->animator().updateLayoutAndStyleForPainting(rootFrame);
65 } 82 }
66 83
67 void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect, CanvasBackground background, LocalFrame* root) 84 void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect, CanvasBackground background, LocalFrame* rootFrame )
68 { 85 {
69 if (rect.isEmpty()) 86 if (rect.isEmpty())
70 return; 87 return;
71 GraphicsContext gc(canvas); 88 GraphicsContext gc(canvas);
72 gc.setCertainlyOpaque(background == Opaque); 89 gc.setCertainlyOpaque(background == Opaque);
73 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); 90 gc.applyDeviceScaleFactor(page->deviceScaleFactor());
74 gc.setDeviceScaleFactor(page->deviceScaleFactor()); 91 gc.setDeviceScaleFactor(page->deviceScaleFactor());
75 IntRect dirtyRect(rect); 92 IntRect dirtyRect(rect);
76 gc.save(); // Needed to save the canvas, not the GraphicsContext. 93 gc.save(); // Needed to save the canvas, not the GraphicsContext.
77 FrameView* view = root->view(); 94 FrameView* view = rootFrameView(page, rootFrame);
78 if (view) { 95 if (view) {
79 gc.clip(dirtyRect); 96 gc.clip(dirtyRect);
80 view->paint(&gc, dirtyRect); 97 view->paint(&gc, dirtyRect);
81 if (overlays) 98 if (overlays)
82 overlays->paintWebFrame(gc); 99 overlays->paintWebFrame(gc);
83 } else { 100 } else {
84 gc.fillRect(dirtyRect, Color::white); 101 gc.fillRect(dirtyRect, Color::white);
85 } 102 }
86 gc.restore(); 103 gc.restore();
87 } 104 }
88 105
89 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha ndler, const WebInputEvent& event, LocalFrame* root) 106 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha ndler, const WebInputEvent& event, LocalFrame* rootFrame)
90 { 107 {
108 LocalFrame* frame = rootFrame;
109 if (!frame)
110 frame = page && page->mainFrame()->isLocalFrame() ? toLocalFrame(page->m ainFrame()) : 0;
91 switch (event.type) { 111 switch (event.type) {
92 112
93 // FIXME: WebKit seems to always return false on mouse events processing 113 // FIXME: WebKit seems to always return false on mouse events processing
94 // methods. For now we'll assume it has processed them (as we are only 114 // methods. For now we'll assume it has processed them (as we are only
95 // interested in whether keyboard events are processed). 115 // interested in whether keyboard events are processed).
96 // FIXME: Why do we return true when there is no root or the root is
97 // detached?
98 case WebInputEvent::MouseMove: 116 case WebInputEvent::MouseMove:
99 if (!root || !root->view()) 117 if (!frame || !frame->view())
100 return true; 118 return true;
101 handler.handleMouseMove(*root, static_cast<const WebMouseEvent&>(event)) ; 119 handler.handleMouseMove(*frame, static_cast<const WebMouseEvent&>(event) );
102 return true; 120 return true;
103 case WebInputEvent::MouseLeave: 121 case WebInputEvent::MouseLeave:
104 if (!root || !root->view()) 122 if (!frame || !frame->view())
105 return true; 123 return true;
106 handler.handleMouseLeave(*root, static_cast<const WebMouseEvent&>(event) ); 124 handler.handleMouseLeave(*frame, static_cast<const WebMouseEvent&>(event ));
107 return true; 125 return true;
108 case WebInputEvent::MouseDown: 126 case WebInputEvent::MouseDown:
109 if (!root || !root->view()) 127 if (!frame || !frame->view())
110 return true; 128 return true;
111 handler.handleMouseDown(*root, static_cast<const WebMouseEvent&>(event)) ; 129 handler.handleMouseDown(*frame, static_cast<const WebMouseEvent&>(event) );
112 return true; 130 return true;
113 case WebInputEvent::MouseUp: 131 case WebInputEvent::MouseUp:
114 if (!root || !root->view()) 132 if (!frame || !frame->view())
115 return true; 133 return true;
116 handler.handleMouseUp(*root, static_cast<const WebMouseEvent&>(event)); 134 handler.handleMouseUp(*frame, static_cast<const WebMouseEvent&>(event));
117 return true; 135 return true;
118 136
119 case WebInputEvent::MouseWheel: 137 case WebInputEvent::MouseWheel:
120 if (!root || !root->view()) 138 if (!frame || !frame->view())
121 return false; 139 return false;
122 return handler.handleMouseWheel(*root, static_cast<const WebMouseWheelEv ent&>(event)); 140 return handler.handleMouseWheel(*frame, static_cast<const WebMouseWheelE vent&>(event));
123 141
124 case WebInputEvent::RawKeyDown: 142 case WebInputEvent::RawKeyDown:
125 case WebInputEvent::KeyDown: 143 case WebInputEvent::KeyDown:
126 case WebInputEvent::KeyUp: 144 case WebInputEvent::KeyUp:
127 return handler.handleKeyEvent(static_cast<const WebKeyboardEvent&>(event )); 145 return handler.handleKeyEvent(static_cast<const WebKeyboardEvent&>(event ));
128 146
129 case WebInputEvent::Char: 147 case WebInputEvent::Char:
130 return handler.handleCharEvent(static_cast<const WebKeyboardEvent&>(even t)); 148 return handler.handleCharEvent(static_cast<const WebKeyboardEvent&>(even t));
131 case WebInputEvent::GestureScrollBegin: 149 case WebInputEvent::GestureScrollBegin:
132 case WebInputEvent::GestureScrollEnd: 150 case WebInputEvent::GestureScrollEnd:
133 case WebInputEvent::GestureScrollUpdate: 151 case WebInputEvent::GestureScrollUpdate:
134 case WebInputEvent::GestureScrollUpdateWithoutPropagation: 152 case WebInputEvent::GestureScrollUpdateWithoutPropagation:
135 case WebInputEvent::GestureFlingStart: 153 case WebInputEvent::GestureFlingStart:
136 case WebInputEvent::GestureFlingCancel: 154 case WebInputEvent::GestureFlingCancel:
137 case WebInputEvent::GestureTap: 155 case WebInputEvent::GestureTap:
138 case WebInputEvent::GestureTapUnconfirmed: 156 case WebInputEvent::GestureTapUnconfirmed:
139 case WebInputEvent::GestureTapDown: 157 case WebInputEvent::GestureTapDown:
140 case WebInputEvent::GestureShowPress: 158 case WebInputEvent::GestureShowPress:
141 case WebInputEvent::GestureTapCancel: 159 case WebInputEvent::GestureTapCancel:
142 case WebInputEvent::GestureDoubleTap: 160 case WebInputEvent::GestureDoubleTap:
143 case WebInputEvent::GestureTwoFingerTap: 161 case WebInputEvent::GestureTwoFingerTap:
144 case WebInputEvent::GestureLongPress: 162 case WebInputEvent::GestureLongPress:
145 case WebInputEvent::GestureLongTap: 163 case WebInputEvent::GestureLongTap:
146 return handler.handleGestureEvent(static_cast<const WebGestureEvent&>(ev ent)); 164 return handler.handleGestureEvent(static_cast<const WebGestureEvent&>(ev ent));
147 165
148 case WebInputEvent::TouchStart: 166 case WebInputEvent::TouchStart:
149 case WebInputEvent::TouchMove: 167 case WebInputEvent::TouchMove:
150 case WebInputEvent::TouchEnd: 168 case WebInputEvent::TouchEnd:
151 case WebInputEvent::TouchCancel: 169 case WebInputEvent::TouchCancel:
152 if (!root || !root->view()) 170 if (!frame || !frame->view())
153 return false; 171 return false;
154 return handler.handleTouchEvent(*root, static_cast<const WebTouchEvent&> (event)); 172 return handler.handleTouchEvent(*frame, static_cast<const WebTouchEvent& >(event));
155 173
156 case WebInputEvent::GesturePinchBegin: 174 case WebInputEvent::GesturePinchBegin:
157 case WebInputEvent::GesturePinchEnd: 175 case WebInputEvent::GesturePinchEnd:
158 case WebInputEvent::GesturePinchUpdate: 176 case WebInputEvent::GesturePinchUpdate:
159 // FIXME: Once PlatformGestureEvent is updated to support pinch, this 177 // FIXME: Once PlatformGestureEvent is updated to support pinch, this
160 // should call handleGestureEvent, just like it currently does for 178 // should call handleGestureEvent, just like it currently does for
161 // gesture scroll. 179 // gesture scroll.
162 return false; 180 return false;
163 181
164 default: 182 default:
(...skipping 28 matching lines...) Expand all
193 { 211 {
194 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event)); 212 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event));
195 } 213 }
196 214
197 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event) 215 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event)
198 { 216 {
199 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event)); 217 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event));
200 } 218 }
201 219
202 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/PageWidgetDelegate.h ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698