Commit graph

172 commits

Author SHA1 Message Date
Xidorn Quan
d138fd1a32 Slightly simplify parse_one_simple_selector. 2017-07-12 15:07:22 +10:00
Josh Matthews
0b43d0072c stylo: Update rust-cssparser; extract more specific error types when reporting (bug 1352669). 2017-07-10 20:46:12 -04:00
Gecko Backout
32269fa7cc Backed out changeset fec394734f83 (bug 17624) for build bustage a=backout CLOSED TREE
Backs out https://github.com/servo/servo/pull/17624
2017-07-06 21:58:15 +00:00
Josh Matthews
f5a3830ea2 stylo: Update rust-cssparser; extract more specific error types when reporting (bug 1352669). 2017-07-06 14:32:37 -04:00
Simon Sapin
7e0254b530 Drive-by fix "unused import" warning. 2017-07-05 13:58:06 +02:00
Bobby Holley
1104cdc580 Invert the order of each compound selector.
MozReview-Commit-ID: JkBjqyYgbrB
2017-06-20 11:59:11 -07:00
Bobby Holley
1fc1d64e80 Hoist specificity computation into a new private builder module.
This patch doesn't modify any of the code because making a few things pub. I
did this first to make the next patch easier to audit.

MozReview-Commit-ID: 7PYxoS5bVGN
2017-06-20 11:59:11 -07:00
Bobby Holley
1d242ad760 Store selectors in matching order, rather than parse order.
We add a slow in-place reverse during parsing to achieve this for now, which
gets fixed up later on.

MozReview-Commit-ID: 42QkOzSgV3T
2017-06-20 11:59:10 -07:00
Bobby Holley
fac5aeb092 Stop creating unnecessarily-large SmallVecs for specific tasks.
MozReview-Commit-ID: IM9aAjSeJI9
2017-06-20 11:59:10 -07:00
Bobby Holley
2159d48382 Stop using parse_compound_selector for negation parsing.
This makes the code easier to work with, and fixes a bug where we don't currently
reject pseudo-elements within :not().

MozReview-Commit-ID: Cgl9w0PBsN3
2017-06-20 11:59:09 -07:00
Simon Sapin
316cd35767 Untry 2017-06-18 13:21:51 +02:00
Simon Sapin
b83afdedc8 Upgrade cssparser to 0.15 2017-06-16 15:05:46 +02:00
Emilio Cobos Álvarez
151b636562
style: Add a way to match a single compound selector.
Also improve the ergonomics of matches_complex_selector.

Bug: 1368240
MozReview-Commit-ID: 9DWDvyZmetM
2017-06-13 10:58:47 +02:00
Simon Sapin
5bccf98aa4 ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
2017-06-12 23:33:53 +02:00
Bobby Holley
6e3e7b282c Pack the fourth ancestor hash into the upper byte of the first three hashes.
MozReview-Commit-ID: KbtKQzLmwVO
2017-06-12 12:13:04 -07:00
Fernando Jiménez Moreno
2cc940384d stylo: Implement GetSpecificity for ServoStyleRule 2017-06-12 14:40:16 +02:00
Nazım Can Altınova
15fe48f3f6
stylo: Support :hover and :active quirk 2017-06-10 22:18:32 +03:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Boris Zbarsky
537cf52707 Fix revalidation selectors when pseudo-elements are involved. 2017-06-08 01:19:50 -04:00
J. Ryan Stinnett
6b1b8bbee8 Log element during selector matching
MozReview-Commit-ID: D8eFyRCy5BR
2017-06-07 14:23:53 -05:00
Fernando Jiménez Moreno
36f3255484 Bug 1367615 - Stylo: implement inIDOMUtils.getSelectorCount and inIDOMUtils.getSelectorTextFromIndex 2017-06-07 17:42:29 +02:00
Bobby Holley
586a21e1dd Make a bunch of types 'static.
The reasoning for this is explained in a comment in the next patch.

MozReview-Commit-ID: FQgDY77mg3B
2017-06-06 19:09:16 -07:00
Bobby Holley
f105d3438d Fix up unit tests.
MozReview-Commit-ID: 9eyOhoQ02qX
2017-06-05 19:44:13 -07:00
Bobby Holley
442211723c Eliminate redundant parse_selector.
MozReview-Commit-ID: 6eBVgT9ri5Q
2017-06-05 19:44:12 -07:00
Bobby Holley
27568de567 Use ThinArc in Selector.
MozReview-Commit-ID: Axvq0rbqA7Y
2017-06-05 19:44:10 -07:00
Bobby Holley
e8a56e969f Make ParseVec bigger.
MozReview-Commit-ID: DszMC031Xlj
2017-06-05 19:44:08 -07:00
Bobby Holley
852efb825f Use dynamically-sized Arcs for Selector.
MozReview-Commit-ID: hq0jYrx8Sg
2017-06-05 19:44:06 -07:00
Bobby Holley
992059c856 Move around specificity computation so that we know it by the time we mint the Selector.
This is important to make the selector immutable, which needs to happen when we stick it in an Arc.

