Chromium Code Reviews| Index: third_party/WebKit/Source/core/events/PointerEventFactory.cpp |
| diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp |
| index 0d88fc6d8148197b56ceeb685b710c4e2bfd354d..ab29c3fe39fbd29b12d9d7a83210b89cdc14d278 100644 |
| --- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp |
| +++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp |
| @@ -4,6 +4,7 @@ |
| #include "core/events/PointerEventFactory.h" |
| +#include "core/frame/FrameView.h" |
| #include "platform/geometry/FloatSize.h" |
| namespace blink { |
| @@ -89,7 +90,7 @@ void PointerEventFactory::setBubblesAndCancelable(PointerEventInit& pointerEvent |
| PointerEvent* PointerEventFactory::create( |
| const AtomicString& mouseEventName, const PlatformMouseEvent& mouseEvent, |
| EventTarget* relatedTarget, |
| - AbstractView* view) |
| + LocalDOMWindow* view) |
| { |
| AtomicString pointerEventName = pointerEventNameForMouseEventName(mouseEventName); |
| unsigned buttons = MouseEvent::platformModifiersToButtons(mouseEvent.getModifiers()); |
| @@ -100,8 +101,27 @@ PointerEvent* PointerEventFactory::create( |
| pointerEventInit.setScreenX(mouseEvent.globalPosition().x()); |
| pointerEventInit.setScreenY(mouseEvent.globalPosition().y()); |
| - pointerEventInit.setClientX(mouseEvent.position().x()); |
| - pointerEventInit.setClientY(mouseEvent.position().y()); |
| + |
| + LayoutPoint scrollPosition; |
| + LayoutPoint adjustedPageLocation; |
| + if (view && view->frame()) { |
| + LocalFrame* frame = view->frame(); |
| + if (FrameView* frameView = frame->view()) { |
|
bokan
2016/05/10 22:24:09
Fold this check into the above one.
Navid Zolghadr
2016/05/11 18:09:43
Done.
|
| + scrollPosition = frameView->scrollPosition(); |
| + adjustedPageLocation = frameView->rootFrameToContents(mouseEvent.position()); |
|
bokan
2016/05/10 22:24:09
s/adjustedPageLocation/locationInContents
Navid Zolghadr
2016/05/11 18:09:43
Done.
|
| + float scaleFactor = 1 / frame->pageZoomFactor(); |
| + if (scaleFactor != 1.0f) { |
|
bokan
2016/05/10 22:24:09
No need for the check here, just allow scaling by
Navid Zolghadr
2016/05/11 18:09:43
Done.
|
| + adjustedPageLocation.scale(scaleFactor, scaleFactor); |
| + scrollPosition.scale(scaleFactor, scaleFactor); |
| + } |
| + } |
| + } |
| + LayoutPoint clientPoint = adjustedPageLocation - toLayoutSize(scrollPosition); |
|
bokan
2016/05/10 22:24:09
I would do this like so:
locationInContents = fra
Navid Zolghadr
2016/05/11 18:09:43
Done.
|
| + |
| + // Set up initial values for coordinates. |
| + // Set up initial values for coordinates. |
| + pointerEventInit.setClientX(clientPoint.x().toInt()); |
| + pointerEventInit.setClientY(clientPoint.y().toInt()); |
| if (pointerEventName == EventTypeNames::pointerdown |
| || pointerEventName == EventTypeNames::pointerup) { |