Title: [157522] trunk
Revision
157522
Author
commit-qu...@webkit.org
Date
2013-10-16 10:35:56 -0700 (Wed, 16 Oct 2013)

Log Message

During editing, merge inline style with overriding other author styles
https://bugs.webkit.org/show_bug.cgi?id=122874

Patch by KyungTae Kim <ktf....@samsung.com> on 2013-10-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

Inline styles need to override other author styles even on DoNotOverrideValues mode.
So, merge and override inline styles to other author styles before merging them to m_mutableStyle.

Test: editing/deleting/merge-div-with-inline-style.html

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):

LayoutTests:

Add a test for merging inline styles of parents.

* editing/deleting/merge-div-with-inline-style.html: Added.
* editing/deleting/merge-div-with-inline-style-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (157521 => 157522)


--- trunk/LayoutTests/ChangeLog	2013-10-16 17:26:56 UTC (rev 157521)
+++ trunk/LayoutTests/ChangeLog	2013-10-16 17:35:56 UTC (rev 157522)
@@ -1,3 +1,15 @@
+2013-10-16  KyungTae Kim  <ktf....@samsung.com>
+
+        During editing, merge inline style with overriding other author styles
+        https://bugs.webkit.org/show_bug.cgi?id=122874
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a test for merging inline styles of parents.
+
+        * editing/deleting/merge-div-with-inline-style.html: Added.
+        * editing/deleting/merge-div-with-inline-style-expected.txt: Added.
+
 2013-10-16  pe...@outlook.com  <pe...@outlook.com>
 
         Emphasis marks has wrong color.

Added: trunk/LayoutTests/editing/deleting/merge-div-with-inline-style-expected.txt (0 => 157522)


--- trunk/LayoutTests/editing/deleting/merge-div-with-inline-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-div-with-inline-style-expected.txt	2013-10-16 17:35:56 UTC (rev 157522)
@@ -0,0 +1,11 @@
+The inline style should be applied when merging div element.
+The test passes if "bar" has the blue color and 20px font-size.
+| "
+"
+| <div>
+|   "foo<#selection-caret>"
+|   <span>
+|     style="color: blue; font-size: 20px;"
+|     "bar"
+| "
+"

Added: trunk/LayoutTests/editing/deleting/merge-div-with-inline-style.html (0 => 157522)


--- trunk/LayoutTests/editing/deleting/merge-div-with-inline-style.html	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-div-with-inline-style.html	2013-10-16 17:35:56 UTC (rev 157522)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+.styleToMerge {
+color: red;
+font-size: 10px;
+}
+</style>
+</head>
+<body>
+<div id="test" contenteditable="true">
+<div>foo</div>
+<div id="divToMerge" class="styleToMerge" style="color:blue;font-size:20px">bar</div>
+</div>
+<script src=""
+<script>
+Markup.description('The inline style should be applied when merging div element.\n'
+    + 'The test passes if "bar" has the blue color and 20px font-size.');
+
+var divToMerge = document.getElementById("divToMerge");
+divToMerge.focus();
+getSelection().collapse(divToMerge, 0);
+document.execCommand("Delete");
+Markup.dump(document.getElementById("test"));
+</script>
+ </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (157521 => 157522)


--- trunk/Source/WebCore/ChangeLog	2013-10-16 17:26:56 UTC (rev 157521)
+++ trunk/Source/WebCore/ChangeLog	2013-10-16 17:35:56 UTC (rev 157522)
@@ -1,3 +1,18 @@
+2013-10-16  KyungTae Kim  <ktf....@samsung.com>
+
+        During editing, merge inline style with overriding other author styles
+        https://bugs.webkit.org/show_bug.cgi?id=122874
+
+        Reviewed by Ryosuke Niwa.
+
+        Inline styles need to override other author styles even on DoNotOverrideValues mode.
+        So, merge and override inline styles to other author styles before merging them to m_mutableStyle.
+
+        Test: editing/deleting/merge-div-with-inline-style.html
+
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
+
 2013-10-16  pe...@outlook.com  <pe...@outlook.com>
 
         Emphasis marks has wrong color.

Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (157521 => 157522)


--- trunk/Source/WebCore/editing/EditingStyle.cpp	2013-10-16 17:26:56 UTC (rev 157521)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp	2013-10-16 17:35:56 UTC (rev 157522)
@@ -1011,11 +1011,13 @@
 {
     RefPtr<EditingStyle> styleFromRules = EditingStyle::create();
     styleFromRules->mergeStyleFromRulesForSerialization(element);
+
+    if (element->inlineStyle())
+        styleFromRules->m_mutableStyle->mergeAndOverrideOnConflict(*element->inlineStyle());
+
     styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_mutableStyle.get(), propertiesToInclude);
     mergeStyle(styleFromRules->m_mutableStyle.get(), mode);
 
-    mergeInlineStyleOfElement(element, mode, propertiesToInclude);
-
     const Vector<OwnPtr<HTMLElementEquivalent> >& elementEquivalents = htmlElementEquivalents();
     for (size_t i = 0; i < elementEquivalents.size(); ++i) {
         if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i].get(), element, mode, m_mutableStyle.get()))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to