MozReview-Commit-ID: BaMbOEbYC3D
2017-06-05 19:44:02 -07:00
Bobby Holley
1281fd9353 Stop slicing selectors when noting dependencies, and match with an offset instead.
MozReview-Commit-ID: KLqmdRKygO0
2017-06-05 19:44:01 -07:00
Bobby Holley
5ddabef636 Collapse Selector, SelectorInner, and ComplexSelector into a single Selector.
The refcounting is still internal. We'll fix that up next.

MozReview-Commit-ID: CTxZNaR3Qgj
2017-06-05 19:44:00 -07:00
Bobby Holley
713c9a63f6 Move the ancestor hashes out of Selector.
MozReview-Commit-ID: 5mipXnjgSED
2017-06-05 19:43:58 -07:00
Bobby Holley
e3d3c5a7b2 Hoist specificity_and_flags into ComplexSelector (soon to be Selector).
In the upcoming patches we'll eliminate the existing Selector and SelectorInner,
and ComplexSelector will become an Arc-managed |Selector|. So the tuple-indexed
setup is just temporary.

MozReview-Commit-ID: 4CcOYeHGUED
2017-06-05 19:29:23 -07:00
Simon Sapin
c968842653 Don’t visit attribute selectors that never match. 2017-05-18 17:13:20 +02:00
Simon Sapin
76166bce58 Add more enum types to avoid unreachable!() for selector case-sensitivity 2017-05-18 17:13:19 +02:00
Simon Sapin
853b688d0b Only non-namespaced attributes can have implicitly case-insensitive values 2017-05-18 17:13:16 +02:00
Simon Sapin
94b4a32c18 Make some attr values case-insensitive in selectors
https://bugzilla.mozilla.org/show_bug.cgi?id=1363531
2017-05-18 17:13:15 +02:00
Simon Sapin
9376abdd2c Shrink selectors::Component, add case-insensitive for other attr selectors
* https://bugzilla.mozilla.org/show_bug.cgi?id=1364148
* https://bugzilla.mozilla.org/show_bug.cgi?id=1364162
2017-05-18 17:13:14 +02:00
Simon Sapin
83c7824fda Simplify rust-selectors API for attribute selectors 2017-05-18 17:13:13 +02:00
Simon Sapin
0b1e51de53 Rename CaseSensitivity::CaseInsensitive to AsciiCaseInsensitive 2017-05-18 17:13:11 +02:00
Emilio Cobos Álvarez
522f8489d6
Bug 1364850: Move PseudoElement to be just another combinator in selectors. r=bholley
MozReview-Commit-ID: 8OoOIodkKJ5
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-17 10:58:24 +02:00
Simon Sapin
685b9efed6 Move "is universal" logic from stylist.rs to selectors/parser.rs 2017-05-16 18:41:27 +02:00
Simon Sapin
390e688058 Fix serialization of namespace and universal selectors
Fix #16017
Fix #16020
2017-05-16 16:44:28 +02:00
Simon Sapin
984d696717 Turns out, we never actual hash selectors 2017-05-16 10:24:50 +02:00
Simon Sapin
fd357f08cf Add size_of tests for geckolib selectors 2017-05-16 10:24:41 +02:00
Emilio Cobos Álvarez
10560ae043
Bug 1364412: Allow pseudo-element selectors to store state. r=bholley
MozReview-Commit-ID: CzAwg2uxqO2
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:49:22 +02:00
Emilio Cobos Álvarez
e09ae428eb
style: Account for cousin sharing in the revalidation logic.
Fixes bug 1361013.
2017-05-01 20:22:16 +02:00
Bobby Holley
b4d05919e2 Unbust unit tests.
Not sure how this managed to get past bors before.
2017-04-29 16:07:39 -07:00
Emilio Cobos Álvarez
7a556a7f03
Bug 1360399: Don't deduplicate revalidation selectors. r=bholley
It's unfortunate, but it's a correctness issue. I was looking at the
expectations update here:

 * 659cddddd4

And investigating it I realised that it's wrong to coalesce selectors like that,
because we keep the bloom filter flags.

So in the test cases disabled, we have a selector that looks like this:

msub > :not(:first-child),
msup > :not(:first-child),
msubsup > :not(:first-child),
mmultiscripts > :not(:first-child) {
    -moz-script-level: +1;
    -moz-math-display: inline;
}

And an element that looks like this:

<msubsup><mi></mi><mi></mi></msubsup>

We're only inserting the first selector msub > :not(:first-child) into the set,
so when we're going to match the <mi> elements we fast-reject it in both cases
due to the bloom filter, so they share style.

I can't see an easy way to fix this keeping the deduplication. If we keep it, we
need to remove the bloom filter optimization, which means that we'd trash the
cache for every first-child in the document (the :not(:first-child) effectively
becomes a global rule).

MozReview-Commit-ID: 9VPkmdj9zDg
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-28 02:57:54 +02:00
Bobby Holley
7e69cf82be Store SelectorInner and only revalidate up to the rightmost ancestor combinator.
MozReview-Commit-ID: HiTGVhwuvCE
2017-04-27 11:12:51 -07:00
Bobby Holley
32c624e585 Require Clone for SelectorImpl so that all the types that are parameterized on it can derive(Clone).
It's not clear to me why this is a requirement, but it seems to be one.

MozReview-Commit-ID: JM0DKjHHfT
2017-04-27 11:12:45 -07:00