Commit graph

329 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
a67e880256
style: Move SelectorMap to its own submodule. 2017-05-23 14:48:04 +02:00
Behnam Esfahbod
14c524df4f [gfx] [layout] [style] Upgrade unicode-bidi to 0.3 2017-05-22 20:06:19 -05:00
Emilio Cobos Álvarez
311c403522
style: Move all the style sharing code outside matching.rs
This is just a code health change. I want to move it away to keep matching.rs as
simple as possible.
2017-05-21 02:30:51 +02:00
bors-servo
4f0b24ac0c Auto merge of #16960 - servo:derive-all-the-things, r=emilio
Derive HasViewportPercentage 🍷

<!-- 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/16960)
<!-- Reviewable:end -->
2017-05-20 11:34:36 -05:00
Anthony Ramine
90bae7f802 Derive HasViewportPercentage 🍷 2017-05-20 14:48:04 +02:00
Simon Sapin
d2be5239f5 Avoid returning / passing around a huge ParsedDeclaration type
This enum type used to contain the result of parsing
one CSS source declaration (`name: value;`) and expanding shorthands.
Enum types are as big as the biggest of their variant (plus discriminant),
which was quite big because some shorthands
expand to many longhand properties.
This type was returned through many functions and methods,
wrapped and rewrapped in `Result` with different error types.
This presumably caused significant `memmove` traffic.

Instead, we now allocate an `ArrayVec` on the stack
and pass `&mut` references to it for various functions to push into it.
This type is also very big, but we never move it.

We still use an intermediate data structure because we sometimes decide
after shorthand expansion that a declaration is invalid after all
and that we’re gonna drop it.
Only later do we push to a `PropertyDeclarationBlock`,
with an entire `ArrayVec` or nothing.

In future work we can try to avoid a large stack-allocated array,
and instead writing directly to the heap allocation
of the `Vec` inside `PropertyDeclarationBlock`.
However this is tricky:
we need to preserve this "all or nothing" aspect
of parsing one source declaration,
and at the same time we want to make it as little error-prone as possible
for the various call sites.
`PropertyDeclarationBlock` curently does property deduplication
incrementally: as each `PropertyDeclaration` is pushed,
we check if an existing declaration of the same property exists
and if so overwrite it.
To get rid of the stack allocated array we’d need to somehow
deduplicate separately after pushing multiple `PropertyDeclaration`.
2017-05-19 18:53:25 +02:00
bors-servo
61d64daf4c Auto merge of #16931 - nox:font-feature-descriptor, r=emilio
Support font-feature-settings as a @font-face descriptor

<!-- 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/16931)
<!-- Reviewable:end -->
2017-05-19 07:49:27 -05:00
Simon Sapin
ee2794e966 Move bindings tests out of the style crate.
This cuts in almost half the time to run:

```
touch components/style/lib.rs
./mach test-stylo
```
2017-05-18 18:46:29 +02:00
Anthony Ramine
7d66e65d94 Move some style macros into their own module, used first 2017-05-18 18:16:21 +02:00
Anthony Ramine
9964b328b1 Implement the hashless color quirk (fixes #15341) 2017-05-17 14:12:58 +02:00
Fernando Jiménez Moreno
b22e0e9494 Stylo: Bug 1355408 - add support for @-moz-document 2017-05-09 12:52:44 +02:00
bors-servo
8b41c7c137 Auto merge of #16689 - servo:m5e, r=nox
Upgrade to html5ever 0.16

<!-- 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/16689)
<!-- Reviewable:end -->
2017-05-03 08:42:41 -05:00
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
Bobby Holley
6d8fc600b8 Strip down StyleArc to what we need.
We remove most of the doc comments to minimize the number of lines
of forked code.

MozReview-Commit-ID: LehEisKxkJW
2017-05-02 17:34:40 -07:00
Simon Sapin
6c518c89b9 Upgrade to html5ever 0.16 2017-05-02 19:24:28 +02:00
Simon Sapin
797f40b0a3 Add initial style system support for @counter-style rules 2017-04-26 13:02:22 +09:00
Emilio Cobos Álvarez
ccf15c0a26
style: Move all the fixup code into a StyleAdjuster struct.
This will allow reusing it from text styles, which we need for some
corner cases, like text-align: -moz-center and similar stuff.
2017-04-26 03:22:24 +02:00
Emilio Cobos Álvarez
97235d0bf7
stylo: Centralize stylesheet handling.
This is needed for both bug 1357461 and bug 1273303, where I plan to add smarter
invalidations than what we have now.

Also, it's cleaner.

Ideally I'll move this onto stylist, though that may require extra work to make
it work fine for Servo, so for now let's just do the obvious thing.
2017-04-19 09:41:36 +02:00
Bobby Holley
1663bf6e5d Cache the results of cache entry revalidation and use the bloom filter. 2017-04-12 10:35:42 +08:00
Emilio Cobos Álvarez
e29b84de18
style: Hash less stuff in the bloom filter, using the precomputed hashes we have. 2017-04-08 02:02:11 +02:00
Xidorn Quan
c857878ce9 Remove servo_config dependency for geckolib 2017-04-07 17:20:42 +10:00
Xidorn Quan
3150a92651 Remove servo_url dependency for geckolib
It seems mod attr is not used for geckolib at all, and that is the
only place where servo_url is still referenced for geckolib, so we
can just remove it.
2017-04-07 16:44:38 +10:00
bors-servo
42f58503c0 Auto merge of #16169 - servo:stylo-heapsize, r=emilio
Remove heapsize for Stylo

