Commit graph

115 commits

Author SHA1 Message Date
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Alex Gaynor
cd75cd6a86
style: fixed an unused import warning.
Differential Revision: https://phabricator.services.mozilla.com/D12028
2018-11-17 09:56:05 +01:00
Timothy Guan-tin Chien
9f28242def
Remove dom.webcomponents.customelements.enabled pref.
This patch removes the following functions:

* nsContentUtils::IsCustomElementsEnabled()
* CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
* CustomElementRegistry::IsCustomElementEnabled(nsIDocument* aDoc)

and all references of the pref.

Depends on D11183

Differential Revision: https://phabricator.services.mozilla.com/D11249
2018-11-17 09:56:03 +01:00
Timothy Guan-tin Chien
3977854ee2
Remove dom.webcomponents.shadowdom.enabled.
This patch removes the dom.webcomponents.shadowdom.enabled pref and all its
references, including the following functions:

* nsContentUtils::IsShadowDOMEnabled()
* nsIDocument::IsShadowDOMEnabled()
* nsDocument::IsShadowDOMEnabled(JSContext* aCx, JSObject* aGlobal)
* nsDocument::IsShadowDOMEnabled(const nsINode* aNode)
* nsTextNode::IsShadowDOMEnabled(JSContext* aCx, JSObject* aObject)

This function is renamed and updated to nsDocument::IsCallerChromeOrAddon():

* nsDocument::IsShadowDOMEnabledAndCallerIsChromeOrAddon(JSContext* aCx, JSObject* aObject)

I didn't change the tests that load Shadow DOM tests in an iframe, in the interest of keeping hg annotation history.

Differential Revision: https://phabricator.services.mozilla.com/D11183
2018-11-17 09:56:02 +01:00
Simon Sapin
b1822a39fa cargo fix --edition --features gecko 2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
72b29d3202
style: Simplify the Lang pseudo-class stuff a bit.
Differential Revision: https://phabricator.services.mozilla.com/D4754
2018-09-03 12:36:49 +02:00
Emilio Cobos Álvarez
d56e537882
style: Use proper escaping for pseudo-class strings.
We always serialize as an atom, which is the previous behavior (though previous
code was using string escaping which I think was not totally sound either...).

Differential Revision: https://phabricator.services.mozilla.com/D4753
2018-09-03 12:36:41 +02:00
Cameron McCormack
2af9264cfe
style: Use an Atom to store pseudo-class string arguments.
Differential Revision: https://phabricator.services.mozilla.com/D4740
2018-09-03 12:33:24 +02:00
Cameron McCormack
4ee3b56d54
style: Use an Atom to represent Direction values in pseudo-classes.
Differential Revision: https://phabricator.services.mozilla.com/D4730
2018-09-03 12:33:13 +02:00
Xidorn Quan
c587fa3586
style: Make tree pseudo-element prefix not case-sensitive.
Differential Revision: https://phabricator.services.mozilla.com/D4185
2018-09-03 12:32:10 +02:00
Emilio Cobos Álvarez
6c5456b4b6
Appease tidy. 2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
888ad3eabe
style: Restrict XUL tree pseudos on nightly and early-beta.
Differential Revision: https://phabricator.services.mozilla.com/D2598
2018-08-08 01:37:20 +02:00
Cameron McCormack
62419adaaa
style: Shrink selectors::Component to 24 bytes.
This saves about 37 KiB of memory across the UA style sheets.

Bug: 1475197
Reviewed-by: emilio
2018-08-08 01:36:53 +02:00
Cameron McCormack
a41127152b
style: Measure heap allocations hanging off selector components.
Bug: 1475191
Reviewed-by: emilio
MozReview-Commit-ID: D7vZQ7v8owS
2018-07-16 19:43:15 +02:00
Olli Pettay
b68e4c2352
style: Implement :defined pseudo-class for custom elements.
Bug: 1331334
Reviewed-by: emilio
2018-07-01 00:08:33 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bobby Holley
f7ae1a37e3 Manual fixups so that the rustfmt output won't trigger tidy. 2018-04-10 17:33:25 -07:00
Emilio Cobos Álvarez
db5db13559
style: Implement the non-functional :host selector.
Kinda tricky because :host only matches rules on the shadow root where the rules
come from. So we need to be careful during invalidation and style sharing.

I didn't use the non_ts_pseudo_class_list bits because as soon as we implement
the :host(..) bits we're going to need to special-case it anyway.

The general schema is the following:

 * Rightmost featureless :host selectors are handled inserting them in the
   host_rules hashmap. Note that we only insert featureless stuff there. We
   could insert all of them and just filter during matching, but that's slightly
   annoying.

 * The other selectors, like non-featureless :host or what not, are added to the
   normal cascade data. This is harmless, since the shadow host rules are never
   matched against the host, so we know they'll just never match, and avoids
   adding more special-cases.

 * Featureless :host selectors to the left of a combinator are handled during
   matching, in the special-case of next_element_for_combinator in selectors.
   This prevents this from being more invasive, and keeps the usual fast path
   slim, but it's a bit hard to match the spec and the implementation.

   We could keep a copy of the SelectorIter instead in the matching context to
   make the handling of featureless-ness explicit in match_non_ts_pseudo_class,
   but we'd still need the special-case anyway, so I'm not fond of it.

 * We take advantage of one thing that makes this sound. As you may have
   noticed, if you had `root` element which is a ShadowRoot, and you matched
   something like `div:host` against it, using a MatchingContext with
   current_host == root, we'd incorrectly report a match. But this is impossible
   due to the following constraints:

    * Shadow root rules aren't matched against the host during styling (except
      these featureless selectors).

    * DOM APIs' current_host needs to be the _containing_ host, not the element
      itself if you're a Shadow host.

