[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

mitz at apple.com mitz at apple.com
Thu Apr 8 02:03:14 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 29bb5006ea49020e99ab0a4086b8ac8d771017c5
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Feb 27 12:39:27 2010 +0000

    <rdar://problem/7696607> Links do not respect -webkit-user-drag: none
    https://bugs.webkit.org/show_bug.cgi?id=35475
    
    Reviewed by Maciej Stachowiak.
    
    WebCore:
    
    Test: fast/css/user-drag-none.html
    
    * page/DragController.cpp:
    (WebCore::DragController::mayStartDragAtEventLocation): Added a node
    parameter. The image drag check is done against the node, rather than
    than against the hit test result. This prevents a non-draggable image
    with an auto-draggable ancestor from being dragged alone. The link drag
    check now ignores links that are -webkit-user-drag: none.
    * page/DragController.h:
    * page/EventHandler.cpp:
    (WebCore::EventHandler::shouldDragAutoNode): Pass the current node
    to mayStartDragAtEventLocation().
    
    LayoutTests:
    
    * fast/css/user-drag-none-expected.txt: Added.
    * fast/css/user-drag-none.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2516ded..c73c902 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-27  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        <rdar://problem/7696607> Links do not respect -webkit-user-drag: none
+        https://bugs.webkit.org/show_bug.cgi?id=35475
+
+        * fast/css/user-drag-none-expected.txt: Added.
+        * fast/css/user-drag-none.html: Added.
+
 2010-02-27  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/LayoutTests/fast/css/user-drag-none-expected.txt b/LayoutTests/fast/css/user-drag-none-expected.txt
new file mode 100644
index 0000000..b571874
--- /dev/null
+++ b/LayoutTests/fast/css/user-drag-none-expected.txt
@@ -0,0 +1,77 @@
+
+
+
+x
+y
+x
+y
+x
+y
+x
+y
+x
+y
+x
+y
+x
+y
+x
+y
+Test #0
+PASS
+PASS
+Test #1
+PASS
+PASS
+Test #2
+PASS
+PASS
+Test #3
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #4
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #5
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #6
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #7
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #8
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #9
+PASS
+PASS
+PASS
+PASS
+PASS
+Test #10
+PASS
+PASS
+PASS
+PASS
+PASS
+
diff --git a/LayoutTests/fast/css/user-drag-none.html b/LayoutTests/fast/css/user-drag-none.html
new file mode 100644
index 0000000..c88caaf
--- /dev/null
+++ b/LayoutTests/fast/css/user-drag-none.html
@@ -0,0 +1,106 @@
+<style>
+    .box { width: 100px; height: 90px; margin-bottom: 10px; background-color: lightblue; }
+    .drag-element { -webkit-user-drag: element; }
+    .drag-none { -webkit-user-drag: none; }
+    a { display: block; width: 80px; height: 80px; background-color: yellow; font-family: ahem; font-size: 25px; }
+    a span { color: orange; }
+    a img { vertical-align: bottom; }
+</style>
+<div id="container" style="position: relative;">
+    <div class="box" expect="IMG nil">
+        <img src="resources/greenbox.png">
+    </div>
+
+    <div class="box" expect="nil nil">
+        <img class="drag-none" src="resources/greenbox.png">
+    </div>
+
+    <div class="box drag-element" expect="DIV DIV">
+        <img class="drag-none" src="resources/greenbox.png">
+    </div>
+
+    <div class="box" expect="IMG text text A nil">
+        <a href="#"><img src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box" expect="IMG text text A nil">
+        <a href="#" class="drag-element"><img src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box" expect="IMG nil nil nil nil">
+        <a href="#" class="drag-none"><img src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box" expect="A text text A nil">
+        <a href="#"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box" expect="A text text A nil">
+        <a href="#" class="drag-element"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box drag-element" expect="IMG DIV DIV DIV DIV">
+        <a href="#" class="drag-none"><img src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box drag-element" expect="A text text A DIV">
+        <a href="#"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+
+    <div class="box drag-element" expect="A text text A DIV">
+        <a href="#" class="drag-element"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
+    </div>
+</div>
+<pre id="console"></pre>
+<script>
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    onload = window.layoutTestController ? function()
+    {
+        layoutTestController.dumpAsText();
+
+        var container = document.getElementById("container");
+        var y = container.getBoundingClientRect().top;
+        for (var i = 0; i < container.childElementCount; ++i) {
+            var listener = function(event)
+            {
+                result = event.target.nodeType === Node.TEXT_NODE ? "text" : event.target.tagName;
+            };
+
+            container.addEventListener("dragstart", listener);
+
+            var child = container.children[i];
+            log("Test #" + i);
+
+            var expectedResults = child.getAttribute("expect").split(" ");
+            var result;
+
+            function test(h, v)
+            {
+                if (expectedResults.length) {
+                    getSelection().empty();
+                    result = "nil";
+                    eventSender.mouseMoveTo(h, y - scrollY + v);
+                    eventSender.mouseDown();
+                    eventSender.mouseMoveTo(220, y - scrollY + v);
+                    eventSender.mouseUp();
+                    var expected = expectedResults.shift();
+                    log(result === expected ? "PASS" : "FAIL: expected " + expected + " but got " + result);
+                }
+            }
+
+            test(20, 20);
+            test(45, 20);
+            test(20, 45);
+            test(45, 45);
+            test(95, 85);
+
+            container.removeEventListener("dragstart", listener);
+            y += 100;
+            scrollBy(0, 100);
+        }
+    } : undefined;
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c166820..bb7b8dd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-02-27  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        <rdar://problem/7696607> Links do not respect -webkit-user-drag: none
+        https://bugs.webkit.org/show_bug.cgi?id=35475
+
+        Test: fast/css/user-drag-none.html
+
+        * page/DragController.cpp:
+        (WebCore::DragController::mayStartDragAtEventLocation): Added a node
+        parameter. The image drag check is done against the node, rather than
+        than against the hit test result. This prevents a non-draggable image
+        with an auto-draggable ancestor from being dragged alone. The link drag
+        check now ignores links that are -webkit-user-drag: none.
+        * page/DragController.h:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::shouldDragAutoNode): Pass the current node
+        to mayStartDragAtEventLocation().
+
 2010-02-27  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp
