Changeset 214433 in webkit


Ignore:
Timestamp:
Mar 27, 2017 3:09:14 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

Test variation font ranges in the CSS Font Loading API
https://bugs.webkit.org/show_bug.cgi?id=170022

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/text/variations/font-loading-api-parse-ranges.html

Don't use keywords when reporting font variation range values.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
(WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
(WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
(WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):

  • css/CSSComputedStyleDeclaration.h:
  • css/FontFace.cpp:

(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):

LayoutTests:

  • fast/text/variations/font-loading-api-parse-ranges-expected.txt: Added.
  • fast/text/variations/font-loading-api-parse-ranges.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r214429 r214433  
     12017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Test variation font ranges in the CSS Font Loading API
     4        https://bugs.webkit.org/show_bug.cgi?id=170022
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/text/variations/font-loading-api-parse-ranges-expected.txt: Added.
     9        * fast/text/variations/font-loading-api-parse-ranges.html: Added.
     10
    1112017-03-27  Ryan Haddad  <ryanhaddad@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r214430 r214433  
     12017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Test variation font ranges in the CSS Font Loading API
     4        https://bugs.webkit.org/show_bug.cgi?id=170022
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: fast/text/variations/font-loading-api-parse-ranges.html
     9
     10        Don't use keywords when reporting font variation range values.
     11
     12        * css/CSSComputedStyleDeclaration.cpp:
     13        (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
     14        (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
     15        (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
     16        (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
     17        (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
     18        (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
     19        * css/CSSComputedStyleDeclaration.h:
     20        * css/FontFace.cpp:
     21        (WebCore::FontFace::style):
     22        (WebCore::FontFace::weight):
     23        (WebCore::FontFace::stretch):
     24
    1252017-03-27  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r214419 r214433  
    19181918}
    19191919
     1920Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(FontSelectionValue weight)
     1921{
     1922    return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
     1923}
     1924
    19201925Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontWeightFromStyleValue(FontSelectionValue weight)
    19211926{
    19221927    if (auto value = fontWeightKeyword(weight))
    19231928        return CSSValuePool::singleton().createIdentifierValue(value.value());
    1924     return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
     1929    return fontNonKeywordWeightFromStyleValue(weight);
    19251930}
    19261931
     
    19281933{
    19291934    return ComputedStyleExtractor::fontWeightFromStyleValue(style.fontDescription().weight());
     1935}
     1936
     1937Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(FontSelectionValue stretch)
     1938{
     1939    return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
    19301940}
    19311941
     
    19341944    if (auto keyword = fontStretchKeyword(stretch))
    19351945        return CSSValuePool::singleton().createIdentifierValue(keyword.value());
    1936     return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
     1946    return fontNonKeywordStretchFromStyleValue(stretch);
    19371947}
    19381948
     
    19401950{
    19411951    return ComputedStyleExtractor::fontStretchFromStyleValue(style.fontDescription().stretch());
     1952}
     1953
     1954Ref<CSSFontStyleValue> ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(FontSelectionValue italic)
     1955{
     1956    return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
    19421957}
    19431958
     
    19461961    if (auto keyword = fontStyleKeyword(italic))
    19471962        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value()));
    1948     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
     1963    return fontNonKeywordStyleFromStyleValue(italic);
    19491964}
    19501965
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h

    r214419 r214433  
    6767    static Ref<CSSValue> valueForFilter(const RenderStyle&, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
    6868
     69    static Ref<CSSPrimitiveValue> fontNonKeywordWeightFromStyleValue(FontSelectionValue);
    6970    static Ref<CSSPrimitiveValue> fontWeightFromStyleValue(FontSelectionValue);
     71    static Ref<CSSPrimitiveValue> fontNonKeywordStretchFromStyleValue(FontSelectionValue);
    7072    static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue);
     73    static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue);
    7174    static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue);
    7275
  • trunk/Source/WebCore/css/FontFace.cpp

    r214419 r214433  
    295295        return minimum->cssText();
    296296
    297     ASSERT(minimum->fontStyleValue->valueID() == CSSValueOblique);
    298     ASSERT(maximum->fontStyleValue->valueID() == CSSValueOblique);
     297    auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(style.minimum);
     298    auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(style.maximum);
     299
     300    ASSERT(minimumNonKeyword->fontStyleValue->valueID() == CSSValueOblique);
     301    ASSERT(maximumNonKeyword->fontStyleValue->valueID() == CSSValueOblique);
    299302
    300303    StringBuilder builder;
    301     builder.append(minimum->fontStyleValue->cssText());
     304    builder.append(minimumNonKeyword->fontStyleValue->cssText());
    302305    builder.append(' ');
    303306    if (minimum->obliqueValue.get() == maximum->obliqueValue.get())
    304         builder.append(minimum->obliqueValue->cssText());
     307        builder.append(minimumNonKeyword->obliqueValue->cssText());
    305308    else {
    306         builder.append(minimum->obliqueValue->cssText());
    307         builder.append(maximum->obliqueValue->cssText());
     309        builder.append(minimumNonKeyword->obliqueValue->cssText());
     310        builder.append(' ');
     311        builder.append(maximumNonKeyword->obliqueValue->cssText());
    308312    }
    309313    return builder.toString();
     
    321325        return minimum->cssText();
    322326
     327    auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(weight.minimum);
     328    auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(weight.maximum);
     329
    323330    StringBuilder builder;
    324     builder.append(minimum->cssText());
     331    builder.append(minimumNonKeyword->cssText());
    325332    builder.append(' ');
    326     builder.append(maximum->cssText());
     333    builder.append(maximumNonKeyword->cssText());
    327334    return builder.toString();
    328335}
     
    339346        return minimum->cssText();
    340347
     348    auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(stretch.minimum);
     349    auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(stretch.maximum);
     350
    341351    StringBuilder builder;
    342     builder.append(minimum->cssText());
     352    builder.append(minimumNonKeyword->cssText());
    343353    builder.append(' ');
    344     builder.append(maximum->cssText());
     354    builder.append(maximumNonKeyword->cssText());
    345355    return builder.toString();
    346356}
Note: See TracChangeset for help on using the changeset viewer.