Title: [147661] trunk/Source/WebCore
Revision
147661
Author
[email protected]
Date
2013-04-04 12:15:52 -0700 (Thu, 04 Apr 2013)

Log Message

Changing typing style with font size delta overrides the previous font size delta
https://bugs.webkit.org/show_bug.cgi?id=113923

Reviewed by Andreas Kling.

The bug was caused by a new font size delta value overriding the old one as
opposed to being added to the old value. Fixed that in overrideWithStyle.

Also made overrideWithStyle share code with mergeStyle since there is already
code to merge text-decorations there.

Unfortunately, adding a test for this fix proved to be hard because we don't
expose any API to directly set typing style.

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::overrideWithStyle): Use mergeStyle.
(WebCore::EditingStyle::mergeStyle): Add font size deltas as opposed to simply
using the new value.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147660 => 147661)


--- trunk/Source/WebCore/ChangeLog	2013-04-04 19:05:22 UTC (rev 147660)
+++ trunk/Source/WebCore/ChangeLog	2013-04-04 19:15:52 UTC (rev 147661)
@@ -1,3 +1,24 @@
+2013-04-04  Ryosuke Niwa  <[email protected]>
+
+        Changing typing style with font size delta overrides the previous font size delta
+        https://bugs.webkit.org/show_bug.cgi?id=113923
+
+        Reviewed by Andreas Kling.
+
+        The bug was caused by a new font size delta value overriding the old one as
+        opposed to being added to the old value. Fixed that in overrideWithStyle.
+
+        Also made overrideWithStyle share code with mergeStyle since there is already
+        code to merge text-decorations there.
+
+        Unfortunately, adding a test for this fix proved to be hard because we don't
+        expose any API to directly set typing style.
+
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::overrideWithStyle): Use mergeStyle.
+        (WebCore::EditingStyle::mergeStyle): Add font size deltas as opposed to simply
+        using the new value.
+
 2013-04-04  Chris Fleizach  <[email protected]>
 
         AX:File upload button has wrong label

Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (147660 => 147661)


--- trunk/Source/WebCore/editing/EditingStyle.cpp	2013-04-04 19:05:22 UTC (rev 147660)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp	2013-04-04 19:15:52 UTC (rev 147661)
@@ -534,12 +534,7 @@
 
 void EditingStyle::overrideWithStyle(const StylePropertySet* style)
 {
-    if (!style || style->isEmpty())
-        return;
-    if (!m_mutableStyle)
-        m_mutableStyle = StylePropertySet::create();
-    m_mutableStyle->mergeAndOverrideOnConflict(style);
-    extractFontSizeDelta();
+    return mergeStyle(style, OverrideValues);
 }
 
 void EditingStyle::clear()
@@ -1071,6 +1066,10 @@
         if (mode == OverrideValues || (mode == DoNotOverrideValues && !value))
             m_mutableStyle->setProperty(property.id(), property.value()->cssText(), property.isImportant());
     }
+
+    int oldFontSizeDelta = m_fontSizeDelta;
+    extractFontSizeDelta();
+    m_fontSizeDelta += oldFontSizeDelta;
 }
 
 static PassRefPtr<StylePropertySet> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to