Closed Bug 1847546 Opened 11 months ago Closed 11 months ago

Don't do duplicate work on style elements from the innerHTML setter.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
118 Branch
Tracking Status
firefox118 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(3 files)

No description provided.

Right now, when binding to the tree we queue a runnable to update the
stylesheet, even though mEnableUpdates is false.

Even though the redundant update is nowadays always cached, it's just
wasted work, and the code is simpler without it.

This will be tested by bug 1771113, which is what made me look at this.

We need to tweak a bit the dispatch of applicable state change events
for DevTools, because for a case like:

div.attachShadow({ mode: "open" }).innerHTML = <style>...</style>;

Before we'd go through the stylesheet cache here due to the redundant
update:

https://searchfox.org/mozilla-central/rev/fb43eb3bdf5b51000bc7dfe3474cbe56ca2ab63c/layout/style/SharedStyleSheetCache.cpp#161-165

But now we won't, and the code in StyleSheet.cpp wasn't quite correct /
didn't dispatch the event.

Nobody listens to style-sheet-applicable-state-changed, so remove that
code while at it.

Blocks: 1771113
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9333c1c9a5e7
Don't do duplicate work on style elements from the innerHTML setter. r=smaug

Remove useless namespacing, we have an using statement in the file
anyways.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8444a955cd4a
Clean-up nsHtml5TreeOperation::CreateHTMLElement. r=smaug
Blocks: 1847715
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c085100a9a96
Other misc nsHtml5TreeOperation clean-ups. r=smaug
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
Regressions: 1848455
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: