Changeset 214359 in webkit


Ignore:
Timestamp:
Mar 24, 2017 11:23:48 AM (7 years ago)
Author:
mmaxfield@apple.com
Message:

font-style needs a new CSSValue to make CSSRule.cssText work correctly
https://bugs.webkit.org/show_bug.cgi?id=169258

Reviewed by David Hyatt.

Source/WebCore:

With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
style and it's associated @font-face descriptor accept.

The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"

We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
this support in https://bugs.webkit.org/show_bug.cgi?id=169357.

Tests: fast/text/font-selection-font-face-parse.html:

fast/text/font-style-parse.html:

  • CMakeLists.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • css/CSSAllInOne.cpp:
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::fontStyleFromStyle):
(WebCore::fontShorthandValueForSelectionProperties):

  • css/CSSFontFace.cpp:

(WebCore::calculateWeightRange):
(WebCore::calculateStretchRange):
(WebCore::calculateItalicRange):

  • css/CSSFontFaceSet.cpp:

(WebCore::computeFontSelectionRequest):
(WebCore::CSSFontFaceSet::matchingFaces):
(WebCore::calculateWeightValue): Deleted.
(WebCore::calculateStretchValue): Deleted.
(WebCore::calculateStyleValue): Deleted.

  • css/CSSFontFaceSet.h:
  • css/CSSFontSelector.cpp:

(WebCore::CSSFontSelector::addFontFaceRule):

  • css/CSSFontStyleRangeValue.cpp: Added.

(WebCore::CSSFontStyleRangeValue::customCSSText):
(WebCore::CSSFontStyleRangeValue::equals):

  • css/CSSFontStyleRangeValue.h: Added.
  • css/CSSFontStyleValue.cpp: Added.

(WebCore::CSSFontStyleValue::customCSSText):
(WebCore::CSSFontStyleValue::equals):

  • css/CSSFontStyleValue.h: Added.
  • css/CSSFontValue.cpp:

(WebCore::CSSFontValue::customCSSText):

  • css/CSSFontValue.h:
  • css/CSSValue.cpp:

(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):

  • css/CSSValue.h:

(WebCore::CSSValue::isFontStyleValue):
(WebCore::CSSValue::isFontStyleRangeValue):

  • css/FontFace.cpp:

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

  • css/StyleBuilderConverter.h:

(WebCore::StyleBuilderConverter::convertFontWeightFromValue):
(WebCore::StyleBuilderConverter::convertFontStretchFromValue):
(WebCore::StyleBuilderConverter::convertFontStyleFromValue):
(WebCore::StyleBuilderConverter::convertFontWeight):
(WebCore::StyleBuilderConverter::convertFontStretch):
(WebCore::StyleBuilderConverter::convertFontStyle):

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):
(WebCore::CSSPropertyParser::consumeSystemFont):
(WebCore::CSSPropertyParser::consumeFont):

  • svg/SVGFontFaceElement.cpp:

(WebCore::SVGFontFaceElement::parseAttribute):

LayoutTests:

Update tests' expected results.

  • fast/text/font-selection-font-face-parse-expected.txt:
  • fast/text/font-selection-font-face-parse.html:
  • fast/text/font-style-parse-expected.txt:
  • fast/text/font-style-parse.html:
  • platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
  • svg/css/getComputedStyle-basic-expected.txt:
