Commit graph

383 commits

Author SHA1 Message Date
Xidorn Quan
dc25b51b6e Remove StyleBackendType uses. 2018-03-28 23:13:44 +11:00
Xidorn Quan
e57b6c65a0 Move matching logic of :-moz-table-border-nonzero and :-moz-browser-frame into individual binding functions. 2018-03-28 09:50:14 +11:00
Xidorn Quan
911f174b70 Make :-moz-native-anonymous and :-moz-use-shadow-tree-root matches in Rust code. 2018-03-28 09:50:13 +11:00
Emilio Cobos Álvarez
9c77f0b977
style: Better Shadow DOM assertions.
Bug: 1445682
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D748
2018-03-19 13:58:18 +01:00
Emilio Cobos Álvarez
9fa2618197
style: Add infrastructure to match :host. 2018-03-14 15:10:05 +01:00
Emilio Cobos Álvarez
9364cd21b8
style: Don't share style with an element that has a different proto binding than us.
See the lengthy comment about why... XBL sucks.

MozReview-Commit-ID: 8UgeJAVkj6a
2018-03-12 21:47:47 +01:00
Emilio Cobos Álvarez
c338745b17
style: Allow to share style across elements with similar XBL bindings. 2018-03-12 21:47:46 +01:00
Emilio Cobos Álvarez
da97d56d4e
style: Make getting the XBL binding faster.
MozReview-Commit-ID: GPj3uv4xgAv
2018-03-08 14:12:08 +01:00
Emilio Cobos Álvarez
ef4ea7cc49
style: Separate the XBL and shadow dom styling bits.
Bug: 1441022
Reviewed-by: xidorn
MozReview-Commit-ID: 2W0BmZ8wWXg
2018-03-07 15:42:28 +01:00
Emilio Cobos Álvarez
f422c7dca4
style: Assert sanity in GeckoNode::as_document. 2018-03-03 23:52:52 +01:00
Emilio Cobos Álvarez
56fc1a6649
style: Account for a few more cases in the node's debug-formatting code. 2018-03-03 23:52:51 +01:00
Emilio Cobos Álvarez
a19219ec79
style: Add also a containing_shadow API. 2018-03-03 23:52:50 +01:00
Emilio Cobos Álvarez
2f0df1b421
style: Add bindings for ShadowRoot.
This adds TShadowRoot to the `dom` module.

Right now it barely adds uses of it, but this is a prerequisite to fix a bunch
of Shadow DOM bugs and separate it from the XBL mess.
2018-03-03 23:52:49 +01:00
Xidorn Quan
107d9d2072 Remove text-is-significant param from Gecko_IsSignificantChild 2018-03-01 09:48:32 +11:00
Emilio Cobos Álvarez
8c4b401dd3
style: Only expose longhands to rust via iterators.
The key here is that we only filter longhands if the shorthand is accessible to
content and vice-versa. This prevents the bug that prevented me to land this
patch before, which was us not expanding properly chrome-only shorthands.

Again, this is incomplete, and I need to teach LonghandsToSerialize to get a
potentially incomplete list of properties, and all that.
2018-02-28 00:19:31 +01:00
bors-servo
a7f38f0f32
Auto merge of #20133 - emilio:kill-xbl, r=xidorn
style: Make Shadow DOM not use XBL anymore.

Bug: 1425759
Reviewed-by: xidorn
MozReview-Commit-ID: Jf2iGvLC5de

<!-- 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/20133)
<!-- Reviewable:end -->
2018-02-27 05:47:29 -05:00
Emilio Cobos Álvarez
cfbdf3d694
style: Make Shadow DOM not use XBL anymore.
More improvements to come. In particular, this still iterates through Shadow DOM
in each_xbl_cascade_data, but that should be changed later. That allows to
cleanup a bunch of stuff and finally fix Shadow DOM cascade order.

We still rely on the binding parent to be setup properly in the shadow tree, but
that requirement can go away later (we can walk the containing shadow chain
instead).

This mostly focuses on removing the XBL binding from the Shadow host.

It'd be nice to do EnumerateShadowRoots faster. I think that should also be a
followup, if needed.

