Граф коммитов

221 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez b800731028 Bug 1655751 - Invalidate for CSSOM changes in a more fine-grained way. r=heycam
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
2020-08-10 18:00:44 +00:00
Sylvestre Ledru caf785c695 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D82178
2020-07-04 09:38:43 +00:00
Simon Giesecke cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Emilio Cobos Álvarez 7649856b1f Bug 1649197 - Remove StyleSheet::UnparentChildren. r=nordzilla
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
2020-06-29 18:41:20 +00:00
Emilio Cobos Álvarez 67f90f0a9e Bug 1648736 - Don't mark a load as performed on a given document until it has actually finished. r=heycam
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
2020-06-29 17:29:06 +00:00
Emilio Cobos Álvarez 8c691e51cb Bug 1646776 - Don't set an URL for pending constructable stylesheet parses. r=heycam
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
2020-06-23 02:54:58 +00:00
Emilio Cobos Álvarez 901e5fd0d7 Bug 1645180 - Don't under-report use counters for documents that hit the shared sheet cache. r=firefox-style-system-reviewers,heycam
This makes us refactor a bit more our setup but I think the end it's
worth it.

Differential Revision: https://phabricator.services.mozilla.com/D79377
2020-06-13 02:03:08 +00:00
Emilio Cobos Álvarez f3e71a1931 Bug 1599160 - Allow caching stylesheets across documents. r=heycam
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
2020-06-12 19:31:32 +00:00
Razvan Maries 7b30d6e82e Backed out 7 changesets (bug 1599160) for damp failures. CLOSED TREE
Backed out changeset edb0e17f3c98 (bug 1599160)
Backed out changeset 64b42ac358e6 (bug 1599160)
Backed out changeset ce1521b895e1 (bug 1599160)
Backed out changeset 0b0ff0ad8db7 (bug 1599160)
Backed out changeset c7ef05dae614 (bug 1599160)
Backed out changeset 466cfd0ad5db (bug 1599160)
Backed out changeset b3f28494f0e7 (bug 1599160)
2020-06-12 02:40:38 +03:00
Emilio Cobos Álvarez 208b60eed2 Bug 1599160 - Allow caching stylesheets across documents. r=heycam
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
2020-06-11 11:42:46 +00:00
Emilio Cobos Álvarez 5f15c64dda Bug 1642224 - Make sheet loads always have a sensible triggering principal. r=ckerschb
I'm going to need to always have a principal at hand for bug 1599160,
and this helps with that.

This fixes the assumptions in the comment here:

  https://searchfox.org/mozilla-central/rev/5e4d4827aa005d031580d2d17a01bae1af138b2e/layout/style/Loader.cpp#1408-1411

Which are not always true I think.

In particular, we may not always do a non-system load without an
associated DOM node. For link headers, we use the document loader, but
there's no DOM node to get a hand to. In those cases, before this patch
we're currently loading using the system principal, which seems wrong.

Differential Revision: https://phabricator.services.mozilla.com/D77614
2020-06-08 09:11:26 +00:00
Cameron McCormack 1e8189c0f1 Bug 1640537 - Improve style sheet dumping in the layout debugger. r=TYLin
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
2020-05-26 23:07:36 +00:00
Emilio Cobos Álvarez c3b7227771 Bug 1639392 - Merge nsIStyleSheetLinkingElement and nsStyleLinkElement, and call it LinkStyle. r=jwatt
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
2020-05-21 03:07:16 +00:00
Emilio Cobos Álvarez ed46f1f078 Bug 1636974 - Make SheetLoadData know whether it's a preload on construction. r=mayhemer
And make a bunch of other stuff const while at it.

Differential Revision: https://phabricator.services.mozilla.com/D74860
2020-05-12 16:36:11 +00:00
Razvan Maries d70a3f8735 Backed out 2 changesets (bug 1636974) for wpt perma failures at subresource-integrity.html. CLOSED TREE
Backed out changeset 74820b124af2 (bug 1636974)
Backed out changeset f53ceddd5fe3 (bug 1636974)
2020-05-12 22:46:15 +03:00
Emilio Cobos Álvarez d17a489ef0 Bug 1636974 - Make SheetLoadData know whether it's a preload on construction. r=mayhemer
And make a bunch of other stuff const while at it.

Differential Revision: https://phabricator.services.mozilla.com/D74860
2020-05-12 16:36:11 +00:00
Cameron McCormack 3ccaaa0422 Bug 1621773 - Gracefully handle errors creating shared memory UA style sheets. r=emilio
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
2020-05-11 00:11:45 +00:00
Erik Nordin 2060006fba Bug 1632686 - Retain GlobalObject in StyleSheets r=emilio
- 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
2020-05-01 17:08:54 +00:00
Erik Nordin 83744c8b4d Bug 1626005 - Fix crash when non-constructed sheets call replace() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D71399
2020-04-24 17:42:22 +00:00
Emilio Cobos Álvarez c7992b8656 Bug 1449522 - Cleanup some parent walks in StyleSheet code. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D71410
2020-04-17 22:55:03 +00:00
Emilio Cobos Álvarez 5f95854d9b Bug 1449522 - Clean up stylesheet association modes. r=nordzilla
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
2020-04-17 22:54:55 +00:00
Emilio Cobos Álvarez 63dce710f2 Bug 1630835 - Don't propagate associated document or shadow root to child sheets. r=nordzilla
This should have no behavior change, but makes the setup simpler and
more similar to the constructable sheets.

