Closed Bug 1732657 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 30923 - Let Node::ParentComputedStyle return nullptr for Document

Categories

(Core :: Layout: Generated Content, Lists, and Counters, task, P4)

task

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

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

Let Node::ParentComputedStyle return nullptr for Document

During Element::RecalcOwnStyle, we call ParentComputedStyle(), which
currently returns a non-nullptr ComputedStyle on the document element.
This suggests that we will or should inherit from that style, and
that is not right. Later in the style resolution process, we do
correctly use nullptr in most cases [1], but for the new highlight
code we set the parent override to ParentComputedStyle()'s result
directly, causing problems.

This CL:

  • Returns nullptr from ParentComputedStyle() if the parent is not
    an Element.
  • Moves ParentComputedStyle() to Element.
  • Allows pseudo-style-resolves without a parent override, since this
    is the correct thing to do for the new highlight pseudo behavior.
  • Fixes a bug where initial custom property values would not be
    available in :root::selection (etc). This is because those values
    are set up in InitialStyleForElement, and the highlight inheritance
    chain never used that function until now.

Note that there is a still an initial-value bug for ::selection (etc)
on non-:root, but a fix for that will come later.

[1] ElementResolveContext::ParentStyle, which checks for IsElementNode

Bug: 1024156
Change-Id: I3f0f2c1841cbe3e7ffeedb3a295b6f470957efc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3173223
Reviewed-by: Rune Lillesveen \<futhark@chromium.org>
Reviewed-by: Delan Azabani \<dazabani@igalia.com>
Commit-Queue: Anders Hartvoll Ruud \<andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#924262}

Component: web-platform-tests → Layout: Generated Content, Lists, and Counters
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests

Status Summary

Firefox

PASS: 1

Chrome

PASS: 1

Safari

PASS: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cc5bfd8b185a
[wpt PR 30923] - Let Node::ParentComputedStyle return nullptr for Document, a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.