index 18e3195..06d3649 100644
--- a/WebCore/page/DragController.cpp
+++ b/WebCore/page/DragController.cpp
@@ -512,7 +512,7 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
     return true;
 }
 
-bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPoint& framePos)
+bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPoint& framePos, Node* node)
 {
     ASSERT(frame);
     ASSERT(frame->settings());
@@ -523,6 +523,8 @@ bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPo
     HitTestResult mouseDownTarget = HitTestResult(framePos);
 
     mouseDownTarget = frame->eventHandler()->hitTestResultAtPoint(framePos, true);
+    if (node)
+        mouseDownTarget.setInnerNonSharedNode(node);
 
     if (mouseDownTarget.image()
         && !mouseDownTarget.absoluteImageURL().isEmpty()
@@ -532,7 +534,8 @@ bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPo
 
     if (!mouseDownTarget.absoluteLinkURL().isEmpty()
         && m_dragSourceAction & DragSourceActionLink
-        && mouseDownTarget.isLiveLink())
+        && mouseDownTarget.isLiveLink()
+        && mouseDownTarget.URLElement()->renderer() && mouseDownTarget.URLElement()->renderer()->style()->userDrag() != DRAG_NONE)
         return true;
 
     if (mouseDownTarget.isSelected()
@@ -540,7 +543,6 @@ bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPo
         return true;
 
     return false;
-
 }
 
 static CachedImage* getCachedImage(Element* element)
diff --git a/WebCore/page/DragController.h b/WebCore/page/DragController.h
index 3d59ebf..3b2b083 100644
--- a/WebCore/page/DragController.h
+++ b/WebCore/page/DragController.h
@@ -77,7 +77,7 @@ namespace WebCore {
         DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; }
         DragSourceAction delegateDragSourceAction(const IntPoint& pagePoint);
         
-        bool mayStartDragAtEventLocation(const Frame*, const IntPoint& framePos);
+        bool mayStartDragAtEventLocation(const Frame*, const IntPoint& framePos, Node*);
         void dragEnded();
         
         void placeDragCaret(const IntPoint&);
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index c4a01f3..93fc5bd 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2217,7 +2217,7 @@ bool EventHandler::shouldDragAutoNode(Node* node, const IntPoint& point) const
     if (!node || !m_frame->view())
         return false;
     Page* page = m_frame->page();
-    return page && page->dragController()->mayStartDragAtEventLocation(m_frame, point);
+    return page && page->dragController()->mayStartDragAtEventLocation(m_frame, point, node);
 }
 
 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperation operation)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list