Title: [148251] trunk
Revision
148251
Author
[email protected]
Date
2013-04-11 17:08:55 -0700 (Thu, 11 Apr 2013)

Log Message

Unable to paste twice in input field when specific CSS present
https://bugs.webkit.org/show_bug.cgi?id=108675

Patch by Sukolsak Sakshuwong <[email protected]> on 2013-04-11
Reviewed by Ryosuke Niwa.

Source/WebCore:

When we are pre-rendering text in ReplaceSelectionCommand, we shouldn't care
whether the content is clipped by its ancestors or not. This bug was caused
by the fact the plainText() method returned an empty string because the text
was fully clipped by its ancestors. Make plainText ignore style visibility.

Test: editing/inserting/insert-text-into-text-field.html

* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::ReplacementFragment):

LayoutTests:

* editing/inserting/insert-text-into-text-field-expected.txt: Added.
* editing/inserting/insert-text-into-text-field.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148250 => 148251)


--- trunk/LayoutTests/ChangeLog	2013-04-11 23:55:03 UTC (rev 148250)
+++ trunk/LayoutTests/ChangeLog	2013-04-12 00:08:55 UTC (rev 148251)
@@ -1,3 +1,13 @@
+2013-04-11  Sukolsak Sakshuwong  <[email protected]>
+
+        Unable to paste twice in input field when specific CSS present
+        https://bugs.webkit.org/show_bug.cgi?id=108675
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/inserting/insert-text-into-text-field-expected.txt: Added.
+        * editing/inserting/insert-text-into-text-field.html: Added.
+
 2013-04-11  Brendan Long  <[email protected]>
 
         TextTrackList's .onremovetrack is missing from IDL

Added: trunk/LayoutTests/editing/inserting/insert-text-into-text-field-expected.txt (0 => 148251)


--- trunk/LayoutTests/editing/inserting/insert-text-into-text-field-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-text-into-text-field-expected.txt	2013-04-12 00:08:55 UTC (rev 148251)
@@ -0,0 +1,4 @@
+This tests inserting text ("b") into a text field with specific CSS and an already existing text ("a"). To manually test, copy and paste some text into the text field below. Pasting should work as expected.
+
+
+PASSED the final text is 'ab'.

Added: trunk/LayoutTests/editing/inserting/insert-text-into-text-field.html (0 => 148251)


--- trunk/LayoutTests/editing/inserting/insert-text-into-text-field.html	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-text-into-text-field.html	2013-04-12 00:08:55 UTC (rev 148251)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>    
+<head>
+<title>Inserting text</title>
+<style>
+input {
+    padding: 15px;
+    border-style: none;
+    box-sizing: border-box;
+    font-size: 14px;
+    height: 1.8em;
+    background-color: yellow;
+}
+</style>
+</head>
+<body>
+<p>This tests inserting text ("b") into a text field with specific CSS
+and an already existing text ("a").
+To manually test, copy and paste some text into the text field below.
+Pasting should work as expected.</p>
+<input type="text" id="input" value="a" />
+<div id="log"></div>
+
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var input = document.getElementById("input");
+input.setSelectionRange(1, 1);
+document.execCommand("InsertHTML", false, "b");
+if (input.value == "ab")
+    log.innerText = "PASSED the final text is 'ab'.";
+else
+    log.innerText = "FAILED the final text is not 'ab'.";
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148250 => 148251)


--- trunk/Source/WebCore/ChangeLog	2013-04-11 23:55:03 UTC (rev 148250)
+++ trunk/Source/WebCore/ChangeLog	2013-04-12 00:08:55 UTC (rev 148251)
@@ -1,3 +1,20 @@
+2013-04-11  Sukolsak Sakshuwong  <[email protected]>
+
+        Unable to paste twice in input field when specific CSS present
+        https://bugs.webkit.org/show_bug.cgi?id=108675
+
+        Reviewed by Ryosuke Niwa.
+
+        When we are pre-rendering text in ReplaceSelectionCommand, we shouldn't care
+        whether the content is clipped by its ancestors or not. This bug was caused
+        by the fact the plainText() method returned an empty string because the text
+        was fully clipped by its ancestors. Make plainText ignore style visibility.
+
+        Test: editing/inserting/insert-text-into-text-field.html
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplacementFragment::ReplacementFragment):
+
 2013-04-11  Martin Robinson  <[email protected]>
 
         [GTK] Add accelerated 2D canvas support using cairo-gl

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (148250 => 148251)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2013-04-11 23:55:03 UTC (rev 148250)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2013-04-12 00:08:55 UTC (rev 148251)
@@ -174,7 +174,7 @@
     }
     
     RefPtr<Range> range = VisibleSelection::selectionFromContentsOfNode(holder.get()).toNormalizedRange();
-    String text = plainText(range.get(), TextIteratorEmitsOriginalText);
+    String text = plainText(range.get(), static_cast<TextIteratorBehavior>(TextIteratorEmitsOriginalText | TextIteratorIgnoresStyleVisibility));
 
     removeInterchangeNodes(holder.get());
     removeUnrenderedNodes(holder.get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to