Commit graph

169 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
600f19540e
style: Make PropertyId::parse less of a footgun.
Bug: 1466095
Reviewed-by: xidorn
MozReview-Commit-ID: 2BmtSDPmHj9
2018-06-02 12:08:40 +02:00
Emilio Cobos Álvarez
d5e19a146e
style: Some trivial cleanup.
Bug: 1464865
Reviewed-by: xidorn
MozReview-Commit-ID: 8ClaBR9ooGb
2018-06-02 12:06:05 +02:00
Emilio Cobos Álvarez
142c9eca4b
style: Don't let @namespace rules that aren't going to be inserted affect the namespace map.
Bug: 1464865
Reviewed-by: xidorn
MozReview-Commit-ID: 9bjlEBExqsr
2018-06-02 12:05:47 +02:00
Emilio Cobos Álvarez
e77a28d543
style: trivial TopLevelRuleParser construction cleanup.
MozReview-Commit-ID: 5CdOdQPZzyb
2018-06-02 12:05:41 +02:00
Xidorn Quan
dc2aadd43a
style: Make creating CssUrl infallible.
There were a check in CssUrl::parse_from_string for extra data, which
was removed as part of servo/servo#16241, so it never fails now.

CssUrl::from_url_value_data doesn't seem to need Result from the very
beginning. It is unclear why it was made that way.

Bug: 1461858
Reviewed-by: emilio
MozReview-Commit-ID: LXzKlZ6wPYW
2018-05-20 18:57:35 +02:00
Emilio Cobos Álvarez
33b593d32e
style: Fix servo build. 2018-05-05 17:19:06 +02:00
Bobby Holley
dfa019c884
style: Parse sheets on the thread pool.
Note that we also drop the dead optional aReusableSheets argument from
the async parsing path, since it was always null.

Bug: 1346988
Reviewed-by: bz,emilio
MozReview-Commit-ID: KddpGFdaqEe
2018-04-28 10:25:59 +02:00
Emilio Cobos Álvarez
827b82dc39
style: Fix build bustage after afe484e46b. 2018-04-17 20:02:58 +02:00
Emilio Cobos Álvarez
f5c85a816a
style: Remove an unused import. 2018-04-17 20:02:33 +02:00
Bobby Holley
afe484e46b
style: Allow placeholder import sheets.
This is necessary because we can't create GeckoStyleSheets off-main-thread,
so we need a placeholder until it can be filled in.

Bug: 1454030
Reviewed-by: emilio
MozReview-Commit-ID: ssRme4fLYg
2018-04-17 20:01:27 +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
Bobby Holley
9b5354f953 Stop using Gecko namespace ids in servo.
MozReview-Commit-ID: 2532dHCGPXW
2018-04-06 11:32:00 -07:00
Xidorn Quan
80ab893e3a Use Servo data to back @counter-style rule. 2018-04-05 09:33:45 +10:00
Xidorn Quan
32cd0b4ea0 Add source_location to CounterStyleRule. 2018-04-05 09:00:25 +10:00
Xidorn Quan
ac7467221a Use Servo data to back @font-face rule in Gecko. 2018-04-04 09:33:07 +10:00
Nicholas Nethercote
8705fb3783 Convert StylePrefs to StaticPrefs. 2018-04-03 11:41:03 +10:00
Emilio Cobos Álvarez
322113a393
style: Add another pref to control the url-prefix hack.
MozReview-Commit-ID: D4qL0oO69Uh
Bug: 1446470
Reviewed-by: xidorn
2018-03-19 11:24:19 +01:00
Emilio Cobos Álvarez
9bb4033ec3
style: Allow @-moz-document url-prefix() on content.
MozReview-Commit-ID: zaT41fpsDT
Bug: 1446470
Reviewed-by: xidorn
2018-03-19 11:24:18 +01:00
Emilio Cobos Álvarez
652633aee2
style: Cleanup @-moz-document parsing a bit.
MozReview-Commit-ID: 7vd0BLAqM0v
Bug: 1446470
Reviewed-by: xidorn
2018-03-19 10:14:59 +01:00
Florian Wagner
85bb94be9c Refactor KeyframePercentage::parse. This adresses #20179 2018-03-11 11:41:52 +01:00
Xidorn Quan
fa5d76c395 Split CssUrl from SpecifiedUrl for non-value URLs. 2018-03-08 23:34:34 +11:00
Anthony Ramine
85950a801f Move #[css(iterable)] on fields rather than variants 2018-03-06 11:08:19 +01:00
Emilio Cobos Álvarez
39a3d93b4f
style: remove unused AsciiExt imports.
eq_ignore_ascii_case is not in AsciiExt since rustc 1.23.
2018-03-04 15:31:06 +01:00
Anthony Ramine
15dcd8a8ea Derive ToCss for ViewportLength 2018-03-03 16:15:24 +01:00
Anthony Ramine
6e19fe6a8f Derive ToCss for KeyframeSelector 2018-03-03 16:15:23 +01:00
Anthony Ramine
be820092ad Derive ToCss for VectorValues 2018-03-03 16:15:23 +01:00
Anthony Ramine
51a54e1a60 Derive ToCss for PairValues 2018-03-03 16:15:22 +01:00
Anthony Ramine
71c0c3a5d3 Derive ToCss for DocumentCondition 2018-03-03 16:15:21 +01:00
Anthony Ramine
ba1d3d4b81 Derive ToCss for UrlMatchingFunction 2018-03-03 01:01:59 +01:00
Emilio Cobos Álvarez
f4c9c598a3
style: Optimize serialization of identifiers of length <= 16 🐉🐲
Much like we optimize to_ascii_lowercase.

