⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287638 in webkit


Ignore:
Timestamp:
Jan 5, 2022, 11:19:25 AM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r285827. rdar://problem/85917218

Revert r285235
​https://bugs.webkit.org/show_bug.cgi?id=233142

Unreviewed.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:

Source/WebCore:

Causes crash with simple repro

<div id=t style="border-radius: unset"></div>
<script>
t.style.borderRadius;
</script>

  • css/StyleProperties.cpp: (WebCore::StyleProperties::getPropertyValue const): (WebCore::StyleProperties::borderRadiusValue const): Deleted.
  • css/StyleProperties.h:

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@285827 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-613.1.12.1-branch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613.1.12.1-branch/LayoutTests/imported/w3c/ChangeLog

    r286940 r287638  
     12022-01-05  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r285827. rdar://problem/85917218
     4
     5    Revert r285235
     6    https://bugs.webkit.org/show_bug.cgi?id=233142
     7   
     8    Unreviewed.
     9   
     10    LayoutTests/imported/w3c:
     11   
     12    * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:
     13   
     14    Source/WebCore:
     15   
     16    Causes crash with simple repro
     17   
     18    <div id=t style="border-radius: unset"></div>
     19    <script>
     20    t.style.borderRadius;
     21    </script>
     22   
     23    * css/StyleProperties.cpp:
     24    (WebCore::StyleProperties::getPropertyValue const):
     25    (WebCore::StyleProperties::borderRadiusValue const): Deleted.
     26    * css/StyleProperties.h:
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2021-11-15  Antti Koivisto  <antti@apple.com>
     31
     32            Revert r285235
     33            https://bugs.webkit.org/show_bug.cgi?id=233142
     34
     35            Unreviewed.
     36
     37            * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:
     38
    1392021-12-13  Youenn Fablet  <youenn@apple.com>
    240
  • branches/safari-613.1.12.1-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt

    r285915 r287638  
    88PASS e.style['border-radius'] = "1px 2% 3px" should set the property value
    99PASS e.style['border-radius'] = "1px 2% 3px 4%" should set the property value
    10 PASS e.style['border-radius'] = "1px / 2px" should set the property value
    11 PASS e.style['border-radius'] = "5em / 1px 2% 3px 4%" should set the property value
    12 PASS e.style['border-radius'] = "1px 2% / 3px 4px" should set the property value
    13 PASS e.style['border-radius'] = "1px 2px 3em / 1px 2px 3%" should set the property value
    14 PASS e.style['border-radius'] = "1px 2% / 2px 3em 4px 5em" should set the property value
    15 PASS e.style['border-radius'] = "1px 2% 3px 4% / 5em" should set the property value
    16 PASS e.style['border-radius'] = "1px 1px 1px 2% / 1px 2% 1px 2%" should set the property value
    17 PASS e.style['border-radius'] = "1px 1px 1px 1px / 1px 1px 2% 1px" should set the property value
     10FAIL e.style['border-radius'] = "1px / 2px" should set the property value assert_equals: serialization should be canonical expected "1px / 2px" but got "1px 2px"
     11FAIL e.style['border-radius'] = "5em / 1px 2% 3px 4%" should set the property value assert_equals: serialization should be canonical expected "5em / 1px 2% 3px 4%" but got "5em 1px 5em 2% 5em 3px 5em 4%"
     12FAIL e.style['border-radius'] = "1px 2% / 3px 4px" should set the property value assert_equals: serialization should be canonical expected "1px 2% / 3px 4px" but got "1px 3px 2% 4px"
     13FAIL e.style['border-radius'] = "1px 2px 3em / 1px 2px 3%" should set the property value assert_equals: serialization should be canonical expected "1px 2px 3em / 1px 2px 3%" but got "1px 2px 3em 3%"
     14FAIL e.style['border-radius'] = "1px 2% / 2px 3em 4px 5em" should set the property value assert_equals: serialization should be canonical expected "1px 2% / 2px 3em 4px 5em" but got "1px 2px 2% 3em 1px 4px 2% 5em"
     15FAIL e.style['border-radius'] = "1px 2% 3px 4% / 5em" should set the property value assert_equals: serialization should be canonical expected "1px 2% 3px 4% / 5em" but got "1px 5em 2% 5em 3px 5em 4% 5em"
     16FAIL e.style['border-radius'] = "1px 1px 1px 2% / 1px 2% 1px 2%" should set the property value assert_equals: serialization should be canonical expected "1px 1px 1px 2% / 1px 2%" but got "1px 1px 2% 1px 2%"
     17FAIL e.style['border-radius'] = "1px 1px 1px 1px / 1px 1px 2% 1px" should set the property value assert_equals: serialization should be canonical expected "1px / 1px 1px 2%" but got "1px 1px 1px 2%"
    1818PASS e.style['border-radius'] = "1px 1px 2% 2%" should set the property value
    1919PASS e.style['border-radius'] = "1px 2% 1px 1px" should set the property value
    20 PASS e.style['border-radius'] = "1px 2% 2% 2% / 1px 2% 3px 2%" should set the property value
     20FAIL e.style['border-radius'] = "1px 2% 2% 2% / 1px 2% 3px 2%" should set the property value assert_equals: serialization should be canonical expected "1px 2% 2% / 1px 2% 3px" but got "1px 2% 2% 3px"
    2121PASS e.style['border-top-left-radius'] = "10px" should set the property value
    2222PASS e.style['border-top-right-radius'] = "20%" should set the property value
  • branches/safari-613.1.12.1-branch/Source/WebCore/ChangeLog

    r287576 r287638  
     12022-01-05  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r285827. rdar://problem/85917218
     4
     5    Revert r285235
     6    https://bugs.webkit.org/show_bug.cgi?id=233142
     7   
     8    Unreviewed.
     9   
     10    LayoutTests/imported/w3c:
     11   
     12    * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:
     13   
     14    Source/WebCore:
     15   
     16    Causes crash with simple repro
     17   
     18    <div id=t style="border-radius: unset"></div>
     19    <script>
     20    t.style.borderRadius;
     21    </script>
     22   
     23    * css/StyleProperties.cpp:
     24    (WebCore::StyleProperties::getPropertyValue const):
     25    (WebCore::StyleProperties::borderRadiusValue const): Deleted.
     26    * css/StyleProperties.h:
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2021-11-15  Antti Koivisto  <antti@apple.com>
     31
     32            Revert r285235
     33            https://bugs.webkit.org/show_bug.cgi?id=233142
     34
     35            Unreviewed.
     36
     37            Causes crash with simple repro
     38
     39            <div id=t style="border-radius: unset"></div>
     40            <script>
     41            t.style.borderRadius;
     42            </script>
     43
     44            * css/StyleProperties.cpp:
     45            (WebCore::StyleProperties::getPropertyValue const):
     46            (WebCore::StyleProperties::borderRadiusValue const): Deleted.
     47            * css/StyleProperties.h:
     48
    1492022-01-04  Alan Coon  <alancoon@apple.com>
    250
  • branches/safari-613.1.12.1-branch/Source/WebCore/css/StyleProperties.cpp

    r286795 r287638  
    3636#include "Color.h"
    3737#include "Document.h"
    38 #include "Pair.h"
    3938#include "PropertySetCSSStyleDeclaration.h"
    4039#include "StylePropertyShorthand.h"
    … …  
    324323        return String();
    325324    case CSSPropertyBorderRadius:
    326         return borderRadiusValue(borderRadiusShorthand());
     325        return get4Values(borderRadiusShorthand());
    327326    case CSSPropertyGap:
    328327        return get2Values(gapShorthand());
    … …  
    366365        return value->cssText();
    367366    return String();
    368 }
    369 
    370 String StyleProperties::borderRadiusValue(const StylePropertyShorthand& shorthand) const
    371 {
    372     auto serialize = [](const CSSValue* topLeft, const CSSValue* topRight, const CSSValue* bottomRight, const CSSValue* bottomLeft) -> String {
    373         bool showBottomLeft = !(*topRight == *bottomLeft);
    374         bool showBottomRight = !(*topLeft == *bottomRight) || showBottomLeft;
    375         bool showTopRight = !(*topLeft == *topRight) || showBottomRight;
    376 
    377         return makeString(topLeft->cssText(), showTopRight ? " " : "", showTopRight ? topRight->cssText() : "", showBottomRight ? " " : "", showBottomRight ? bottomRight->cssText() : "", showBottomLeft ? " " : "", showBottomLeft ? bottomLeft->cssText() : "");
    378     };
    379 
    380     int topLeftValueIndex = findPropertyIndex(shorthand.properties()[0]);
    381     int topRightValueIndex = findPropertyIndex(shorthand.properties()[1]);
    382     int bottomRightValueIndex = findPropertyIndex(shorthand.properties()[2]);
    383     int bottomLeftValueIndex = findPropertyIndex(shorthand.properties()[3]);
    384 
    385     if (topLeftValueIndex == -1 || topRightValueIndex == -1 || bottomRightValueIndex == -1 || bottomLeftValueIndex == -1)
    386         return String();
    387 
    388     PropertyReference topLeft = propertyAt(topLeftValueIndex);
    389     PropertyReference topRight = propertyAt(topRightValueIndex);
    390     PropertyReference bottomRight = propertyAt(bottomRightValueIndex);
    391     PropertyReference bottomLeft = propertyAt(bottomLeftValueIndex);
    392 
    393     auto* topLeftValue = topLeft.value();
    394     if (!topLeftValue)
    395         return String();
    396     if (topLeftValue->isCSSWideKeyword())
    397         return topLeftValue->cssText();
    398 
    399     auto* topRightValue = topRight.value();
    400     auto* bottomRightValue = bottomRight.value();
    401     auto* bottomLeftValue = bottomLeft.value();
    402 
    403     // All 4 properties must be specified and the remaining ones other than topLeftValue are checked here.
    404     if (!topRightValue || !bottomRightValue || !bottomLeftValue)
    405         return String();
    406 
    407     // Important flags must be the same
    408     bool isImportant = topLeft.isImportant();
    409     if (topRight.isImportant() != isImportant || bottomRight.isImportant() != isImportant || bottomLeft.isImportant() != isImportant)
    410         return String();
    411 
    412     auto& topLeftPair = *downcast<CSSPrimitiveValue>(*topLeftValue).pairValue();
    413     auto& topRightPair = *downcast<CSSPrimitiveValue>(*topRightValue).pairValue();
    414     auto& bottomRightPair = *downcast<CSSPrimitiveValue>(*bottomRightValue).pairValue();
    415     auto& bottomLeftPair = *downcast<CSSPrimitiveValue>(*bottomLeftValue).pairValue();
    416 
    417     auto first = serialize(topLeftPair.first(), topRightPair.first(), bottomRightPair.first(), bottomLeftPair.first());
    418     auto second = serialize(topLeftPair.second(), topRightPair.second(), bottomRightPair.second(), bottomLeftPair.second());
    419     if (first == second)
    420         return first;
    421 
    422     return makeString(first, " / ", second);
    423367}
    424368
  • branches/safari-613.1.12.1-branch/Source/WebCore/css/StyleProperties.h

    r285915 r287638  
    171171    String get2Values(const StylePropertyShorthand&) const;
    172172    String get4Values(const StylePropertyShorthand&) const;
    173     String borderRadiusValue(const StylePropertyShorthand&) const;
    174173    String borderSpacingValue(const StylePropertyShorthand&) const;
    175174    String fontValue() const;
Note: See TracChangeset for help on using the changeset viewer.