Commit graph

258 commits

Author SHA1 Message Date
Bobby Holley
713c9a63f6 Move the ancestor hashes out of Selector.
MozReview-Commit-ID: 5mipXnjgSED
2017-06-05 19:43:58 -07:00
Boris Zbarsky
ad1309552d Allow style sharing for elements with ids as long as the ID is not being used for styling. 2017-06-05 13:32:03 -04:00
Boris Zbarsky
d031b5badb Add selectors with an id in them to the list of revalidation selectors. 2017-06-05 13:32:02 -04:00
Boris Zbarsky
98f95a32da Fix the handling of the Bloom filter in the style sharing cache. 2017-06-05 12:51:51 -04:00
Emilio Cobos Álvarez
58fd80e282
style: Split stylesheets.rs
This file has become quite bloated lately. This commit deletes that file in
favor of a set of submodules.

The only noticeable change apart from code move, is converting deep_clone_foo
methods into a trait.

It also unifies logic related to different style rules in the same place.

There's some missing work, specially related to font-face and counter-style, but
I think this is worth landing in the meantime.
2017-06-04 21:50:09 +02:00
Emilio Cobos Álvarez
5c66d3c77a
Cache effective media query results.
This patch also makes RulesIterator not iterate over rules for which we don't
process nested rules.

There's nothing depending on this behavior right now afaik, and this will make
us duplicate less code in following patches.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1357461
MozReview-Commit-ID: CaMFQtAVnJF
2017-06-03 14:43:44 +02:00
J. Ryan Stinnett
56b44d2709 Pull decls from Gecko for link preshints
Based on a link's active state and the visited handling mode, pull in link,
vlink, and alink preshint declaration blocks from Gecko as needed.

MozReview-Commit-ID: A6udMYbzQnK
2017-06-02 14:34:39 -05:00
Bobby Holley
47404cfc4e Compare style attributes rather than rejecting them from the cache.
MozReview-Commit-ID: Jmu7Pie2mBP
2017-05-31 06:48:40 -07:00
Bobby Holley
6d8455a916 Sort the cached class list in ValidationInfo.
MozReview-Commit-ID: 3vsfP5ECzds
2017-05-31 06:48:27 -07:00
bors-servo
38a6a3bff6 Auto merge of #17063 - emilio:pres-hints-sharing, r=bholley
style: Allow sharing styles across elements with presentational hints.

<!-- 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/17063)
<!-- Reviewable:end -->
2017-05-30 07:28:06 -05:00
Emilio Cobos Álvarez
544e0f4cd6
style: Allow ApplicableDeclarationBlocks to be compared.
We'll need this to cache pres hints, which generate these.
2017-05-29 21:38:21 +02:00
Emilio Cobos Álvarez
ac5872b48c
Bug 1357583: style: Make effective_rules return an iterator, stop refcounting the Device. r=heycam
This makes the code cleaner, and also documents the fact that effective_rules
recurses into imports.

No we're not adding the imported stylesheets twice, and we share code with the
invalidation analysis.

MozReview-Commit-ID: DOF2AViTlmR
2017-05-29 20:27:43 +02:00
Cameron McCormack
cc44f05f44 style: Add support for resolving default computed styles. 2017-05-25 14:19:59 +08:00
J. Ryan Stinnett
a7882cfeb9 Match and cascade visited styles
To support visited styles, we match and cascade a separate set of styles any
time we notice that an element has a relevant link.

The visited rules and values are held in `ComputedStyle` alongside the
regular rules and values, which simplifies supporting various APIs like
`cascade_primary_and_pseudos` which expect easy access to previously matched
rules.

To simplify passing the additional values around, an additional reference to the
visited `ComputedValues` is placed inside the regular `ComputedValues`.

MozReview-Commit-ID: 2ebbjcfkfWf
2017-05-24 18:07:44 -05:00
Manish Goregaokar
a19dd8142e Rollup merge of #17014 - hiikezoe:animation-rules-in-norma-restyle, r=emilio,birtles
Animation rules in norma restyle

<!-- Please describe your changes on the following line: -->

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1366631 and https://bugzilla.mozilla.org/show_bug.cgi?id=1367225

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it's for stylo

<!-- 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/17014)
<!-- Reviewable:end -->
2017-05-24 11:59:28 -07:00
Manish Goregaokar
c5b47f769e Rollup merge of #17010 - CJKu:bug-1348490, r=emilio
Stylo: match both ::placehoder & ::moz-placeholder for placeholder ps…

<!-- Please describe your changes on the following line: -->
The first patch of "Bug 1348490 - stylo: need support for ::-moz-placeholder pseudo element"

Part 2 need to be landed immediately after Part 1 be merged into servo repo:
https://reviewboard.mozilla.org/r/141264/diff/9#index_header

Bugzilla link:
https://bugzilla.mozilla.org/show_bug.cgi?id=1348490
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/17010)
<!-- Reviewable:end -->
2017-05-24 11:59:25 -07:00
Hiroyuki Ikezoe
4935d972e5 Use animation values that have been processed during animation-only restyle for normal restyle. 2017-05-24 11:11:57 +09:00
Hiroyuki Ikezoe
35e0e3aa11 Move AnimationRules into declaration_block.rs. 2017-05-24 11:11:42 +09:00
cku
6143e95d74 Stylo: match both ::placehoder & ::moz-placeholder for placeholder pseudo-elements. 2017-05-24 00:34:52 +08:00
Emilio Cobos Álvarez
e51ca0958e
style: Add a SelectorMapEntry trait. 2017-05-23 14:48:06 +02:00
Emilio Cobos Álvarez
a67e880256
style: Move SelectorMap to its own submodule. 2017-05-23 14:48:04 +02:00
Emilio Cobos Álvarez
bc8382ebe9
style: Use a FnvHashMap for ExtraStyleData, and remove unused stuff from PerDocumentStyleDataImpl. 2017-05-23 14:47:18 +02:00
bors-servo
17069f4876 Auto merge of #16981 - emilio:backdrop, r=heycam
Bug 1366427: Make backdrop not inherit from the parent element. r=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/16981)
<!-- Reviewable:end -->
2017-05-23 02:25:07 -05:00
bors-servo
1306b16d5a Auto merge of #16968 - HeyZoos:stylist-accessors, r=emilio
Stylist accessors