Differential Revision: https://phabricator.services.mozilla.com/D71262
2020-04-17 22:54:35 +00:00
Emilio Cobos Álvarez 1f3abc7835 Bug 1630837 - Optimize CC of rules from constructable stylesheets. r=smaug,nordzilla
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
2020-04-17 21:12:11 +00:00
Erik Nordin 65e0b8ff27 Bug 1629994 - Minor Code Changes Constructable StyleSheets r=emilio
These are a collection of minor changes that have no effect on the behavior of the code.

Differential Revision: https://phabricator.services.mozilla.com/D71093
2020-04-17 16:34:38 +00:00
Erik Nordin dbc1240152 Bug 1629596 - Rename mParent to mParentSheet r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D70705

--HG--
extra : moz-landing-system : lando
2020-04-13 20:49:32 +00:00
Erik Nordin ca4fa23626 Bug 1621415 - Ensure adopted styles are applied when printing r=emilio
- 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
2020-03-24 22:54:18 +00:00
Razvan Maries a2e3903c68 Backed out changeset c0235b7bddcc (bug 1621415) for Mochitest perma failures on test_printpreview.xhtml. CLOSED TREE 2020-03-14 02:52:09 +02:00
Erik Nordin b6f5189943 Bug 1621415 - Ensure adopted styles are applied when printing r=emilio
- 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
2020-03-13 21:20:22 +00:00
Erik Nordin 17dbae2125 Bug 1613511 - Disallow @import rules for all Constructable StyleSheets functions r=emilio
- 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
2020-03-12 18:11:09 +00:00
Erik Nordin 8e777fed4b Bug 1608489 - Add relative semantics for baseURL r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D65373

--HG--
extra : moz-landing-system : lando
2020-03-04 23:39:33 +00:00
Erik Nordin 8fe2efa8d6 Bug 1608489 - Add baseURL constructor option for CSSStyleSheet r=emilio
- Add baseURL constructor option for CSSStyleSheet WebIDL
- Resolve baseURL in CSSStyleSheet WebIDL Constructor
- Add WPTs for custom URL, default URL, invalid URL

Differential Revision: https://phabricator.services.mozilla.com/D65048

--HG--
extra : moz-landing-system : lando
2020-03-04 18:34:35 +00:00
Erik Nordin 5694c83b80 Bug 1613748 - Ensure that children of constructed stylesheets resolve the correct associated document r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D64839

--HG--
extra : moz-landing-system : lando
2020-03-02 17:46:24 +00:00
Erik Nordin b57e52d440 Bug 1618394 - Remove alternate and title from CSSStyleSheet constructor options r=emilio
- 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
2020-02-27 00:43:38 +00:00
Erik Nordin b837c381bc Bug 1613746 - Implement Replace() Functionality r=emilio
- 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
2020-02-22 20:41:30 +00:00
Erik Nordin 9f804f290f Bug 1613746 - Update Replace() WebIDL to take UTF8String -- r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D62127

--HG--
extra : moz-landing-system : lando
2020-02-19 01:00:15 +00:00
Erik Nordin 14304c1fdf Bug 1609288 - Apply styles from adopted stylesheets r=emilio
- 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
2020-02-15 01:16:46 +00:00
Simon Giesecke b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
shindli 91aa0518dd Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Boris Zbarsky 747a4d9f0a Bug 1613013 part 1. Annotate DOMExceptions from WebIDL implementations with the method they come from. r=peterv
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
2020-02-06 21:16:10 +00:00
Boris Zbarsky c8713bf40a Bug 1612444. Improve some error messages for exceptions in layout. r=emilio
I used ThrowNotSupportedError for the not-implemented case.

Differential Revision: https://phabricator.services.mozilla.com/D61324

--HG--
extra : moz-landing-system : lando
2020-02-03 20:35:54 +00:00
Boris Zbarsky b88d5ac5a8 Bug 1612213 part 1. Switch most consumers of ThrowDOMException to the new methods. r=smaug,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D61267

--HG--
extra : moz-landing-system : lando
2020-02-03 20:19:11 +00:00
Emilio Cobos Álvarez cf6728cdd2 Bug 1610059 - Rename Document::SetStyleSheetApplicableState. r=nordzilla
It doesn't set anything, it is just a notification callback.

Differential Revision: https://phabricator.services.mozilla.com/D60336

--HG--
extra : moz-landing-system : lando
2020-01-22 01:14:42 +00:00
nordzilla 5465ed1ec0 Bug 1607268 - Implement replaceSync() Functionality r=emilio,bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D58881

--HG--
extra : moz-landing-system : lando
2020-01-14 22:34:40 +00:00
Emilio Cobos Álvarez dcdba4a9bd Bug 1608907 - Remove layout.css.parsing.parallel. r=jwatt
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
2020-01-13 22:38:29 +00:00
Emilio Cobos Álvarez 86a70df5d7 Bug 1607006 - Remove utf-16 versions of nsCSSProps::LookupProperty* and ServoCSSParser::ComputeColor. r=bzbarsky
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
2020-01-08 01:21:30 +00:00
nordzilla 7579f1a3b7 Bug 1606727 - Implement CSSStyleSheet Constructor r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D58569

--HG--
extra : moz-landing-system : lando
2020-01-07 00:19:53 +00:00
nordzilla e85b170e10 Bug 1604296 - Add Constructable StyleSheets API Under Preference r=emilio,bzbarsky
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
2019-12-31 21:58:40 +00:00
Mihai Alexandru Michis 2f43e04863 Backed out changeset 6e675d6399ce (bug 1604296) for causing failures in layout/style tests. 2020-01-01 02:05:30 +02:00
nordzilla a8096f6948 Bug 1604296 - Add Constructable StyleSheets API Under Preference r=emilio,bzbarsky
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
2019-12-31 21:58:40 +00:00