Title: [293485] trunk
Revision
293485
Author
[email protected]
Date
2022-04-26 17:19:14 -0700 (Tue, 26 Apr 2022)

Log Message

[css-cascade] Fix cascade rollback for deferred properties
https://bugs.webkit.org/show_bug.cgi?id=238125

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Add a test. It still has some failures due to bug 239579, bug 239669,
and bug 239670.

* web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: Added.
* web-platform-tests/css/css-cascade/all-prop-revert-layer.html: Added.

Source/WebCore:

When a deferred property was set to 'revert' or 'revert-layer', it used
to roll back to a declaration of the same exact property (or behave as
'unset' if none).

This patch lets deferred properties roll back to their related property,
e.g. '-webkit-box-shadow: revert-layer' can roll back to a 'box-shadow'
declaration in the previous layer.

This is consistent with logical and physical properties, where the
rollback happens after resolving logical properties.

Test: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html

* style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::lastDeferredPropertyResolvingRelated const):
* style/PropertyCascade.h:
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty):

LayoutTests:

Add custom expectation for mac-wk1 since scroll-behavior is disabled
there, and thus not checked by the test.

* platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (293484 => 293485)


--- trunk/LayoutTests/ChangeLog	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/LayoutTests/ChangeLog	2022-04-27 00:19:14 UTC (rev 293485)
@@ -1,3 +1,15 @@
+2022-04-26  Oriol Brufau  <[email protected]>
+
+        [css-cascade] Fix cascade rollback for deferred properties
+        https://bugs.webkit.org/show_bug.cgi?id=238125
+
+        Reviewed by Antti Koivisto.
+
+        Add custom expectation for mac-wk1 since scroll-behavior is disabled
+        there, and thus not checked by the test.
+
+        * platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: Added.
+
 2022-04-26  Karl Rackler  <[email protected]>
 
         [ macOS ] webanimations/accelerated-animation-slot-invalidation.html is a flaky image failure

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (293484 => 293485)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-27 00:19:14 UTC (rev 293485)
@@ -1,3 +1,16 @@
+2022-04-26  Oriol Brufau  <[email protected]>
+
+        [css-cascade] Fix cascade rollback for deferred properties
+        https://bugs.webkit.org/show_bug.cgi?id=238125
+
+        Reviewed by Antti Koivisto.
+
+        Add a test. It still has some failures due to bug 239579, bug 239669,
+        and bug 239670.
+
+        * web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: Added.
+        * web-platform-tests/css/css-cascade/all-prop-revert-layer.html: Added.
+
 2022-04-26  Ziran Sun  <[email protected]>
 
         Constructed FormData object should not contain an entry for the submit button that was used to submit the form

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt (0 => 293485)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-04-27 00:19:14 UTC (rev 293485)
@@ -0,0 +1,336 @@
+
+PASS accent-color
+PASS align-content
+PASS align-items
+PASS align-self
+PASS alignment-baseline
+PASS alt
+PASS animation-composition
+PASS animation-delay
+PASS animation-direction
+PASS animation-duration
+PASS animation-fill-mode
+PASS animation-iteration-count
+PASS animation-name
+PASS animation-play-state
+PASS animation-timing-function
+PASS appearance
+PASS aspect-ratio
+PASS backface-visibility
+PASS background-attachment
+PASS background-blend-mode
+PASS background-clip
+PASS background-color
+PASS background-image
+PASS background-origin
+PASS background-position-x
+PASS background-position-y
+PASS background-repeat
+PASS background-size
+PASS baseline-shift
+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
+PASS border-bottom-style
+PASS border-bottom-width
+PASS border-collapse
+PASS border-end-end-radius
+PASS border-end-start-radius
+PASS border-image-outset
+PASS border-image-repeat
+PASS border-image-slice
+PASS border-image-source
+PASS border-image-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
+PASS border-right-color
+PASS border-right-style
+PASS border-right-width
+PASS border-start-end-radius
+PASS border-start-start-radius
+PASS border-top-color
+PASS border-top-left-radius
+PASS border-top-right-radius
+PASS border-top-style
+PASS border-top-width
+PASS bottom
+PASS box-shadow
+PASS box-sizing
+PASS break-after
+PASS break-before
+PASS break-inside
+PASS buffered-rendering
+PASS caption-side
+PASS caret-color
+PASS clear
+PASS clip
+PASS clip-path
+PASS clip-rule
+PASS color
+PASS color-interpolation
+PASS color-interpolation-filters
+PASS color-scheme
+PASS column-count
+PASS column-fill
+PASS column-gap
+PASS column-rule-color
+PASS column-rule-style
+PASS column-rule-width
+PASS column-span
+PASS column-width
+PASS contain
+PASS contain-intrinsic-block-size
+PASS contain-intrinsic-height
+PASS contain-intrinsic-inline-size
+PASS contain-intrinsic-width
+PASS container-name
+PASS container-type
+PASS content
+PASS counter-increment
+PASS counter-reset
+PASS cursor
+PASS cx
+PASS cy
+PASS direction
+PASS display
+PASS dominant-baseline
+PASS empty-cells
+PASS fill
+PASS fill-opacity
+PASS fill-rule
+PASS filter
+PASS flex-basis
+PASS flex-direction
+PASS flex-grow
+PASS flex-shrink
+PASS flex-wrap
+PASS float
+PASS flood-color
+PASS flood-opacity
+PASS font-family
+PASS font-feature-settings
+PASS font-kerning
+PASS font-optical-sizing
+PASS font-palette
+PASS font-size
+PASS font-stretch
+PASS font-style
+PASS font-synthesis
+PASS font-variant-alternates
+PASS font-variant-caps
+PASS font-variant-east-asian
+PASS font-variant-ligatures
+PASS font-variant-numeric
+PASS font-variant-position
+PASS font-variation-settings
+PASS font-weight
+PASS glyph-orientation-horizontal
+PASS glyph-orientation-vertical
+PASS grid-auto-columns
+PASS grid-auto-flow
+PASS grid-auto-rows
+PASS grid-column-end
+PASS grid-column-start
+PASS grid-row-end
+PASS grid-row-start
+PASS grid-template-areas
+PASS grid-template-columns
+PASS grid-template-rows
+PASS hanging-punctuation
+PASS height
+PASS image-orientation
+PASS image-rendering
+PASS inline-size
+PASS input-security
+PASS inset-block-end
+PASS inset-block-start
+PASS inset-inline-end
+PASS inset-inline-start
+PASS isolation
+PASS justify-content
+PASS justify-items
+PASS justify-self
+PASS kerning
+PASS left
+PASS letter-spacing
+PASS lighting-color
+PASS line-break
+PASS line-height
+PASS list-style-image
+PASS list-style-position
+PASS list-style-type
+PASS margin-block-end
+PASS margin-block-start
+PASS margin-bottom
+PASS margin-inline-end
+PASS margin-inline-start
+PASS margin-left
+PASS margin-right
+PASS margin-top
+PASS marker-end
+PASS marker-mid
+PASS marker-start
+FAIL mask-clip assert_not_equals: Should get a different computed value. got disallowed value "border-box"
+FAIL mask-composite assert_not_equals: Should get a different computed value. got disallowed value "add"
+PASS mask-image
+FAIL mask-mode assert_not_equals: Should get a different computed value. got disallowed value "match-source"
+PASS mask-origin
+PASS mask-repeat
+PASS mask-size
+PASS mask-type
+PASS math-style
+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
+PASS object-position
+PASS offset-anchor
+PASS offset-distance
+PASS offset-path
+PASS offset-position
+PASS offset-rotate
+PASS opacity
+PASS order
+PASS orphans
+PASS outline-color
+PASS outline-offset
+PASS outline-style
+PASS outline-width
+FAIL overflow-wrap assert_not_equals: Should get a different computed value. got disallowed value "normal"
+PASS overflow-x
+PASS overflow-y
+PASS overscroll-behavior-x
+PASS overscroll-behavior-y
+PASS padding-block-end
+PASS padding-block-start
+PASS padding-bottom
+PASS padding-inline-end
+PASS padding-inline-start
+PASS padding-left
+PASS padding-right
+PASS padding-top
+PASS page-break-after
+PASS page-break-before
+PASS page-break-inside
+PASS paint-order
+PASS perspective
+FAIL perspective-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL perspective-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+PASS pointer-events
+PASS position
+PASS print-color-adjust
+PASS quotes
+PASS r
+PASS resize
+PASS right
+PASS rotate
+PASS row-gap
+PASS rx
+PASS ry
+PASS scale
+PASS scroll-behavior
+PASS scroll-margin-block
+PASS scroll-margin-bottom
+PASS scroll-margin-inline
+PASS scroll-margin-left
+PASS scroll-margin-right
+PASS scroll-margin-top
+PASS scroll-padding-block
+PASS scroll-padding-bottom
+PASS scroll-padding-inline
+PASS scroll-padding-left
+PASS scroll-padding-right
+PASS scroll-padding-top
+PASS scroll-snap-align
+PASS scroll-snap-stop
+PASS scroll-snap-type
+PASS shape-image-threshold
+PASS shape-margin
+PASS shape-outside
+PASS shape-rendering
+PASS speak-as
+PASS stop-color
+PASS stop-opacity
+PASS stroke
+PASS stroke-color
+PASS stroke-dasharray
+PASS stroke-dashoffset
+PASS stroke-linecap
+PASS stroke-linejoin
+PASS stroke-miterlimit
+PASS stroke-opacity
+PASS stroke-width
+PASS tab-size
+PASS table-layout
+PASS text-align
+PASS text-anchor
+FAIL text-combine-upright assert_not_equals: Should get a different computed value. got disallowed value "none"
+PASS text-decoration
+PASS text-decoration-color
+PASS text-decoration-line
+PASS text-decoration-skip
+PASS text-decoration-skip-ink
+PASS text-decoration-style
+PASS text-decoration-thickness
+PASS text-emphasis-color
+PASS text-emphasis-position
+PASS text-emphasis-style
+PASS text-indent
+PASS text-orientation
+PASS text-overflow
+PASS text-rendering
+PASS text-shadow
+PASS text-transform
+PASS text-underline-offset
+PASS text-underline-position
+PASS top
+PASS touch-action
+PASS transform
+PASS transform-box
+FAIL transform-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-origin-z assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-style assert_not_equals: Should get a different computed value. got disallowed value "flat"
+PASS transition-delay
+PASS transition-duration
+PASS transition-property
+PASS transition-timing-function
+PASS translate
+PASS unicode-bidi
+PASS user-select
+PASS vector-effect
+PASS vertical-align
+PASS visibility
+PASS white-space
+PASS widows
+PASS width
+PASS will-change
+PASS word-break
+PASS word-spacing
+PASS word-wrap
+PASS writing-mode
+PASS x
+PASS y
+PASS z-index
+PASS zoom
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html (0 => 293485)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html	2022-04-27 00:19:14 UTC (rev 293485)
@@ -0,0 +1,457 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Cascade: "all: revert-layer"</title>
+<link rel="author" title="Oriol Brufau" href=""
+<link rel="help" href=""
+<meta name="assert" content="Checks that adding 'all: revert-layer' on the last layer has no effect.">
+<style>
+/* Set properties to a value different than the initial one. */
+#nothing {
+  accent-color: #123;
+  align-content: baseline;
+  align-items: baseline;
+  align-self: baseline;
+  align-tracks: baseline;
+  alignment-baseline: central;
+  alt: "a";
+  animation-composition: add;
+  animation-delay: 123s;
+  animation-direction: reverse;
+  animation-duration: 123s;
+  animation-fill-mode: both;
+  animation-iteration-count: 123;
+  animation-name: \.;
+  animation-play-state: paused;
+  animation-timeline: none;
+  animation-timing-function: linear;
+  app-region: drag;
+  appearance: auto;
+  aspect-ratio: 3 / 4;
+  backdrop-filter: invert(1);
+  backface-visibility: hidden;
+  background-attachment: fixed;
+  background-blend-mode: overlay;
+  background-clip: content-box;
+  background-color: #123;
+  background-image: url("#ref");
+  background-origin: border-box;
+  background-position: 123px;
+  background-repeat: round;
+  background-size: 123px;
+  baseline-shift: 123px;
+  block-size: 123px;
+  border-block-end: 123px dashed #123;
+  border-block-start: 123px dashed #123;
+  border-bottom: 123px dashed #123;
+  border-collapse: collapse;
+  border-end-end-radius: 123px;
+  border-end-start-radius: 123px;
+  border-image-outset: 123;
+  border-image-repeat: round;
+  border-image-slice: 123;
+  border-image-source: url("#ref");
+  border-image-width: 123px;
+  border-inline-end: 123px dashed #123;
+  border-inline-start: 123px dashed #123;
+  border-left: 123px dashed #123;
+  border-radius: 123px;
+  border-right: 123px dashed #123;
+  border-start-end-radius: 123px;
+  border-start-start-radius: 123px;
+  border-spacing: 123px;
+  border-top: 123px dashed #123;
+  bottom: 123px;
+  box-decoration-break: clone;
+  box-shadow: #123 123px 123px 123px 123px;
+  box-sizing: border-box;
+  break-after: avoid;
+  break-before: avoid;
+  break-inside: avoid;
+  buffered-rendering: static;
+  caption-side: bottom;
+  caret-color: #123;
+  clear: both;
+  clip: rect(123px, 123px, 123px, 123px);
+  clip-path: url("#ref");
+  clip-rule: evenodd;
+  color: #123;
+  color-interpolation: auto;
+  color-interpolation-filters: auto;
+  color-rendering: optimizespeed;
+  color-scheme: dark;
+  column-count: 123;
+  column-fill: auto;
+  column-gap: 123px;
+  column-rule-color: #123;
+  column-rule-style: dashed;
+  column-rule-width: 123px;
+  column-span: all;
+  column-width: 123px;
+  contain: size;
+  contain-intrinsic-block-size: 123px;
+  contain-intrinsic-inline-size: 123px;
+  contain-intrinsic-size: 123px 123px;
+  container-name: foo;
+  container-type: size;
+  content: "b";
+  counter-increment: add 123;
+  counter-reset: add 123;
+  counter-set: add 123;
+  cursor: none;
+  cx: 123px;
+  cy: 123px;
+  d: path("M 1 1");
+  direction: rtl;
+  display: flow-root;
+  dominant-baseline: middle;
+  empty-cells: hide;
+  fill: #123;
+  fill-opacity: 0.123;
+  fill-rule: evenodd;
+  filter: url("#ref");
+  flex-basis: 123px;
+  flex-direction: column;
+  flex-grow: 123;
+  flex-shrink: 123;
+  flex-wrap: wrap;
+  float: right;
+  flood-color: #123;
+  flood-opacity: 0.123;
+  font-family: "c";
+  font-feature-settings: "smcp";
+  font-kerning: none;
+  font-language-override: "d";
+  font-optical-sizing: none;
+  font-palette: dark;
+  font-size: 123px;
+  font-size-adjust: 123;
+  font-stretch: 123%;
+  font-style: italic;
+  font-synthesis: none;
+  font-variant-alternates: historical-forms;
+  font-variant-caps: small-caps;
+  font-variant-east-asian: full-width;
+  font-variant-ligatures: none;
+  font-variant-numeric: tabular-nums;
+  font-variant-position: super;
+  font-variation-settings: "smcp" 1;
+  font-weight: 123;
+  glyph-orientation-horizontal: 123deg;
+  glyph-orientation-vertical: 123deg;
+  grid-auto-columns: 123px;
+  grid-auto-flow: column;
+  grid-auto-rows: 123px;
+  grid-column-end: 123;
+  grid-column-start: 123;
+  grid-row-end: 123;
+  grid-row-start: 123;
+  grid-template-areas: ".";
+  grid-template-columns: 123fr;
+  grid-template-rows: 123fr;
+  hanging-punctuation: first;
+  height: 123px;
+  hyphenate-character: "e";
+  hyphens: auto;
+  image-orientation: none;
+  image-rendering: pixelated;
+  ime-mode: normal;
+  initial-letter: 123;
+  inline-size: 123px;
+  input-security: none;
+  inset-block-end: 123px;
+  inset-block-start: 123px;
+  inset-inline-end: 123px;
+  inset-inline-start: 123px;
+  isolation: isolate;
+  justify-content: center;
+  justify-items: baseline;
+  justify-self: baseline;
+  justify-tracks: center;
+  kerning: 123px;
+  left: 123px;
+  letter-spacing: 123px;
+  lighting-color: #123;
+  line-break: anywhere;
+  line-height: 123px;
+  line-height-step: 123px;
+  list-style-image: url("#ref");
+  list-style-position: inside;
+  list-style-type: square;
+  margin-block-end: 123px;
+  margin-block-start: 123px;
+  margin-bottom: 123px;
+  margin-inline-end: 123px;
+  margin-inline-start: 123px;
+  margin-left: 123px;
+  margin-right: 123px;
+  margin-top: 123px;
+  marker-end: url("#ref");
+  marker-mid: url("#ref");
+  marker-start: url("#ref");
+  mask-clip: content-box;
+  mask-composite: exclude;
+  mask-image: url("#ref");
+  mask-mode: alpha;
+  mask-origin: content-box;
+  mask-position-x: 123px;
+  mask-position-y: 123px;
+  mask-repeat: round;
+  mask-size: 123px;
+  mask-type: alpha;
+  masonry-auto-flow: ordered;
+  math-depth: 123;
+  math-shift: compact;
+  math-style: compact;
+  max-block-size: 123px;
+  max-height: 123px;
+  max-inline-size: 123px;
+  max-width: 123px;
+  min-block-size: 123px;
+  min-height: 123px;
+  min-inline-size: 123px;
+  min-width: 123px;
+  mix-blend-mode: overlay;
+  object-fit: contain;
+  object-overflow: visible;
+  object-position: 123px 123%;
+  object-view-box: inset(123px);
+  offset-anchor: 123px 123%;
+  offset-distance: 123px;
+  offset-path: path("M 1 1");
+  offset-position: 123px;
+  offset-rotate: 123deg;
+  opacity: 0.123;
+  order: 123;
+  orphans: 123;
+  outline-color: #123;
+  outline-offset: 123px;
+  outline-style: auto;
+  outline-width: 123px;
+  overflow-anchor: none;
+  overflow-block: auto;
+  overflow-clip-margin: 123px;
+  overflow-inline: hidden;
+  overflow-wrap: anywhere;
+  overflow-x: auto;
+  overflow-y: hidden;
+  overscroll-behavior-block: contain;
+  overscroll-behavior-inline: contain;
+  overscroll-behavior-x: contain;
+  overscroll-behavior-y: contain;
+  padding-block-end: 123px;
+  padding-block-start: 123px;
+  padding-bottom: 123px;
+  padding-inline-end: 123px;
+  padding-inline-start: 123px;
+  padding-left: 123px;
+  padding-right: 123px;
+  padding-top: 123px;
+  paint-order: fill;
+  perspective: 123px;
+  perspective-origin: 123px 123%;
+  pointer-events: all;
+  position: relative;
+  print-color-adjust: exact;
+  quotes: none;
+  r: 123px;
+  resize: both;
+  right: 123px;
+  rotate: 123deg;
+  row-gap: 123px;
+  ruby-align: center;
+  ruby-position: under;
+  rx: 123px;
+  ry: 123px;
+  scale: 123;
+  scroll-behavior: smooth;
+  scroll-margin-block-end: 123px;
+  scroll-margin-block-start: 123px;
+  scroll-margin-bottom: 123px;
+  scroll-margin-inline-end: 123px;
+  scroll-margin-inline-start: 123px;
+  scroll-margin-left: 123px;
+  scroll-margin-right: 123px;
+  scroll-margin-top: 123px;
+  scroll-padding-block-end: 123px;
+  scroll-padding-block-start: 123px;
+  scroll-padding-bottom: 123px;
+  scroll-padding-inline-end: 123px;
+  scroll-padding-inline-start: 123px;
+  scroll-padding-left: 123px;
+  scroll-padding-right: 123px;
+  scroll-padding-top: 123px;
+  scroll-snap-align: center;
+  scroll-snap-stop: always;
+  scroll-snap-type: both;
+  scrollbar-color: #123 #123;
+  scrollbar-gutter: stable;
+  scrollbar-width: none;
+  shape-image-threshold: 123;
+  shape-margin: 123px;
+  shape-outside: border-box;
+  shape-rendering: optimizespeed;
+  speak: spell-out;
+  speak-as: spell-out;
+  stop-color: #123;
+  stop-opacity: 0.123;
+  stroke: #123;
+  stroke-color: #123;
+  stroke-dasharray: 123px;
+  stroke-dashoffset: 123px;
+  stroke-linecap: round;
+  stroke-linejoin: round;
+  stroke-miterlimit: 123;
+  stroke-opacity: 0.123;
+  stroke-width: 123px;
+  tab-size: 123;
+  table-layout: fixed;
+  text-align: center;
+  text-align-last: center;
+  text-anchor: middle;
+  text-combine-upright: all;
+  text-decoration-color: #123;
+  text-decoration-line: underline;
+  text-decoration-skip-ink: none;
+  text-decoration-style: dashed;
+  text-decoration-thickness: 123px;
+  text-emphasis-color: #123;
+  text-emphasis-position: under right;
+  text-emphasis-style: dot;
+  text-indent: 123px;
+  text-justify: none;
+  text-orientation: sideways;
+  text-overflow: ellipsis;
+  text-rendering: optimizespeed;
+  text-shadow: #123 123px 123px 123px;
+  text-size-adjust: none;
+  text-transform: lowercase;
+  text-underline-offset: 123px;
+  text-underline-position: under;
+  top: 123px;
+  touch-action: none;
+  transform: scale(-1);
+  transform-box: fill-box;
+  transform-origin: 123px 123px 123px;
+  transform-style: preserve-3d;
+  transition-delay: 123s;
+  transition-duration: 123s;
+  transition-property: add;
+  transition-timing-function: linear;
+  translate: 123px;
+  unicode-bidi: plaintext;
+  user-select: all;
+  vector-effect: non-scaling-stroke;
+  vertical-align: 123px;
+  visibility: collapse;
+  white-space: nowrap;
+  widows: 123;
+  width: 123px;
+  will-change: height;
+  word-break: break-word;
+  word-spacing: 123px;
+  word-wrap: break-word;
+  writing-mode: vertical-lr;
+  x: 123px;
+  y: 123px;
+  z-index: 123;
+  zoom: 123;
+}
+
+@layer layer1 {
+  /* Reset properties to their initial value */
+  #target {
+    all: initial;
+  }
+}
+
+@layer layer2 {
+  /* This will be populated with properties set to a non-initial value */
+  #target {}
+}
+
+@layer layer3 {
+  /* This should roll back to the values from the previous layer */
+  #target.rollback {
+    all: revert-layer;
+  }
+}
+</style>
+
+<div id="log"></div>
+
+<!-- This custom element is unlikely to get important UA styles -->
+<foo-bar id="target"></foo-bar>
+
+<script src=""
+<script src=""
+<script>
+const { sheet } = document.querySelector("style");
+const nonInitialStyle = sheet.cssRules[0].style;
+const layer2Style = sheet.cssRules[2].cssRules[0].style;
+
+const target = document.getElementById("target");
+const cs = getComputedStyle(target);
+
+// Some properties can be forced to compute to their initial value
+// unless another property is set to a certain value.
+function prerequisites(property) {
+  switch (property) {
+    case "border-block-end-width":
+    case "border-block-start-width":
+    case "border-bottom-width":
+    case "border-inline-end-width":
+    case "border-inline-start-width":
+    case "border-left-width":
+    case "border-right-width":
+    case "border-top-width":
+      return "border-style: solid";
+    case "column-rule-width":
+      return "column-rule-style: solid";
+    case "outline-width":
+      return "outline-style: solid";
+    case "rotate":
+    case "scale":
+    case "transform":
+    case "transform-style":
+    case "translate":
+      return "display: block";
+    default:
+      return "";
+  }
+}
+
+const initialValues = Object.create(null);
+for (let property of cs) {
+  if (!property.startsWith("-")) {
+    initialValues[property] = cs.getPropertyValue(property);
+  }
+}
+
+for (let property in initialValues) {
+  // Skip property if the stylesheet above doesn't provide a non-initial value.
+  // This is to avoid having to update the test every time a new CSS property is added.
+  const nonInitialValue = nonInitialStyle.getPropertyValue(property);
+  if (nonInitialValue === "") {
+    continue;
+  }
+
+  test(function() {
+    const initialValue = initialValues[property];
+    assert_not_equals(initialValue, "", "Should have the initial value.");
+
+    this.add_cleanup(() => {
+      layer2Style.cssText = "";
+      target.classList.remove("rollback");
+    });
+
+    layer2Style.cssText = prerequisites(property);
+    layer2Style.setProperty(property, nonInitialValue);
+    const changedValue = cs.getPropertyValue(property);
+    assert_not_equals(changedValue, initialValue, "Should get a different computed value.");
+
+    target.classList.add("rollback");
+    const revertedValue = cs.getPropertyValue(property);
+    assert_equals(revertedValue, changedValue, "Layer 3 should rollback to layer 2.");
+  }, property);
+}
+</script>

