Commit graph

204 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
e6f9ad0edb
style: Don't call the before change closure with the locked declaration block.
Test Plan: No behavior change.

Reviewers: xidorn

Bug #: 1468665

Differential Revision: https://phabricator.services.mozilla.com/D1681
2018-06-23 20:34:14 +02:00
Emilio Cobos Álvarez
00b42fc6ef
style: Remove some cfgs. 2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
cdbc409759
style: Trivially simplify a condition.
Bug: 1466963
Reviewed-by: xidorn
MozReview-Commit-ID: L9LzpPt4js4
2018-06-12 12:15:15 -07:00
Emilio Cobos Álvarez
3c7fb2a217
style: Add a before-change callback to remove_property.
Bug: 1466963
Reviewed-by: xidorn
MozReview-Commit-ID: 4vyN9iLT7e3
2018-06-12 12:15:14 -07:00
Emilio Cobos Álvarez
6ca324f8b5
style: Remove unused PropertyDeclarationBlock::set_importance.
Bug: 1466963
Reviewed-by: xidorn
MozReview-Commit-ID: 1YrlOvktag9
2018-06-12 12:15:14 -07:00
Emilio Cobos Álvarez
e052666153
style: Fix a typo.
Nobody looks at the result from parsing, but this is the right thing to return.

Bug: 1466963
Reviewed-by: xidorn
MozReview-Commit-ID: 9P5VARiPIAk
2018-06-12 12:15:13 -07:00
Emilio Cobos Álvarez
915c8725ae
style: Remove PropertyId::name.
It's only used for the error path in property parsing, so most of the time is
not useful.

Use the just-introduced NonCustomPropertyId::name to preserve the alias name,
which we were doing by passing the name around.

Bug: 1466645
Reviewed-by: xidorn
MozReview-Commit-ID: 46xxZKCoeBB
2018-06-12 12:15:12 -07:00
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
Matt Brubeck
e3f79d9130 Update to smallbitvec 2.1 2018-04-17 17:24:54 -07:00
Xidorn Quan
3274e84278 Have CSSOM append rather than replace slot in declaration block.
The early return for identical setting in importance matching as well
as the comment before `index_to_remove` are removed because the order
is web-exposing regardless of whether it's from CSSOM or parsing. e.g.
`top: 1px; left: 2px; top: 1px;` is effectively `left: 2px; top: 1px;`,
not `top: 1px; left: 2px;`.
2018-04-07 19:58:27 +10:00
Emilio Cobos Álvarez
8c4b401dd3
style: Only expose longhands to rust via iterators.
The key here is that we only filter longhands if the shorthand is accessible to
content and vice-versa. This prevents the bug that prevented me to land this
patch before, which was us not expanding properly chrome-only shorthands.

Again, this is incomplete, and I need to teach LonghandsToSerialize to get a
potentially incomplete list of properties, and all that.
2018-02-28 00:19:31 +01:00
Emilio Cobos Álvarez
0b1f78275c
style: Remove unneeded whitespace.
I bet it was added when this code was part of a mako file.
2018-02-20 16:32:13 +01:00
Emilio Cobos Álvarez
1359c7c218
style: Don't try to serialize the same shorthand over and over.
I looked at what were we doing in that loop, and we're doing tons of dumb stuff.