It doesn’t seem to be used, and is causing compilation trouble for Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1350581

<!-- 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/16169)
<!-- Reviewable:end -->
2017-04-05 03:59:26 -05:00
Xidorn Quan
f68e2948d5 Use Gecko nsCSSFontFaceRule for font face rule. 2017-03-30 11:41:09 +11:00
Simon Sapin
94eb159137 Remove heapsize for Stylo 2017-03-28 17:50:52 +02:00
Jeremy Chen
a9e4b9caa6 stylo: Implement gecko glue for font-language-override.
To be aligned with the implementation from Gecko side, we parse
font-language-override as Normal keyword or String. Then, we compute
and store it as a u32. So, as to the stylo glue, we can just pass the
u32 to Gecko.

The extra crate, byteorder, is used to simplify the computing and
serialization.

Since we now implement font-language-override for Gecko, we can remove
the additional branches for font-language-override in font shorthand.

ref: Gecko Bug 1347821
2017-03-28 15:34:08 +08:00
Simon Sapin
7850d3f331 Use AtomicRefCell instead of RwLock inside SharedRwLock for stylo.
MozReview-Commit-ID: 8M6BUqe4pil
2017-03-20 16:36:03 -07:00
Simon Sapin
1bacd0eb15 Move all PropertyDeclarationBlock from RwLock<_> to Locked<_> 2017-03-19 22:30:38 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Simon Sapin
8feb9e8047 Add SharedRwLock<T> and Locked<T> 2017-03-19 22:30:24 +01:00
Simon Sapin
19c71a9082 Remove rust-encoding from geckolib.
It wasn’t used, gecko always passes UTF-8 for parsing stylesheets.
2017-03-16 20:22:40 +01:00
Simon Sapin
288ef97055 Update cssparser for https://github.com/servo/rust-cssparser/pull/123 2017-02-28 17:16:36 +01:00
Simon Sapin
33ef6f78e5 Update to cssparser 0.11 2017-02-26 11:09:53 +01:00
Anthony Ramine
8a8ee2888c Remove rustc-serialize from style and style_traits 2017-02-23 21:47:23 +01:00
Nathan Froyd
fafcdda16a geckolib: move NUM_THREADS from style to geckolib
This change eliminates some gecko-only configuration in the style
component and moves NUM_THREADS closer to its only uses.
2017-02-22 11:35:08 -05:00
Marco Concetto Rudilosso
07f04ced2e changed quickersort with pdqsort 2017-01-27 18:42:22 +00:00
Ms2ger
14fe337866 Update rustc to 1.16.0-nightly (7821a9b99 2017-01-23). 2017-01-24 11:02:51 +01:00
Manish Goregaokar
1b0842e228 Support @supports (fixes #14786) 2017-01-07 23:17:50 -08:00
bors-servo
df895cb80c Auto merge of #14889 - servo:rustup, r=jdm
Upgrade to rustc 1.16.0-nightly (6f1ae663e 2017-01-06)

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

---
<!-- 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 _____

<!-- 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/14889)
<!-- Reviewable:end -->
2017-01-07 08:18:28 -08:00
Emilio Cobos Álvarez
c0cf847043
style: Isolate the soon-to-be style-backend-specific from the media_query module. 2017-01-07 12:34:43 +01:00
Simon Sapin
67aea3bba4 Upgrade to rustc 1.16.0-nightly (6f1ae663e 2017-01-06) 2017-01-06 17:43:31 +01:00
Bobby Holley
b9d99390ad Switch to crates.io for atomic_refcell. 2017-01-03 18:14:27 -08:00
Bobby Holley
c26b4bed60 Reimplement AtomicRefCell as a fork of RefCell. 2017-01-03 12:23:06 -08:00
Emilio Cobos Álvarez
a8fdf5b6b9
style: Require documentation also for a Gecko build. 2017-01-02 12:58:08 +01:00
Emilio Cobos Álvarez
51134b9dc8
style: Disallow new undocumented code by default for Servo.
Still a bunch of Gecko-only code to document.
2017-01-02 12:57:58 +01:00
Emilio Cobos Álvarez
939557260c
style: Allow the attr module to be without documentation, for now. 2017-01-02 12:57:57 +01:00
Emilio Cobos Álvarez
3cd6cba1ee
style: Allow the atomic_refcell module to be undocumented, for now.
Given Bobby is rewriting it as I write this.
2017-01-02 12:57:55 +01:00
Emilio Cobos Álvarez
c9ffd9b429
style: Allow the logical_geometry module to be undocumented, for now. 2017-01-02 12:57:55 +01:00
Emilio Cobos Álvarez
3f7f914e16
style: Allow the lack of documentation for the media_queries module.
I'm rewriting all that stuff soon, so it's kind of pointless to document the
existing stuff right now.
2017-01-02 12:57:54 +01:00
Emilio Cobos Álvarez
b556449a96
style: Require docs in the less-straightforward part of the properties module. 2017-01-02 12:57:48 +01:00