Added: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt (0 => 293485)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-04-27 00:19:14 UTC (rev 293485)
@@ -0,0 +1,335 @@
+
+PASS accent-color
+PASS align-content
+PASS align-items
+PASS align-self
+PASS alignment-baseline
+PASS alt
+PASS animation-composition
+PASS animation-delay
+PASS animation-direction
+PASS animation-duration
+PASS animation-fill-mode
+PASS animation-iteration-count
+PASS animation-name
+PASS animation-play-state
+PASS animation-timing-function
+PASS appearance
+PASS aspect-ratio
+PASS backface-visibility
+PASS background-attachment
+PASS background-blend-mode
+PASS background-clip
+PASS background-color
+PASS background-image
+PASS background-origin
+PASS background-position-x
+PASS background-position-y
+PASS background-repeat
+PASS background-size
+PASS baseline-shift
+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
+PASS border-bottom-style
+PASS border-bottom-width
+PASS border-collapse
+PASS border-end-end-radius
+PASS border-end-start-radius
+PASS border-image-outset
+PASS border-image-repeat
+PASS border-image-slice
+PASS border-image-source
+PASS border-image-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
+PASS border-right-color
+PASS border-right-style
+PASS border-right-width
+PASS border-start-end-radius
+PASS border-start-start-radius
+PASS border-top-color
+PASS border-top-left-radius
+PASS border-top-right-radius
+PASS border-top-style
+PASS border-top-width
+PASS bottom
+PASS box-shadow
+PASS box-sizing
+PASS break-after
+PASS break-before
+PASS break-inside
+PASS buffered-rendering
+PASS caption-side
+PASS caret-color
+PASS clear
+PASS clip
+PASS clip-path
+PASS clip-rule
+PASS color
+PASS color-interpolation
+PASS color-interpolation-filters
+PASS color-scheme
+PASS column-count
+PASS column-fill
+PASS column-gap
+PASS column-rule-color
+PASS column-rule-style
+PASS column-rule-width
+PASS column-span
+PASS column-width
+PASS contain
+PASS contain-intrinsic-block-size
+PASS contain-intrinsic-height
+PASS contain-intrinsic-inline-size
+PASS contain-intrinsic-width
+PASS container-name
+PASS container-type
+PASS content
+PASS counter-increment
+PASS counter-reset
+PASS cursor
+PASS cx
+PASS cy
+PASS direction
+PASS display
+PASS dominant-baseline
+PASS empty-cells
+PASS fill
+PASS fill-opacity
+PASS fill-rule
+PASS filter
+PASS flex-basis
+PASS flex-direction
+PASS flex-grow
+PASS flex-shrink
+PASS flex-wrap
+PASS float
+PASS flood-color
+PASS flood-opacity
+PASS font-family
+PASS font-feature-settings
+PASS font-kerning
+PASS font-optical-sizing
+PASS font-palette
+PASS font-size
+PASS font-stretch
+PASS font-style
+PASS font-synthesis
+PASS font-variant-alternates
+PASS font-variant-caps
+PASS font-variant-east-asian
+PASS font-variant-ligatures
+PASS font-variant-numeric
+PASS font-variant-position
+PASS font-variation-settings
+PASS font-weight
+PASS glyph-orientation-horizontal
+PASS glyph-orientation-vertical
+PASS grid-auto-columns
+PASS grid-auto-flow
+PASS grid-auto-rows
+PASS grid-column-end
+PASS grid-column-start
+PASS grid-row-end
+PASS grid-row-start
+PASS grid-template-areas
+PASS grid-template-columns
+PASS grid-template-rows
+PASS hanging-punctuation
+PASS height
+PASS image-orientation
+PASS image-rendering
+PASS inline-size
+PASS input-security
+PASS inset-block-end
+PASS inset-block-start
+PASS inset-inline-end
+PASS inset-inline-start
+PASS isolation
+PASS justify-content
+PASS justify-items
+PASS justify-self
+PASS kerning
+PASS left
+PASS letter-spacing
+PASS lighting-color
+PASS line-break
+PASS line-height
+PASS list-style-image
+PASS list-style-position
+PASS list-style-type
+PASS margin-block-end
+PASS margin-block-start
+PASS margin-bottom
+PASS margin-inline-end
+PASS margin-inline-start
+PASS margin-left
+PASS margin-right
+PASS margin-top
+PASS marker-end
+PASS marker-mid
+PASS marker-start
+FAIL mask-clip assert_not_equals: Should get a different computed value. got disallowed value "border-box"
+FAIL mask-composite assert_not_equals: Should get a different computed value. got disallowed value "add"
+PASS mask-image
+FAIL mask-mode assert_not_equals: Should get a different computed value. got disallowed value "match-source"
+PASS mask-origin
+PASS mask-repeat
+PASS mask-size
+PASS mask-type
+PASS math-style
+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
+PASS object-position
+PASS offset-anchor
+PASS offset-distance
+PASS offset-path
+PASS offset-position
+PASS offset-rotate
+PASS opacity
+PASS order
+PASS orphans
+PASS outline-color
+PASS outline-offset
+PASS outline-style
+PASS outline-width
+FAIL overflow-wrap assert_not_equals: Should get a different computed value. got disallowed value "normal"
+PASS overflow-x
+PASS overflow-y
+PASS overscroll-behavior-x
+PASS overscroll-behavior-y
+PASS padding-block-end
+PASS padding-block-start
+PASS padding-bottom
+PASS padding-inline-end
+PASS padding-inline-start
+PASS padding-left
+PASS padding-right
+PASS padding-top
+PASS page-break-after
+PASS page-break-before
+PASS page-break-inside
+PASS paint-order
+PASS perspective
+FAIL perspective-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL perspective-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+PASS pointer-events
+PASS position
+PASS print-color-adjust
+PASS quotes
+PASS r
+PASS resize
+PASS right
+PASS rotate
+PASS row-gap
+PASS rx
+PASS ry
+PASS scale
+PASS scroll-margin-block
+PASS scroll-margin-bottom
+PASS scroll-margin-inline
+PASS scroll-margin-left
+PASS scroll-margin-right
+PASS scroll-margin-top
+PASS scroll-padding-block
+PASS scroll-padding-bottom
+PASS scroll-padding-inline
+PASS scroll-padding-left
+PASS scroll-padding-right
+PASS scroll-padding-top
+PASS scroll-snap-align
+PASS scroll-snap-stop
+PASS scroll-snap-type
+PASS shape-image-threshold
+PASS shape-margin
+PASS shape-outside
+PASS shape-rendering
+PASS speak-as
+PASS stop-color
+PASS stop-opacity
+PASS stroke
+PASS stroke-color
+PASS stroke-dasharray
+PASS stroke-dashoffset
+PASS stroke-linecap
+PASS stroke-linejoin
+PASS stroke-miterlimit
+PASS stroke-opacity
+PASS stroke-width
+PASS tab-size
+PASS table-layout
+PASS text-align
+PASS text-anchor
+FAIL text-combine-upright assert_not_equals: Should get a different computed value. got disallowed value "none"
+PASS text-decoration
+PASS text-decoration-color
+PASS text-decoration-line
+PASS text-decoration-skip
+PASS text-decoration-skip-ink
+PASS text-decoration-style
+PASS text-decoration-thickness
+PASS text-emphasis-color
+PASS text-emphasis-position
+PASS text-emphasis-style
+PASS text-indent
+PASS text-orientation
+PASS text-overflow
+PASS text-rendering
+PASS text-shadow
+PASS text-transform
+PASS text-underline-offset
+PASS text-underline-position
+PASS top
+PASS touch-action
+PASS transform
+PASS transform-box
+FAIL transform-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-origin-z assert_not_equals: Should have the initial value. got disallowed value ""
+FAIL transform-style assert_not_equals: Should get a different computed value. got disallowed value "flat"
+PASS transition-delay
+PASS transition-duration
+PASS transition-property
+PASS transition-timing-function
+PASS translate
+PASS unicode-bidi
+PASS user-select
+PASS vector-effect
+PASS vertical-align
+PASS visibility
+PASS white-space
+PASS widows
+PASS width
+PASS will-change
+PASS word-break
+PASS word-spacing
+PASS word-wrap
+PASS writing-mode
+PASS x
+PASS y
+PASS z-index
+PASS zoom
+

