#include "core/frame/LocalFrame.h"
#include "core/page/AutoscrollController.h"
#include "core/page/EventHandler.h"
+#include "core/page/Page.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/compositing/RenderLayerCompositor.h"
#include "platform/graphics/GraphicsContext.h"
#include "web/WebInputEventConversion.h"
#include "wtf/CurrentTime.h"
-using namespace WebCore;
-
namespace blink {
static inline FrameView* mainFrameView(Page* page)
page->animator().serviceScriptedAnimations(monotonicFrameBeginTime);
}
-void PageWidgetDelegate::layout(Page* page)
+void PageWidgetDelegate::layout(Page* page, LocalFrame* rootFrame)
{
- if (!page || !page->mainFrame())
+ if (!page)
return;
- page->animator().updateLayoutAndStyleForPainting();
+
+ 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)
GraphicsContext gc(canvas);
gc.setCertainlyOpaque(background == Opaque);
gc.applyDeviceScaleFactor(page->deviceScaleFactor());
- gc.setUseHighResMarkers(page->deviceScaleFactor() > 1.5f);
+ gc.setDeviceScaleFactor(page->deviceScaleFactor());
IntRect dirtyRect(rect);
gc.save(); // Needed to save the canvas, not the GraphicsContext.
FrameView* view = mainFrameView(page);
case WebInputEvent::MouseMove:
if (!frame || !frame->view())
return true;
- handler.handleMouseMove(*frame, *static_cast<const WebMouseEvent*>(&event));
+ handler.handleMouseMove(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseLeave:
if (!frame || !frame->view())
return true;
- handler.handleMouseLeave(*frame, *static_cast<const WebMouseEvent*>(&event));
+ handler.handleMouseLeave(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseDown:
if (!frame || !frame->view())
return true;
- handler.handleMouseDown(*frame, *static_cast<const WebMouseEvent*>(&event));
+ handler.handleMouseDown(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseUp:
if (!frame || !frame->view())
return true;
- handler.handleMouseUp(*frame, *static_cast<const WebMouseEvent*>(&event));
+ handler.handleMouseUp(*frame, static_cast<const WebMouseEvent&>(event));
return true;
case WebInputEvent::MouseWheel:
if (!frame || !frame->view())
return false;
- return handler.handleMouseWheel(*frame, *static_cast<const WebMouseWheelEvent*>(&event));
+ return handler.handleMouseWheel(*frame, static_cast<const WebMouseWheelEvent&>(event));
case WebInputEvent::RawKeyDown:
case WebInputEvent::KeyDown:
case WebInputEvent::KeyUp:
- return handler.handleKeyEvent(*static_cast<const WebKeyboardEvent*>(&event));
+ return handler.handleKeyEvent(static_cast<const WebKeyboardEvent&>(event));
case WebInputEvent::Char:
- return handler.handleCharEvent(*static_cast<const WebKeyboardEvent*>(&event));
+ return handler.handleCharEvent(static_cast<const WebKeyboardEvent&>(event));
case WebInputEvent::GestureScrollBegin:
case WebInputEvent::GestureScrollEnd:
case WebInputEvent::GestureScrollUpdate:
case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureLongPress:
case WebInputEvent::GestureLongTap:
- return handler.handleGestureEvent(*static_cast<const WebGestureEvent*>(&event));
+ return handler.handleGestureEvent(static_cast<const WebGestureEvent&>(event));
case WebInputEvent::TouchStart:
case WebInputEvent::TouchMove:
case WebInputEvent::TouchCancel:
if (!frame || !frame->view())
return false;
- return handler.handleTouchEvent(*frame, *static_cast<const WebTouchEvent*>(&event));
+ return handler.handleTouchEvent(*frame, static_cast<const WebTouchEvent&>(event));
case WebInputEvent::GesturePinchBegin:
case WebInputEvent::GesturePinchEnd:
return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(mainFrame.view(), event));
}
-}
+} // namespace blink