Bug: 1425759
Reviewed-by: xidorn
MozReview-Commit-ID: Jf2iGvLC5de
2018-02-27 11:14:18 +01:00
Anthony Ramine
e2a6d07dad Remove TransitionProperty::All 2018-02-26 14:30:53 +01:00
Emilio Cobos Álvarez
28ea593347
style: Make a style sharing check account for Shadow DOM explicitly too.
Good I added tests for this (style-sharing-across-shadow.html).

Bug: 1425759
Reviewed-by: xidorn
MozReview-Commit-ID: 7d4WioCDAn7
2018-02-26 11:40:28 +01:00
Emilio Cobos Álvarez
07f86404cd
style: Make the simplified children iterator check account for Shadow DOM on its own.
We are relying in the XBL binding for the shadow host, we need to check
explicitly.

Also, we were checking in_shadow_tree, which is really broad. Just
is_html_slot_element should do, since the rest of the nodes should have only
light tree children.

Bug: 1425759
Reviewed-by: xidorn
MozReview-Commit-ID: KAFRVxaLsK
2018-02-26 11:40:13 +01:00
Emilio Cobos Álvarez
e77dd773d8
style: Other miscellaneous cleanup. 2018-02-24 22:45:45 +01:00
Emilio Cobos Álvarez
23d9462d23
style: Remove unused and somewhat dubious GeckoElement::set_data. 2018-02-24 22:45:44 +01:00
Emilio Cobos Álvarez
601a351632
style: Remove some get_ prefixes from Gecko functions. 2018-02-24 22:45:43 +01:00
Emilio Cobos Álvarez
f2efd04a5d
style: Make Element::id not clone the attribute. 2018-02-24 22:45:43 +01:00
Emilio Cobos Álvarez
98c9292ecb
style: Remove get_ prefix from get_state and get_id. 2018-02-24 22:45:42 +01:00
Emilio Cobos Álvarez
b8fb41da0c
style: Remove get_css_transitions_info and might_need_transition_update_per_property from TElement.
They're only called from wrapper.rs, there's no need to expose them in the
common trait.
2018-02-24 22:45:41 +01:00
Emilio Cobos Álvarez
607cf5aa3c
style: Remove the get_ prefix from get_smil_override, and other animation stuff. 2018-02-24 22:45:41 +01:00
Emilio Cobos Álvarez
c5bfc81b74
style: Remove get_animation_rule_by_cascade.
It's pretty useless.
2018-02-24 22:45:40 +01:00
Emilio Cobos Álvarez
7ab4b21bc3
selectors: Remove the get_ prefix from get_local_name and get_namespace. 2018-02-24 22:45:38 +01:00
Emilio Cobos Álvarez
da99f159f4
style: Add a shadow root accessor.
I'm going to use it in a bit.
2018-02-24 20:29:36 +01:00
bors-servo
d423e54d58
Auto merge of #20065 - emilio:note-stuff, r=nox
style: Cleanup GeckoElement::note_explicit_hints

What it's doing is not so complicated.

<!-- 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/20065)
<!-- Reviewable:end -->
2018-02-16 15:33:48 -05:00
Emilio Cobos Álvarez
2c03609dc1
style: Cleanup GeckoElement::note_explicit_hints.
What it's doing is not so complicated.
2018-02-16 19:00:21 +01:00
Emilio Cobos Álvarez
36e6d57aee
style: Inline maybe_restyle, since it only has one caller. 2018-02-16 19:00:21 +01:00
Emilio Cobos Álvarez
5e64cb3516
style: Make XBL / Shadow DOM use something more light-weight than a Stylist.
It's just a struct aggregating stylesheets + CascadeData, with a quirks_mode
parameter because XBL sucks so bad.

Bug: 1436059
Reviewed-by: xidorn
MozReview-Commit-ID: 7q99tSNXo0K
2018-02-16 13:42:36 +01:00
Emilio Cobos Álvarez
1bb6ce2c88
style: Use more CascadeData and less Stylist for XBL stuff.
Just some more uses of Stylist in XBL that can be converted right away.

