Changeset 283561 in webkit


Ignore:
Timestamp:
Oct 5, 2021 11:19:17 AM (10 months ago)
Author:
commit-queue@webkit.org
Message:

radial-gradient does not accept calc values that combine length and percent
https://bugs.webkit.org/show_bug.cgi?id=230388

Patch by Nikos Mouchtaris <Nikos Mouchtaris> on 2021-10-05
Reviewed by Simon Fraser.

Source/WebCore:

Removed outdated check that disallowed combined percentage and length expressions.
Added code to calculate radius for combined percentage and length expressions.

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumeRadialGradient):

LayoutTests:

  • css3/calc/css3-radial-gradients-expected.html:
  • css3/calc/css3-radial-gradients.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r283558 r283561  
     12021-10-05  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        radial-gradient does not accept calc values that combine length and percent
     4        https://bugs.webkit.org/show_bug.cgi?id=230388
     5
     6        Reviewed by Simon Fraser.
     7
     8        * css3/calc/css3-radial-gradients-expected.html:
     9        * css3/calc/css3-radial-gradients.html:
     10
    1112021-10-05  Ayumi Kojima  <ayumi_kojima@apple.com>
    212
  • trunk/LayoutTests/css3/calc/css3-radial-gradients-expected.html

    r110934 r283561  
    4848    background-image: -moz-radial-gradient(circle closest-side, red, green 40px, blue);
    4949}
     50   
     51.gradient9 {
     52    background-image: radial-gradient(50px 70px, #f0f, #fff);
     53}
     54   
     55.gradient10 {
     56    background-image: radial-gradient(50px 60px, #f0f, #fff);
     57}
     58
    5059</style>
    5160<body>
     
    6069    <div class="gradient7 box"></div>
    6170    <div class="gradient8 box"></div>
     71    <div class="gradient9 box"></div>
     72    <div class="gradient10 box"></div>
    6273</body>
  • trunk/LayoutTests/css3/calc/css3-radial-gradients.html

    r140300 r283561  
    4848    background-image: -moz-radial-gradient(circle closest-side, red, green -moz-calc(50% + 10px), blue);
    4949}
     50   
     51.gradient9 {
     52    background-image: radial-gradient(50px calc(50% + 10px), #f0f, #fff);
     53}
     54   
     55.gradient10 {
     56    background-image: radial-gradient(50px 50%, #f0f, #fff);
     57}
    5058</style>
    5159<body>
     
    6068    <div class="gradient7 box"></div>
    6169    <div class="gradient8 box"></div>
     70    <div class="gradient9 box"></div>
     71    <div class="gradient10 box"></div>
    6272</body>
  • trunk/Source/WebCore/ChangeLog

    r283560 r283561  
     12021-10-05  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        radial-gradient does not accept calc values that combine length and percent
     4        https://bugs.webkit.org/show_bug.cgi?id=230388
     5
     6        Reviewed by Simon Fraser.
     7
     8        Removed outdated check that disallowed combined percentage and length expressions.
     9        Added code to calculate radius for combined percentage and length expressions.
     10
     11        * css/parser/CSSPropertyParserHelpers.cpp:
     12        (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
     13
    1142021-10-05  Tim Horton  <timothy_horton@apple.com>
    215
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r282755 r283561  
    978978    else if (widthOrHeight && radius.isPercentage())
    979979        result = *widthOrHeight * radius.floatValue() / 100;
     980    else if (widthOrHeight && radius.isCalculatedPercentageWithLength()) {
     981        auto expression = radius.cssCalcValue()->createCalculationValue(conversionData);
     982        result = expression->evaluate(*widthOrHeight);
     983    }
    980984    else
    981985        result = radius.computeLength<float>(conversionData);
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r283537 r283561  
    31053105    // If there's only one size, it must be a length.
    31063106    if (!verticalSize && horizontalSize && horizontalSize->isPercentage())
    3107         return nullptr;
    3108     if ((horizontalSize && horizontalSize->isCalculatedPercentageWithLength())
    3109         || (verticalSize && verticalSize->isCalculatedPercentageWithLength()))
    31103107        return nullptr;
    31113108
Note: See TracChangeset for help on using the changeset viewer.