Title: [158815] trunk
Revision
158815
Author
[email protected]
Date
2013-11-06 19:49:36 -0800 (Wed, 06 Nov 2013)

Log Message

Applied background color is not retained after typing a characters
https://bugs.webkit.org/show_bug.cgi?id=117337

Patch by Vani Hegde <[email protected]> on 2013-11-06
Reviewed by Ryosuke Niwa.

Source/WebCore:

While deleting a selection, only the inheritable style properties
applied on the selection were saved.
Since background color is considered as noninheritable style property,
on deleting the selection, background color set on it was being lost.
Hence on typing in new text, it would not have the applied
background color set.
Fixed by saving editing preoperties that are already in effect
on a selection before deleting it.

Test: editing/style/background-color-retained.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::saveTypingStyleState):
Modified as to save EditingPropertiesInEffect on a selection before
deleting it.

LayoutTests:

* editing/style/background-color-retained-expected.txt: Added.
* editing/style/background-color-retained.html: Added.
Test to make sure that background color applied on a
selection is retained after deleting the selection.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (158814 => 158815)


--- trunk/LayoutTests/ChangeLog	2013-11-07 03:49:35 UTC (rev 158814)
+++ trunk/LayoutTests/ChangeLog	2013-11-07 03:49:36 UTC (rev 158815)
@@ -1,3 +1,15 @@
+2013-11-06  Vani Hegde  <[email protected]>
+
+        Applied background color is not retained after typing a characters
+        https://bugs.webkit.org/show_bug.cgi?id=117337
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/style/background-color-retained-expected.txt: Added.
+        * editing/style/background-color-retained.html: Added.
+        Test to make sure that background color applied on a
+        selection is retained after deleting the selection.
+
 2013-11-06  Andreas Kling  <[email protected]>
 
         Optimize baselines: svg/W3C-I18N

Added: trunk/LayoutTests/editing/style/background-color-retained-expected.txt (0 => 158815)


--- trunk/LayoutTests/editing/style/background-color-retained-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/style/background-color-retained-expected.txt	2013-11-07 03:49:36 UTC (rev 158815)
@@ -0,0 +1,4 @@
+Tests whether the background color is retained when all the text is deleted and new text is typed in.
+| <span>
+|   style="background-color: rgb(0, 128, 0);"
+|   "New Text<#selection-caret>"

Added: trunk/LayoutTests/editing/style/background-color-retained.html (0 => 158815)


--- trunk/LayoutTests/editing/style/background-color-retained.html	                        (rev 0)
+++ trunk/LayoutTests/editing/style/background-color-retained.html	2013-11-07 03:49:36 UTC (rev 158815)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="test" contenteditable>
+<span style="background-color:green;">Delete this text and type in new text. Background color should be retained.</span>
+</div>
+<script src=""
+<script>
+    Markup.description('Tests whether the background color is retained when all the text is deleted and new text is typed in.');
+
+    var testDiv = document.getElementById("test");
+    testDiv.focus();
+
+    document.execCommand("selectAll");
+    document.execCommand("Delete");
+    document.execCommand("InsertText", false, "New Text");
+
+    Markup.dump(testDiv);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (158814 => 158815)


--- trunk/Source/WebCore/ChangeLog	2013-11-07 03:49:35 UTC (rev 158814)
+++ trunk/Source/WebCore/ChangeLog	2013-11-07 03:49:36 UTC (rev 158815)
@@ -1,3 +1,26 @@
+2013-11-06  Vani Hegde  <[email protected]>
+
+        Applied background color is not retained after typing a characters
+        https://bugs.webkit.org/show_bug.cgi?id=117337
+
+        Reviewed by Ryosuke Niwa.
+
+        While deleting a selection, only the inheritable style properties
+        applied on the selection were saved.
+        Since background color is considered as noninheritable style property,
+        on deleting the selection, background color set on it was being lost.
+        Hence on typing in new text, it would not have the applied
+        background color set.
+        Fixed by saving editing preoperties that are already in effect
+        on a selection before deleting it.
+
+        Test: editing/style/background-color-retained.html
+
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::saveTypingStyleState):
+        Modified as to save EditingPropertiesInEffect on a selection before
+        deleting it.
+
 2013-11-06  Andreas Kling  <[email protected]>
 
         InlineBox: Make paint() and nodeAtPoint() pure virtuals.

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (158814 => 158815)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-11-07 03:49:35 UTC (rev 158814)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-11-07 03:49:36 UTC (rev 158815)
@@ -291,7 +291,7 @@
     }
 
     // Figure out the typing style in effect before the delete is done.
-    m_typingStyle = EditingStyle::create(m_selectionToDelete.start());
+    m_typingStyle = EditingStyle::create(m_selectionToDelete.start(), EditingStyle::EditingPropertiesInEffect);
     m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDelete.start()));
 
     // If we're deleting into a Mail blockquote, save the style at end() instead of start()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to