[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

weinig at apple.com weinig at apple.com
Thu Oct 29 20:44:14 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit d63a987ba105af7729022f7254bc2812efaf1342
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 14 03:16:03 2009 +0000

    WebCore: Fix issue where clientX and clientY on MouseEvents were wrong when
    the page was zoomed and scrolled.
    
    Reviewed by David Hyatt.
    
    Test: fast/events/clientXY-in-zoom-and-scroll.html
    
    * dom/MouseRelatedEvent.cpp:
    (WebCore::contentsX): Take page zoom into account.
    (WebCore::contentsY): Ditto.
    
    LayoutTests: Test issue where clientX and clientY on MouseEvents were wrong when
    the page was zoomed and scrolled.
    
    Reviewed by David Hyatt.
    
    * fast/events/clientXY-in-zoom-and-scroll-expected.txt: Added.
    * fast/events/clientXY-in-zoom-and-scroll.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8449a98..35f4d47 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-13  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by David Hyatt.
+
+        Test issue where clientX and clientY on MouseEvents were wrong when
+        the page was zoomed and scrolled.
+
+        * fast/events/clientXY-in-zoom-and-scroll-expected.txt: Added.
+        * fast/events/clientXY-in-zoom-and-scroll.html: Added.
+
 2009-10-13  Dmitry Titov  <dimich at chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/fast/events/clientXY-in-zoom-and-scroll-expected.txt b/LayoutTests/fast/events/clientXY-in-zoom-and-scroll-expected.txt
new file mode 100644
index 0000000..43137f4
--- /dev/null
+++ b/LayoutTests/fast/events/clientXY-in-zoom-and-scroll-expected.txt
@@ -0,0 +1,27 @@
+Base
+PASS event.clientX is 100
+PASS event.clientY is 100
+PASS event.pageX is 100
+PASS event.pageY is 100
+
+Just zoomed
+PASS event.clientX is 83
+PASS event.clientY is 83
+PASS event.pageX is 83
+PASS event.pageY is 83
+
+Just scrolled
+PASS event.clientX is 100
+PASS event.clientY is 100
+PASS event.pageX is 150
+PASS event.pageY is 150
+
+Zoomed and scrolled
+PASS event.clientX is 84
+PASS event.clientY is 84
+PASS event.pageX is 133
+PASS event.pageY is 133
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html b/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html
new file mode 100644
index 0000000..7833de8
--- /dev/null
+++ b/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html
@@ -0,0 +1,123 @@
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<style>
+    #pusher {
+        width: 1000px;
+        height: 1000px;
+        outline: 1px solid black;
+    }
+</style>
+<div id="console"></div>
+<div id="testArea">
+    <div id="pusher">This box is here to create scrollbars.</div>
+</div>
+<script>
+    var event;
+
+    function sendClick()
+    {
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(100, 100);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+        }
+    }
+
+    function zoomPageIn()
+    {
+        if (window.eventSender) {
+            eventSender.zoomPageIn();
+        }
+    }
+
+    function zoomPageOut()
+    {
+        if (window.eventSender) {
+            eventSender.zoomPageOut();
+        }
+    }
+
+    function scrollPage(x, y)
+    {
+        window.scrollTo(x, y);
+    }
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    // Default.
+    function base(e)
+    {
+        event = e;
+        debug("Base");
+        shouldBe("event.clientX", "100");
+        shouldBe("event.clientY", "100");
+        shouldBe("event.pageX", "100");
+        shouldBe("event.pageY", "100");
+    }
+    window.addEventListener("click", base, false);
+    sendClick();
+    window.removeEventListener("click", base, false);
+    
+    // Just zoomed.
+    function justZoomed(e)
+    {
+        event = e;
+        debug("\nJust zoomed");
+        shouldBe("event.clientX", "83");
+        shouldBe("event.clientY", "83");
+        shouldBe("event.pageX", "83");
+        shouldBe("event.pageY", "83");
+    }
+    window.addEventListener("click", justZoomed, false);
+    zoomPageIn();
+    sendClick();
+    zoomPageOut();
+    window.removeEventListener("click", justZoomed, false);
+
+    // Just scrolled.
+    function justScrolled(e)
+    {
+        event = e;
+        debug("\nJust scrolled");
+        shouldBe("event.clientX", "100");
+        shouldBe("event.clientY", "100");
+        shouldBe("event.pageX", "150");
+        shouldBe("event.pageY", "150");
+    }
+    window.addEventListener("click", justScrolled, false);
+    scrollPage(50, 50);
+    sendClick();
+    scrollPage(0, 0);
+    window.removeEventListener("click", justScrolled, false);
+
+    // Zoomed and scrolled.
+    function zoomedAndScrolled(e)
+    {
+        event = e;
+        debug("\nZoomed and scrolled");
+        shouldBe("event.clientX", "84");
+        shouldBe("event.clientY", "84");
+        shouldBe("event.pageX", "133");
+        shouldBe("event.pageY", "133");
+    }
+    window.addEventListener("click", zoomedAndScrolled, false);
+    zoomPageIn();
+    scrollPage(50, 50);
+    sendClick();
+    zoomPageOut();
+    scrollPage(0, 0);
+    window.removeEventListener("click", zoomedAndScrolled, false);
+
+    if (window.layoutTestController) {
+        var area = document.getElementById('testArea');
+        area.parentNode.removeChild(area);
+
+        layoutTestController.notifyDone();
+    }
+
+    successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 08e0107..dd60865 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-10-13  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by David Hyatt.
+
+        Fix issue where clientX and clientY on MouseEvents were wrong when
+        the page was zoomed and scrolled.
+
+        Test: fast/events/clientXY-in-zoom-and-scroll.html
+
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::contentsX): Take page zoom into account.
+        (WebCore::contentsY): Ditto.
+
 2009-10-13  Dave Hyatt  <hyatt at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/dom/MouseRelatedEvent.cpp b/WebCore/dom/MouseRelatedEvent.cpp
index 4ed85ce..87815b1 100644
--- a/WebCore/dom/MouseRelatedEvent.cpp
+++ b/WebCore/dom/MouseRelatedEvent.cpp
@@ -57,7 +57,7 @@ static int contentsX(AbstractView* abstractView)
     FrameView* frameView = frame->view();
     if (!frameView)
         return 0;
-    return frameView->scrollX();
+    return frameView->scrollX() / frame->pageZoomFactor();
 }
 
 static int contentsY(AbstractView* abstractView)
@@ -70,7 +70,7 @@ static int contentsY(AbstractView* abstractView)
     FrameView* frameView = frame->view();
     if (!frameView)
         return 0;
-    return frameView->scrollY();
+    return frameView->scrollY() / frame->pageZoomFactor();
 }
 
 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> viewArg,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list