I'm trying to make XBL not use a Stylist, slowly...
2018-02-12 11:25:24 +01:00
Emilio Cobos Álvarez
0466e0b2bc
style: Make GeckoElement::has_class more specialized.
Bug: 1431421
Reviewed-by: xidorn
MozReview-Commit-ID: 7LiSEamTCkX
2018-01-31 11:26:13 +01:00
Emilio Cobos Álvarez
61e60a87e5
selectors: Never match ::slotted on <slot>s.
This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.
2018-01-27 17:57:17 +01:00
Emilio Cobos Álvarez
cd04664fb9
style: Use CascadeFlags for what they're for.
Now that we have an Element around on cascade, we can stop using the cascade
flags mechanism to pass various element-related state, like "is this element the
root", or "should it use the item-based display fixup".

That fixes handwaviness in the handling of those flags from style reparenting,
and code duplication to handle tricky stuff like :visited.

There are a number of other changes that are worth noticing:

 * skip_root_and_item_based_display_fixup is renamed to skip_item_display_fixup:

   TElement::is_root() already implies being the document element, which by
   definition is not native anonymous and not a pseudo-element.

   Thus, you never get fixed-up if your NAC or a pseudo, which is what the code
   tried to avoid, so the only fixup with a point is the item one, which is
   necessary.

 * The pseudo-element probing code was refactored to return early a
   Option::<CascadeInputs>::None, which is nicer than what it was doing.

 * The visited_links_enabled check has moved to selector-matching time. The rest
   of the checks aren't based on whether the element is a link, or are properly
   guarded by parent_style.visited_style().is_some() or visited_rules.is_some().

   Thus you can transitively infer that no element will end up with a :visited
   style, not even from style reparenting.

Anyway, the underlying reason why I want the element in StyleAdjuster is because
we're going to implement an adjustment in there depending on the tag of the
element (converting display: contents to display: none depending on the tag), so
computing that information eagerly, including a hash lookup, wouldn't be nice.
2018-01-23 13:18:54 +01:00
Emilio Cobos Álvarez
e74fad6259
style: Handle correctly document state invalidation inside negation. 2018-01-20 02:10:57 +01:00
Emilio Cobos Álvarez
8e25c9e674
style: Track the visited-handling-mode on the MatchingContext.
Instead of on the stack.

This fixes bugs where we're not passing the value around correctly, like from
::-moz-any.

This is a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1431539.
2018-01-19 13:22:37 +01:00
Emilio Cobos Álvarez
e4f08ee2bb
selectors: Add a MatchingContext::nest function, make nesting_level private. 2018-01-19 12:40:17 +01:00
Emilio Cobos Álvarez
e55bb3e76d
style: Always inline GeckoElement::has_class.
It's easier, and probably faster, than trying to inline the function call to
Gecko.

This symbol is in libxul.so as of right now.
2018-01-16 22:14:11 +01:00
Bobby Holley
f858ce91e8 Avoid entraining various Debug impls in release builds.
MozReview-Commit-ID: Lp9i9EI5qdU
2018-01-13 09:51:46 -08:00
Emilio Cobos Álvarez
335ca47361
style: Use Default for ExtraStyleData instead of Option. 2018-01-12 12:08:47 +01:00
Emilio Cobos Álvarez
cb1a951477
style: Allow storing a DocumentState for invalidation. 2018-01-12 12:08:39 +01:00
Emilio Cobos Álvarez
b6a2bff032
style: Move :-moz-locale-dir matching to rust. 2018-01-11 14:47:29 +01:00
Edgar Chen
4c778b34e6 style: Remove :unsolved pseudo-class
This is the servo part changes of https://bugzilla.mozilla.org/show_bug.cgi?id=1417829.
2018-01-10 17:20:06 +08:00
Emilio Cobos Álvarez
b26f3280d2
style: Add invalidation support for ::slotted().
Bug: 1424607
Reviewed-by: heycam
MozReview-Commit-ID: 8pIVUx27o7x
2018-01-09 14:26:02 +01:00
Emilio Cobos Álvarez
040379208e
style: Implement GeckoElement::assigned_slot.
This allows to selector-match ::slotted, though we still don't parse it.

Bug: 1425755
Reviewed-by: heycam
MozReview-Commit-ID: ItELHkf2PMl
2018-01-08 19:01:41 +01:00
Emilio Cobos Álvarez
f3ea248188
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.
Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.
2018-01-04 14:45:54 +01:00