Title: [205603] releases/WebKitGTK/webkit-2.14
Revision
205603
Author
[email protected]
Date
2016-09-08 01:00:34 -0700 (Thu, 08 Sep 2016)

Log Message

Merge r205246 - REGRESSION (r201701): Unable to copy from CodeMirror editor version used in Jenkins install website
https://bugs.webkit.org/show_bug.cgi?id=161386
<rdar://problem/27590077>

Reviewed by Dan Bernstein.

Source/WebCore:

This CodeMirror version uses a hidden <textarea> to implement copy/paste. The textarea has width:1px; border-width:1px.
Jenkins page has also has a stylesheet that contains * { box-sizing:border-box } and as a result the textarea content
width gets computed as 0. With r201701 we use content size instead of box size for clipping and the textarea content is
(correctly) considered invisible.

Add a quirk that allows this to continue working.

Test: editing/text-iterator/hidden-textarea-selection-quirk.html

* editing/TextIterator.cpp:
(WebCore::fullyClipsContents):

LayoutTests:

* editing/text-iterator/hidden-textarea-selection-quirk-expected.txt: Added.
* editing/text-iterator/hidden-textarea-selection-quirk.html: Added.
* platform/ios-simulator/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt: Added.

    textarea.select() doesn't select the text content on iOS.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (205602 => 205603)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-09-08 07:58:55 UTC (rev 205602)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-09-08 08:00:34 UTC (rev 205603)
