WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Add more test cases to border-radius-valid wpt test
bug-183994-20211030115719.patch (text/plain), 10.17 KB, created by
Joonghun Park
on 2021-10-29 19:57:20 PDT
(
hide
)
Description:
Add more test cases to border-radius-valid wpt test
Filename:
MIME Type:
Creator:
Joonghun Park
Created:
2021-10-29 19:57:20 PDT
Size:
10.17 KB
patch
obsolete
>Subversion Revision: 285020 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 88f001678e4421b3a19098f488ba6c8f13ee9a5e..6ebab00d144052c0c866cdc36488c4283f213c35 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2021-10-29 Joonghun Park <jh718.park@samsung.com> >+ >+ border-radius inline style should serialize with valid syntax >+ https://bugs.webkit.org/show_bug.cgi?id=183994 >+ >+ This patch have border-radius property serializes in canonical order >+ as specified in https://drafts.csswg.org/css-backgrounds/#border-radius. >+ >+ * css/StyleProperties.cpp: >+ (WebCore::StyleProperties::getPropertyValue const): >+ (WebCore::StyleProperties::borderRadiusValue const): >+ * css/StyleProperties.h: >+ * css/parser/CSSPropertyParser.cpp: >+ > 2021-10-28 Tim Horton <timothy_horton@apple.com> > > Yahoo.com has fragments of wrongly-scaled content throughout when using CGDisplayListImageBufferBackend >diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp >index bd3be590dfe7a5f67cb945eeae6d6f2ecc290714..2d4fea36d83d211c9ba5a54f9e7ea6b7fcabd8ff 100644 >--- a/Source/WebCore/css/StyleProperties.cpp >+++ b/Source/WebCore/css/StyleProperties.cpp >@@ -35,6 +35,7 @@ > #include "CSSValuePool.h" > #include "Color.h" > #include "Document.h" >+#include "Pair.h" > #include "PropertySetCSSStyleDeclaration.h" > #include "StylePropertyShorthand.h" > #include "StylePropertyShorthandFunctions.h" >@@ -319,7 +320,7 @@ String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const > return value->cssText(); > return String(); > case CSSPropertyBorderRadius: >- return get4Values(borderRadiusShorthand()); >+ return borderRadiusValue(); > case CSSPropertyGap: > return get2Values(gapShorthand()); > case CSSPropertyScrollMargin: >@@ -363,6 +364,38 @@ String StyleProperties::getCustomPropertyValue(const String& propertyName) const > return String(); > } > >+String StyleProperties::borderRadiusValue() const >+{ >+ auto serialize = [](const CSSValue* topLeft, const CSSValue* topRight, const CSSValue* bottomRight, const CSSValue* bottomLeft) -> String { >+ bool showBottomLeft = !(*topRight == *bottomLeft); >+ bool showBottomRight = !(*topLeft == *bottomRight) || showBottomLeft; >+ bool showTopRight = !(*topLeft == *topRight) || showBottomRight; >+ >+ return makeString(topLeft->cssText(), showTopRight ? " " : "", showTopRight ? topRight->cssText() : "", showBottomRight ? " " : "", showBottomRight ? bottomRight->cssText() : "", showBottomLeft ? " " : "", showBottomLeft ? bottomLeft->cssText() : ""); >+ }; >+ >+ auto topLeft = getPropertyCSSValue(CSSPropertyBorderTopLeftRadius); >+ auto topRight = getPropertyCSSValue(CSSPropertyBorderTopRightRadius); >+ auto bottomRight = getPropertyCSSValue(CSSPropertyBorderBottomRightRadius); >+ auto bottomLeft = getPropertyCSSValue(CSSPropertyBorderBottomLeftRadius); >+ >+ // All 4 properties must be specified. >+ if (!topLeft || !topRight || !bottomRight || !bottomLeft) >+ return String(); >+ >+ auto& topLeftPair = *downcast<CSSPrimitiveValue>(*topLeft).pairValue(); >+ auto& topRightPair = *downcast<CSSPrimitiveValue>(*topRight).pairValue(); >+ auto& bottomRightPair = *downcast<CSSPrimitiveValue>(*bottomRight).pairValue(); >+ auto& bottomLeftPair = *downcast<CSSPrimitiveValue>(*bottomLeft).pairValue(); >+ >+ auto first = serialize(topLeftPair.first(), topRightPair.first(), bottomRightPair.first(), bottomLeftPair.first()); >+ auto second = serialize(topLeftPair.second(), topRightPair.second(), bottomRightPair.second(), bottomLeftPair.second()); >+ if (first == second) >+ return first; >+ >+ return makeString(first, " / ", second); >+} >+ > String StyleProperties::borderSpacingValue(const StylePropertyShorthand& shorthand) const > { > auto horizontalValue = getPropertyCSSValue(shorthand.properties()[0]); >diff --git a/Source/WebCore/css/StyleProperties.h b/Source/WebCore/css/StyleProperties.h >index df82592ac77c2b8f3ae3be59916203ae1af18a74..198573c5ca833950e343a9fe2f252e22aec8d401 100644 >--- a/Source/WebCore/css/StyleProperties.h >+++ b/Source/WebCore/css/StyleProperties.h >@@ -170,6 +170,7 @@ private: > String getLayeredShorthandValue(const StylePropertyShorthand&) const; > String get2Values(const StylePropertyShorthand&) const; > String get4Values(const StylePropertyShorthand&) const; >+ String borderRadiusValue() const; > String borderSpacingValue(const StylePropertyShorthand&) const; > String fontValue() const; > String fontVariantValue() const; >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index 71d3177d86e849ed677704e075060f191807b6fb..30372896ea27420f5553a2fc75aca110af9e2675 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -63,6 +63,10 @@ > #include "Counter.h" > #include "FontFace.h" > #include "HashTools.h" >+// FIXME-NEWPARSER: CSSPrimitiveValue is a large class that holds many unrelated objects, >+// switching behavior on the type of the object it is holding. >+// Since CSSValue is already a class hierarchy, this adds an unnecessary second level to the hierarchy that complicates code. >+// So we need to remove the various behaviors from CSSPrimitiveValue and split them into separate subclasses of CSSValue. > // FIXME-NEWPARSER: Replace Pair and Rect with actual CSSValue subclasses (CSSValuePair and CSSQuadValue). > #include "Pair.h" > #include "Rect.h" >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 608c711ef7bb5c1152de82bc16a2a04d9ec23b8d..f621ad6b5499909ad27871a6471dc723ed5d5663 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,16 @@ >+2021-10-29 Joonghun Park <jh718.park@samsung.com> >+ >+ border-radius inline style should serialize with valid syntax >+ https://bugs.webkit.org/show_bug.cgi?id=183994 >+ >+ This patch have border-radius property serializes in canonical order >+ as specified in https://drafts.csswg.org/css-backgrounds/#border-radius. >+ >+ Reviewed by Darin Adler. >+ >+ * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt: Add more test case results. >+ * web-platform-tests/css/css-backgrounds/parsing/border-radius-valid.html: Add more test cases. >+ > 2021-10-28 Chris Dumez <cdumez@apple.com> > > Add stubs for the Web Locks API >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt >index 317c9a4a91f3d5935b79a574b565132e5a77c87c..9cc3087012847e73881b1a8da50af38618f74c87 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid-expected.txt >@@ -1,13 +1,13 @@ > > PASS e.style['border-radius'] = "1px" should set the property value > PASS e.style['border-radius'] = "1px 2% 3px 4%" should set the property value >-FAIL 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%" >-FAIL 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" >-FAIL 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%" >-FAIL 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%" >+PASS e.style['border-radius'] = "5em / 1px 2% 3px 4%" should set the property value >+PASS e.style['border-radius'] = "1px 2% 3px 4% / 5em" should set the property value >+PASS e.style['border-radius'] = "1px 1px 1px 2% / 1px 2% 1px 2%" should set the property value >+PASS e.style['border-radius'] = "1px 1px 1px 1px / 1px 1px 2% 1px" should set the property value > PASS e.style['border-radius'] = "1px 1px 2% 2%" should set the property value > PASS e.style['border-radius'] = "1px 2% 1px 1px" should set the property value >-FAIL 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" >+PASS e.style['border-radius'] = "1px 2% 2% 2% / 1px 2% 3px 2%" should set the property value > PASS e.style['border-top-left-radius'] = "10px" should set the property value > PASS e.style['border-top-right-radius'] = "20%" should set the property value > PASS e.style['border-bottom-right-radius'] = "30px 40%" should set the property value >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid.html >index 738362f96933c34fae38e6adfa9a82a556fc1f3b..287f95e175539af94697bf65b59204f62565787d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-radius-valid.html >@@ -12,8 +12,14 @@ > <body> > <script> > test_valid_value("border-radius", "1px"); >+test_valid_value("border-radius", "1px 5%"); >+test_valid_value("border-radius", "1px 2% 3px"); > test_valid_value("border-radius", "1px 2% 3px 4%"); >+test_valid_value("border-radius", "1px / 2px"); > test_valid_value("border-radius", "5em / 1px 2% 3px 4%"); >+test_valid_value("border-radius", "1px 2% / 3px 4px"); >+test_valid_value("border-radius", "1px 2px 3em / 1px 2px 3%"); >+test_valid_value("border-radius", "1px 2% / 2px 3em 4px 5em"); > test_valid_value("border-radius", "1px 2% 3px 4% / 5em"); > > test_valid_value("border-radius", "1px 1px 1px 2% / 1px 2% 1px 2%", "1px 1px 1px 2% / 1px 2%");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 183994
:
442824
|
442839
|
442853
|
442854
|
442891
|
442894
|
442910
|
443238
|
444348
|
444365
|
444450