Also, for changes in CSS declarations, like changing
cssRules[i].style.color or something, we end up avoiding a lot of the
work we were doing.
This page still trips us in the sense that they add a stylesheet, then
call getBoundingClientRect(), then insert more rules in the stylesheet,
which causes us to rebuild a lot of the cascade data.
We could try to detect appends to the last stylesheet on the list or
something I guess, and avoid rebuilding the cascade data in some cases.
Depends on D85615
Differential Revision: https://phabricator.services.mozilla.com/D85616
It leaves parent pointers nulled out when it really shouldn't when
cloning shared sheets (if there's another suitable parent, we should use
that instead of nulling out).
Fix the code in StyleSheetInfo::RemoveSheet to handle all cases
(including nulling out when removing the only remaining sheet), and rely
on that instead.
Differential Revision: https://phabricator.services.mozilla.com/D81569
Consider the case where we have an expired entry in the cache, and we
load a new document.
We get an speculative load from the HTML parser. That's great, and we
see the entry is expired and actually fired the load.
But then, we actually get to the load that the <link> element performs,
and we see that we've already performed this load, so instead of peeking
the in-progress load, we go ahead and peek the expired "complete" cache
entry, which is not what we want.
By marking a load as performed only once it has finished, we avoid the
complete sheet cache, and glom onto the existing load instead, which is
the correct thing to do.
Differential Revision: https://phabricator.services.mozilla.com/D81318
This shouldn't have any behavior change, but it makes the code make a
bit more sense. Rather than counting inline stylesheets like a pending
load, we won't (but note that any @import inside it will).
The SheetLoadData::mURL it's supposed to be the url of the stylesheet,
so for StyleSheet::Replace it should be null.
Differential Revision: https://phabricator.services.mozilla.com/D80379
This patch implements a per-process cache of parsed stylesheets for
non-inline sheets. The entries are evicted when the document gets
destroyed and there's no other document with the same principal around.
This works fine in practice even when navigating because CC happens
pretty late, but we could add an extra timer if we deem it worth it.
I had to adapt some tests so that they keep passing. They were already
clearing various image / network caches so it seems fine to also clear
this one.
Note that there's a very subtle change in the load data key: We only
miss the cache if the referrer _policy_ is different, not if the
referrer is different. While that is slightly dubious, that is the only
think that makes this effort somewhat worth it. Otherwise stylesheets
would have to be re-fetched if the referrer is different, which
effectively would mean to re-parse it if the document URI is different,
which is bad.
It seems like the network cache only keys on the referrer policy, so it
seems fine to do the same.
Differential Revision: https://phabricator.services.mozilla.com/D77457
This patch implements a per-process cache of parsed stylesheets for
non-inline sheets. The entries are evicted when the document gets
destroyed and there's no other document with the same principal around.
This works fine in practice even when navigating because CC happens
pretty late, but we could add an extra timer if we deem it worth it.
I had to adapt some tests so that they keep passing. They were already
clearing various image / network caches so it seems fine to also clear
this one.
Note that there's a very subtle change in the load data key: We only
miss the cache if the referrer _policy_ is different, not if the
referrer is different. While that is slightly dubious, that is the only
think that makes this effort somewhat worth it. Otherwise stylesheets
would have to be re-fetched if the referrer is different, which
effectively would mean to re-parse it if the document URI is different,
which is bad.
It seems like the network cache only keys on the referrer policy, so it
seems fine to do the same.
Differential Revision: https://phabricator.services.mozilla.com/D77457
Make it show the contents of style sheets (as it used to before Stylo)
and make it work in --disable-debug --enable-layout-debugger builds.
Differential Revision: https://phabricator.services.mozilla.com/D76640
Which is the spec term. nsIStyleSheetLinkingElement is even more
confusing since it may not be an element at all (see: processing
instructions).
Differential Revision: https://phabricator.services.mozilla.com/D76071
We still panic in a debug build, so that developers can notice when they
need to add a new static atom after modifying UA sheets.
We also add telemetry to note when this happens, add an app note to a
crash report, in case any crash later on occurs, and re-up the existing,
expired shared memory sheet telemetry probes so we can look at them
again.
Differential Revision: https://phabricator.services.mozilla.com/D73188
- Add new data member StyleSheet::mParentObject
- Clone Sheets before adding them to nsXULPrototypeCache
- Return mParentObject from GetParentObject if non-null
Differential Revision: https://phabricator.services.mozilla.com/D72725
Should also have no behavior change.
After the previous patch we don't have sheets associated with a document but
not owned by it, so take advantage of that.
Differential Revision: https://phabricator.services.mozilla.com/D71264
This removes StyleSheet::GetComposedDoc because it wasn't doing the
right thing, and while constructable stylesheets _could_ in theory
return something meaningful (the constructor doc iff any adopters is
connected), it's not a concept we need in other places for now.
Differential Revision: https://phabricator.services.mozilla.com/D71261
- Add functionality to clone adopted style sheets for printing.
- Add reftest to ensure that the document's adopted styles show in print.
- Add reftest to ensure that a shadow root's adopted styles show in print.
Differential Revision: https://phabricator.services.mozilla.com/D66517
--HG--
extra : moz-landing-system : lando
- Add functionality to clone adopted style sheets for printing.
- Add reftest to ensure that the document's adopted styles show in print.
- Add reftest to ensure that a shadow root's adopted styles show in print.
Differential Revision: https://phabricator.services.mozilla.com/D66517
--HG--
extra : moz-landing-system : lando
- Add enum AllowImportRules to CSS parsing.
- `replaceSync()` will skip over @import rules and continue parsing.
- `replace()` will skip over @import rules and continue parsing.
- `insertRule()` will throw a syntax error on @import rules.
- Modify WPT test cases to reflect these changes.
Differential Revision: https://phabricator.services.mozilla.com/D61882
--HG--
extra : moz-landing-system : lando
- Remove `alternate` and `title` from the `CSSStyleSheetInit` struct.
- Remove all usages/assertions that involve `alternate` or `title` from WPTs.
- Add WPT test case ensuring that title cannot be set in the constructor.
Differential Revision: https://phabricator.services.mozilla.com/D64492
--HG--
extra : moz-landing-system : lando
- Enable StyleSheet to resolve/reject a promise from Replace()
- Implement the StyleSheet::Replace() method.
- Remove use of `alternate` in WPTs, because it will soon be gone.
- Ensure that WPT test cases which modify document's style clean up after themselves.
- Modify WPT @import test cases to handle unhandled cases on promises.
- Modify WPT test case for failed imports to correctly check `NetworkError` as per the spec, rather than `NotAllowedError`.
Differential Revision: https://phabricator.services.mozilla.com/D62524
--HG--
extra : moz-landing-system : lando
- Ensure that adopted styles are applied correctly to ShadowRoot
- Ensure that adopted styles are applied correctly to Document
- Add new WPT test cases to ensure the ordering of the styles.
Differential Revision: https://phabricator.services.mozilla.com/D60083
--HG--
extra : moz-landing-system : lando
This adds the name of the interface and method to the beginning of the exception
string when reporting the exception from Web IDL codegen, so it's clearer what
was called.
Some existing error messages are adjusted to not duplicate the information
about which method was called.
Differential Revision: https://phabricator.services.mozilla.com/D61521
--HG--
extra : moz-landing-system : lando
There's no reason to have this pref anymore, as we've shipped with it
successfully for quite a while.
Differential Revision: https://phabricator.services.mozilla.com/D59767
--HG--
extra : moz-landing-system : lando
Now that we have UTF8String in the WebIDL, we can remove quite a few of the
conversions. Do that, and lift the remaining string conversions up as needed.
Also deindent Servo_ComputeColor while touching it.
Most of the remaining copies are because either bug 1606994, or because they're
WebIDL attributes that we still need to serialize back as UTF-16 (bug 1606995).
Differential Revision: https://phabricator.services.mozilla.com/D58687
--HG--
extra : moz-landing-system : lando
This patch adds the following functionality to the CSSStyleSheet WebIDL API
under the feature flag layout.css.constructable-stylesheets.enabled:
- constructor()
- replace()
- replaceSync()
constructor(), replace() and replaceSync() are currently stubs that lack full
functionality.
Differential Revision: https://phabricator.services.mozilla.com/D58326
--HG--
extra : source : 6e675d6399cee28f204b3501de3475ea3febd12c
This patch adds the following functionality to the CSSStyleSheet WebIDL API
under the feature flag layout.css.constructable-stylesheets.enabled:
- constructor()
- replace()
- replaceSync()
constructor(), replace() and replaceSync() are currently stubs that lack full
functionality.
Differential Revision: https://phabricator.services.mozilla.com/D58326
--HG--
extra : moz-landing-system : lando