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

Unified Diff: Source/core/events/MouseRelatedEvent.cpp

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: whee 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/events/MouseRelatedEvent.cpp
diff --git a/Source/core/events/MouseRelatedEvent.cpp b/Source/core/events/MouseRelatedEvent.cpp
index 9b7f32ec3a37666eff6bb73e64b3b17a7e226d55..42351626b9024296bcdc57d557f959ee7ebc096e 100644
--- a/Source/core/events/MouseRelatedEvent.cpp
+++ b/Source/core/events/MouseRelatedEvent.cpp
@@ -40,9 +40,9 @@ MouseRelatedEvent::MouseRelatedEvent()
static LayoutSize contentsScrollOffset(AbstractView* abstractView)
{
- if (!abstractView)
+ if (!abstractView || !abstractView->isLocalDOMWindow())
return LayoutSize();
- LocalFrame* frame = abstractView->frame();
+ LocalFrame* frame = toLocalDOMWindow(abstractView)->frame();
if (!frame)
return LayoutSize();
FrameView* frameView = frame->view();
@@ -64,7 +64,7 @@ MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
LayoutPoint adjustedPageLocation;
LayoutPoint scrollPosition;
- LocalFrame* frame = view() ? view()->frame() : 0;
+ LocalFrame* frame = view() && view()->isLocalDOMWindow() ? toLocalDOMWindow(view())->frame() : 0;
dcheng 2014/10/31 03:20:41 It was quite a surprise to me that you can pass ar
if (frame && !isSimulated) {
if (FrameView* frameView = frame->view()) {
scrollPosition = frameView->scrollPosition();
@@ -110,10 +110,9 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
static float pageZoomFactor(const UIEvent* event)
{
- LocalDOMWindow* window = event->view();
- if (!window)
+ if (!event->view() || !event->view()->isLocalDOMWindow())
return 1;
- LocalFrame* frame = window->frame();
+ LocalFrame* frame = toLocalDOMWindow(event->view())->frame();
if (!frame)
return 1;
return frame->pageZoomFactor();

Powered by Google App Engine
This is Rietveld 408576698