Simon Sapin
1d38bc0419
Fix some new warnings
2019-06-22 14:59:09 +02:00
Emilio Cobos Álvarez
02210264e7
style: Centralize a bit invalid value error reporting.
...
Also, buffer the errors, since we're going to want to look at the whole
declaration block to skip reporting them.
This shouldn't change behavior, just moves some work to the caller, and defers a
bit the work so that it happens only when error reporting is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D30200
2019-05-10 12:42:56 +02:00
Emilio Cobos Álvarez
bd77cd64b9
style: Refactor some enabledness checks.
...
There are some common checks that could get some easy-to-use aliases.
Differential Revision: https://phabricator.services.mozilla.com/D25117
2019-04-12 12:19:38 +02:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4)
2018-11-19 14:47:27 +01:00
Simon Sapin
b1822a39fa
cargo fix --edition --features gecko
2018-11-10 17:47:28 +01:00
Simon Sapin
a15d33a10e
cargo fix --edition
2018-11-10 17:47:28 +01:00
chansuke
8dab4d659a
Format style component.
2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
89b8f30737
style: Hook the use counters into StyleSheet parsing.
...
Still not hooked into telemetry, I talked with :janerik and :gfritzsche about
that, but test incoming!
This intentionally doesn't handle CSSOM and such for now, will file followups
for those, though should be trivial.
I want to unify / clean up how we do the use counters and the error reporting
stuff for CSSOM, since the current function call still shows up in profiles,
but that should be a follow-up.
Differential Revision: https://phabricator.services.mozilla.com/D3828
2018-09-03 12:31:33 +02:00
Emilio Cobos Álvarez
c8e5b7f1b0
style: Add a very simple use counter implementation.
...
As simple as I could make it, for now. We can improve on this.
Differential Revision: https://phabricator.services.mozilla.com/D3827
2018-09-03 12:31:23 +02:00
Emilio Cobos Álvarez
3a0c3224b9
style: Move the error reporter into ParserContext.
...
Summary:
This should make it easier to report errors, and also reduce codesize.
The reason this was so generic is that error reporting was unconditionally
enabled and was super-hot, but now that's no longer the case after bug 1452143,
so we can afford the virtual call in the "error reporting enabled" case.
This opens the possibility of simplifying a lot the error setup as well, though
this patch doesn't do it.
Test Plan: No behavior change, so no new tests.
Reviewers: xidorn
Bug #: 1469957
Differential Revision: https://phabricator.services.mozilla.com/D1734
MozReview-Commit-ID: F3wTdhX9MB5
2018-06-23 20:36:23 +02:00
Emilio Cobos Álvarez
2c0a19e517
style: Move some parsing-only attributes to use #[parse(..)] instead of #[css(..)].
...
I need to admit I'm ambivalent about this one :).
Bug: 1466609
Reviewed-by: xidorn
MozReview-Commit-ID: F1jlfnQKXwo
2018-06-12 12:15:10 -07:00
Emilio Cobos Álvarez
1da798e65b
style: Introduce css(parse_condition).
...
This will allow us to add a pref for this, and to parse it only on chrome easily.
Bug: 1288572
Reviewed-by: xidorn
MozReview-Commit-ID: L1rsyc2A2hu
2018-06-12 12:15:06 -07: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
Emilio Cobos Álvarez
fdc8405330
style: Trivially cleanup length parsing.
...
Mostly formatting signatures properly, but also removing useless functions and
stuff.
2018-02-16 16:04:19 +01:00
Emilio Cobos Álvarez
7036cb0077
Allow deriving Parse for keywords.
2017-12-15 20:01:31 +01:00
Emilio Cobos Álvarez
7a5a35f5e0
style: Fix indentation of multiple CssParserContext construction.
2017-11-27 15:35:16 +01:00
Emilio Cobos Álvarez
c7a3c929f6
style: Enable chrome-only CSS features in user stylesheets.
...
MozReview-Commit-ID: FJ4vTiOrotH
Reviewed-by: heycam
Bug: 1418963
2017-11-21 10:59:47 +01:00
Bastien Orivel
29b4eec141
Bump bitflags to 1.0 in every servo crate
2017-10-30 23:36:06 +01:00
Emilio Cobos Álvarez
066de9f8d2
style: Minimal ParserContext cleanup.
...
MozReview-Commit-ID: I1Qgy1W7azU
2017-10-24 12:30:20 +02:00
Gecko Backout
11c64178d8
Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
...
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
Bastien Orivel
e8e2d0a4b2
Update bitflags to 1.0 in every servo crate
...
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Emilio Cobos Álvarez
b0706d5cf0
stylo: Add a mechanism to restrict media-features to UA and chrome sheets.
...
Reviewed-by: xidorn
Bug: 1396066
MozReview-Commit-ID: 38jRV6mPbE3
2017-10-07 13:13:36 +02:00
Xidorn Quan
8fc24bc5fa
Backout #18759
2017-10-07 12:27:04 +11:00
Emilio Cobos Álvarez
43636e676d
stylo: Restrict system-metric media features to UA and chrome sheets only. r=xidorn
...
Reviewed-by: xidorn
Bug: 1396066
MozReview-Commit-ID: 38jRV6mPbE3
2017-10-05 20:51:21 +02:00
Tom Tromey
546ecaeee9
Use cssparser's new_with_line_number_offset
...
cssparser provides a way to set the initial line number on a
ParserInput. This patch changes servo to use this facility, rather than
reimplement the same functionality itself.
2017-08-28 12:49:30 -06:00
Josh Matthews
1297c0ff51
Devirtualize CSS error reporting.
2017-08-24 10:41:06 -07:00
Emilio Cobos Álvarez
a962c54928
style: Cleanup ParserContext::new_with_rule_type.
2017-08-18 19:57:59 +02:00
Emilio Cobos Álvarez
4763d05cf0
style: A few minor formatting cleanups.
2017-08-18 16:10:41 +02:00
Simon Sapin
7382dad939
Update to cssparser 0.19, count line numbers during tokenization
2017-08-09 22:37:16 +02:00
Anthony Ramine
c03f5f19ab
Introduce CommaWithSpace
...
This allows us to support stroke-dasharray the same way as comma-separated
values.
2017-06-27 23:37:48 +02:00
Anthony Ramine
17875b8a81
Introduce Separator::parse
2017-06-27 23:37:44 +02:00
Jonathan Chan
26179b3660
style: Have OneOrMoreSeparated replace OneOrMoreCommaSeparated.
...
A future patch series has some values that should be separated by spaces. This
allows us to re-use the code for serialization, but the types do get a little
clunky. The separator is now indicated with an associated type.
2017-06-19 16:09:37 -07:00
Hiroyuki Ikezoe
8bfed4cb3c
Move ParsingMode into style_traits.
2017-06-14 09:51:36 +09:00
Josh Matthews
27ae1ef2e7
Thread ParseError return values through CSS parsing.
2017-06-09 16:46:25 -04:00
Josh Matthews
fd6e54d9e3
Report CSS parse errors via enum instead of strings.
2017-06-09 13:16:32 -04:00
Emilio Cobos Álvarez
bbd85ccbda
style: Simplify the namespace setup for stylesheet parsing.
2017-06-02 14:38:05 +02:00
Manish Goregaokar
25d193ba34
stylo: Use namespace ids for content: attr(..)
...
MozReview-Commit-ID: FZ9YEpHQCBh
2017-06-01 14:11:31 -07:00
Manish Goregaokar
7deeccf4cb
stylo: Move reference of namespace map to parser context
...
MozReview-Commit-ID: 74Kaj2Rqkdb
2017-06-01 14:10:40 -07:00
Hiroyuki Ikezoe
59dd93f849
Add PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES to force to parse negative values.
...
As per SVG spec [1], we should also parse negative color components values for
SMIL, but currently Gecko does not support it either.
[1] https://www.w3.org/TR/SVG/implnote.html#RangeClamping
2017-05-14 07:15:19 +09:00
Hiroyuki Ikezoe
b6b3187efa
Make ParsingMode bitflags.
...
assert_parsing_mode_match() is mostly the same as
assert_restyle_hints_match().
2017-05-14 07:15:19 +09:00
Hiroyuki Ikezoe
fcc50ea421
Rename LengthParsingMode to ParsingMode and LengthParsingMode::SVG to PasingMode::AllowUnitlessLength.
...
We need another flag that represents allow-negative-number for SMIL, so
this enum will also comprise the another parsing mode that allows negative number.
2017-05-14 07:15:19 +09:00
Emilio Cobos Álvarez
0c5681140a
style: Use SmallVec in the computed value representation of most stuff.
2017-04-30 23:32:32 +02:00
Anthony Ramine
f68e2fded9
Propagate quirks mode all the way to ParserContext
...
The quirks mode is still not properly propagated in geckolib.
2017-04-27 10:41:55 +02:00
J. Ryan Stinnett
6069e44f02
SVG length parsing mode
...
SVG allows non-zero lengths to be accepted and assumes they are in px. This
adds this length parsing mode to Servo.
MozReview-Commit-ID: Kxd3x64r9Ye
2017-04-14 17:22:16 +08:00
mckaymatt
5d8cbd8e6a
Support line number offsets for inline stylesheets
2017-04-13 19:36:49 -04:00
J. Ryan Stinnett
4574cd8ea6
Pull rule_type into ParserContext
...
Absorb `rule_type` into the `ParserContext` so that it's easier to pass down to
deeper levels of the parser.
MozReview-Commit-ID: DjBNytLxGKX
2017-04-12 16:40:17 +08:00
Simon Sapin
3ac0dd05cf
ParserContext::new_for_cssom is used for author origin, not user.
...
This probably doesn’t make any difference since the only thing we do
with this origin is test whether it is user-agent (for internal properties),
but this is more correct.
2017-04-03 18:28:47 +02:00
Xidorn Quan
37585309e9
Use a UrlExtraData type alias to unify url handling logic.
2017-04-03 21:57:16 +10:00
Xidorn Quan
0a97a0df0c
Create URLExtraData for holding base uri, referrer, and principal.
2017-04-03 14:30:33 +10:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter.
2017-03-14 00:49:18 +01:00