WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-238888-20220427171110.patch (text/plain), 6.03 KB, created by
Oriol Brufau
on 2022-04-27 08:11:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Oriol Brufau
Created:
2022-04-27 08:11:12 PDT
Size:
6.03 KB
patch
obsolete
>Subversion Revision: 293493 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ae11c39af7ea2677fdaa0ba7dcc7ec1b3950e30c..af2227ee2fca1dac286cf3aaed03ea75251a4805 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2022-04-27 Oriol Brufau <obrufau@igalia.com> >+ >+ [css-cascade] Sort shorthand properties at the end of CSSPropertyID enum >+ https://bugs.webkit.org/show_bug.cgi?id=238888 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Only longhands should matter during the CSS Cascade, so by sorting >+ shorthands at the end, and ignoring them, we can save some memory and >+ avoid some iterations. >+ >+ No test since now there should be no observable change in behavior. >+ >+ * css/makeprop.pl: >+ (addProperty): >+ (sortByDescendingPriorityAndName): >+ Sort shorthand properties at the end. >+ >+ * style/PropertyCascade.h: >+ Update comment. >+ > 2022-04-26 Oriol Brufau <obrufau@igalia.com> > > [css-logical] Side border shorthands should not be logical/physical >diff --git a/Source/WebCore/css/makeprop.pl b/Source/WebCore/css/makeprop.pl >index 024c7460d2ea4acb493878c19791352065b2758e..b27a4d5cda108fd271780e8c9cef6ad775db03f9 100755 >--- a/Source/WebCore/css/makeprop.pl >+++ b/Source/WebCore/css/makeprop.pl >@@ -284,8 +284,10 @@ sub addProperty($$) > } elsif ($codegenOptionName eq "comment") { > next; > } elsif ($codegenOptionName eq "high-priority") { >+ die "$name is a shorthand, but has high-priority" if exists $codegenProperties->{"longhands"}; > $nameIsHighPriority{$name} = 1; > } elsif ($codegenOptionName eq "sink-priority") { >+ die "$name is a shorthand, but has sink-priority" if exists $codegenProperties->{"longhands"}; > $namePriorityShouldSink{$name} = 1; > } elsif ($codegenOptionName eq "related-property") { > $relatedProperty{$name} = $codegenProperties->{"related-property"} >@@ -353,14 +355,21 @@ sub addProperty($$) > > sub sortByDescendingPriorityAndName > { >- # Sort names with high priority to the front >+ # Sort shorthands to the back >+ if (exists $propertiesWithStyleBuilderOptions{$a}{"longhands"} < exists $propertiesWithStyleBuilderOptions{$b}{"longhands"}) { >+ return -1; >+ } >+ if (exists $propertiesWithStyleBuilderOptions{$a}{"longhands"} > exists $propertiesWithStyleBuilderOptions{$b}{"longhands"}) { >+ return 1; >+ } >+ # Sort longhands with high priority to the front > if (!!$nameIsHighPriority{$a} < !!$nameIsHighPriority{$b}) { > return 1; > } > if (!!$nameIsHighPriority{$a} > !!$nameIsHighPriority{$b}) { > return -1; > } >- # Defer names with a related property to the back >+ # Defer longhands with a related property to the back, before shorthands > if (!!$relatedProperty{$a} < !!$relatedProperty{$b}) { > return -1; > } >@@ -849,9 +858,14 @@ my $firstLowPriorityPropertyName; > my $lastLowPriorityPropertyName; > my $firstDeferredPropertyName; > my $lastDeferredPropertyName; >+my $firstShorthand; >+my $lastShorthand; > foreach my $name (@names) { > # Assumes that @names is sorted by descending priorities. >- if ($nameIsHighPriority{$name}) { >+ if (exists $propertiesWithStyleBuilderOptions{$name}{"longhands"}) { >+ $firstShorthand = $name if !$firstShorthand; >+ $lastShorthand = $name; >+ } elsif ($nameIsHighPriority{$name}) { > $firstHighPriorityPropertyName = $name if !$firstHighPriorityPropertyName; > $lastHighPriorityPropertyName = $name; > } elsif (!$relatedProperty{$name}) { >@@ -880,7 +894,9 @@ print HEADER "const CSSPropertyID lastHighPriorityProperty = CSSProperty" . $nam > print HEADER "const CSSPropertyID firstLowPriorityProperty = CSSProperty" . $nameToId{$firstLowPriorityPropertyName} . ";\n"; > print HEADER "const CSSPropertyID lastLowPriorityProperty = CSSProperty" . $nameToId{$lastLowPriorityPropertyName} . ";\n"; > print HEADER "const CSSPropertyID firstDeferredProperty = CSSProperty" . $nameToId{$firstDeferredPropertyName} . ";\n"; >-print HEADER "const CSSPropertyID lastDeferredProperty = CSSProperty" . $nameToId{$lastDeferredPropertyName} . ";\n\n"; >+print HEADER "const CSSPropertyID lastDeferredProperty = CSSProperty" . $nameToId{$lastDeferredPropertyName} . ";\n"; >+print HEADER "const CSSPropertyID firstShorthand = CSSProperty" . $nameToId{$firstShorthand} . ";\n"; >+print HEADER "const CSSPropertyID lastShorthand = CSSProperty" . $nameToId{$lastShorthand} . ";\n\n"; > > print HEADER "static const CSSPropertyID computedPropertyIDs[] = {\n"; > my $numComputedPropertyIDs = 0; >diff --git a/Source/WebCore/style/PropertyCascade.h b/Source/WebCore/style/PropertyCascade.h >index 5a2dcfd263879d70d7770aad5f9dbca91c32b472..9ede5420a7eb2420aa18e3562821b1d738ae92ed 100644 >--- a/Source/WebCore/style/PropertyCascade.h >+++ b/Source/WebCore/style/PropertyCascade.h >@@ -99,11 +99,12 @@ private: > > // The CSSPropertyID enum is sorted like this: > // 1. CSSPropertyInvalid and CSSPropertyCustom. >- // 2. Normal properties (high priority ones followed by low priority ones). >- // 3. Deferred properties. >+ // 2. Normal longhands (high priority ones followed by low priority ones). >+ // 3. Deferred longhands. >+ // 4. Shorthands. > // >- // 'm_properties' is used for both normal and deferred properties, so it has size 'lastDeferredProperty + 1'. >- // It could actually use 'numCSSProperties', but then we would have to subtract 'firstCSSProperty', which may not be worth it. >+ // 'm_properties' is used for both normal and deferred longhands, so it has size 'lastDeferredProperty + 1'. >+ // It could actually be 2 units smaller, but then we would have to subtract 'firstCSSProperty', which may not be worth it. > // 'm_propertyIsPresent' is not used for deferred properties, so we only need to cover up to the last low priority one. > std::array<Property, lastDeferredProperty + 1> m_properties; > std::bitset<lastLowPriorityProperty + 1> m_propertyIsPresent;
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 238888
:
458446
|
458509