Title: [210717] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210716 => 210717)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-13 06:10:48 UTC (rev 210716)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-13 06:10:51 UTC (rev 210717)
@@ -1,5 +1,20 @@
 2017-01-12  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210687. rdar://problem/29388806
+
+    2017-01-12  Enrica Casucci  <enr...@apple.com>
+
+            Do not allow selection of editable content when not editing.
+            https://bugs.webkit.org/show_bug.cgi?id=166897
+            <rdar://problem/29388806>
+
+            Reviewed by Tim Horton.
+
+            * fast/events/touch/ios/long-press-on-editable-expected.txt: Added.
+            * fast/events/touch/ios/long-press-on-editable.html: Added.
+
+2017-01-12  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210622. rdar://problem/28389364
 
     2017-01-11  Joseph Pecoraro  <pecor...@apple.com>

Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable-expected.txt (0 => 210717)


--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable-expected.txt	2017-01-13 06:10:51 UTC (rev 210717)
@@ -0,0 +1,2 @@
+PASS: no selection made
+

Added: branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable.html (0 => 210717)


--- branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/touch/ios/long-press-on-editable.html	2017-01-13 06:10:51 UTC (rev 210717)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getPressScript()
+        {
+            return `
+            (function() {
+                uiController.longPressAtPoint(30, 20, function() {
+                    uiController.uiScriptComplete();
+                });
+            })();`
+        }
+    
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getPressScript(), function(result) {
+                    var selectionText = document.getSelection().toString();
+                    if (selectionText == "PressMe")
+                        output += 'FAILED: Selected: ' + selectionText;
+                    else
+                        output += 'PASS: no selection made';
+                    output += '<br>';
+                    document.getElementById('target').innerHTML = output;
+                    testRunner.notifyDone();
+                });
+            }
+        }
+
+        window.addEventListener('load', runTest, false);
+    </script>
+    <style>
+        #target {
+            height: 100px;
+            width: 200px;
+            background-color: silver;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+<div id="target">
+	<textarea>PressMe</textarea>
+    This test requires UIScriptController to run.
+</div>
+</body>
+</html>

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (210716 => 210717)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-13 06:10:48 UTC (rev 210716)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-13 06:10:51 UTC (rev 210717)
@@ -1,5 +1,27 @@
 2017-01-12  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210687. rdar://problem/29388806
+
+    2017-01-12  Enrica Casucci  <enr...@apple.com>
+
+            Do not allow selection of editable content when not editing.
+            https://bugs.webkit.org/show_bug.cgi?id=166897
+            <rdar://problem/29388806>
+
+            Reviewed by Tim Horton.
+
+            Test: fast/events/touch/ios/long-press-on-editable.html
+
+            When retrieving the position information, we should not consider
+            as candidates for selection editable elements, since this is only
+            used for non editable selections.
+
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::isAssistableElement): Moved within the file.
+            (WebKit::WebPage::getPositionInformation):
+
+2017-01-12  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210683. rdar://problem/11187315
 
     2017-01-12  Megan Gardner  <megan_gard...@apple.com>

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (210716 => 210717)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-01-13 06:10:48 UTC (rev 210716)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-01-13 06:10:51 UTC (rev 210717)
@@ -2282,6 +2282,20 @@
     return nullptr;
 }
 
+static inline bool isAssistableElement(Element& node)
+{
+    if (is<HTMLSelectElement>(node))
+        return true;
+    if (is<HTMLTextAreaElement>(node))
+        return true;
+    if (is<HTMLInputElement>(node)) {
+        HTMLInputElement& inputElement = downcast<HTMLInputElement>(node);
+        // FIXME: This laundry list of types is not a good way to factor this. Need a suitable function on HTMLInputElement itself.
+        return inputElement.isTextField() || inputElement.isDateField() || inputElement.isDateTimeLocalField() || inputElement.isMonthField() || inputElement.isTimeField();
+    }
+    return node.isContentEditable();
+}
+
 void WebPage::getPositionInformation(const InteractionInformationRequest& request, InteractionInformationAtPosition& info)
 {
     info.request = request;
@@ -2435,7 +2449,7 @@
             } else {
                 info.isSelectable = renderer->style().userSelect() != SELECT_NONE;
                 if (info.isSelectable && !hitNode->isTextNode())
-                    info.isSelectable = !rectIsTooBigForSelection(info.bounds, *result.innerNodeFrame());
+                    info.isSelectable = !isAssistableElement(*downcast<Element>(hitNode)) && !rectIsTooBigForSelection(info.bounds, *result.innerNodeFrame());
             }
         }
     }
@@ -2497,20 +2511,6 @@
     }
 }
 
-static inline bool isAssistableElement(Element& node)
-{
-    if (is<HTMLSelectElement>(node))
-        return true;
-    if (is<HTMLTextAreaElement>(node))
-        return true;
-    if (is<HTMLInputElement>(node)) {
-        HTMLInputElement& inputElement = downcast<HTMLInputElement>(node);
-        // FIXME: This laundry list of types is not a good way to factor this. Need a suitable function on HTMLInputElement itself.
-        return inputElement.isTextField() || inputElement.isDateField() || inputElement.isDateTimeLocalField() || inputElement.isMonthField() || inputElement.isTimeField();
-    }
-    return node.isContentEditable();
-}
-
 static inline Element* nextAssistableElement(Node* startNode, Page& page, bool isForward)
 {
     if (!is<Element>(startNode))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to