This also fixes a bug in Servo where attr() rules with an unknown namespace
prefix are parsed, which is wrong.
2018-02-07 17:34:22 +01:00
Emilio Cobos Álvarez
349d6e7167
style: Cleanup StyleBuilder.
This is in preparation of a cascade optimization for custom properties.

This fixes various fishiness around our StyleBuilder stuff. In particular,
StyleBuilder::for_derived_style (renamed to for_animation) is only used to
compute specified values, and thus doesn't need to know about rules, visited
style, or other things like that.

The flag propagation that was done in StyleAdjuster is now done in StyleBuilder,
since we know beforehand which ones are always inherited, and it simplified the
callers and the StyleAdjuster code. It also fixed some fishiness wrt which flags
were propagated to anon boxes and text.

The text-decoration-lines bit is interesting, because the way it was implemented
in #17722 meant that display: contents elements did get HAS_DECORATION_LINES
flags only if its parent also had it, so in practice the Contents check
preserves behavior, but it's only an optimization looking at Gecko's call-sites,
so we can remove it too.

MozReview-Commit-ID: 6BHCyEO2U8c
2018-02-03 18:07:25 +01:00
Emilio Cobos Álvarez
7fb470c373
style: Remove some uses of StyleBuilder::for_derived_style.
for_derived_style(default_values) is effectively for_inheritance(default_values).

MozReview-Commit-ID: DfTeD49uTlp
2018-02-03 17:40:35 +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
Anthony Ramine
3672856efa Derive ToCss for font_feature_values_rule::SingleValue 2018-01-23 09:25:16 +01:00
Bobby Holley
5526947500 Avoid the generic writer parameter for PropertyDeclaration serialization.
MozReview-Commit-ID: JR3IcL1NRHO
2018-01-22 14:58:05 -08:00
Emilio Cobos Álvarez
a491ccac83
style: Some trivial cleanup. 2017-12-24 19:21:10 +01:00
bors-servo
5f4f355cea Auto merge of #19537 - mbrubeck:try, r=nox
style: Use the ? operator for Option

This is stable in Rust 1.22 (#19532).

---

- [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 is refactoring only

<!-- 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/19537)
<!-- Reviewable:end -->
2017-12-09 10:50:55 -06:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
Xidorn Quan
d2042d7ed1 Add @supports -moz-bool-pref() support for stylo. 2017-12-08 14:12:02 -06:00
Cameron McCormack
374f0091c1 geckolib: Add FFI function to parse a @counter-style name. 2017-12-05 10:04:52 +08:00
Emilio Cobos Álvarez
b45686f243
style: Disable @-moz-document on author sheets on nightly and early beta.
Bug: 1035091
Reviewed-by: xidorn
MozReview-Commit-ID: AAUs1jJifjS
2017-11-30 14:08:55 +01:00
Emilio Cobos Álvarez
7a5a35f5e0
style: Fix indentation of multiple CssParserContext construction. 2017-11-27 15:35:16 +01:00
CYBAI
a470ebd501 style: Move font-family outside of mako 2017-11-26 00:36:00 +08:00
Emilio Cobos Álvarez
a6923522a0
style: Avoid unneessary malloc churn when evaluating @supports rules. 2017-11-21 16:10:33 +01:00
Emilio Cobos Álvarez
8de554f334
style: Move property allowance tests to PropertyId::parse_into.
It's not only more consistent (since we have a proper ParserContext there), but
also fixes a bunch of bugs where Gecko accidentally exposes and allows setting
internal state because of conversions from nsCSSPropertyID to PropertyId.

This adds the extra complexity of caring about aliases for longer, but that's
probably not a big deal in practice, since we also have PropertyDeclarationId.

MozReview-Commit-ID: C2Js8PfloxQ
2017-11-21 14:26:16 +01:00
Xidorn Quan
faa6898237 Use InvalidRule for nested rule list. 2017-11-15 13:23:52 -08:00
Xidorn Quan
ae3989ebf0 Serialize media rule and supports rule like Gecko. 2017-11-14 13:42:06 -08:00
Simon Sapin
954b2cc3d8
Allow unused imports for AsciiExt in style code.
See #19128, this part is cherry-picked so Gecko can build with rust nightly.
2017-11-09 12:43:23 +01:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00