Commit graph

61 commits

Author SHA1 Message Date
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
Manish Goregaokar
eda6a4fc4f stylo: Pass parser URL data in Servo_DeclarationBlock_SetProperty*
MozReview-Commit-ID: EVk4aEoyiXv
2017-03-09 14:44:17 -08:00
avinash
f48f0567cf Add ServoUrl as a parameter to report_error(...) of ParseErrorReporter
passes test-tidy
removed match and used map

added new test test_report_error_passing_correct_url(...) and modified old unit tests

removed the option for servourl and tidied up

removed the duplicate test.

made a few more changes after @cbrewster suggestions.

changed _url to url in few places

fixed the indenting
2017-03-06 09:06:42 -06:00
Manish Goregaokar
ff08de8ad1 stylo: Support stroke-dasharray and stroke-dashoffset
MozReview-Commit-ID: 4QKKzJ1DVYP
2017-02-18 02:43:36 -08:00
Simon Sapin
c3cad2d6c7 Update cssparser to 0.9 2017-02-15 12:42:14 +01:00
Simon Sapin
9ec8418d8c Rename CommaSeparated to OneOrMoreCommaSeparated, reflecting its behavior. 2017-02-03 13:15:53 +01:00
Simon Sapin
4701850f37 Add unicode-range descriptor to @font-face 2017-02-02 20:28:21 +01:00
Manish Goregaokar
b4a83b6cec CSSOM bits for @supports: CSSConditionRule and CSSSupportsRule, with conditionText attribute 2017-01-07 23:17:52 -08:00
Emilio Cobos Álvarez
e8d947430a
style: Document and clean up the parser module. 2017-01-02 12:57:52 +01:00
Ravi Shankar
dee1a65a69 Use the ParserContext along with Parser in the parse function 2016-11-27 08:49:20 +05:30
Simon Sapin
82b13d50e3 Update to selectors 0.15 2016-11-22 14:50:21 +01:00
Simon Sapin
b203ab2419 Rename selector_impl.rs to selector_parser.rs
This makes it consistent with an upcoming update of the selectors crate.
2016-11-20 15:30:37 +01:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Emilio Cobos Álvarez
5f2e7af864
style: Centralize specified url value handling, and refcount urls. 2016-11-10 13:15:21 +01:00
Manish Goregaokar
2bde9462b1 Add safer bindings for RefPtr 2016-10-14 00:44:06 +05:30
Manish Goregaokar
254900bd1a
Add ShapeSource to basic-shape values 2016-08-18 11:38:33 +05:30
Simon Sapin
fdb2071b2d Update to selectors 0.8.2 2016-08-09 18:18:38 +02:00
Ms2ger
79e0d18a1d Add some documentation to the style crate. 2016-06-27 17:33:14 +02:00
Cameron McCormack
6d67aa8a01 Pass Gecko sheet base/referrer/principal from Servo_StylesheetFromUTF8Bytes through ParserContext. 2016-05-24 12:12:17 +10:00
Cameron McCormack
bb85f5faf0 Add an extra data field to ParserContext.
This will be used for passing Gecko-specific information through
the CSS parser in stylo.
2016-05-24 12:12:10 +10:00
Simon Sapin
6889f37d9e Remove the url! plugin.
In rust-url 1.0 the `Url` struct is going to have private fields, and there
is no way to to create an aribitrary one without going through the parser.

The plugin never had a clear demonstrated performance benefit,
it was made mostly because it was possible and relatively easy at the time.
2016-04-14 15:35:28 +02:00
Bobby Holley
384cdfcfff Hoist ParseErrorReporter into style and remove the dependency on msg.
The pipeline id stuff is currently unused. If someone needs it, they can add
an additional trait bound on their css error reporter to get the pipeline id.
2016-01-11 18:01:48 -08:00
Mathieu Agopian
11234f5370 Use Url.join instead of UrlParser.base_url(...).parse (#9002) 2015-12-18 17:02:41 +01:00
GauriGNaik
fc81276c8e Add pipeline information to CSS error reporting. 2015-12-14 11:18:30 -05:00
Simon Sapin
b19cc7e44c Fix warnings
Fixing unused attributes warnings required updating serde_macros
which required updating to rustc 1.6.0-nightly (a2866e387 2015-11-30)
which required updating some other dependencies.
2015-12-03 17:05:26 +01:00