Commit graph

193 commits

Author SHA1 Message Date
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
Emilio Cobos Álvarez
2adfd84636
style: Avoid being so Arc-happy in the custom properties code. 2017-10-01 13:27:15 +02:00
Emilio Cobos Álvarez
b7b22b76a8
style: Use PrecomputedHasher for custom properties. 2017-09-30 14:35:38 +02:00
Emilio Cobos Álvarez
3215e36b5b
style: Cleanup the animated value setup.
We have three different enums to represent slightly different things. Reuse them
properly, and kill some code in the animated_properties module while at it.

MozReview-Commit-ID: 5ZAly8f4lWy
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-29 13:20:50 +02:00
Hiroyuki Ikezoe
5481d8ed6f Compute css variables with custom properties in keyframes for getKeyframes() 2017-09-27 18:27:57 +09:00
Hiroyuki Ikezoe
1b39041a8c Factor custom properties in keyframes into compute values in each keyframe 2017-09-27 18:27:55 +09:00
Hiroyuki Ikezoe
a940999795 Filter out !important property in keyframes for stylo. 2017-09-20 15:58:40 +09:00
bors-servo
bb2030a493 Auto merge of #18494 - frewsxcv:frewsxcv-size-hint, r=jdm
Implement `size_hint` for more iterators.

```
implement size hint for
more iterators because why
not we like fast things
```

<!-- 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/18494)
<!-- Reviewable:end -->
2017-09-13 19:38:32 -05:00
Corey Farwell
9cd4535364 Implement size_hint for more iterators.
```
implement size hint for
more iterators because why
not we like fast things
```
2017-09-13 20:29:27 -04:00
Josh Matthews
5b83beaceb Consider serializing shorthands based on previously-serialized longhands. 2017-09-13 10:58:50 -04:00
Nicholas Nethercote
32548e5312 Overhaul MallocSizeOf and related things.
This patch makes the MallocSizeOf stuff in Stylo work more like the HeapSizeOf
stuff already in Servo, except better. In particular, it adds deriving support
for MallocSizeOf, which will make it easier to improve coverage.

The patch does the following.

- Combines servo/components/style/stylesheets/memory.rs and the heapsize crate
  into a new crate, malloc_size_of.

- Forks the heapsize_derive crate, calling it malloc_size_of, so that
  MallocSizeOf can be derived.

- Both the new crates have MIT/Apache licenses, like heapsize, in case they are
  incorporated into heapsize in the future.

- Renames the methods within MallocSizeOf and the related traits so they are
  more concise.

- Removes MallocSizeOfWithGuard.

- Adds `derive(MallocSizeOf)` to a lot of types, in some cases replacing an
  equivalent or almost-equivalent hand-written implementation.

- Adds stuff so that Rc/Arc can be handled properly.
2017-09-12 12:37:51 +10:00
Xidorn Quan
d486def53b Use the LonghandIdSet to check whether a property is set 2017-09-12 08:47:26 +10:00