@@ -1,3 +1,17 @@
+2016-08-31  Antti Koivisto  <[email protected]>
+
+        REGRESSION (r201701): Unable to copy from CodeMirror editor version used in Jenkins install website
+        https://bugs.webkit.org/show_bug.cgi?id=161386
+        <rdar://problem/27590077>
+
+        Reviewed by Dan Bernstein.
+
+        * editing/text-iterator/hidden-textarea-selection-quirk-expected.txt: Added.
+        * editing/text-iterator/hidden-textarea-selection-quirk.html: Added.
+        * platform/ios-simulator/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt: Added.
+
+            textarea.select() doesn't select the text content on iOS.
+
 2016-08-30  Chris Dumez  <[email protected]>
 
         Object.setPrototypeOf() should throw when used on a cross-origin Window / Location object

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt (0 => 205603)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt	2016-09-08 08:00:34 UTC (rev 205603)
@@ -0,0 +1,11 @@
+
+
+PASS Selecting in barely visible textarea 
+PASS Selecting in barely visible div 
+PASS Selecting in textarea hidden by container 
+PASS Selecting in div hidden by container 
+PASS Selecting in absolute positioned textarea hidden by container 
+PASS Selecting in absolute positioned div hidden by container 
+PASS Selecting in absolute positioned zero content width textarea hidden by container (quirk behavior) 
+PASS Selecting in absolute positioned zero content width div hidden by container 
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk.html (0 => 205603)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/editing/text-iterator/hidden-textarea-selection-quirk.html	2016-09-08 08:00:34 UTC (rev 205603)
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Selections in hidden elements</title>
+<script src=""
+<script src=""
+<link rel='stylesheet' href=''>
+</head>
+<body>
+<style>
+container, my-text {
+    display: block;
+}
+
+.hide {
+    position:relative;
+    overflow:hidden;
+    height:0px;
+    width:10px;
+}
+.select {
+    height:11px;
+    width:1px;
+    padding:0px;
+    border:1px solid blue;
+    box-sizing:content-box;
+    overflow:hidden;
+}
+.abs {
+    position: absolute;
+}
+.borderBox {
+    box-sizing:border-box;
+}
+</style>
+<container>
+<textarea class=select>test text</textarea>
+<my-text class=select>test text</my-text>
+</container>
+<script>
+function checkSelectable(element, expected)
+{
+    var selection = document.getSelection();
+    if (element.select)
+        element.select();
+    else
+        selection.selectAllChildren(element);
+
+    var selectionText = selection.toString();
+    if (expected)
+        assert_equals(selectionText, "test text");
+    else
+        assert_equals(selectionText, "");
+}
+
+var textarea = document.querySelector("textarea");
+var myText = document.querySelector("my-text");
+
+test(function () {
+    checkSelectable(textarea, true);
+}, "Selecting in barely visible textarea");
+
+test(function () {
+    checkSelectable(myText, true);
+}, "Selecting in barely visible div");
+
+document.querySelector("container").classList.add("hide");
+
+test(function () {
+    checkSelectable(textarea, false);
+}, "Selecting in textarea hidden by container");
+
+test(function () {
+    checkSelectable(myText, false);
+}, "Selecting in div hidden by container");
+
+textarea.classList.add("abs");
+myText.classList.add("abs");
+
+test(function () {
+    checkSelectable(textarea, true);
+}, "Selecting in absolute positioned textarea hidden by container");
+
+test(function () {
+    checkSelectable(myText, true);
+}, "Selecting in absolute positioned div hidden by container");
+
+textarea.classList.add("borderBox");
+myText.classList.add("borderBox");
+
+test(function () {
+    checkSelectable(textarea, true);
+}, "Selecting in absolute positioned zero content width textarea hidden by container (quirk behavior)");
+
+test(function () {
+    checkSelectable(myText, false);
+}, "Selecting in absolute positioned zero content width div hidden by container");
+
+</script>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/platform/ios-simulator/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt (0 => 205603)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/platform/ios-simulator/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/platform/ios-simulator/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt	2016-09-08 08:00:34 UTC (rev 205603)
@@ -0,0 +1,11 @@
+
+
+FAIL Selecting in barely visible textarea assert_equals: expected "test text" but got ""
+PASS Selecting in barely visible div 
+PASS Selecting in textarea hidden by container 
+PASS Selecting in div hidden by container 
+FAIL Selecting in absolute positioned textarea hidden by container assert_equals: expected "test text" but got ""
+PASS Selecting in absolute positioned div hidden by container 
+FAIL Selecting in absolute positioned zero content width textarea hidden by container (quirk behavior) assert_equals: expected "test text" but got ""
+PASS Selecting in absolute positioned zero content width div hidden by container 
+

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (205602 => 205603)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-09-08 07:58:55 UTC (rev 205602)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-09-08 08:00:34 UTC (rev 205603)
@@ -1,3 +1,23 @@
+2016-08-31  Antti Koivisto  <[email protected]>
+
+        REGRESSION (r201701): Unable to copy from CodeMirror editor version used in Jenkins install website
+        https://bugs.webkit.org/show_bug.cgi?id=161386
+        <rdar://problem/27590077>
+
+        Reviewed by Dan Bernstein.
+
+        This CodeMirror version uses a hidden <textarea> to implement copy/paste. The textarea has width:1px; border-width:1px.
+        Jenkins page has also has a stylesheet that contains * { box-sizing:border-box } and as a result the textarea content
+        width gets computed as 0. With r201701 we use content size instead of box size for clipping and the textarea content is
+        (correctly) considered invisible.
+
+        Add a quirk that allows this to continue working.
+
+        Test: editing/text-iterator/hidden-textarea-selection-quirk.html
+
+        * editing/TextIterator.cpp:
+        (WebCore::fullyClipsContents):
+
 2016-08-30  Yusuke Suzuki  <[email protected]>
 
         Make PendingScript as ref-counted

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TextIterator.cpp (205602 => 205603)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TextIterator.cpp	2016-09-08 07:58:55 UTC (rev 205602)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TextIterator.cpp	2016-09-08 08:00:34 UTC (rev 205603)
@@ -40,6 +40,7 @@
 #include "HTMLNames.h"
 #include "HTMLParagraphElement.h"
 #include "HTMLProgressElement.h"
+#include "HTMLTextAreaElement.h"
 #include "HTMLTextFormControlElement.h"
 #include "InlineTextBox.h"
 #include "NodeTraversal.h"
@@ -213,6 +214,11 @@
     auto& box = downcast<RenderBox>(*renderer);
     if (!box.hasOverflowClip())
         return false;
+
+    // Quirk to keep copy/paste in the CodeMirror editor version used in Jenkins working.
+    if (is<HTMLTextAreaElement>(node))
+        return box.size().isEmpty();
+
     return box.contentSize().isEmpty();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to