Title: [241942] trunk
Revision
241942
Author
[email protected]
Date
2019-02-22 02:42:43 -0800 (Fri, 22 Feb 2019)

Log Message

Fix unitless usage of mathsize
https://bugs.webkit.org/show_bug.cgi?id=194940

Patch by Rob Buis <[email protected]> on 2019-02-22
Reviewed by Frédéric Wang.

Source/WebCore:

Convert unitless lengths to percentage values to correct the computed
font size.

* mathml/MathMLElement.cpp:
(WebCore::convertToPercentageIfNeeded):
(WebCore::MathMLElement::collectStyleForPresentationAttribute):

LayoutTests:

Tests lengths-1.html and length-3.html now pass.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241941 => 241942)


--- trunk/LayoutTests/ChangeLog	2019-02-22 09:43:59 UTC (rev 241941)
+++ trunk/LayoutTests/ChangeLog	2019-02-22 10:42:43 UTC (rev 241942)
@@ -1,3 +1,14 @@
+2019-02-22  Rob Buis  <[email protected]>
+
+        Fix unitless usage of mathsize
+        https://bugs.webkit.org/show_bug.cgi?id=194940
+
+        Reviewed by Frédéric Wang.
+
+        Tests lengths-1.html and length-3.html now pass.
+
+        * TestExpectations:
+
 2019-02-21  Simon Fraser  <[email protected]>
 
         Hardcode Visual Viewports on everywhere except iOS WK1

Modified: trunk/LayoutTests/TestExpectations (241941 => 241942)


--- trunk/LayoutTests/TestExpectations	2019-02-22 09:43:59 UTC (rev 241941)
+++ trunk/LayoutTests/TestExpectations	2019-02-22 10:42:43 UTC (rev 241942)
@@ -719,9 +719,7 @@
 imported/w3c/web-platform-tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html [ Pass Failure ]
 
 # These MathML WPT tests fail.
-webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-1.html [ ImageOnlyFailure ]
 webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2.html [ ImageOnlyFailure ]
-webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-3.html [ Failure ]
 
 # These webmessaging WPT tests time out.
 webkit.org/b/187034 imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (241941 => 241942)


--- trunk/Source/WebCore/ChangeLog	2019-02-22 09:43:59 UTC (rev 241941)
+++ trunk/Source/WebCore/ChangeLog	2019-02-22 10:42:43 UTC (rev 241942)
@@ -1,3 +1,17 @@
+2019-02-22  Rob Buis  <[email protected]>
+
+        Fix unitless usage of mathsize
+        https://bugs.webkit.org/show_bug.cgi?id=194940
+
+        Reviewed by Frédéric Wang.
+
+        Convert unitless lengths to percentage values to correct the computed
+        font size.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::convertToPercentageIfNeeded):
+        (WebCore::MathMLElement::collectStyleForPresentationAttribute):
+
 2019-02-21  Simon Fraser  <[email protected]>
 
         Hardcode Visual Viewports on everywhere except iOS WK1

Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (241941 => 241942)


--- trunk/Source/WebCore/mathml/MathMLElement.cpp	2019-02-22 09:43:59 UTC (rev 241941)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp	2019-02-22 10:42:43 UTC (rev 241942)
@@ -97,6 +97,15 @@
     return StyledElement::isPresentationAttribute(name);
 }
 
+static String convertToPercentageIfNeeded(const AtomicString& value)
+{
+    bool ok = false;
+    float unitlessValue = value.toFloat(&ok);
+    if (ok)
+        return String::format("%.3f%%", unitlessValue * 100.0);
+    return value;
+}
+
 void MathMLElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == mathbackgroundAttr)
@@ -104,7 +113,7 @@
     else if (name == mathsizeAttr) {
         // The following three values of mathsize are handled in WebCore/css/mathml.css
         if (value != "normal" && value != "small" && value != "big")
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, value);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, convertToPercentageIfNeeded(value));
     } else if (name == mathcolorAttr)
         addPropertyToPresentationAttributeStyle(style, CSSPropertyColor, value);
     // FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to