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

Changeset 285840 in webkit


Ignore:
Timestamp:
Nov 15, 2021, 4:25:05 PM (5 years ago)
Author:
Russell Epstein
Message:

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

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.9-branch
Files:
5 edited

Legend:

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

    r285745 r285840  
     12021-11-15  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r285827. rdar://problem/85391118
     4
     5    Revert r285235
     6    https://bugs.webkit.org/show_bug.cgi?id=233142
     7   
     8    Unreviewed.
     9   
     10    LayoutTests/imported/w3c:
     11   
     12   
     13    * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:
     14   
     15    Source/WebCore:
     16   
     17    Causes crash with simple repro
     18   
     19    <div id=t style="border-radius: unset"></div>
     20    <script>
     21    t.style.borderRadius;
     22    </script>
     23   
     24   
     25    * css/StyleProperties.cpp:
     26    (WebCore::StyleProperties::getPropertyValue const):
     27    (WebCore::StyleProperties::borderRadiusValue const): Deleted.
     28    * css/StyleProperties.h:
     29   
     30   
     31    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     32
     33    2021-11-15  Antti Koivisto  <antti@apple.com>
     34
     35            Revert r285235
     36            https://bugs.webkit.org/show_bug.cgi?id=233142
     37
     38            Unreviewed.
     39
     40            * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt:
     41
    1422021-11-12  Ryan Haddad  <ryanhaddad@apple.com>
    243
  • branches/safari-613.1.9-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt

    r285235 r285840  
    44PASS e.style['border-radius'] = "1px 2% 3px" should set the property value
    55PASS e.style['border-radius'] = "1px 2% 3px 4%" should set the property value
    6 PASS e.style['border-radius'] = "1px / 2px" should set the property value
    7 PASS e.style['border-radius'] = "5em / 1px 2% 3px 4%" should set the property value
    8 PASS e.style['border-radius'] = "1px 2% / 3px 4px" should set the property value
    9 PASS e.style['border-radius'] = "1px 2px 3em / 1px 2px 3%" should set the property value
    10 PASS e.style['border-radius'] = "1px 2% / 2px 3em 4px 5em" should set the property value
    11 PASS e.style['border-radius'] = "1px 2% 3px 4% / 5em" should set the property value
    12 PASS e.style['border-radius'] = "1px 1px 1px 2% / 1px 2% 1px 2%" should set the property value
    13 PASS e.style['border-radius'] = "1px 1px 1px 1px / 1px 1px 2% 1px" should set the property value
     6FAIL e.style['border-radius'] = "1px / 2px" should set the property value assert_equals: serialization should be canonical expected "1px / 2px" but got "1px 2px"
     7FAIL 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%"
     8FAIL 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"
     9FAIL 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%"
     10FAIL 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"
     11FAIL 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"
     12FAIL 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%"
     13FAIL 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%"
    1414PASS e.style['border-radius'] = "1px 1px 2% 2%" should set the property value
    1515PASS e.style['border-radius'] = "1px 2% 1px 1px" should set the property value
    16 PASS e.style['border-radius'] = "1px 2% 2% 2% / 1px 2% 3px 2%" should set the property value
     16FAIL 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"
    1717PASS e.style['border-top-left-radius'] = "10px" should set the property value
    1818PASS e.style['border-top-right-radius'] = "20%" should set the property value
  • branches/safari-613.1.9-branch/Source/WebCore/ChangeLog

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

    r285373 r285840  
    3636#include "Color.h"
    3737#include "Document.h"
    38 #include "Pair.h"
    3938#include "PropertySetCSSStyleDeclaration.h"
    4039#include "StylePropertyShorthand.h"
     
    321320        return String();
    322321    case CSSPropertyBorderRadius:
    323         return borderRadiusValue(borderRadiusShorthand());
     322        return get4Values(borderRadiusShorthand());
    324323    case CSSPropertyGap:
    325324        return get2Values(gapShorthand());
     
    363362        return value->cssText();
    364363    return String();
    365 }
    366 
    367 String StyleProperties::borderRadiusValue(const StylePropertyShorthand& shorthand) const
    368 {
    369     auto serialize = [](const CSSValue* topLeft, const CSSValue* topRight, const CSSValue* bottomRight, const CSSValue* bottomLeft) -> String {
    370         bool showBottomLeft = !(*topRight == *bottomLeft);
    371         bool showBottomRight = !(*topLeft == *bottomRight) || showBottomLeft;
    372         bool showTopRight = !(*topLeft == *topRight) || showBottomRight;
    373 
    374         return makeString(topLeft->cssText(), showTopRight ? " " : "", showTopRight ? topRight->cssText() : "", showBottomRight ? " " : "", showBottomRight ? bottomRight->cssText() : "", showBottomLeft ? " " : "", showBottomLeft ? bottomLeft->cssText() : "");
    375     };
    376 
    377     int topLeftValueIndex = findPropertyIndex(shorthand.properties()[0]);
    378     int topRightValueIndex = findPropertyIndex(shorthand.properties()[1]);
    379     int bottomRightValueIndex = findPropertyIndex(shorthand.properties()[2]);
    380     int bottomLeftValueIndex = findPropertyIndex(shorthand.properties()[3]);
    381 
    382     if (topLeftValueIndex == -1 || topRightValueIndex == -1 || bottomRightValueIndex == -1 || bottomLeftValueIndex == -1)
    383         return String();
    384 
    385     PropertyReference topLeft = propertyAt(topLeftValueIndex);
    386     PropertyReference topRight = propertyAt(topRightValueIndex);
    387     PropertyReference bottomRight = propertyAt(bottomRightValueIndex);
    388     PropertyReference bottomLeft = propertyAt(bottomLeftValueIndex);
    389 
    390     auto* topLeftValue = topLeft.value();
    391     auto* topRightValue = topRight.value();
    392     auto* bottomRightValue = bottomRight.value();
    393     auto* bottomLeftValue = bottomLeft.value();
    394 
    395     // All 4 properties must be specified.
    396     if (!topLeftValue || !topRightValue || !bottomRightValue || !bottomLeftValue)
    397         return String();
    398 
    399     // Important flags must be the same
    400     if (topLeft.isImportant() != topRight.isImportant() || topRight.isImportant() != bottomRight.isImportant() || bottomRight.isImportant() != bottomLeft.isImportant())
    401         return String();
    402 
    403     if (topLeftValue->isInheritValue() && topRightValue->isInheritValue() && bottomRightValue->isInheritValue() && bottomLeftValue->isInheritValue())
    404         return getValueName(CSSValueInherit);
    405 
    406     if (topLeftValue->isInitialValue() || topRightValue->isInitialValue() || bottomRightValue->isInitialValue() || bottomLeftValue->isInitialValue()) {
    407         if (topLeftValue->isInitialValue() && topRightValue->isInitialValue() && bottomRightValue->isInitialValue() && bottomLeftValue->isInitialValue() && !topLeft.isImplicit()) {
    408             // All components are "initial" and "topLeft" is not implicit.
    409             return getValueName(CSSValueInitial);
    410         }
    411         return String();
    412     }
    413 
    414     auto& topLeftPair = *downcast<CSSPrimitiveValue>(*topLeftValue).pairValue();
    415     auto& topRightPair = *downcast<CSSPrimitiveValue>(*topRightValue).pairValue();
    416     auto& bottomRightPair = *downcast<CSSPrimitiveValue>(*bottomRightValue).pairValue();
    417     auto& bottomLeftPair = *downcast<CSSPrimitiveValue>(*bottomLeftValue).pairValue();
    418 
    419     auto first = serialize(topLeftPair.first(), topRightPair.first(), bottomRightPair.first(), bottomLeftPair.first());
    420     auto second = serialize(topLeftPair.second(), topRightPair.second(), bottomRightPair.second(), bottomLeftPair.second());
    421     if (first == second)
    422         return first;
    423 
    424     return makeString(first, " / ", second);
    425364}
    426365
  • branches/safari-613.1.9-branch/Source/WebCore/css/StyleProperties.h

    r285235 r285840  
    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.