- 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
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.
Differential Revision: https://phabricator.services.mozilla.com/D64151
--HG--
extra : moz-landing-system : lando
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.
Differential Revision: https://phabricator.services.mozilla.com/D64151
--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
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
We need to ensure we have a unique inner so that ruleLists and such have the
right pointer identity (we could do better, really, but it's harder).
But as long as the CSSOM hasn't modified them there should be no reason not to
use the cache. We can do a deep clone synchronously instead of refetching /
reparsing.
This is important because, as of right now, just using the inspector makes the
stylesheets unique, which is unfortunate.
We'll still have the modified rule bit for sheets with @import, because our
notification system for @import is silly, and on parents of imported sheets.
Fixing those are future improvements, but I see no reason not to land this.
Differential Revision: https://phabricator.services.mozilla.com/D55163
--HG--
extra : moz-landing-system : lando
Using an array is much better to reason about than a manually linked list, and
allows us to preserve @import order.
Added a test for a bug that we happened not to have, but that it's not covered
by existing WPT tests.
Differential Revision: https://phabricator.services.mozilla.com/D55565
--HG--
extra : moz-landing-system : lando
Test is hopefully self-explanatory. The children setup here is a bit bogus as
noted here and other comments, will file a followup to clean it up.
Differential Revision: https://phabricator.services.mozilla.com/D55550
--HG--
extra : moz-landing-system : lando
Have their own notification for when the child sheet loads instead of
piggy-backing in the RuleAdded one, and make the callers check instead.
This prevents incorrectly marking as modified sheets which only have @import
rules.
Differential Revision: https://phabricator.services.mozilla.com/D55184
--HG--
extra : moz-landing-system : lando
The existing code wasn't sound, as CSSOM objects also needed to go away before
the shared memory goes away (as they keep references to them).
This is sound assuming no presence of reference cycles introduced by CSSOM.
We may want to live with this and rely on chrome code not writing cycles like
this with UA stylesheet DOM objects.
We could explicitly drop all potentially-static objects... That seems pretty
error prone though.
Or we could also just leak the shared memory buffer, is there any reason why we
may not want to do that?
Differential Revision: https://phabricator.services.mozilla.com/D51870
--HG--
extra : moz-landing-system : lando
The existing code wasn't sound, as CSSOM objects also needed to go away before
the shared memory goes away (as they keep references to them).
This is sound assuming no presence of reference cycles introduced by CSSOM.
We may want to live with this and rely on chrome code not writing cycles like
this with UA stylesheet DOM objects.
We could explicitly drop all potentially-static objects... That seems pretty
error prone though.
Or we could also just leak the shared memory buffer, is there any reason why we
may not want to do that?
Differential Revision: https://phabricator.services.mozilla.com/D51870
--HG--
extra : moz-landing-system : lando
ReferrerPolicy gets tossed back and forth as a uint32_t and
ReferrerPolicy enum in header file. Expose ReferrerPolicyValues from
webidl file and use consistently in native code.
Differential Revision: https://phabricator.services.mozilla.com/D41954
--HG--
extra : moz-landing-system : lando
This is mostly straight-forward cleanup, but there's a behavior change which
was an oversight from bug 1386840, the regular mObservers stuff didn't pass the
right thing (was passing only mWasAlternate rather than whether it was
deferred).
I think that as a result, only in XML documents (since nsXMLContentSink is the
only thing that adds itself as a global CSS loader observer that ever looks at
this boolean), we may end up breaking this assert:
https://searchfox.org/mozilla-central/rev/9ae20497229225cb3fa729a787791f424ff8087b/dom/base/nsContentSink.cpp#183
(If there are any sheets with non-matching media queries and such).
But I couldn't find a test-case that broke it (tried SVG / XHTML), and in other
documents like pure XML you cannot specify a media query...
Differential Revision: https://phabricator.services.mozilla.com/D41091
--HG--
extra : moz-landing-system : lando
Saving a refcount bump is not worth the churn. Use a proper RefPtr<>
everywhere instead of manual refcounting, and don't make DoSheetComplete call
NS_RELEASE unconditionally.
Also, make clear by using references where null is expected or not.
Also, properly use a RefPtr in mPendingDatas, since they are strong pointers,
in fact.
Finally, remove some unused macros from nsCSSValue of which this code was the
last consumer.
Differential Revision: https://phabricator.services.mozilla.com/D41090
--HG--
extra : moz-landing-system : lando
The referrerInfo in SheetLoadData and StyleSheetInfo should be
different. One is used to load a style sheet and the other is used to
load resources referenced by a style sheet.
Differential Revision: https://phabricator.services.mozilla.com/D36477
--HG--
extra : moz-landing-system : lando
We need to notify the whole parent chain (using NOTIFY) rather than just
mStyleSets, since mStyleSets is empty for @import-ed sheets.
Differential Revision: https://phabricator.services.mozilla.com/D31787
--HG--
extra : moz-landing-system : lando
It's not worth dying on this hill. Both Blink and WebKit pass the tests.
(Well, WebKit actually fails one of the latest ones I wrote, cssRules and rules
are not the same JS object, WebKit returns a new rule list. I'll file)
Spec PR in https://github.com/w3c/csswg-drafts/pull/3900.
Differential Revision: https://phabricator.services.mozilla.com/D30348
--HG--
extra : moz-landing-system : lando
Just one set of stylesheets is enough. While at it, unify SheetType and Origin.
Differential Revision: https://phabricator.services.mozilla.com/D27564
--HG--
extra : moz-landing-system : lando
Each user agent style sheet has a unique URLExtraData object containing
its URL, but since they are refcounted objects, we can't share them
easily across processes. Rather than adding support for copying them
into a shared memory buffer like we will do with the Rust objects, here
we just set up a static array of URLExtraData objects per UA style
sheet. The array will be filled in in a later patch.
Rust UrlExtraData objects, once they are transformed into their
sharable form and copied into the shared memory buffer, will reference
them by an index.
Depends on D17181
Differential Revision: https://phabricator.services.mozilla.com/D17182
--HG--
extra : moz-landing-system : lando
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.
Overall it's not a very interesting patch I think.
nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.
I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.
While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
Referrer policy argurment is passed from sheet/doc to URLExtraData, default
value is RP_Unset. We use default value in some cases, particularly when there's
no certain spec talks about that (svg for example)
MozReview-Commit-ID: 5VAX1ZUXD3i
Differential Revision: https://phabricator.services.mozilla.com/D1922
--HG--
extra : moz-landing-system : lando
This also fixes loading child stylesheet case, using correct referrer policy stored
in parent sheet.
MozReview-Commit-ID: ARXQyleD9Wq
Differential Revision: https://phabricator.services.mozilla.com/D1921
--HG--
extra : moz-landing-system : lando
We share the inner object across sheets from the same URL, so what happens here
is that, once the sheet parses and loads, we call SetEnabled() on the first
sheet, which sets the inner bit, then calls ApplicableStateChanged.
That set actually turned the second sheet complete, so when inserting the sheet,
we think that the second sheet is already enabled, and thus in the author data,
and try to insert before it. Of course there's nothing there, so we panic.
We rely on calling SetEnabled() on all the sheets already to insert them in the
styleset / author data, so this makes it clearer and fixes the bug by moving the
state to each individual sheet.
Differential Revision: https://phabricator.services.mozilla.com/D3798
--HG--
extra : moz-landing-system : lando