Title: [152248] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (152247 => 152248)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-01 20:39:59 UTC (rev 152247)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-01 20:43:41 UTC (rev 152248)
@@ -1,5 +1,25 @@
 2013-07-01  Lucas Forschler  <[email protected]>
 
+        Merge r152198
+
+    2013-06-28  Ryosuke Niwa  <[email protected]>
+
+            An element with -webkit-user-select: all should be selected on single click
+            https://bugs.webkit.org/show_bug.cgi?id=117864
+
+            Reviewed by Darin Adler.
+
+            Add tests for single clicking on an element with user-select: all.
+            We select the entire element regardless of whether the user had clicked on text or an image
+            to be consistent even though Firefox requires a double click on the latter case.
+
+            * editing/selection/user-select-all-with-image-single-click-expected.txt: Added.
+            * editing/selection/user-select-all-with-image-single-click.html: Added.
+            * editing/selection/user-select-all-with-single-click-expected.txt: Added.
+            * editing/selection/user-select-all-with-single-click.html: Added.
+
+2013-07-01  Lucas Forschler  <[email protected]>
+
         Merge r152091
 
     2013-06-27  Timothy Hatcher  <[email protected]>

Copied: branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click-expected.txt (from rev 152198, trunk/LayoutTests/editing/selection/user-select-all-image-with-single-click-expected.txt) (0 => 152248)


--- branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click-expected.txt	2013-07-01 20:43:41 UTC (rev 152248)
@@ -0,0 +1,9 @@
+This tests single-clicking on an image inside user-select: all. WebKit should select the entire element.
+Firefox doesn't do this but I'm not sure it makes sense for us to be inconsistent since Firefox DOES allow text with user-select: all to be selected by a single click.
+To manually test, single click on the image below. WebKit should select the entire bordered region.
+| <div>
+|   class="select-all"
+|   <#selection-anchor>
+|   <img>
+|     src=""
+|   <#selection-focus>

Copied: branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click.html (from rev 152198, trunk/LayoutTests/editing/selection/user-select-all-image-with-single-click.html) (0 => 152248)


--- branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-image-with-single-click.html	2013-07-01 20:43:41 UTC (rev 152248)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<body _onload_="runTest()">
+<p id="description">This tests single-clicking on an image inside user-select: all. WebKit should select the entire element.
+Firefox doesn't do this but I'm not sure it makes sense for us to be inconsistent since Firefox DOES allow text with user-select: all to be selected by a single click.<br>
+To manually test, single click on the image below. WebKit should select the entire bordered region.</p>
+<div id="container"><div class="select-all"><img src=""
+<script src=""
+<style>
+.select-all {
+    border: 1px solid black;
+    height: 200px;
+    width: 200px;
+    -webkit-user-select: all;
+    -moz-user-select: all;
+}
+</style>
+<script>
+
+Markup.description(document.getElementById('description').textContent);
+Markup.waitUntilDone();
+
+function runTest() {
+    function clickOnElement(element) {
+        eventSender.mouseMoveTo(element.offsetLeft + 10, element.offsetTop + 10);
+        eventSender.mouseDown(0);
+        eventSender.mouseUp(0);
+    }
+
+    if (window.eventSender) {
+        clickOnElement(document.querySelector('.select-all'));
+        Markup.dump('container');
+        Markup.notifyDone();
+    }
+}
+
+</script>
+</body>
+</html>

Copied: branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click-expected.txt (from rev 152198, trunk/LayoutTests/editing/selection/user-select-all-with-single-click-expected.txt) (0 => 152248)


--- branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click-expected.txt	2013-07-01 20:43:41 UTC (rev 152248)
@@ -0,0 +1,5 @@
+This tests single-clicking on text inside user-select: all. WebKit should select the entire element.
+To manually test, single click on "click here" below. WebKit should select the entire bordered region.
+| <div>
+|   class="select-all"
+|   "<#selection-anchor>Click here<#selection-focus>"

Copied: branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click.html (from rev 152198, trunk/LayoutTests/editing/selection/user-select-all-with-single-click.html) (0 => 152248)


--- branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/user-select-all-with-single-click.html	2013-07-01 20:43:41 UTC (rev 152248)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p id="description">This tests single-clicking on text inside user-select: all. WebKit should select the entire element.
+To manually test, single click on "click here" below. WebKit should select the entire bordered region.</p>
+<div id="container"><div class="select-all">Click here</div></div>
+<script src=""
+<style>
+.select-all {
+    border: 1px solid black;
+    height: 100px;
+    width: 100px;
+    -webkit-user-select: all;
+    -moz-user-select: all;
+}
+</style>
+<script>
+
+Markup.description(document.getElementById('description').textContent);
+
+function clickOnElement(element) {
+    eventSender.mouseMoveTo(element.offsetLeft + 10, element.offsetTop + 10);
+    eventSender.mouseDown(0);
+    eventSender.mouseUp(0);
+}
+
+if (window.eventSender) {
+    clickOnElement(document.querySelector('.select-all'));
+    Markup.dump('container');
+} else
+    Markup.noAutoDump();
+
+</script>
+</body>
+</html>

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (152247 => 152248)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-01 20:39:59 UTC (rev 152247)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-01 20:43:41 UTC (rev 152248)
@@ -1,5 +1,24 @@
 2013-07-01  Lucas Forschler  <[email protected]>
 
+        Merge r152198
+
+    2013-06-28  Ryosuke Niwa  <[email protected]>
+
+            An element with -webkit-user-select: all should be selected on single click
+            https://bugs.webkit.org/show_bug.cgi?id=117864
+
+            Reviewed by Darin Adler.
+
+            Set m_mouseDownMayStartSelect true even when the node cannot start selection
+            if the node was inside an element with -webkit-user-select: all.
+
+            Test: editing/selection/user-select-all-with-single-click.html
+
+            * page/EventHandler.cpp:
+            (WebCore::canMouseDownStartSelect):
+
+2013-07-01  Lucas Forschler  <[email protected]>
+
         Merge r152196
 
     2013-06-28  Alexey Proskuryakov  <[email protected]>

Modified: branches/safari-537-branch/Source/WebCore/dom/Position.h (152247 => 152248)


--- branches/safari-537-branch/Source/WebCore/dom/Position.h	2013-07-01 20:39:59 UTC (rev 152247)
+++ branches/safari-537-branch/Source/WebCore/dom/Position.h	2013-07-01 20:43:41 UTC (rev 152248)
@@ -191,6 +191,9 @@
 #if ENABLE(USERSELECT_ALL)
     static bool nodeIsUserSelectAll(const Node*);
     static Node* rootUserSelectAllForNode(Node*);
+#else
+    static bool nodeIsUserSelectAll(const Node*) { return false; }
+    static Node* rootUserSelectAllForNode(Node*) { return 0; }
 #endif
     static ContainerNode* findParent(const Node*);
     

Modified: branches/safari-537-branch/Source/WebCore/page/EventHandler.cpp (152247 => 152248)


--- branches/safari-537-branch/Source/WebCore/page/EventHandler.cpp	2013-07-01 20:39:59 UTC (rev 152247)
+++ branches/safari-537-branch/Source/WebCore/page/EventHandler.cpp	2013-07-01 20:43:41 UTC (rev 152248)
@@ -640,10 +640,7 @@
     if (!node || !node->renderer())
         return true;
 
-    if (!node->canStartSelection())
-        return false;
-
-    return true;
+    return node->canStartSelection() || Position::nodeIsUserSelectAll(node);
 }
 
 bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to