REGRESSION (r168327): ImageDocuments with margins zoom to the wrong position when...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Aug 2015 03:46:47 +0000 (03:46 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Aug 2015 03:46:47 +0000 (03:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148063

Reviewed by Simon Fraser.

No new test because it doesn't seem possible to click on a window.open'd ImageDocument.

* html/ImageDocument.cpp:
(WebCore::ImageEventListener::handleEvent):
Use <img>-relative coordinates, not document-relative coordinates,
because after r168327, the image can be centered.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188518 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/ImageDocument.cpp

index 9f8d6a0..382f6f1 100644 (file)
@@ -1,3 +1,17 @@
+2015-08-15  Timothy Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r168327): ImageDocuments with margins zoom to the wrong position when clicked
+        https://bugs.webkit.org/show_bug.cgi?id=148063
+
+        Reviewed by Simon Fraser.
+
+        No new test because it doesn't seem possible to click on a window.open'd ImageDocument.
+
+        * html/ImageDocument.cpp:
+        (WebCore::ImageEventListener::handleEvent):
+        Use <img>-relative coordinates, not document-relative coordinates,
+        because after r168327, the image can be centered.
+
 2015-08-15  Simon Fraser  <simon.fraser@apple.com>
 
         Have will-change create stacking context when necessary
index 891e67e..9ec0212 100644 (file)
@@ -400,7 +400,7 @@ void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
         m_document.windowSizeChanged();
     else if (event->type() == eventNames().clickEvent && is<MouseEvent>(*event)) {
         MouseEvent& mouseEvent = downcast<MouseEvent>(*event);
-        m_document.imageClicked(mouseEvent.x(), mouseEvent.y());
+        m_document.imageClicked(mouseEvent.offsetX(), mouseEvent.offsetY());
     }
 }