Bug: 992245
Reviewed-by: xidorn
MozReview-Commit-ID: KayYNfTXb5h
2018-04-09 12:19:05 +02:00
Bobby Holley
9b5354f953 Stop using Gecko namespace ids in servo.
MozReview-Commit-ID: 2532dHCGPXW
2018-04-06 11:32:00 -07:00
Nicholas Nethercote
8705fb3783 Convert StylePrefs to StaticPrefs. 2018-04-03 11:41:03 +10:00
Xidorn Quan
688fb23d25 Remove nsCSSPseudoClasses.{h,cpp} and nsCSSPseudoClassList.h. 2018-03-28 09:50:14 +11:00
Xidorn Quan
bb15111dab Use Servo to implement GetStatesForPseudoClass function in InspectorUtils. 2018-03-28 09:50:13 +11:00
Emilio Cobos Álvarez
9fa2618197
style: Add infrastructure to match :host. 2018-03-14 15:10:05 +01:00
Anthony Ramine
31036d6510 Derive ToCss for MediaList
This uncovered the fancy snowflake `use fmt::Write` in the impl of ToCss
for NonTSPseudoClass.
2018-03-05 12:02:31 +01:00
Emilio Cobos Álvarez
b76bbdf501
style: Make input[type=number] pseudo-elements accessible to chrome.
Bug: 1433389
Reviewed-by: jwatt
MozReview-Commit-ID: 2ycajPYd3CV
2018-02-05 13:05:26 +01:00
Anthony Ramine
cd8f96cc9e Change ToCss to take a CssWriter<W>
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
2018-01-23 10:41:42 +01:00
Jessica Jong
2e532b8e00 style: Update shadow dom preference. 2018-01-16 17:52:50 +08:00
Simon Sapin
c14b766ff5 Rename SelectorMethods to Visit, after its one method. 2018-01-12 15:26:56 +01:00
Emilio Cobos Álvarez
5b7d9eb94a
style: Add a document state invalidator. 2018-01-12 12:08:42 +01:00
Emilio Cobos Álvarez
cb1a951477
style: Allow storing a DocumentState for invalidation. 2018-01-12 12:08:39 +01:00
Emilio Cobos Álvarez
1e27f2883b
selectors: Allow defining an implementation-dependent field in the matching context. 2018-01-12 12:08:38 +01:00
Emilio Cobos Álvarez
b6a2bff032
style: Move :-moz-locale-dir matching to rust. 2018-01-11 14:47:29 +01:00
Emilio Cobos Álvarez
d88696023f
style: Parse ::slotted() if the webcomponents pref is on.
Bug: 1425834
Reviewed-by: heycam
MozReview-Commit-ID: IOFneIgu7Rm
2018-01-09 14:26:05 +01:00
bors-servo
c6bf85eca9 Auto merge of #19536 - emilio:compound-selector-list, r=mbrubeck
style: Move the code to parse a list of compound selectors.

I'll need this for ::slotted().

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19536)
<!-- Reviewable:end -->
2017-12-09 17:15:14 -06:00
bors-servo
95520ca39c Auto merge of #19533 - emilio:unused-code-should-die, r=emilio
style: Remove unused SelectorImpl::pseudo_element_cascade_type.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19533)
<!-- Reviewable:end -->
2017-12-09 15:27:49 -06:00
Emilio Cobos Álvarez
b1f25a2b1f
style: Move the code to parse a list of compound selectors.
I'll need this for ::slotted().
2017-12-09 16:47:37 +01:00
Emilio Cobos Álvarez
bf564e0238
style: Simplify naming and signatures of single-colon pseudo stuff.
Also drop a few FIXMEs while at it, since they look bogus.
2017-12-09 16:12:22 +01:00
Emilio Cobos Álvarez
c93b844125
style: Remove unused SelectorImpl::pseudo_element_cascade_type. 2017-12-09 16:03:09 +01:00
Michael Wilson
1ebc1382ce moving :dir() param serialization FIXME 2017-11-21 21:47:41 -08:00
bors-servo
5905f8d3ea Auto merge of #19315 - emilio:chrome-rules-user-sheets, r=heycam
style: Enable chrome-only CSS features in user stylesheets.

MozReview-Commit-ID: FJ4vTiOrotH
Bug: 1418963
Reviewed-by: heycam

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19315)
<!-- Reviewable:end -->
2017-11-21 04:27:25 -06:00
Emilio Cobos Álvarez
c7a3c929f6
style: Enable chrome-only CSS features in user stylesheets.
MozReview-Commit-ID: FJ4vTiOrotH
Reviewed-by: heycam
Bug: 1418963
2017-11-21 10:59:47 +01:00
Michael Wilson
10f3ef42bb style: :dir() pseudo class now represented by enum
Fixes #19195
2017-11-15 18:12:44 -08:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
bors-servo
b1e6f05ae4 Auto merge of #18962 - upsuper:tree-pseudos, r=emilio
Support matching for ::-moz-tree-* pseudo-elements

This is the Servo side change of [bug 1397644](https://bugzilla.mozilla.org/show_bug.cgi?id=1397644).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18962)
<!-- Reviewable:end -->
2017-10-20 04:18:53 -05:00
Cameron McCormack
d58c967efa style: Record DocumentState dependencies. 2017-10-20 13:13:13 +08:00
Cameron McCormack
c22dba0b87 style: Remove unused SelectorImpl::pseudo_class_state_flag. 2017-10-20 13:12:44 +08:00
Xidorn Quan
4ce3dc7729 Add slots in PerPseudoElementMap for tree pseudos. 2017-10-20 14:08:35 +11:00
Xidorn Quan
b743d68ccd Accept argument-less tree pseudo-element selector. 2017-10-20 14:08:33 +11:00