Closed Bug 1617746 Opened 5 years ago Closed 5 years ago

Handle Duplicate Adopted Style Sheets

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: nordzilla, Assigned: emilio)

References

Details

Attachments

(2 files)

The Constructable StyleSheets API (here) may require one style sheet to be represented in the same style set multiple times.

This is currently disallowed in Gecko, enforced via assertions that check the sheet's address as well as the style set's address.

We may want to update the uniqueness checks to an index-based system, rather than an address-based system, which would allow the same sheet to exist in the set in multiple places.

We should first investigate how difficult it may be to make this change.

Flags: needinfo?(emilio)
Summary: Modify style set to use indices instead of address counting → Modify style set to use indices instead of addresses

Removing unused arguments and so on.

The origin can always be inferred from the stylesheet so it wasn't being used.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

This also fixes some other bits, like mAdoptedStyleSheets.ElementAt(0) (which
really should be "the first applicable adopted stylesheet") and so on. Added a
test for that.

The new invariant also implies that a DocumentOrShadowRoot can't appear twice in
StyleSheet::mAdopters.

Also clears adopted stylesheets in Document::ResetStylesheetsToURI, as it's the
right thing to do (if you hit that code path with constructable sheets you'd end
up asserting, as we'd call FillStyleSetDocumentSheets after and find sheets in
there). I don't quite have a test-case for that though.

Depends on D64150

This is what I came up with. I think it's better than dealing with duplicates and such in the styleset, but let me know if you disagree :)

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3543162b815b Minor cleanup of ServoStyleSet. r=nordzilla https://hg.mozilla.org/integration/autoland/rev/6cb30e866b95 Deal with duplicate adopted stylesheets correctly. r=nordzilla
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21994 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR was closed without merging
Backout by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a546217f66bf Backed out 2 changesets assertion failures on ShadowRoot.cpp.

I'll land the first patch first so that I can land another patch that conflicts with it. Will double-check and wait for try for the second.

Keywords: leave-open
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/14987993bb33 Minor cleanup of ServoStyleSet. r=nordzilla https://hg.mozilla.org/integration/autoland/rev/6c64f7ad2c09 Deal with duplicate adopted stylesheets correctly. r=nordzilla
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Upstream PR merged by moz-wptsync-bot

Changed title to be more representative of the work done in this patch.

Summary: Modify style set to use indices instead of addresses → Handle Duplicate Adopted Style Sheets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: