Closed Bug 1626700 Opened 4 years ago Closed 4 years ago

[wpt-sync] Sync PR 22614 - Support reverting to/from css-logical properties

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 22614 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/22614
Details from upstream follow.

Anders Hartvoll Ruud <andruud@chromium.org> wrote:

Support reverting to/from css-logical properties

The properties defined by css-logical (and more generally surrogates)
pose a hard problem for 'revert' in the StyleCascade, because
declarations such as 'margin-bottom:revert' may actually need to revert
to a different property in the previous origin (e.g. margin-block-end).

An example is the h1 element, which is styled by html.css using
css-logical properties. When the author then reverts using a
corresponding physical property, we can't simply look up the cascaded
value for that same physical property in the UA origin: we must be
aware that the css-logical property won the cascade at that level.

So when we we're applying an author declaration 'margin-bottom:revert',
we have to find the target property for the revert, which is either
margin-bottom (if that property won the cascade at the target origin),
or the corresponding css-logical property. However, to find the target
property, we need to know during the application of margin-bottom that
a corresponding logical property (surrogate) needs to be taken into
account. AutoSurrogateScope was created for this purpose, which sets
(and resets) a "current surrogate" field on CascadeResolver. This
current surrogate is used when resolving reverts, in order to find
the correct target property.

Also, we don't control the order in which physical/logical properties
are applied. This means we could be applying the physical property
first, which is unaware of any logical properties that should have been
taken into account for revert. In other words, if we apply
'margin-bottom:revert' without the context of a "current surrogate" set,
we'll fall back to unconditionally using margin-bottom as the target
property, which may be incorrect if there also exists a logical
property we'll get to later. This is why the force-reapply code exists:
when both the physical and logical property exists in the cascade,
the physical property must be applied (or re-applied) during
AutoSurrogateScope, otherwise revert will not behave correctly.

Bug: 579788
Change-Id: I864a4c9afdd94f130c42635d28d45c843d5fb617
Reviewed-on: https://chromium-review.googlesource.com/2130850
WPT-Export-Revision: 24bffd1a19025b2192e29caa96bdb024db6a07fc

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/336845ffc8f2
[wpt PR 22614] - Support reverting to/from css-logical properties, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.