- Revision
- 260335
- Author
- [email protected]
- Date
- 2020-04-19 06:46:15 -0700 (Sun, 19 Apr 2020)
Log Message
Fix the logic to decide whether a property is enumerated in a computed style declaration.
https://bugs.webkit.org/show_bug.cgi?id=210695
Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:
Import the test from
https://github.com/web-platform-tests/wpt/pull/23088. One subtest is
failing, separate bug.
* web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt: Added.
* web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html: Added.
Source/WebCore:
Fix the logic to decide whether a property is enumerated in a computed
style declaration.
Logical properties don't need stylebuilder code, but still should be
generated. Using the specification->category for this seems a bit
hacky, but unclear if it's worse than adding a new flag.
Tests: fast/css/getComputedStyle/computed-style-enumeration.html
imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
* css/makeprop.pl:
(skippedFromComputedStyle):
(isLogical):
(sortWithPrefixedPropertiesLast):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260334 => 260335)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-19 04:41:59 UTC (rev 260334)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-19 13:46:15 UTC (rev 260335)
@@ -1,3 +1,17 @@
+2020-04-19 Emilio Cobos Álvarez <[email protected]>
+
+ Fix the logic to decide whether a property is enumerated in a computed style declaration.
+ https://bugs.webkit.org/show_bug.cgi?id=210695
+
+ Reviewed by Antti Koivisto.
+
+ Import the test from
+ https://github.com/web-platform-tests/wpt/pull/23088. One subtest is
+ failing, separate bug.
+
+ * web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt: Added.
+ * web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html: Added.
+
2020-04-18 Antti Koivisto <[email protected]>
[CSS selectors] Support :where() pseudo class
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (260334 => 260335)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt 2020-04-19 04:41:59 UTC (rev 260334)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt 2020-04-19 13:46:15 UTC (rev 260335)
@@ -27,12 +27,13 @@
PASS background-repeat
PASS background-size
PASS baseline-shift
-PASS border-block
-PASS border-block-color
-PASS border-block-end
-PASS border-block-start
-PASS border-block-style
-PASS border-block-width
+PASS block-size
+PASS border-block-end-color
+PASS border-block-end-style
+PASS border-block-end-width
+PASS border-block-start-color
+PASS border-block-start-style
+PASS border-block-start-width
PASS border-bottom-color
PASS border-bottom-left-radius
PASS border-bottom-right-radius
@@ -44,12 +45,12 @@
PASS border-image-slice
PASS border-image-source
PASS border-image-width
-PASS border-inline
-PASS border-inline-color
-PASS border-inline-end
-PASS border-inline-start
-PASS border-inline-style
-PASS border-inline-width
+PASS border-inline-end-color
+PASS border-inline-end-style
+PASS border-inline-end-width
+PASS border-inline-start-color
+PASS border-inline-start-style
+PASS border-inline-start-width
PASS border-left-color
PASS border-left-style
PASS border-left-width
@@ -140,8 +141,11 @@
PASS height
PASS image-orientation
PASS image-rendering
-PASS inset-block
-PASS inset-inline
+PASS inline-size
+PASS inset-block-end
+PASS inset-block-start
+PASS inset-inline-end
+PASS inset-inline-start
PASS isolation
PASS justify-content
PASS justify-items
@@ -155,9 +159,11 @@
PASS list-style-image
PASS list-style-position
PASS list-style-type
-PASS margin-block
+PASS margin-block-end
+PASS margin-block-start
PASS margin-bottom
-PASS margin-inline
+PASS margin-inline-end
+PASS margin-inline-start
PASS margin-left
PASS margin-right
PASS margin-top
@@ -166,9 +172,13 @@
PASS marker-start
PASS mask
PASS mask-type
+PASS max-block-size
PASS max-height
+PASS max-inline-size
PASS max-width
+PASS min-block-size
PASS min-height
+PASS min-inline-size
PASS min-width
PASS mix-blend-mode
PASS object-fit
@@ -183,9 +193,11 @@
PASS overflow-wrap
PASS overflow-x
PASS overflow-y
-PASS padding-block
+PASS padding-block-end
+PASS padding-block-start
PASS padding-bottom
-PASS padding-inline
+PASS padding-inline-end
+PASS padding-inline-start
PASS padding-left
PASS padding-right
PASS padding-top
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt (0 => 260335)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt 2020-04-19 13:46:15 UTC (rev 260335)
@@ -0,0 +1,3 @@
+
+FAIL Logical properties in enumeration of computed style assert_false: environment variables should not be enumerated in computed style expected false got true
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html (0 => 260335)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html 2020-04-19 13:46:15 UTC (rev 260335)
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: getComputedStyle returns no style for elements not in the tree</title>
+<link rel="help" href=""
+<link rel="author" title="Emilio Cobos Álvarez" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+ test(function() {
+ let longhand = false;
+ let shorthand = false;
+ let env = false;
+ for (let property of getComputedStyle(document.documentElement)) {
+ if (property == "block-size")
+ longhand = true;
+ if (property == "padding-block")
+ shorthand = true;
+ if (property == "safe-area-inset-top")
+ env = true;
+ }
+ assert_true(longhand, "Logical longhands should be enumerated in computed style");
+ assert_false(shorthand, "Logical shorthands should not be enumerated in computed style");
+ assert_false(env, "environment variables should not be enumerated in computed style");
+ }, "Logical properties in enumeration of computed style")
+</script>
Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (260334 => 260335)
--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt 2020-04-19 04:41:59 UTC (rev 260334)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt 2020-04-19 13:46:15 UTC (rev 260335)
@@ -27,12 +27,13 @@
PASS background-repeat
PASS background-size
PASS baseline-shift
-PASS border-block
-PASS border-block-color
-PASS border-block-end
-PASS border-block-start
-PASS border-block-style
-PASS border-block-width
+PASS block-size
+PASS border-block-end-color
+PASS border-block-end-style
+PASS border-block-end-width
+PASS border-block-start-color
+PASS border-block-start-style
+PASS border-block-start-width
PASS border-bottom-color
PASS border-bottom-left-radius
PASS border-bottom-right-radius
@@ -44,12 +45,12 @@
PASS border-image-slice
PASS border-image-source
PASS border-image-width
-PASS border-inline
-PASS border-inline-color
-PASS border-inline-end
-PASS border-inline-start
-PASS border-inline-style
-PASS border-inline-width
+PASS border-inline-end-color
+PASS border-inline-end-style
+PASS border-inline-end-width
+PASS border-inline-start-color
+PASS border-inline-start-style
+PASS border-inline-start-width
PASS border-left-color
PASS border-left-style
PASS border-left-width
@@ -140,8 +141,11 @@
PASS height
PASS image-orientation
PASS image-rendering
-PASS inset-block
-PASS inset-inline
+PASS inline-size
+PASS inset-block-end
+PASS inset-block-start
+PASS inset-inline-end
+PASS inset-inline-start
PASS isolation
PASS justify-content
PASS justify-items
@@ -155,9 +159,11 @@
PASS list-style-image
PASS list-style-position
PASS list-style-type
-PASS margin-block
+PASS margin-block-end
+PASS margin-block-start
PASS margin-bottom
-PASS margin-inline
+PASS margin-inline-end
+PASS margin-inline-start
PASS margin-left
PASS margin-right
PASS margin-top
@@ -166,9 +172,13 @@
PASS marker-start
PASS mask
PASS mask-type
+PASS max-block-size
PASS max-height
+PASS max-inline-size
PASS max-width
+PASS min-block-size
PASS min-height
+PASS min-inline-size
PASS min-width
PASS mix-blend-mode
PASS object-fit
@@ -183,9 +193,11 @@
PASS overflow-wrap
PASS overflow-x
PASS overflow-y
-PASS padding-block
+PASS padding-block-end
+PASS padding-block-start
PASS padding-bottom
-PASS padding-inline
+PASS padding-inline-end
+PASS padding-inline-start
PASS padding-left
PASS padding-right
PASS padding-top
Modified: trunk/Source/WebCore/ChangeLog (260334 => 260335)
--- trunk/Source/WebCore/ChangeLog 2020-04-19 04:41:59 UTC (rev 260334)
+++ trunk/Source/WebCore/ChangeLog 2020-04-19 13:46:15 UTC (rev 260335)
@@ -1,3 +1,25 @@
+2020-04-19 Emilio Cobos Álvarez <[email protected]>
+
+ Fix the logic to decide whether a property is enumerated in a computed style declaration.
+ https://bugs.webkit.org/show_bug.cgi?id=210695
+
+ Reviewed by Antti Koivisto.
+
+ Fix the logic to decide whether a property is enumerated in a computed
+ style declaration.
+
+ Logical properties don't need stylebuilder code, but still should be
+ generated. Using the specification->category for this seems a bit
+ hacky, but unclear if it's worse than adding a new flag.
+
+ Tests: fast/css/getComputedStyle/computed-style-enumeration.html
+ imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
+
+ * css/makeprop.pl:
+ (skippedFromComputedStyle):
+ (isLogical):
+ (sortWithPrefixedPropertiesLast):
+
2020-04-18 Antti Koivisto <[email protected]>
[CSS selectors] Support :where() pseudo class
Modified: trunk/Source/WebCore/css/makeprop.pl (260334 => 260335)
--- trunk/Source/WebCore/css/makeprop.pl 2020-04-19 04:41:59 UTC (rev 260334)
+++ trunk/Source/WebCore/css/makeprop.pl 2020-04-19 13:46:15 UTC (rev 260335)
@@ -31,8 +31,10 @@
use Getopt::Long;
use JSON::PP;
+sub isLogical;
+sub skippedFromComputedStyle;
+sub isPropertyEnabled($$);
sub addProperty($$);
-sub isPropertyEnabled($$);
sub removeInactiveCodegenProperties($$);
my $inputFile = "CSSProperties.json";
@@ -151,6 +153,51 @@
$propertyValue->{"codegen-properties"} = $matching_codegen_options;
}
+sub skippedFromComputedStyle
+{
+ my $name = shift;
+
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"skip-builder"}) and not isLogical($name)) {
+ return 1;
+ }
+
+ if (grep { $_ eq $name } @internalProprerties) {
+ return 1;
+ }
+
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"longhands"})) {
+ my @longhands = @{$propertiesWithStyleBuilderOptions{$name}{"longhands"}};
+ if (scalar @longhands != 1) {
+ # Skip properties if they have a non-internal longhand property.
+ foreach my $longhand (@longhands) {
+ if (!skippedFromComputedStyle($longhand)) {
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+sub isLogical
+{
+ my $name = shift;
+ my $value = $propertiesHashRef->{$name};
+
+ if (!exists($value->{"specification"})) {
+ return 0;
+ }
+
+ my $spec_properties = $value->{"specification"};
+ if (!exists($spec_properties->{"category"})) {
+ return 0;
+ }
+
+ return $spec_properties->{"category"} eq "css-logical-props"
+}
+
sub isPropertyEnabled($$)
{
my ($name, $propertyValue) = @_;
@@ -516,27 +563,9 @@
}
return $a cmp $b;
}
+
foreach my $name (sort sortWithPrefixedPropertiesLast @names) {
- next if (exists($propertiesWithStyleBuilderOptions{$name}{"skip-builder"}));
- next if (grep { $_ eq $name } @internalProprerties);
-
- # Skip properties if they have a non-internal longhand property.
- if (exists($propertiesWithStyleBuilderOptions{$name}{"longhands"})) {
- my @longhands = @{$propertiesWithStyleBuilderOptions{$name}{"longhands"}};
- if (scalar @longhands != 1) {
- my $hasNonInternalLonghand = 0;
- foreach my $longhand (@longhands) {
- if (!exists($propertiesWithStyleBuilderOptions{$longhand}{"skip-builder"}) && !grep { $_ eq $longhand } @internalProprerties) {
- $hasNonInternalLonghand = 1;
- last;
- }
- }
- if ($hasNonInternalLonghand) {
- next;
- }
- }
- }
-
+ next if skippedFromComputedStyle($name);
print HEADER " CSSProperty" . $nameToId{$name} . ",\n";
$numComputedPropertyIDs += 1;
}