Changeset 241942 in webkit


Ignore:
Timestamp:
Feb 22, 2019 2:42:43 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Rob Buis <rbuis@igalia.com> 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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r241934 r241942  
     12019-02-22  Rob Buis  <rbuis@igalia.com>
     2
     3        Fix unitless usage of mathsize
     4        https://bugs.webkit.org/show_bug.cgi?id=194940
     5
     6        Reviewed by Frédéric Wang.
     7
     8        Tests lengths-1.html and length-3.html now pass.
     9
     10        * TestExpectations:
     11
    1122019-02-21  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r241824 r241942  
    720720
    721721# These MathML WPT tests fail.
    722 webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-1.html [ ImageOnlyFailure ]
    723722webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2.html [ ImageOnlyFailure ]
    724 webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-3.html [ Failure ]
    725723
    726724# These webmessaging WPT tests time out.
  • trunk/Source/WebCore/ChangeLog

    r241934 r241942  
     12019-02-22  Rob Buis  <rbuis@igalia.com>
     2
     3        Fix unitless usage of mathsize
     4        https://bugs.webkit.org/show_bug.cgi?id=194940
     5
     6        Reviewed by Frédéric Wang.
     7
     8        Convert unitless lengths to percentage values to correct the computed
     9        font size.
     10
     11        * mathml/MathMLElement.cpp:
     12        (WebCore::convertToPercentageIfNeeded):
     13        (WebCore::MathMLElement::collectStyleForPresentationAttribute):
     14
    1152019-02-21  Simon Fraser  <simon.fraser@apple.com>
    216
  • trunk/Source/WebCore/mathml/MathMLElement.cpp

    r229694 r241942  
    9898}
    9999
     100static String convertToPercentageIfNeeded(const AtomicString& value)
     101{
     102    bool ok = false;
     103    float unitlessValue = value.toFloat(&ok);
     104    if (ok)
     105        return String::format("%.3f%%", unitlessValue * 100.0);
     106    return value;
     107}
     108
    100109void MathMLElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
    101110{
     
    105114        // The following three values of mathsize are handled in WebCore/css/mathml.css
    106115        if (value != "normal" && value != "small" && value != "big")
    107             addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, value);
     116            addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, convertToPercentageIfNeeded(value));
    108117    } else if (name == mathcolorAttr)
    109118        addPropertyToPresentationAttributeStyle(style, CSSPropertyColor, value);
Note: See TracChangeset for help on using the changeset viewer.