Modified: trunk/Source/WebCore/ChangeLog (293484 => 293485)


--- trunk/Source/WebCore/ChangeLog	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/Source/WebCore/ChangeLog	2022-04-27 00:19:14 UTC (rev 293485)
@@ -1,3 +1,29 @@
+2022-04-26  Oriol Brufau  <[email protected]>
+
+        [css-cascade] Fix cascade rollback for deferred properties
+        https://bugs.webkit.org/show_bug.cgi?id=238125
+
+        Reviewed by Antti Koivisto.
+
+        When a deferred property was set to 'revert' or 'revert-layer', it used
+        to roll back to a declaration of the same exact property (or behave as
+        'unset' if none).
+
+        This patch lets deferred properties roll back to their related property,
+        e.g. '-webkit-box-shadow: revert-layer' can roll back to a 'box-shadow'
+        declaration in the previous layer.
+
+        This is consistent with logical and physical properties, where the
+        rollback happens after resolving logical properties.
+
+        Test: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html
+
+        * style/PropertyCascade.cpp:
+        (WebCore::Style::PropertyCascade::lastDeferredPropertyResolvingRelated const):
+        * style/PropertyCascade.h:
+        * style/StyleBuilder.cpp:
+        (WebCore::Style::Builder::applyProperty):
+
 2022-04-26  Elliott Williams  <[email protected]>
 
         Fix build error: "cp: _javascript_Core.profdata is not a directory"