Location:
trunk
Files:
4 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r214357 r214359  
     12017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        font-style needs a new CSSValue to make CSSRule.cssText work correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=169258
     5
     6        Reviewed by David Hyatt.
     7
     8        Update tests' expected results.
     9
     10        * fast/text/font-selection-font-face-parse-expected.txt:
     11        * fast/text/font-selection-font-face-parse.html:
     12        * fast/text/font-style-parse-expected.txt:
     13        * fast/text/font-style-parse.html:
     14        * platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
     15        * svg/css/getComputedStyle-basic-expected.txt:
     16
    1172017-03-24  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt

    r213528 r214359  
    7070PASS stretchTestSheet.cssRules[38].style.fontStretch is "7 / 8"
    7171PASS stretchTestSheet.cssRules[39].style.fontStretch is "2 / 7"
    72 PASS styleTestSheet.cssRules[0].style.fontStyle is "1deg"
    73 PASS styleTestSheet.cssRules[1].style.fontStyle is "200grad"
    74 PASS styleTestSheet.cssRules[2].style.fontStyle is "6.28318rad"
    75 PASS styleTestSheet.cssRules[3].style.fontStyle is "4turn"
    76 PASS styleTestSheet.cssRules[4].style.fontStyle is "5"
    77 PASS styleTestSheet.cssRules[5].style.fontStyle is "20"
     72PASS styleTestSheet.cssRules[0].style.fontStyle is "oblique 1deg"
     73PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 200grad"
     74PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 6.28318rad"
     75PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 4turn"
     76PASS styleTestSheet.cssRules[4].style.fontStyle is "oblique 5"
     77PASS styleTestSheet.cssRules[5].style.fontStyle is "oblique 20"
    7878PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
    7979PASS styleTestSheet.cssRules[7].style.fontStyle is "oblique"
     
    8181PASS styleTestSheet.cssRules[9].style.fontStyle is ""
    8282PASS styleTestSheet.cssRules[10].style.fontStyle is ""
    83 PASS styleTestSheet.cssRules[11].style.fontStyle is "7"
    84 PASS styleTestSheet.cssRules[12].style.fontStyle is "calc(1441deg)"
    85 PASS styleTestSheet.cssRules[13].style.fontStyle is "100 / 200"
    86 PASS styleTestSheet.cssRules[14].style.fontStyle is "100 / 200"
     83PASS styleTestSheet.cssRules[11].style.fontStyle is "oblique 7"
     84PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
     85PASS styleTestSheet.cssRules[13].style.fontStyle is "oblique 100deg 200deg"
     86PASS styleTestSheet.cssRules[14].style.fontStyle is "oblique 100deg 200deg"
    8787PASS styleTestSheet.cssRules[15].style.fontStyle is ""
    8888PASS styleTestSheet.cssRules[16].style.fontStyle is ""
     
    9191PASS styleTestSheet.cssRules[19].style.fontStyle is ""
    9292PASS styleTestSheet.cssRules[20].style.fontStyle is ""
    93 PASS styleTestSheet.cssRules[21].style.fontStyle is "1 / 2"
    94 PASS styleTestSheet.cssRules[22].style.fontStyle is "-2 / -1"
     93PASS styleTestSheet.cssRules[21].style.fontStyle is "oblique 1deg 2deg"
     94PASS styleTestSheet.cssRules[22].style.fontStyle is "oblique -2deg -1deg"
    9595PASS styleTestSheet.cssRules[23].style.fontStyle is ""
    96 PASS styleTestSheet.cssRules[24].style.fontStyle is "100deg / 200deg"
    97 PASS styleTestSheet.cssRules[25].style.fontStyle is "100deg / 200deg"
     96PASS styleTestSheet.cssRules[24].style.fontStyle is "oblique 100deg 200deg"
     97PASS styleTestSheet.cssRules[25].style.fontStyle is "oblique 100deg 200deg"
    9898PASS styleTestSheet.cssRules[26].style.fontStyle is ""
    9999PASS styleTestSheet.cssRules[27].style.fontStyle is ""
     
    102102PASS styleTestSheet.cssRules[30].style.fontStyle is ""
    103103PASS styleTestSheet.cssRules[31].style.fontStyle is ""
    104 PASS styleTestSheet.cssRules[32].style.fontStyle is "1deg / 2deg"
    105 PASS styleTestSheet.cssRules[33].style.fontStyle is "-2deg / -1deg"
     104PASS styleTestSheet.cssRules[32].style.fontStyle is "oblique 1deg 2deg"
     105PASS styleTestSheet.cssRules[33].style.fontStyle is "oblique -2deg -1deg"
    106106PASS styleTestSheet.cssRules[34].style.fontStyle is ""
    107107PASS styleTestSheet.cssRules[35].style.fontStyle is ""
    108108PASS styleTestSheet.cssRules[36].style.fontStyle is ""
    109 PASS styleTestSheet.cssRules[37].style.fontStyle is "2deg / 1turn"
    110 PASS styleTestSheet.cssRules[38].style.fontStyle is "7 / 8"
    111 PASS styleTestSheet.cssRules[39].style.fontStyle is "2 / 7"
     109PASS styleTestSheet.cssRules[37].style.fontStyle is "oblique 2deg 1turn"
     110PASS styleTestSheet.cssRules[38].style.fontStyle is "oblique 7deg 8deg"
     111PASS styleTestSheet.cssRules[39].style.fontStyle is "oblique 2deg 7deg"
    112112PASS successfullyParsed is true
    113113
  • trunk/LayoutTests/fast/text/font-selection-font-face-parse.html

    r213528 r214359  
    262262}
    263263@font-face {
    264     font-style: oblique 100/200;
    265 }
    266 @font-face {
    267     font-style: oblique 100 / 200;
    268 }
    269 @font-face {
    270     font-style: oblique a 100 / 200;
    271 }
    272 @font-face {
    273     font-style: oblique 100 / 200 a;
    274 }
    275 @font-face {
    276     font-style: oblique 100 a / 200;
    277 }
    278 @font-face {
    279     font-style: oblique 100 a/ 200;
    280 }
    281 @font-face {
    282     font-style: oblique 100 /a 200;
    283 }
    284 @font-face {
    285     font-style: oblique 100 / a200;
    286 }
    287 @font-face {
    288     font-style: oblique 1 / 2;
    289 }
    290 @font-face {
    291     font-style: oblique -2 / -1;
    292 }
    293 @font-face {
    294     font-style: oblique 2 / 1;
    295 }
    296 @font-face {
    297     font-style: oblique 100deg/200deg;
    298 }
    299 @font-face {
    300     font-style: oblique 100deg / 200deg;
    301 }
    302 @font-face {
    303     font-style: oblique a 100deg / 200deg;
    304 }
    305 @font-face {
    306     font-style: oblique 100deg / 200deg a;
    307 }
    308 @font-face {
    309     font-style: oblique 100deg a / 200deg;
    310 }
    311 @font-face {
    312     font-style: oblique 100deg a/ 200deg;
    313 }
    314 @font-face {
    315     font-style: oblique 100deg /a 200deg;
    316 }
    317 @font-face {
    318     font-style: oblique 100deg / a200deg;
    319 }
    320 @font-face {
    321     font-style: oblique 1deg / 2deg;
    322 }
    323 @font-face {
    324     font-style: oblique -2deg / -1deg;
    325 }
    326 @font-face {
    327     font-style: oblique 2deg / 1deg;
    328 }
    329 @font-face {
    330     font-style: oblique 1 / 2deg;
    331 }
    332 @font-face {
    333     font-style: oblique 1deg / 2;
    334 }
    335 @font-face {
    336     font-style: oblique 2deg / 1turn;
    337 }
    338 @font-face {
    339     font-style: oblique calc(3 + 4) / 8;
    340 }
    341 @font-face {
    342     font-style: oblique 2 / calc(3 + 4);
     264    font-style: oblique 100 200;
     265}
     266@font-face {
     267    font-style: oblique 100 200;
     268}
     269@font-face {
     270    font-style: oblique a 100 200;
     271}
     272@font-face {
     273    font-style: oblique 100 200 a;
     274}
     275@font-face {
     276    font-style: oblique 100 a 200;
     277}
     278@font-face {
     279    font-style: oblique 100 a200;
     280}
     281@font-face {
     282    font-style: oblique 100a 200;
     283}
     284@font-face {
     285    font-style: oblique 100 a200;
     286}
     287@font-face {
     288    font-style: oblique 1 2;
     289}
     290@font-face {
     291    font-style: oblique -2 -1;
     292}
     293@font-face {
     294    font-style: oblique 2 1;
     295}
     296@font-face {
     297    font-style: oblique 100deg 200deg;
     298}
     299@font-face {
     300    font-style: oblique 100deg   200deg;
     301}
     302@font-face {
     303    font-style: oblique a 100deg 200deg;
     304}
     305@font-face {
     306    font-style: oblique 100deg 200deg a;
     307}
     308@font-face {
     309    font-style: oblique 100deg a 200deg;
     310}
     311@font-face {
     312    font-style: oblique 100deg a200deg;
     313}
     314@font-face {
     315    font-style: oblique 100dega 200deg;
     316}
     317@font-face {
     318    font-style: oblique 100deg a200deg;
     319}
     320@font-face {
     321    font-style: oblique 1deg 2deg;
     322}
     323@font-face {
     324    font-style: oblique -2deg -1deg;
     325}
     326@font-face {
     327    font-style: oblique 2deg 1deg;
     328}
     329@font-face {
     330    font-style: oblique 1 2deg;
     331}
     332@font-face {
     333    font-style: oblique 1deg 2;
     334}
     335@font-face {
     336    font-style: oblique 2deg 1turn;
     337}
     338@font-face {
     339    font-style: oblique calc(3 + 4) 8;
     340}
     341@font-face {
     342    font-style: oblique 2 calc(3 + 4);
    343343}
    344344</style>
     
    422422
    423423var styleTestSheet = document.getElementById("styleTest").sheet;
    424 shouldBeEqualToString("styleTestSheet.cssRules[0].style.fontStyle", "1deg");
    425 shouldBeEqualToString("styleTestSheet.cssRules[1].style.fontStyle", "200grad");
    426 shouldBeEqualToString("styleTestSheet.cssRules[2].style.fontStyle", "6.28318rad");
    427 shouldBeEqualToString("styleTestSheet.cssRules[3].style.fontStyle", "4turn");
    428 shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "5");
    429 shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "20");
     424shouldBeEqualToString("styleTestSheet.cssRules[0].style.fontStyle", "oblique 1deg");
     425shouldBeEqualToString("styleTestSheet.cssRules[1].style.fontStyle", "oblique 200grad");
     426shouldBeEqualToString("styleTestSheet.cssRules[2].style.fontStyle", "oblique 6.28318rad");
     427shouldBeEqualToString("styleTestSheet.cssRules[3].style.fontStyle", "oblique 4turn");
     428shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "oblique 5");
     429shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "oblique 20");
    430430shouldBeEqualToString("styleTestSheet.cssRules[6].style.fontStyle", "italic");
    431431shouldBeEqualToString("styleTestSheet.cssRules[7].style.fontStyle", "oblique");
     
    433433shouldBeEqualToString("styleTestSheet.cssRules[9].style.fontStyle", "");
    434434shouldBeEqualToString("styleTestSheet.cssRules[10].style.fontStyle", "");
    435 shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "7");
    436 shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "calc(1441deg)");
     435shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "oblique 7");
     436shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "oblique calc(1441deg)");
    437437
    438 shouldBeEqualToString("styleTestSheet.cssRules[13].style.fontStyle", "100 / 200");
    439 shouldBeEqualToString("styleTestSheet.cssRules[14].style.fontStyle", "100 / 200");
     438shouldBeEqualToString("styleTestSheet.cssRules[13].style.fontStyle", "oblique 100deg 200deg");
     439shouldBeEqualToString("styleTestSheet.cssRules[14].style.fontStyle", "oblique 100deg 200deg");
    440440shouldBeEqualToString("styleTestSheet.cssRules[15].style.fontStyle", "");
    441441shouldBeEqualToString("styleTestSheet.cssRules[16].style.fontStyle", "");
     
    444444shouldBeEqualToString("styleTestSheet.cssRules[19].style.fontStyle", "");
    445445shouldBeEqualToString("styleTestSheet.cssRules[20].style.fontStyle", "");
    446 shouldBeEqualToString("styleTestSheet.cssRules[21].style.fontStyle", "1 / 2");
    447 shouldBeEqualToString("styleTestSheet.cssRules[22].style.fontStyle", "-2 / -1");
     446shouldBeEqualToString("styleTestSheet.cssRules[21].style.fontStyle", "oblique 1deg 2deg");
     447shouldBeEqualToString("styleTestSheet.cssRules[22].style.fontStyle", "oblique -2deg -1deg");
    448448shouldBeEqualToString("styleTestSheet.cssRules[23].style.fontStyle", "");
    449 shouldBeEqualToString("styleTestSheet.cssRules[24].style.fontStyle", "100deg / 200deg");
    450 shouldBeEqualToString("styleTestSheet.cssRules[25].style.fontStyle", "100deg / 200deg");
     449shouldBeEqualToString("styleTestSheet.cssRules[24].style.fontStyle", "oblique 100deg 200deg");
     450shouldBeEqualToString("styleTestSheet.cssRules[25].style.fontStyle", "oblique 100deg 200deg");
    451451shouldBeEqualToString("styleTestSheet.cssRules[26].style.fontStyle", "");
    452452shouldBeEqualToString("styleTestSheet.cssRules[27].style.fontStyle", "");
     
    455455shouldBeEqualToString("styleTestSheet.cssRules[30].style.fontStyle", "");
    456456shouldBeEqualToString("styleTestSheet.cssRules[31].style.fontStyle", "");
    457 shouldBeEqualToString("styleTestSheet.cssRules[32].style.fontStyle", "1deg / 2deg");
    458 shouldBeEqualToString("styleTestSheet.cssRules[33].style.fontStyle", "-2deg / -1deg");
     457shouldBeEqualToString("styleTestSheet.cssRules[32].style.fontStyle", "oblique 1deg 2deg");
     458shouldBeEqualToString("styleTestSheet.cssRules[33].style.fontStyle", "oblique -2deg -1deg");
    459459shouldBeEqualToString("styleTestSheet.cssRules[34].style.fontStyle", "");
    460460shouldBeEqualToString("styleTestSheet.cssRules[35].style.fontStyle", "");
    461461shouldBeEqualToString("styleTestSheet.cssRules[36].style.fontStyle", "");
    462 shouldBeEqualToString("styleTestSheet.cssRules[37].style.fontStyle", "2deg / 1turn");
    463 shouldBeEqualToString("styleTestSheet.cssRules[38].style.fontStyle", "7 / 8");
    464 shouldBeEqualToString("styleTestSheet.cssRules[39].style.fontStyle", "2 / 7");
     462shouldBeEqualToString("styleTestSheet.cssRules[37].style.fontStyle", "oblique 2deg 1turn");
     463shouldBeEqualToString("styleTestSheet.cssRules[38].style.fontStyle", "oblique 7deg 8deg");
     464shouldBeEqualToString("styleTestSheet.cssRules[39].style.fontStyle", "oblique 2deg 7deg");
    465465</script>
    466466<script src="../../resources/js-test-post.js"></script>
  • trunk/LayoutTests/fast/text/font-style-parse-expected.txt

    r214324 r214359  
    11PASS window.getComputedStyle(document.getElementById('test1')).fontStyle is "normal"
    2 PASS window.getComputedStyle(document.getElementById('test2')).fontStyle is "1deg"
    3 PASS window.getComputedStyle(document.getElementById('test3')).fontStyle is "180deg"
    4 PASS window.getComputedStyle(document.getElementById('test4')).fontStyle is "359.75deg"
    5 PASS window.getComputedStyle(document.getElementById('test5')).fontStyle is "1440deg"
    6 PASS window.getComputedStyle(document.getElementById('test6')).fontStyle is "5deg"
     2PASS window.getComputedStyle(document.getElementById('test2')).fontStyle is "oblique 1deg"
     3PASS window.getComputedStyle(document.getElementById('test3')).fontStyle is "oblique 180deg"
     4PASS window.getComputedStyle(document.getElementById('test4')).fontStyle is "oblique 359.75deg"
     5PASS window.getComputedStyle(document.getElementById('test5')).fontStyle is "oblique 1440deg"
     6PASS window.getComputedStyle(document.getElementById('test6')).fontStyle is "oblique 5deg"
    77PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "italic"
    88PASS window.getComputedStyle(document.getElementById('test8')).fontStyle is "italic"
     
    1111PASS window.getComputedStyle(document.getElementById('test11')).fontStyle is "normal"
    1212PASS window.getComputedStyle(document.getElementById('test12')).fontStyle is "normal"
    13 PASS window.getComputedStyle(document.getElementById('test13')).fontStyle is "7deg"
    14 PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "1441deg"
     13PASS window.getComputedStyle(document.getElementById('test13')).fontStyle is "oblique 7deg"
     14PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "oblique 1441deg"
    1515PASS window.getComputedStyle(document.getElementById('test15')).fontStyle is "italic"
    1616PASS window.getComputedStyle(document.getElementById('test16')).fontStyle is "italic"
     
    1919PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is "italic"
    2020PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal"
    21 PASS window.getComputedStyle(document.getElementById('test21')).fontStyle is "14deg"
     21PASS window.getComputedStyle(document.getElementById('test21')).fontStyle is "oblique 14deg"
    2222PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
    2323PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
     
    4848PASS document.getElementById('test19').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
    4949PASS document.getElementById('test20').style.font is ""
    50 PASS document.getElementById('test21').style.font is "14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'"
     50PASS document.getElementById('test21').style.font is "oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'"
    5151PASS successfullyParsed is true
    5252
  • trunk/LayoutTests/fast/text/font-style-parse.html

    r214324 r214359  
    3030<script>
    3131shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontStyle", "normal");
    32 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontStyle", "1deg");
    33 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStyle", "180deg");
    34 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStyle", "359.75deg");
    35 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStyle", "1440deg");
    36 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "5deg");
     32shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontStyle", "oblique 1deg");
     33shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStyle", "oblique 180deg");
     34shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStyle", "oblique 359.75deg");
     35shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStyle", "oblique 1440deg");
     36shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "oblique 5deg");
    3737shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "italic");
    3838shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontStyle", "italic");
     
    4141shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontStyle", "normal");
    4242shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontStyle", "normal");
    43 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "7deg");
    44 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "1441deg");
     43shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "oblique 7deg");
     44shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "oblique 1441deg");
    4545shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStyle", "italic");
    4646shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontStyle", "italic");
     
    4949shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).fontStyle", "italic");
    5050shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStyle", "normal");
    51 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontStyle", "14deg");
     51shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontStyle", "oblique 14deg");
    5252
    5353shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
     
    8080shouldBeEqualToString("document.getElementById('test19').style.font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
    8181shouldBeEqualToString("document.getElementById('test20').style.font", "");
    82 shouldBeEqualToString("document.getElementById('test21').style.font", "14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'");
     82shouldBeEqualToString("document.getElementById('test21').style.font", "oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'");
    8383</script>
    8484<script src="../../resources/js-test-post.js"></script>
  • trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt

    r213528 r214359  
    7070FAIL stretchTestSheet.cssRules[38].style.fontStretch should be 7 / 8. Was .
    7171FAIL stretchTestSheet.cssRules[39].style.fontStretch should be 2 / 7. Was .
    72 PASS styleTestSheet.cssRules[0].style.fontStyle is "1deg"
    73 PASS styleTestSheet.cssRules[1].style.fontStyle is "200grad"
    74 PASS styleTestSheet.cssRules[2].style.fontStyle is "6.28318rad"
    75 PASS styleTestSheet.cssRules[3].style.fontStyle is "4turn"
    76 PASS styleTestSheet.cssRules[4].style.fontStyle is "5"
    77 PASS styleTestSheet.cssRules[5].style.fontStyle is "20"
     72PASS styleTestSheet.cssRules[0].style.fontStyle is "oblique 1deg"
     73PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 200grad"
     74PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 6.28318rad"
     75PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 4turn"
     76FAIL styleTestSheet.cssRules[4].style.fontStyle should be oblique 5. Was oblique 5deg.
     77FAIL styleTestSheet.cssRules[5].style.fontStyle should be oblique 20. Was oblique 20deg.
    7878PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
    7979PASS styleTestSheet.cssRules[7].style.fontStyle is "oblique"
     
    8181PASS styleTestSheet.cssRules[9].style.fontStyle is ""
    8282PASS styleTestSheet.cssRules[10].style.fontStyle is ""
    83 PASS styleTestSheet.cssRules[11].style.fontStyle is "7"
    84 PASS styleTestSheet.cssRules[12].style.fontStyle is "calc(1441deg)"
    85 FAIL styleTestSheet.cssRules[13].style.fontStyle should be 100 / 200. Was .
    86 FAIL styleTestSheet.cssRules[14].style.fontStyle should be 100 / 200. Was .
     83FAIL styleTestSheet.cssRules[11].style.fontStyle should be oblique 7. Was oblique 7deg.
     84PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
     85FAIL styleTestSheet.cssRules[13].style.fontStyle should be oblique 100deg 200deg. Was .
     86FAIL styleTestSheet.cssRules[14].style.fontStyle should be oblique 100deg 200deg. Was .
    8787PASS styleTestSheet.cssRules[15].style.fontStyle is ""
    8888PASS styleTestSheet.cssRules[16].style.fontStyle is ""
     
    9191PASS styleTestSheet.cssRules[19].style.fontStyle is ""
    9292PASS styleTestSheet.cssRules[20].style.fontStyle is ""
    93 FAIL styleTestSheet.cssRules[21].style.fontStyle should be 1 / 2. Was .
    94 FAIL styleTestSheet.cssRules[22].style.fontStyle should be -2 / -1. Was .
     93FAIL styleTestSheet.cssRules[21].style.fontStyle should be oblique 1deg 2deg. Was .
     94FAIL styleTestSheet.cssRules[22].style.fontStyle should be oblique -2deg -1deg. Was .
    9595PASS styleTestSheet.cssRules[23].style.fontStyle is ""
    96 FAIL styleTestSheet.cssRules[24].style.fontStyle should be 100deg / 200deg. Was .
    97 FAIL styleTestSheet.cssRules[25].style.fontStyle should be 100deg / 200deg. Was .
     96FAIL styleTestSheet.cssRules[24].style.fontStyle should be oblique 100deg 200deg. Was .
     97FAIL styleTestSheet.cssRules[25].style.fontStyle should be oblique 100deg 200deg. Was .
    9898PASS styleTestSheet.cssRules[26].style.fontStyle is ""
    9999PASS styleTestSheet.cssRules[27].style.fontStyle is ""
     
    102102PASS styleTestSheet.cssRules[30].style.fontStyle is ""
    103103PASS styleTestSheet.cssRules[31].style.fontStyle is ""
    104 FAIL styleTestSheet.cssRules[32].style.fontStyle should be 1deg / 2deg. Was .
    105 FAIL styleTestSheet.cssRules[33].style.fontStyle should be -2deg / -1deg. Was .
     104FAIL styleTestSheet.cssRules[32].style.fontStyle should be oblique 1deg 2deg. Was .
     105FAIL styleTestSheet.cssRules[33].style.fontStyle should be oblique -2deg -1deg. Was .
    106106PASS styleTestSheet.cssRules[34].style.fontStyle is ""
    107107PASS styleTestSheet.cssRules[35].style.fontStyle is ""
    108108PASS styleTestSheet.cssRules[36].style.fontStyle is ""
    109 FAIL styleTestSheet.cssRules[37].style.fontStyle should be 2deg / 1turn. Was .
    110 FAIL styleTestSheet.cssRules[38].style.fontStyle should be 7 / 8. Was .
    111 FAIL styleTestSheet.cssRules[39].style.fontStyle should be 2 / 7. Was .
     109FAIL styleTestSheet.cssRules[37].style.fontStyle should be oblique 2deg 1turn. Was .
     110FAIL styleTestSheet.cssRules[38].style.fontStyle should be oblique 7deg 8deg. Was .
     111FAIL styleTestSheet.cssRules[39].style.fontStyle should be oblique 2deg 7deg. Was .
    112112PASS successfullyParsed is true
    113113
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r213094 r214359  
    9292rect: style.getPropertyCSSValue(font-size) : [object CSSPrimitiveValue]
    9393rect: style.getPropertyValue(font-style) : normal
    94 rect: style.getPropertyCSSValue(font-style) : [object CSSPrimitiveValue]
     94rect: style.getPropertyCSSValue(font-style) : [object CSSValue]
    9595rect: style.getPropertyValue(font-synthesis) : style weight small-caps
    9696rect: style.getPropertyCSSValue(font-synthesis) : [object CSSValueList]
     
    644644g: style.getPropertyCSSValue(font-size) : [object CSSPrimitiveValue]
    645645g: style.getPropertyValue(font-style) : normal
    646 g: style.getPropertyCSSValue(font-style) : [object CSSPrimitiveValue]
     646g: style.getPropertyCSSValue(font-style) : [object CSSValue]
    647647g: style.getPropertyValue(font-synthesis) : style weight small-caps
    648648g: style.getPropertyCSSValue(font-synthesis) : [object CSSValueList]
  • trunk/Source/WebCore/CMakeLists.txt

    r214338 r214359  
    13151315    css/CSSFontFeatureValue.cpp
    13161316    css/CSSFontSelector.cpp
     1317    css/CSSFontStyleRangeValue.cpp
     1318    css/CSSFontStyleValue.cpp
    13171319    css/CSSFontValue.cpp
    13181320    css/CSSFontVariationValue.cpp
  • trunk/Source/WebCore/ChangeLog

    r214358 r214359  
     12017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        font-style needs a new CSSValue to make CSSRule.cssText work correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=169258
     5
     6        Reviewed by David Hyatt.
     7
     8        With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
     9        off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
     10        style and it's associated @font-face descriptor accept.
     11
     12        The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
     13        The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"
     14
     15        We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
     16        this support in https://bugs.webkit.org/show_bug.cgi?id=169357.
     17
     18        Tests: fast/text/font-selection-font-face-parse.html:
     19               fast/text/font-style-parse.html:
     20
     21        * CMakeLists.txt:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * css/CSSAllInOne.cpp:
     24        * css/CSSComputedStyleDeclaration.cpp:
     25        (WebCore::fontStyleFromStyle):
     26        (WebCore::fontShorthandValueForSelectionProperties):
     27        * css/CSSFontFace.cpp:
     28        (WebCore::calculateWeightRange):
     29        (WebCore::calculateStretchRange):
     30        (WebCore::calculateItalicRange):
     31        * css/CSSFontFaceSet.cpp:
     32        (WebCore::computeFontSelectionRequest):
     33        (WebCore::CSSFontFaceSet::matchingFaces):
     34        (WebCore::calculateWeightValue): Deleted.
     35        (WebCore::calculateStretchValue): Deleted.
     36        (WebCore::calculateStyleValue): Deleted.
     37        * css/CSSFontFaceSet.h:
     38        * css/CSSFontSelector.cpp:
     39        (WebCore::CSSFontSelector::addFontFaceRule):
     40        * css/CSSFontStyleRangeValue.cpp: Added.
     41        (WebCore::CSSFontStyleRangeValue::customCSSText):
     42        (WebCore::CSSFontStyleRangeValue::equals):
     43        * css/CSSFontStyleRangeValue.h: Added.
     44        * css/CSSFontStyleValue.cpp: Added.
     45        (WebCore::CSSFontStyleValue::customCSSText):
     46        (WebCore::CSSFontStyleValue::equals):
     47        * css/CSSFontStyleValue.h: Added.
     48        * css/CSSFontValue.cpp:
     49        (WebCore::CSSFontValue::customCSSText):
     50        * css/CSSFontValue.h:
     51        * css/CSSValue.cpp:
     52        (WebCore::CSSValue::equals):
     53        (WebCore::CSSValue::cssText):
     54        (WebCore::CSSValue::destroy):
     55        * css/CSSValue.h:
     56        (WebCore::CSSValue::isFontStyleValue):
     57        (WebCore::CSSValue::isFontStyleRangeValue):
     58        * css/FontFace.cpp:
     59        (WebCore::FontFace::style):
     60        (WebCore::FontFace::weight):
     61        (WebCore::FontFace::stretch):
     62        * css/StyleBuilderConverter.h:
     63        (WebCore::StyleBuilderConverter::convertFontWeightFromValue):
     64        (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
     65        (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
     66        (WebCore::StyleBuilderConverter::convertFontWeight):
     67        (WebCore::StyleBuilderConverter::convertFontStretch):
     68        (WebCore::StyleBuilderConverter::convertFontStyle):
     69        * css/parser/CSSPropertyParser.cpp:
     70        (WebCore::consumeFontStyle):
     71        (WebCore::consumeFontStyleRange):
     72        (WebCore::CSSPropertyParser::consumeSystemFont):
     73        (WebCore::CSSPropertyParser::consumeFont):
     74        * svg/SVGFontFaceElement.cpp:
     75        (WebCore::SVGFontFaceElement::parseAttribute):
     76
    1772017-03-24  Alex Christensen  <achristensen@webkit.org>
    278
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r214330 r214359  
    59315931                C2AB0AF71E6B3C6C001348C5 /* FontSelectionAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = C2AB0AF51E6B3C6C001348C5 /* FontSelectionAlgorithm.h */; settings = {ATTRIBUTES = (Private, ); }; };
    59325932                C2E1F43F1D6254E10094625C /* BreakLines.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4816097D93020094C9E4 /* BreakLines.h */; settings = {ATTRIBUTES = (Private, ); }; };
     5933                C2E38EFD1E8396FD00CA3ADF /* CSSFontStyleValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2E38EFB1E8396FD00CA3ADF /* CSSFontStyleValue.cpp */; };
     5934                C2E38EFE1E8396FD00CA3ADF /* CSSFontStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = C2E38EFC1E8396FD00CA3ADF /* CSSFontStyleValue.h */; };
     5935                C2E38F011E84573500CA3ADF /* CSSFontStyleRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2E38EFF1E84573500CA3ADF /* CSSFontStyleRangeValue.cpp */; };
     5936                C2E38F021E84573500CA3ADF /* CSSFontStyleRangeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = C2E38F001E84573500CA3ADF /* CSSFontStyleRangeValue.h */; };
    59335937                C2F4E78A1E45BEA1006D7105 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2F4E7881E45AEDF006D7105 /* ComplexTextController.cpp */; };
    59345938                C2F4E78C1E45C3EF006D7105 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = C2F4E7891E45AEDF006D7105 /* ComplexTextController.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1431914323                C2AB0B021E6DE32B001348C5 /* FontSelectionKeywordValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontSelectionKeywordValues.h; sourceTree = "<group>"; };
    1432014324                C2AB0B031E6DE92C001348C5 /* FontSelectionValueInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontSelectionValueInlines.h; sourceTree = "<group>"; };
     14325                C2E38EFB1E8396FD00CA3ADF /* CSSFontStyleValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontStyleValue.cpp; sourceTree = "<group>"; };
     14326                C2E38EFC1E8396FD00CA3ADF /* CSSFontStyleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontStyleValue.h; sourceTree = "<group>"; };
     14327                C2E38EFF1E84573500CA3ADF /* CSSFontStyleRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontStyleRangeValue.cpp; sourceTree = "<group>"; };
     14328                C2E38F001E84573500CA3ADF /* CSSFontStyleRangeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontStyleRangeValue.h; sourceTree = "<group>"; };
    1432114329                C2F4E7881E45AEDF006D7105 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; };
    1432214330                C2F4E7891E45AEDF006D7105 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; };
     
    2492424932                                3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
    2492524933                                31055BB81E4FE18900EB604E /* WebKitFontFamilyNames.in */,
     24934                                C2E38EFB1E8396FD00CA3ADF /* CSSFontStyleValue.cpp */,
     24935                                C2E38EFC1E8396FD00CA3ADF /* CSSFontStyleValue.h */,
     24936                                C2E38EFF1E84573500CA3ADF /* CSSFontStyleRangeValue.cpp */,
     24937                                C2E38F001E84573500CA3ADF /* CSSFontStyleRangeValue.h */,
    2492624938                        );
    2492724939                        path = css;
     
    2726427276                                51E269371DD3BD9B006B6A58 /* IDBIterateCursorData.h in Headers */,
    2726527277                                5185FC951BB4C4E80012898F /* IDBKey.h in Headers */,
     27278                                C2E38F021E84573500CA3ADF /* CSSFontStyleRangeValue.h in Headers */,
    2726627279                                5185FC971BB4C4E80012898F /* IDBKeyData.h in Headers */,
    2726727280                                5185FC991BB4C4E80012898F /* IDBKeyPath.h in Headers */,
     
    2940829421                                081093DC1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.h in Headers */,
    2940929422                                081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */,
     29423                                C2E38EFE1E8396FD00CA3ADF /* CSSFontStyleValue.h in Headers */,
    2941029424                                080E49261255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.h in Headers */,
    2941129425                                080E49281255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h in Headers */,
     
    3058630600                                94D4AC621DC24C8E0080F02D /* CSSCustomPropertyValue.cpp in Sources */,
    3058730601                                4A9CC81716BB9AC600EC645A /* CSSDefaultStyleSheets.cpp in Sources */,
     30602                                C2E38F011E84573500CA3ADF /* CSSFontStyleRangeValue.cpp in Sources */,
    3058830603                                94476BDA1DFCAC0300690E23 /* CSSDeferredParser.cpp in Sources */,
    3058930604                                FBB0C5B717BBD626003D3677 /* CSSFilterImageValue.cpp in Sources */,
     
    3311033125                                BC22747A0E8366E200E7F975 /* SVGRenderStyleDefs.cpp in Sources */,
    3311133126                                B2227AA20D00BF220071B782 /* SVGScriptElement.cpp in Sources */,
     33127                                C2E38EFD1E8396FD00CA3ADF /* CSSFontStyleValue.cpp in Sources */,
    3311233128                                B2227AA50D00BF220071B782 /* SVGSetElement.cpp in Sources */,
    3311333129                                E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */,
  • trunk/Source/WebCore/css/CSSAllInOne.cpp

    r212252 r214359  
    4747#include "CSSFontFeatureValue.cpp"
    4848#include "CSSFontSelector.cpp"
     49#include "CSSFontStyleValue.cpp"
    4950#include "CSSFontValue.cpp"
    5051#include "CSSFontVariationValue.cpp"
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r213567 r214359  
    3636#include "CSSCustomPropertyValue.h"
    3737#include "CSSFontFeatureValue.h"
     38#include "CSSFontStyleValue.h"
    3839#include "CSSFontValue.h"
    3940#include "CSSFontVariationValue.h"
     
    19301931}
    19311932
    1932 static Ref<CSSPrimitiveValue> fontStyleFromStyle(const RenderStyle& style)
    1933 {
    1934     auto italic = style.fontDescription().italic();
    1935     if (auto italicValue = fontStyleKeyword(italic))
    1936         return CSSValuePool::singleton().createIdentifierValue(italicValue.value());
    1937     return CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG);
     1933static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style)
     1934{
     1935    FontSelectionValue italic = style.fontDescription().italic();
     1936    if (italic == normalItalicValue())
     1937        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
     1938    if (italic == italicValue())
     1939        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueItalic));
     1940    return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
    19381941}
    19391942
     
    25512554
    25522555    if (auto italic = fontStyleKeyword(fontDescription.italic()))
    2553         computedFont->style = CSSValuePool::singleton().createIdentifierValue(italic.value());
     2556        computedFont->style = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(italic.value()));
    25542557    else
    25552558        return CSSFontValue::create();
  • trunk/Source/WebCore/css/CSSFontFace.cpp

    r213528 r214359  
    3232#include "CSSFontFeatureValue.h"
    3333#include "CSSFontSelector.h"
     34#include "CSSFontStyleRangeValue.h"
     35#include "CSSFontStyleValue.h"
    3436#include "CSSPrimitiveValueMappings.h"
    3537#include "CSSSegmentedFontFace.h"
     
    4446#include "RuntimeEnabledFeatures.h"
    4547#include "Settings.h"
     48#include "StyleBuilderConverter.h"
    4649#include "StyleProperties.h"
    4750#include "StyleRule.h"
     
    136139        auto& value0 = downcast<CSSPrimitiveValue>(*valueList.item(0));
    137140        auto& value1 = downcast<CSSPrimitiveValue>(*valueList.item(1));
    138         ASSERT(value0.isNumber());
    139         ASSERT(value1.isNumber());
    140         return { FontSelectionValue::clampFloat(value0.floatValue()), FontSelectionValue::clampFloat(value1.floatValue()) };
     141        auto result0 = StyleBuilderConverter::convertFontWeightFromValue(value0);
     142        auto result1 = StyleBuilderConverter::convertFontWeightFromValue(value1);
     143        return { result0, result1 };
    141144    }
    142145
    143146    ASSERT(is<CSSPrimitiveValue>(value));
    144147    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
    145 
    146     FontSelectionValue result;
    147     if (primitiveValue.isNumber()) {
    148         result = FontSelectionValue::clampFloat(primitiveValue.floatValue());
    149         return { result, result };
    150     }
    151 
    152     ASSERT(primitiveValue.isValueID());
    153     if (auto value = fontWeightValue(primitiveValue.valueID()))
    154         result = value.value();
    155     else {
    156         ASSERT_NOT_REACHED();
    157         result = normalWeightValue();
    158     }
    159 
     148    FontSelectionValue result = StyleBuilderConverter::convertFontWeightFromValue(primitiveValue);
    160149    return { result, result };
    161150}
     
    185174        auto& value0 = downcast<CSSPrimitiveValue>(*valueList.item(0));
    186175        auto& value1 = downcast<CSSPrimitiveValue>(*valueList.item(1));
    187         ASSERT(value0.isPercentage() || value0.isNumber());
    188         ASSERT(value1.isPercentage() || value1.isNumber());
    189         return { FontSelectionValue::clampFloat(value0.floatValue()), FontSelectionValue::clampFloat(value1.floatValue()) };
     176        auto result0 = StyleBuilderConverter::convertFontStretchFromValue(value0);
     177        auto result1 = StyleBuilderConverter::convertFontStretchFromValue(value1);
     178        return { result0, result1 };
    190179    }
    191180
    192181    ASSERT(is<CSSPrimitiveValue>(value));
    193182    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
    194 
    195     FontSelectionValue result;
    196     if (primitiveValue.isPercentage() || primitiveValue.isNumber()) {
    197         result = FontSelectionValue::clampFloat(primitiveValue.floatValue());
    198         return { result, result };
    199     }
    200 
    201     ASSERT(primitiveValue.isValueID());
    202     if (auto value = fontStretchValue(primitiveValue.valueID()))
    203         result = value.value();
    204     else {
    205         ASSERT_NOT_REACHED();
    206         result = normalStretchValue();
    207     }
    208 
     183    FontSelectionValue result = StyleBuilderConverter::convertFontStretchFromValue(primitiveValue);
    209184    return { result, result };
    210185}
     
    225200static FontSelectionRange calculateItalicRange(CSSValue& value)
    226201{
    227     if (value.isValueList()) {
    228         auto& valueList = downcast<CSSValueList>(value);
    229         ASSERT(valueList.length() == 2);
    230         if (valueList.length() != 2)
     202    if (value.isFontStyleValue()) {
     203        auto result = StyleBuilderConverter::convertFontStyleFromValue(value);
     204        return { result, result };
     205    }
     206
     207    ASSERT(value.isFontStyleRangeValue());
     208    auto& rangeValue = downcast<CSSFontStyleRangeValue>(value);
     209    ASSERT(rangeValue.fontStyleValue->isValueID());
     210    auto valueID = rangeValue.fontStyleValue->valueID();
     211    if (!rangeValue.obliqueValues) {
     212        if (valueID == CSSValueNormal)
    231213            return { normalItalicValue(), normalItalicValue() };
    232         ASSERT(valueList.item(0)->isPrimitiveValue());
    233         ASSERT(valueList.item(1)->isPrimitiveValue());
    234         auto& value0 = downcast<CSSPrimitiveValue>(*valueList.item(0));
    235         auto& value1 = downcast<CSSPrimitiveValue>(*valueList.item(1));
    236         ASSERT(value0.isAngle() || value0.isNumber() || value0.isCalculated());
    237         ASSERT(value1.isAngle() || value1.isNumber() || value1.isCalculated());
    238         return { FontSelectionValue::clampFloat(value0.floatValue(CSSPrimitiveValue::CSS_DEG)), FontSelectionValue::clampFloat(value1.floatValue(CSSPrimitiveValue::CSS_DEG)) };
    239     }
    240 
    241     ASSERT(is<CSSPrimitiveValue>(value));
    242     const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
    243 
    244     FontSelectionValue result;
    245     if (primitiveValue.isAngle() || primitiveValue.isNumber() || primitiveValue.isCalculated()) {
    246         result = FontSelectionValue::clampFloat(primitiveValue.floatValue(CSSPrimitiveValue::CSS_DEG));
     214        ASSERT(valueID == CSSValueItalic || valueID == CSSValueOblique);
     215        return { italicValue(), italicValue() };
     216    }
     217    ASSERT(valueID == CSSValueOblique);
     218    auto length = rangeValue.obliqueValues->length();
     219    if (length == 1) {
     220        auto& primitiveValue = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(0));
     221        FontSelectionValue result(primitiveValue.value<float>(CSSPrimitiveValue::CSS_DEG));
    247222        return { result, result };
    248223    }
    249 
    250     ASSERT(primitiveValue.isValueID());
    251     if (auto value = fontStyleValue(primitiveValue.valueID()))
    252         result = value.value();
    253     else {
    254         ASSERT_NOT_REACHED();
    255         result = normalItalicValue();
    256     }
    257     return { result, result };
     224    ASSERT(length == 2);
     225    auto& primitiveValue1 = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(0));
     226    auto& primitiveValue2 = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(1));
     227    FontSelectionValue result1(primitiveValue1.value<float>(CSSPrimitiveValue::CSS_DEG));
     228    FontSelectionValue result2(primitiveValue2.value<float>(CSSPrimitiveValue::CSS_DEG));
     229    return { result1, result2 };
    258230}
    259231
  • trunk/Source/WebCore/css/CSSFontFaceSet.cpp

    r213464 r214359  
    3030#include "CSSFontFamily.h"
    3131#include "CSSFontSelector.h"
     32#include "CSSFontStyleValue.h"
    3233#include "CSSParser.h"
    3334#include "CSSPrimitiveValue.h"
     
    3738#include "ExceptionCode.h"
    3839#include "FontCache.h"
     40#include "StyleBuilderConverter.h"
    3941#include "StyleProperties.h"
    4042
     
    287289}
    288290
    289 static std::optional<FontSelectionValue> calculateWeightValue(CSSValue& weight)
    290 {
    291     if (!is<CSSPrimitiveValue>(weight))
    292         return std::nullopt;
    293 
    294     auto& primitiveWeight = downcast<CSSPrimitiveValue>(weight);
    295     if (primitiveWeight.isNumber())
    296         return FontSelectionValue::clampFloat(primitiveWeight.floatValue());
    297 
    298     if (!primitiveWeight.isValueID())
    299         return std::nullopt;
    300 
    301     if (auto value = fontWeightValue(primitiveWeight.valueID()))
    302         return value.value();
    303     ASSERT_NOT_REACHED();
    304     return normalWeightValue();
    305 }
    306 
    307 static std::optional<FontSelectionValue> calculateStretchValue(CSSValue& style)
    308 {
    309     if (!is<CSSPrimitiveValue>(style))
    310         return std::nullopt;
    311 
    312     auto& primitiveStretch = downcast<CSSPrimitiveValue>(style);
    313     if (primitiveStretch.isNumber() || primitiveStretch.isPercentage())
    314         return FontSelectionValue::clampFloat(primitiveStretch.floatValue());
    315 
    316     if (!primitiveStretch.isValueID())
    317         return std::nullopt;
    318 
    319     if (auto value = fontStretchValue(primitiveStretch.valueID()))
    320         return value.value();
    321     return normalStretchValue();
    322 }
    323 
    324 static std::optional<FontSelectionValue> calculateStyleValue(CSSValue& style)
    325 {
    326     if (!is<CSSPrimitiveValue>(style))
    327         return std::nullopt;
    328 
    329     auto& primitiveSlant = downcast<CSSPrimitiveValue>(style);
    330     if (primitiveSlant.isNumber() || primitiveSlant.isAngle())
    331         return FontSelectionValue::clampFloat(primitiveSlant.floatValue());
    332 
    333     if (!primitiveSlant.isValueID())
    334         return std::nullopt;
    335 
    336     if (auto value = fontStyleValue(downcast<CSSPrimitiveValue>(style).valueID()))
    337         return value.value();
    338     return normalItalicValue();
    339 }
    340 
    341 static std::optional<FontSelectionRequest> computeFontSelectionRequest(MutableStyleProperties& style)
     291static FontSelectionRequest computeFontSelectionRequest(MutableStyleProperties& style)
    342292{
    343293    RefPtr<CSSValue> weightValue = style.getPropertyCSSValue(CSSPropertyFontWeight).get();
     
    345295        weightValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
    346296
    347     FontSelectionValue weightSelectionValue;
    348     if (auto weightOptional = calculateWeightValue(*weightValue))
    349         weightSelectionValue = weightOptional.value();
    350     else
    351         return std::nullopt;
    352 
    353297    RefPtr<CSSValue> stretchValue = style.getPropertyCSSValue(CSSPropertyFontStretch).get();
    354298    if (!stretchValue)
    355299        stretchValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
    356300
    357     FontSelectionValue stretchSelectionValue;
    358     if (auto stretchOptional = calculateStretchValue(*weightValue))
    359         stretchSelectionValue = stretchOptional.value();
    360     else
    361         return std::nullopt;
    362 
    363301    RefPtr<CSSValue> styleValue = style.getPropertyCSSValue(CSSPropertyFontStyle).get();
    364302    if (!styleValue)
    365         styleValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
    366 
    367     FontSelectionValue styleSelectionValue;
    368     if (auto styleOptional = calculateStyleValue(*styleValue))
    369         styleSelectionValue = styleOptional.value();
    370     else
    371         return std::nullopt;
    372 
    373     return {{ weightSelectionValue, stretchSelectionValue, styleSelectionValue }};
     303        styleValue = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
     304
     305    FontSelectionValue weightSelectionValue = StyleBuilderConverter::convertFontWeightFromValue(*weightValue);
     306    FontSelectionValue stretchSelectionValue = StyleBuilderConverter::convertFontStretchFromValue(*stretchValue);
     307    FontSelectionValue styleSelectionValue = StyleBuilderConverter::convertFontStyleFromValue(*styleValue);
     308
     309    return { weightSelectionValue, stretchSelectionValue, styleSelectionValue };
    374310}
    375311
     
    397333        return Exception { SYNTAX_ERR };
    398334
    399     FontSelectionRequest request;
    400     if (auto fontSelectionRequestOptional = computeFontSelectionRequest(style.get()))
    401         request = fontSelectionRequestOptional.value();
    402     else
    403         return Exception { SYNTAX_ERR };
     335    FontSelectionRequest request = computeFontSelectionRequest(style.get());
    404336
    405337    auto family = style->getPropertyCSSValue(CSSPropertyFontFamily);
  • trunk/Source/WebCore/css/CSSFontFaceSet.h

    r213464 r214359  
    5252    }
    5353    ~CSSFontFaceSet();
     54
     55    static FontSelectionValue convertFontWeightFromValue(const CSSValue&);
     56    static FontSelectionValue convertFontStretchFromValue(const CSSValue&);
     57    static FontSelectionValue convertFontStyleFromValue(const CSSValue&);
    5458
    5559    void addClient(CSSFontFaceSetClient&);
  • trunk/Source/WebCore/css/CSSFontSelector.cpp

    r213464 r214359  
    3434#include "CSSFontFamily.h"
    3535#include "CSSFontFeatureValue.h"
     36#include "CSSFontStyleRangeValue.h"
     37#include "CSSFontStyleValue.h"
    3638#include "CSSPrimitiveValue.h"
    3739#include "CSSPrimitiveValueMappings.h"
     
    164166
    165167    if (!fontStyle)
    166         fontStyle = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
     168        fontStyle = CSSFontStyleRangeValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
    167169
    168170    if (!fontWeight)
  • trunk/Source/WebCore/css/CSSFontValue.cpp

    r213267 r214359  
    2121#include "CSSFontValue.h"
    2222
     23#include "CSSFontStyleValue.h"
    2324#include "CSSPrimitiveValue.h"
    2425#include "CSSValueList.h"
     
    4546        result.append(weight->cssText());
    4647    }
    47     if (weight) {
     48    if (stretch) {
    4849        if (!result.isEmpty())
    4950            result.append(' ');
  • trunk/Source/WebCore/css/CSSFontValue.h

    r213267 r214359  
    2121#pragma once
    2222
     23#include "CSSFontStyleValue.h"
    2324#include "CSSValue.h"
    2425#include <wtf/RefPtr.h>
     
    4041    bool equals(const CSSFontValue&) const;
    4142
    42     RefPtr<CSSPrimitiveValue> style;
     43    RefPtr<CSSFontStyleValue> style;
    4344    RefPtr<CSSPrimitiveValue> variant;
    4445    RefPtr<CSSPrimitiveValue> weight;
  • trunk/Source/WebCore/css/CSSValue.cpp

    r212629 r214359  
    4242#include "CSSFontFaceSrcValue.h"
    4343#include "CSSFontFeatureValue.h"
     44#include "CSSFontStyleRangeValue.h"
     45#include "CSSFontStyleValue.h"
    4446#include "CSSFontValue.h"
    4547#include "CSSFontVariationValue.h"
     
    207209        case PendingSubstitutionValueClass:
    208210            return compareCSSValues<CSSPendingSubstitutionValue>(*this, other);
     211        case FontStyleClass:
     212            return compareCSSValues<CSSFontStyleValue>(*this, other);
     213        case FontStyleRangeClass:
     214            return compareCSSValues<CSSFontStyleRangeValue>(*this, other);
    209215        default:
    210216            ASSERT_NOT_REACHED();
     
    303309    case PendingSubstitutionValueClass:
    304310        return downcast<CSSPendingSubstitutionValue>(*this).customCSSText();
     311    case FontStyleClass:
     312        return downcast<CSSFontStyleValue>(*this).customCSSText();
     313    case FontStyleRangeClass:
     314        return downcast<CSSFontStyleRangeValue>(*this).customCSSText();
    305315    }
    306316
     
    432442    case PendingSubstitutionValueClass:
    433443        delete downcast<CSSPendingSubstitutionValue>(this);
     444        return;
     445    case FontStyleClass:
     446        delete downcast<CSSFontStyleValue>(this);
     447        return;
     448    case FontStyleRangeClass:
     449        delete downcast<CSSFontStyleRangeValue>(this);
    434450        return;
    435451    }
  • trunk/Source/WebCore/css/CSSValue.h

    r212629 r214359  
    8080    bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; }
    8181    bool isFontValue() const { return m_classType == FontClass; }
     82    bool isFontStyleValue() const { return m_classType == FontStyleClass; }
     83    bool isFontStyleRangeValue() const { return m_classType == FontStyleRangeClass; }
    8284    bool isImageGeneratorValue() const { return m_classType >= CanvasClass && m_classType <= RadialGradientClass; }
    8385    bool isGradientValue() const { return m_classType >= LinearGradientClass && m_classType <= RadialGradientClass; }
     
    156158#endif
    157159        FontClass,
     160        FontStyleClass,
     161        FontStyleRangeClass,
    158162        FontFaceSrcClass,
    159163        FunctionClass,
  • trunk/Source/WebCore/css/FontFace.cpp

    r213464 r214359  
    306306    }
    307307
    308     return String::format("oblique %fdeg-%fdeg", static_cast<float>(style.minimum), static_cast<float>(style.maximum));
     308    return String::format("oblique %fdeg %fdeg", static_cast<float>(style.minimum), static_cast<float>(style.maximum));
    309309}
    310310
     
    329329    }
    330330
    331     return String::format("%f-%f", static_cast<float>(weight.minimum), static_cast<float>(weight.maximum));
     331    return String::format("%f %f", static_cast<float>(weight.minimum), static_cast<float>(weight.maximum));
    332332}
    333333
     
    366366    }
    367367
    368     return String::format("%f%%-%f%%", static_cast<float>(stretch.minimum), static_cast<float>(stretch.maximum));
     368    return String::format("%f%% %f%%", static_cast<float>(stretch.minimum), static_cast<float>(stretch.maximum));
    369369}
    370370
  • trunk/Source/WebCore/css/StyleBuilderConverter.h

    r213831 r214359  
    3131#include "CSSContentDistributionValue.h"
    3232#include "CSSFontFeatureValue.h"
     33#include "CSSFontStyleValue.h"
    3334#include "CSSFontVariationValue.h"
    3435#include "CSSFunctionValue.h"
     
    4041#include "CSSImageValue.h"
    4142#include "CSSPrimitiveValue.h"
     43#include "CSSPrimitiveValueMappings.h"
    4244#include "CSSReflectValue.h"
    4345#include "FontSelectionValueInlines.h"
     
    116118#endif
    117119    static FontFeatureSettings convertFontFeatureSettings(StyleResolver&, const CSSValue&);
     120    static FontSelectionValue convertFontWeightFromValue(const CSSValue&);
     121    static FontSelectionValue convertFontStretchFromValue(const CSSValue&);
     122    static FontSelectionValue convertFontStyleFromValue(const CSSValue&);
    118123    static FontSelectionValue convertFontWeight(StyleResolver&, const CSSValue&);
    119124    static FontSelectionValue convertFontStretch(StyleResolver&, const CSSValue&);
     
    11611166}
    11621167
    1163 inline FontSelectionValue StyleBuilderConverter::convertFontWeight(StyleResolver& styleResolver, const CSSValue& value)
     1168inline FontSelectionValue StyleBuilderConverter::convertFontWeightFromValue(const CSSValue& value)
    11641169{
    11651170    ASSERT(is<CSSPrimitiveValue>(value));
     
    11741179        return normalWeightValue();
    11751180    case CSSValueBold:
     1181    case CSSValueBolder:
    11761182        return boldWeightValue();
    1177     case CSSValueBolder:
    1178         return FontCascadeDescription::bolderWeight(styleResolver.parentStyle()->fontDescription().weight());
    11791183    case CSSValueLighter:
    1180         return FontCascadeDescription::lighterWeight(styleResolver.parentStyle()->fontDescription().weight());
     1184        return lightWeightValue();
    11811185    default:
    11821186        ASSERT_NOT_REACHED();
     
    11851189}
    11861190
    1187 inline FontSelectionValue StyleBuilderConverter::convertFontStretch(StyleResolver&, const CSSValue& value)
     1191inline FontSelectionValue StyleBuilderConverter::convertFontStretchFromValue(const CSSValue& value)
    11881192{
    11891193    ASSERT(is<CSSPrimitiveValue>(value));
     
    12001204}
    12011205
     1206inline FontSelectionValue StyleBuilderConverter::convertFontStyleFromValue(const CSSValue& value)
     1207{
     1208    ASSERT(is<CSSFontStyleValue>(value));
     1209    const auto& fontStyleValue = downcast<CSSFontStyleValue>(value);
     1210
     1211    auto valueID = fontStyleValue.fontStyleValue->valueID();
     1212    if (valueID == CSSValueNormal)
     1213        return normalItalicValue();
     1214    if (valueID == CSSValueItalic)
     1215        return italicValue();
     1216    ASSERT(valueID == CSSValueOblique);
     1217    if (auto* obliqueValue = fontStyleValue.obliqueValue.get())
     1218        return FontSelectionValue(obliqueValue->value<float>(CSSPrimitiveValue::CSS_DEG));
     1219    return italicValue();
     1220}
     1221
     1222inline FontSelectionValue StyleBuilderConverter::convertFontWeight(StyleResolver& styleResolver, const CSSValue& value)
     1223{
     1224    ASSERT(is<CSSPrimitiveValue>(value));
     1225    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     1226    if (primitiveValue.isValueID()) {
     1227        auto valueID = primitiveValue.valueID();
     1228        if (valueID == CSSValueBolder)
     1229            return FontCascadeDescription::bolderWeight(styleResolver.parentStyle()->fontDescription().weight());
     1230        if (valueID == CSSValueLighter)
     1231            return FontCascadeDescription::lighterWeight(styleResolver.parentStyle()->fontDescription().weight());
     1232    }
     1233    return convertFontWeightFromValue(value);
     1234}
     1235
     1236inline FontSelectionValue StyleBuilderConverter::convertFontStretch(StyleResolver&, const CSSValue& value)
     1237{
     1238    return convertFontStretchFromValue(value);
     1239}
     1240
    12021241inline FontSelectionValue StyleBuilderConverter::convertFontStyle(StyleResolver&, const CSSValue& value)
    12031242{
    1204     ASSERT(is<CSSPrimitiveValue>(value));
    1205     const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
    1206 
    1207     if (primitiveValue.isAngle() || primitiveValue.isNumber() || primitiveValue.isCalculated())
    1208         return FontSelectionValue::clampFloat(primitiveValue.floatValue(CSSPrimitiveValue::CSS_DEG));
    1209 
    1210     ASSERT(primitiveValue.isValueID());
    1211     if (auto value = fontStyleValue(primitiveValue.valueID()))
    1212         return value.value();
    1213     ASSERT_NOT_REACHED();
    1214     return normalItalicValue();
     1243    return convertFontStyleFromValue(value);
    12151244}
    12161245
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r214324 r214359  
    4646#include "CSSFontVariationValue.h"
    4747#endif
     48#include "CSSFontStyleRangeValue.h"
     49#include "CSSFontStyleValue.h"
    4850#include "CSSFunctionValue.h"
    4951#include "CSSGridAutoRepeatValue.h"
     
    961963}
    962964
    963 static RefPtr<CSSPrimitiveValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode)
    964 {
    965     if (auto result = consumeFontStyleKeywordValue(range)) {
    966         if (result->valueID() == CSSValueOblique) {
    967             if (range.atEnd())
    968                 return result;
    969             if (auto angle = consumeAngle(range, cssParserMode))
    970                 return angle;
    971             if (auto number = consumeNumber(range, ValueRangeAll))
    972                 return number;
    973         }
    974         return result;
    975     }
    976     return nullptr;
     965static RefPtr<CSSFontStyleValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode)
     966{
     967    auto result = consumeFontStyleKeywordValue(range);
     968    if (!result)
     969        return nullptr;
     970
     971    if (result->valueID() == CSSValueNormal)
     972        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
     973    if (result->valueID() == CSSValueItalic)
     974        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueItalic));
     975    ASSERT(result->valueID() == CSSValueOblique);
     976    if (range.atEnd())
     977        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
     978    if (auto angle = consumeAngle(range, cssParserMode))
     979        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle));
     980    if (auto number = consumeNumber(range, ValueRangeAll))
     981        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(number->value<double>(), CSSPrimitiveValue::CSS_DEG));
     982    return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
    977983}
    978984
    979985#if ENABLE(VARIATION_FONTS)
    980 static RefPtr<CSSValue> consumeFontStyleRange(CSSParserTokenRange& range, CSSParserMode cssParserMode)
    981 {
    982     if (auto result = consumeFontStyleKeywordValue(range)) {
    983         if (result->valueID() == CSSValueOblique) {
    984             if (range.atEnd())
    985                 return result;
    986 
    987             if (auto firstAngle = consumeAngle(range, cssParserMode)) {
    988                 if (range.atEnd())
    989                     return firstAngle;
    990                 if (!consumeSlashIncludingWhitespace(range))
    991                     return nullptr;
    992                 auto secondAngle = consumeAngle(range, cssParserMode);
    993                 if (!secondAngle)
    994                     return nullptr;
    995                 if (firstAngle->floatValue(CSSPrimitiveValue::CSS_DEG) > secondAngle->floatValue(CSSPrimitiveValue::CSS_DEG))
    996                     return nullptr;
    997                 auto result = CSSValueList::createSlashSeparated();
    998                 result->append(firstAngle.releaseNonNull());
    999                 result->append(secondAngle.releaseNonNull());
    1000                 return RefPtr<CSSValue>(WTFMove(result));
    1001             }
    1002 
    1003             if (auto firstNumber = consumeNumber(range, ValueRangeAll)) {
    1004                 if (range.atEnd())
    1005                     return firstNumber;
    1006                 if (!consumeSlashIncludingWhitespace(range))
    1007                     return nullptr;
    1008                 auto secondNumber = consumeNumber(range, ValueRangeAll);
    1009                 if (!secondNumber)
    1010                     return nullptr;
    1011                 if (firstNumber->floatValue() > secondNumber->floatValue())
    1012                     return nullptr;
    1013                 auto result = CSSValueList::createSlashSeparated();
    1014                 result->append(firstNumber.releaseNonNull());
    1015                 result->append(secondNumber.releaseNonNull());
    1016                 return RefPtr<CSSValue>(WTFMove(result));
    1017             }
    1018 
    1019             return nullptr;
    1020         }
    1021         return result;
    1022     }
     986static RefPtr<CSSFontStyleRangeValue> consumeFontStyleRange(CSSParserTokenRange& range, CSSParserMode cssParserMode)
     987{
     988    auto keyword = consumeFontStyleKeywordValue(range);
     989    if (!keyword)
     990        return nullptr;
     991
     992    if (keyword->valueID() != CSSValueOblique || range.atEnd())
     993        return CSSFontStyleRangeValue::create(keyword.releaseNonNull());
     994
     995    if (auto firstAngle = consumeAngle(range, cssParserMode)) {
     996        if (range.atEnd()) {
     997            auto result = CSSValueList::createSpaceSeparated();
     998            result->append(firstAngle.releaseNonNull());
     999            return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
     1000        }
     1001        auto secondAngle = consumeAngle(range, cssParserMode);
     1002        if (!secondAngle)
     1003            return nullptr;
     1004        if (firstAngle->floatValue(CSSPrimitiveValue::CSS_DEG) > secondAngle->floatValue(CSSPrimitiveValue::CSS_DEG))
     1005            return nullptr;
     1006        auto result = CSSValueList::createSpaceSeparated();
     1007        result->append(firstAngle.releaseNonNull());
     1008        result->append(secondAngle.releaseNonNull());
     1009        return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
     1010    }
     1011
     1012    if (auto firstNumber = consumeNumber(range, ValueRangeAll)) {
     1013        if (range.atEnd()) {
     1014            auto result = CSSValueList::createSpaceSeparated();
     1015            result->append(firstNumber.releaseNonNull());
     1016            return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
     1017        }
     1018        auto secondNumber = consumeNumber(range, ValueRangeAll);
     1019        if (!secondNumber)
     1020            return nullptr;
     1021        if (firstNumber->floatValue() > secondNumber->floatValue())
     1022            return nullptr;
     1023        auto result = CSSValueList::createSpaceSeparated();
     1024        result->append(CSSValuePool::singleton().createValue(firstNumber->value<double>(), CSSPrimitiveValue::CSS_DEG));
     1025        result->append(CSSValuePool::singleton().createValue(secondNumber->value<double>(), CSSPrimitiveValue::CSS_DEG));
     1026        return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
     1027    }
     1028
    10231029    return nullptr;
    10241030}
     
    43864392        return false;
    43874393   
    4388     addProperty(CSSPropertyFontStyle, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(isItalic(fontDescription.italic()) ? CSSValueItalic : CSSValueNormal), important);
     4394    addProperty(CSSPropertyFontStyle, CSSPropertyFont, CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(isItalic(fontDescription.italic()) ? CSSValueItalic : CSSValueNormal)), important);
    43894395    addProperty(CSSPropertyFontWeight, CSSPropertyFont, CSSValuePool::singleton().createValue(static_cast<float>(fontDescription.weight())), important);
    43904396    addProperty(CSSPropertyFontSize, CSSPropertyFont, CSSValuePool::singleton().createValue(fontDescription.specifiedSize(), CSSPrimitiveValue::CSS_PX), important);
     
    44104416    }
    44114417    // Optional font-style, font-variant, font-stretch and font-weight.
    4412     RefPtr<CSSPrimitiveValue> fontStyle;
     4418    RefPtr<CSSFontStyleValue> fontStyle;
    44134419    RefPtr<CSSPrimitiveValue> fontVariantCaps;
    44144420    RefPtr<CSSPrimitiveValue> fontWeight;
     
    44494455    bool hasWeight = fontWeight;
    44504456    bool hasStretch = fontStretch;
    4451    
    4452     addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? fontStyle.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !hasStyle);
     4457
     4458    if (!fontStyle)
     4459        fontStyle = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
     4460   
     4461    addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle.releaseNonNull(), important, !hasStyle);
    44534462    addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? fontVariantCaps.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !hasVariant);
    44544463/* 
     
    44734482            return false;
    44744483        addProperty(CSSPropertyLineHeight, CSSPropertyFont, lineHeight.releaseNonNull(), important);
    4475     } else {
     4484    } else
    44764485        addProperty(CSSPropertyLineHeight, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, true);
    4477     }
    44784486
    44794487    // Font family must come now.
  • trunk/Source/WebCore/editing/EditingStyle.cpp

    r213464 r214359  
    3030#include "ApplyStyleCommand.h"
    3131#include "CSSComputedStyleDeclaration.h"
     32#include "CSSFontStyleValue.h"
    3233#include "CSSParser.h"
    3334#include "CSSRuleList.h"
     
    143144{
    144145    RefPtr<CSSValue> value = extractPropertyValue(style, propertyID);
     146    if (propertyID == CSSPropertyFontStyle && is<CSSFontStyleValue>(value.get()) && downcast<CSSFontStyleValue>(value.get())->isItalic())
     147        return CSSValueItalic;
    145148    if (!is<CSSPrimitiveValue>(value.get()))
    146149        return 0;
  • trunk/Source/WebCore/svg/SVGFontFaceElement.cpp

    r211591 r214359  
    6666    CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name);
    6767    if (propId > 0) {
     68        // FIXME: Parse using the @font-face descriptor grammars, not the property grammars.
    6869        m_fontFaceRule->mutableProperties().setProperty(propId, value, false);
    6970        rebuildFontFace();
Note: See TracChangeset for help on using the changeset viewer.