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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/PageWidgetDelegate.h ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/PageWidgetDelegate.cpp
diff --git a/Source/web/PageWidgetDelegate.cpp b/Source/web/PageWidgetDelegate.cpp
index 621091ce8391f482f6126cc486dbca68589ffeac..0f7e4d4bcda3ae814148cae96394a904939ba15e 100644
--- a/Source/web/PageWidgetDelegate.cpp
+++ b/Source/web/PageWidgetDelegate.cpp
@@ -47,24 +47,41 @@
namespace blink {
-void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime, LocalFrame* root)
-{
- RefPtr<FrameView> view = root->view();
+static inline FrameView* rootFrameView(Page* page, LocalFrame* rootFrame)
+{
+ if (rootFrame)
+ return rootFrame->view();
+ if (!page)
+ return 0;
+ if (!page->mainFrame()->isLocalFrame())
+ return 0;
+ return toLocalFrame(page->mainFrame())->view();
+}
+
+void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime, LocalFrame* rootFrame)
+{
+ RefPtr<FrameView> view = rootFrameView(page, rootFrame);
if (!view)
return;
page->autoscrollController().animate(monotonicFrameBeginTime);
page->animator().serviceScriptedAnimations(monotonicFrameBeginTime);
}
-void PageWidgetDelegate::layout(Page* page, LocalFrame* root)
+void PageWidgetDelegate::layout(Page* page, LocalFrame* rootFrame)
{
if (!page)
return;
- page->animator().updateLayoutAndStyleForPainting(root);
-}
-
-void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect, CanvasBackground background, LocalFrame* root)
+ if (!rootFrame) {
+ if (!page->mainFrame() || !page->mainFrame()->isLocalFrame())
+ return;
+ rootFrame = toLocalFrame(page->mainFrame());
+ }
+
+ page->animator().updateLayoutAndStyleForPainting(rootFrame);
+}
+
+void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect, CanvasBackground background, LocalFrame* rootFrame)
{
if (rect.isEmpty())
return;
@@ -74,7 +91,7 @@
gc.setDeviceScaleFactor(page->deviceScaleFactor());
IntRect dirtyRect(rect);
gc.save(); // Needed to save the canvas, not the GraphicsContext.
- FrameView* view = root->view();
+ FrameView* view = rootFrameView(page, rootFrame);
if (view) {
gc.clip(dirtyRect);
view->paint(&gc, dirtyRect);
@@ -86,40 +103,41 @@
gc.restore();
}
-bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& handler, const WebInputEvent& event, LocalFrame* root)
-{
+bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& handler, const WebInputEvent& event, LocalFrame* rootFrame)
+{
+ LocalFrame* frame = rootFrame;
+ if (!frame)
+ frame = page && page->mainFrame()->isLocalFrame() ? toLocalFrame(page->mainFrame()) : 0;
switch (event.type) {
// FIXME: WebKit seems to always return false on mouse events processing
// methods. For now we'll assume it has processed them (as we are only
// interested in whether keyboard events are processed).
- // FIXME: Why do we return true when there is no root or the root is
- // detached?
case WebInputEvent::MouseMove:
- if (!root || !root->view())
- return true;
- handler.handleMouseMove(*root, static_cast<const WebMouseEvent&>(event));
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseMove(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseLeave:
- if (!root || !root->view())
- return true;
- handler.handleMouseLeave(*root, static_cast<const WebMouseEvent&>(event));
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseLeave(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseDown:
- if (!root || !root->view())
- return true;
- handler.handleMouseDown(*root, static_cast<const WebMouseEvent&>(event));
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseDown(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseUp:
- if (!root || !root->view())
- return true;
- handler.handleMouseUp(*root, static_cast<const WebMouseEvent&>(event));
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseUp(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseWheel:
- if (!root || !root->view())
+ if (!frame || !frame->view())
return false;
- return handler.handleMouseWheel(*root, static_cast<const WebMouseWheelEvent&>(event));
+ return handler.handleMouseWheel(*frame, static_cast<const WebMouseWheelEvent&>(event));
case WebInputEvent::RawKeyDown:
case WebInputEvent::KeyDown:
@@ -149,9 +167,9 @@
case WebInputEvent::TouchMove:
case WebInputEvent::TouchEnd:
case WebInputEvent::TouchCancel:
- if (!root || !root->view())
+ if (!frame || !frame->view())
return false;
- return handler.handleTouchEvent(*root, static_cast<const WebTouchEvent&>(event));
+ return handler.handleTouchEvent(*frame, static_cast<const WebTouchEvent&>(event));
case WebInputEvent::GesturePinchBegin:
case WebInputEvent::GesturePinchEnd:
« 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