Modified: trunk/Source/WebCore/style/PropertyCascade.cpp (293484 => 293485)


--- trunk/Source/WebCore/style/PropertyCascade.cpp	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/Source/WebCore/style/PropertyCascade.cpp	2022-04-27 00:19:14 UTC (rev 293485)
@@ -154,6 +154,23 @@
     setPropertyInternal(property, id, cssValue, matchedProperties, cascadeLevel);
 }
 
+const PropertyCascade::Property* PropertyCascade::lastDeferredPropertyResolvingRelated(CSSPropertyID propertyID) const
+{
+    auto relatedID = getRelatedPropertyId(propertyID);
+    if (relatedID == CSSPropertyInvalid) {
+        ASSERT_NOT_REACHED();
+        return hasDeferredProperty(propertyID) ? &deferredProperty(propertyID) : nullptr;
+    }
+    auto indexForPropertyID = deferredPropertyIndex(propertyID);
+    auto indexForRelatedID = deferredPropertyIndex(relatedID);
+    if (indexForPropertyID > indexForRelatedID)
+        return &deferredProperty(propertyID);
+    if (indexForPropertyID < indexForRelatedID)
+        return &deferredProperty(relatedID);
+    ASSERT(!hasDeferredProperty(propertyID));
+    ASSERT(!hasDeferredProperty(relatedID));
+    return nullptr;
+}
 
 bool PropertyCascade::addMatch(const MatchedProperties& matchedProperties, CascadeLevel cascadeLevel, bool important)
 {

Modified: trunk/Source/WebCore/style/PropertyCascade.h (293484 => 293485)


--- trunk/Source/WebCore/style/PropertyCascade.h	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/Source/WebCore/style/PropertyCascade.h	2022-04-27 00:19:14 UTC (rev 293485)
@@ -64,6 +64,7 @@
 
     bool hasDeferredProperty(CSSPropertyID) const;
     const Property& deferredProperty(CSSPropertyID) const;
+    const Property* lastDeferredPropertyResolvingRelated(CSSPropertyID) const;
 
     bool hasCustomProperty(const AtomString&) const;
     Property customProperty(const AtomString&) const;

Modified: trunk/Source/WebCore/style/StyleBuilder.cpp (293484 => 293485)


--- trunk/Source/WebCore/style/StyleBuilder.cpp	2022-04-26 23:44:58 UTC (rev 293484)
+++ trunk/Source/WebCore/style/StyleBuilder.cpp	2022-04-27 00:19:14 UTC (rev 293485)
@@ -322,9 +322,8 @@
                     applyRollbackCascadeProperty(property, linkMatchMask);
                     return;
                 }
-            } else if (rollbackCascade->hasDeferredProperty(id)) {
-                auto& property = rollbackCascade->deferredProperty(id);
-                applyRollbackCascadeProperty(property, linkMatchMask);
+            } else if (auto* property = rollbackCascade->lastDeferredPropertyResolvingRelated(id)) {
+                applyRollbackCascadeProperty(*property, linkMatchMask);
                 return;
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to