In particular, we try to serialize the "all" shorthand all the time. This patch
prevents us from trying to serialize shorthands that we've already tried to
serialize.
2018-02-20 14:21:35 +01:00
Emilio Cobos Álvarez
c09257b540
style: There's no need to check the serialized custom properties.
Given they're not duplicated, and can't be part of a shorthand.
2018-02-20 14:21:34 +01:00
Emilio Cobos Álvarez
e46f910b66
style: Rejigger serialization of a declaration block to not look at the shorthands length.
This is because I'm going to make shorthands() and longhands() return an
iterator, so that we account for prefs properly
(https://bugzilla.mozilla.org/show_bug.cgi?id=1438234).
2018-02-20 10:05:58 +01:00
Emilio Cobos Álvarez
c676b52448
style: Sprinkle some #[inline] on trivial methods. 2018-02-20 10:05:12 +01:00
Emilio Cobos Álvarez
f896cb63a6
style: Make DeclarationBlock::get O(1) if we know the longhand isn't there. 2018-02-20 10:04:17 +01:00
Emilio Cobos Álvarez
7473796aba
style: Unship the legacy syntax for -moz-transform.
Intent to unship link:

  https://groups.google.com/d/msg/mozilla.dev.platform/T3PGm97MPNU/59XUavMlCgAJ

Reviewed-by: xidorn
Bug: 1438297
MozReview-Commit-ID: 6ybGBasPAWU
2018-02-19 10:46:14 +01:00
Emilio Cobos Álvarez
502b734a1a
style: Update a couple other spec links. 2018-02-14 20:29:40 +01:00
Emilio Cobos Álvarez
808102035e
style: Deindent and reuse some more code in single_value_to_css.
This method is a hack on its own, let's try to scope it a bit...
2018-02-14 20:29:11 +01:00
Emilio Cobos Álvarez
f3e38aca1b
style: Move the shorthand serialization code to its own function. 2018-02-14 20:29:10 +01:00
Emilio Cobos Álvarez
5c2ac8cf8b
style: Deindent a giant loop guarded by an !is_empty() condition. 2018-02-14 20:29:09 +01:00
Emilio Cobos Álvarez
ba7629a17e
style: Update a spec link. 2018-02-14 20:29:09 +01:00
Anthony Ramine
5195eb38f2 Make all PropertyDeclaration variants have only one field 2018-02-06 13:45:18 +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
Bobby Holley
5526947500 Avoid the generic writer parameter for PropertyDeclaration serialization.
MozReview-Commit-ID: JR3IcL1NRHO
2018-01-22 14:58:05 -08:00
Xidorn Quan
3593392788 Skip rule node which contains only inherited properties for rule cache. 2018-01-05 11:29:01 +11:00
Emilio Cobos Álvarez
dbf0183b0f
style: Use ? in Option more often. 2017-12-09 20:26:09 +01:00
Emilio Cobos Álvarez
3fe28e380c
style: Don't unconditionally extend() the declaration block vector.
Since it appears in profiles when used from CSSOM, like the one in the bug
mentioned in the comment.
2017-12-08 21:30:58 +01:00
Emilio Cobos Álvarez
2bbeda97d3
style: Inline some things that should never ever appear in a profile. 2017-12-01 20:04:33 +01:00
Emilio Cobos Álvarez
7a5a35f5e0
style: Fix indentation of multiple CssParserContext construction. 2017-11-27 15:35:16 +01:00
Emilio Cobos Álvarez
47e9c88742
style: Deindent some property declaration code. 2017-11-26 17:16:22 +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
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01: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
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00
Emilio Cobos Álvarez
6fbf006680
style: Fixup the hack added in #18867.
The declaration can indeed have the same id if it contains variables, or is a
CSS keyword value.

This was making a WPT test fail, so this is tested, though Servo's WPT import
didn't catch this for some reason.
2017-10-14 15:28:10 +02:00
bors-servo
2be76c5fd7 Auto merge of #18867 - emilio:parse-hack, r=heycam
style: Dishonor display: -moz-box if -webkit-box was specified before

This is a compatibility hack that Gecko supports that is apparently important for android.

I want to remove it, but let's see...

See https://bugzilla.mozilla.org/show_bug.cgi?id=1407701 for reference.

<!-- 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/18867)
<!-- Reviewable:end -->
2017-10-14 05:27:51 -05:00
Emilio Cobos Álvarez
6d694a4bcd
style: Dishonor display: -moz-box if -webkit-box was specified before.
Bug: 1407701
2017-10-14 11:31:01 +02:00
Emilio Cobos Álvarez
25c303ee62
style: Be clearer about whether a declaration comes from parsing or not.
This introduces DeclarationSource, to see if a declaration has been parsed or
set from CSSOM in a declaration block.

The Servo_DeclarationBlock_SetFoo and similar callers are changed to
DeclarationSource::CssOm because their semantics are more CSSOM-y, but it
shouldn't matter since they should all be checked before hand with
Servo_DeclarationBlock_PropertyIsSet.
2017-10-14 11:30:59 +02:00
Emilio Cobos Álvarez
09d3a11c86
style: Reformat a couple signatures.
MozReview-Commit-ID: 7Wdvj7i8ClR
2017-10-13 17:01:31 +02:00
Simon Sapin
c36ac69d48 CSS parsing error types: flatten nested enums more still 2017-10-10 18:04:08 +02:00
Simon Sapin
46ea99d54b CSS parsing error types: flatten nested enums somewhat 2017-10-10 13:28:30 +02:00
Simon Sapin
c64374bc58 Use the location in the error value when reporting a CSS error 2017-10-10 13:28:29 +02:00
Simon Sapin
c0f8f15f39 Update to cssparser 0.22 (source location in error types) 2017-10-10 13:28:17 +02:00
Simon Sapin
056e599562 Use the current parser location for CSS error
… rather than the start location of the current construct.
This likely places the error just *after* of the unexpected token
whereas before would be best, but that’s likely a much bigger change.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1378861
2017-10-10 13:27:01 +02:00
Emilio Cobos Álvarez
d0f080d5dd
style: Introduce CustomPropertiesBuilder.
I'm about to introduce more state here to implement optimizations for custom
property cascading, so this abstraction is useful to encapsulate that state.
2017-10-08 15:01:21 +02:00
Hiroyuki Ikezoe
c8c02aab86 Use NormalDeclarationIterator for AnimationValueIterator 2017-10-03 07:33:30 +09:00