<!-- Please describe your changes on the following line: -->
Add accessor methods for the `device` and `ruleset` fields in the `Stylist` struct.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16857 (github issue number if applicable).
<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16968)
<!-- Reviewable:end -->
2017-05-22 20:12:46 -05:00
Emilio Cobos Álvarez
71dbc6c023
Bug 1366427: Make backdrop not inherit from the parent element. r=heycam
MozReview-Commit-ID: EnnmvDsgbdx
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-21 15:19:01 +02:00
heyzoos
fb755838ca Return &Device instead of &Arc<Device> 2017-05-20 18:52:53 -05:00
Emilio Cobos Álvarez
a12996f030
style: Make a bloom filter arrive to restyle hint computation. 2017-05-21 00:12:16 +02:00
heyzoos
4196156bb9 Change device and rule_set references to accessors 2017-05-18 22:18:16 -05: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
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
bors-servo
c962458984 Auto merge of #16890 - servo:qname, r=emilio
Fix serialization of namespace and universal selectors

Fix #16017
Fix #16020

<!-- 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/16890)
<!-- Reviewable:end -->
2017-05-16 20:03:53 -05: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
J. Ryan Stinnett
e385b81fc3 Create a MatchingContext to group related matching args
MozReview-Commit-ID: 7XZTn7HDXrm
2017-05-16 09:19:28 -05:00
bors-servo
1afc89e944 Auto merge of #16888 - upsuper:bug1328319, r=heycam,Manishearth,SimonSapin
Implement @counter-style for stylo

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

<!-- 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/16888)
<!-- Reviewable:end -->
2017-05-16 01:17:07 -05:00
Xidorn Quan
3e00a91e20 Enable querying counter-style rule on Servo backend. 2017-05-16 14:42:46 +10:00
bors-servo
7ca393a960 Auto merge of #16874 - bholley:applicable_declarations_smallvec, r=emilio
Use a SmallVec when gathering applicable declarations

https://bugzilla.mozilla.org/show_bug.cgi?id=1364952

<!-- 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/16874)
<!-- Reviewable:end -->
2017-05-15 23:19:43 -05:00
Emilio Cobos Álvarez
de680b06fe
Bug 1364412: Track pseudo-element's state dependencies too. r=heycam
MozReview-Commit-ID: 8zOE7TyW1xi
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:49:37 +02:00
Emilio Cobos Álvarez
84f5a90668
Bug 1364412: Use the pseudo selector to reject state selectors. r=bholley
MozReview-Commit-ID: 73dnp6nZpdU
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:49:30 +02:00
Emilio Cobos Álvarez
dd38740ece
Bug 1364412: Store full selectors in the Rule object. r=bholley
MozReview-Commit-ID: EKLKxNCghLD
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:49:26 +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
Bobby Holley
bf242088c7 Use a SmallVec when gathering applicable declarations. 2017-05-15 18:36:38 +02:00
Nazım Can Altınova
c54d255d07
stylo: Propagate quirks mode information from Gecko to Servo 2017-05-14 01:51:50 +03:00
bors-servo
eeb1ee9723 Auto merge of #16802 - emilio:slim-down-slc, r=bholley
style: Slim down SharedStyleContext, and do various other cleanups around the style crate.

This slims down SharedStyleContext, in preparation for a few things.

First, I would like to eventually move the stylist to the document in Servo, in
order for it to hold the StyleSheetSet.

Also, this gets rid of a fair amount of overhead while creating it in stylo.

Fixes bug 1363245.

<!-- 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/16802)
<!-- Reviewable:end -->
2017-05-12 08:56:47 -05:00
Emilio Cobos Álvarez
677daaabc5
style: Parameterize the update and rebuild methods to take an iterator.
In preparation to avoid cloning the stylesheets while rebuilding in Gecko.
2017-05-12 14:50:59 +02:00
Cameron McCormack
b405a1cb67 style: Record ElementState bits that selectors depend on. 2017-05-12 17:02:50 +08:00
Cameron McCormack
5cf915118e style: Record names that appear in attribute selectors. 2017-05-12 17:02:18 +08:00
bors-servo
48fdda3f07 Auto merge of #16785 - aethanyc:fix-typo-and-simplify, r=mbrubeck
Fix typo and simplify for PresentationalHintsSynthesizer

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it only affects build.

<!-- 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/16785)
<!-- Reviewable:end -->
2017-05-12 02:41:25 -05:00
Bobby Holley
e9d4110ad4 Handle importance when inserting into the rule tree. 2017-05-11 17:37:17 +02:00
bors-servo
c6c0252b19 Auto merge of #16798 - bzbarsky:stylist-lazier-updates, r=emilio
Allow stylo to do lazier stylist rebuilds

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1361843 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because it's optimization, which should have no observable behavior difference.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16798)
<!-- Reviewable:end -->
2017-05-10 16:22:06 -05:00