Commit graph

591 commits

Author SHA1 Message Date
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
b73b5b581b
style: Not all computed value flags are really inherited.
This fixes the fishiness I noticed in:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1407832
2017-10-14 14:48:27 +02:00
Emilio Cobos Álvarez
09d3a11c86
style: Reformat a couple signatures.
MozReview-Commit-ID: 7Wdvj7i8ClR
2017-10-13 17:01:31 +02:00
J. Ryan Stinnett
cedc17550c Clear visited rules for text inheritance
There are two key steps when resolving text styles with `::first-line`:

1. `ResolveStyleForText` computes the initial style of the text via
   `Servo_ComputedValues_Inherit`
2. `ReparentStyleContext` is called to update style data when the first line
   of text is moved to be a child of the `::first-line` frame

Before this patch, `Servo_ComputedValues_Inherit` would clear out unvisited
rules, but visited styles (with rules inside) were cloned as-is, meaning that
step 1 might leave the text node with a style that has:

* Unvisited rules: None
* Visited rules: Some

When we later go to step 2 and re-parent onto the `::first-line` styles, we try
to cascade with these leftover visited rules.  This causes any `::first-line`
styles from our parent to be overridden by these rules which are no longer quite
right for the new frame tree.

In this patch, we resolve this by changing `StyleBuilder::for_inheritance`
(which is used by step 1's `Servo_ComputedValues_Inherit`) to also clear out
visited rules, so that we use the same logic for both unvisited and visited text
styles when reparenting onto the `::first-line` frame.

MozReview-Commit-ID: 3sgc4eGHBXs
2017-10-11 18:45:45 -05:00
Simon Sapin
c36ac69d48 CSS parsing error types: flatten nested enums more still 2017-10-10 18:04:08 +02:00
Simon Sapin
c0f8f15f39 Update to cssparser 0.22 (source location in error types) 2017-10-10 13:28:17 +02:00
Emilio Cobos Álvarez
a6eaa0812a
style: Share custom property declarations if they don't contain variable references. 2017-10-09 12:29:50 +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
Emilio Cobos Álvarez
8ea275a376
style: Avoid unused context argument.
In custom_properties::SpecifiedValue::parse.

It's not a big deal now, but it's useful to simplify testing this stuff, since
it avoids forcing us to mock it.
2017-10-08 12:56:24 +02:00
Manish Goregaokar
aac31a35d7
stylo: all shorthand should not apply to internal properties 2017-10-03 18:01:57 -07:00
bors-servo
e13f5a656a Auto merge of #18699 - emilio:remove-cfg, r=jdm
Remove some cfg'd imports.

<!-- 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/18699)
<!-- Reviewable:end -->
2017-10-02 02:10:25 -05:00
bors-servo
28b8f8eba5 Auto merge of #18698 - emilio:always-been-cleaning-up-ifdefs, r=mrobinson
style: Remove the last of the explicit style fixups.

No more `modify_style_for_foo` in `properties.mako.rs`!

<!-- 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/18698)
<!-- Reviewable:end -->
2017-10-02 01:06:23 -05:00
Emilio Cobos Álvarez
0714652d35
style: Remove another cfg'd import.
And a redundant assertion while at it.
2017-10-01 22:56:00 +02:00
Emilio Cobos Álvarez
5e4b5105f9
style: Remove the last of the explicit style fixups.
This one is particularly dumb, I think.
2017-10-01 22:54:12 +02:00
Emilio Cobos Álvarez
9305fadc9f
style: Remove unused ComputedValues::has_visited_style. 2017-10-01 13:27:17 +02:00
Emilio Cobos Álvarez
ab8dcf0a18
style: Rename get_visited_style to just visited_style. 2017-10-01 13:27:16 +02:00
Emilio Cobos Álvarez
d2dab24748
style: Remove boilerplate code in the properties module. 2017-10-01 13:27:16 +02:00
Emilio Cobos Álvarez
4933a54803
style: deduplicate some code in the ComputedValues code. 2017-10-01 13:27:15 +02: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
ded0c713db Store custom properties in keyframes into servo's PropertyDeclarationBlock 2017-09-27 18:27:48 +09:00
Manish Goregaokar
e1a39a2012 stylo: Remove FontComputationData, switch over to using the new font tracking 2017-09-23 10:51:55 -07:00
Emilio Cobos Álvarez
680f8368ef
style: No more need_clone.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-17 04:31:18 +02:00
Emilio Cobos Álvarez
2c88248b87
style: Kill -servo-under-display-none.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-17 04:31:15 +02:00
Josh Matthews
d41baf7f5f Share more strings between Debug implementations for property-based types. 2017-09-14 11:52:46 -04:00
bors-servo
874cb0d9df Auto merge of #18499 - heycam:rule-cache, r=emilio
Rule cache

<!-- Please describe your changes on the following line: -->
This adds a TLS-based cache reset styles structs keyed off rule nodes.  Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1367635 by me and Emilio.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2017-09-14 04:28:50 -05:00
Cameron McCormack
8d3f6b116d style: Don't re-cache structs if we just got them from the cache. 2017-09-14 17:13:51 +08:00
Cameron McCormack
fd5fe0a8e3 style: Don't cache structs with custom property references. 2017-09-14 17:13:49 +08:00
Cameron McCormack
30982b92c8 style: Don't use rule cache for property-restricted pseudo-elements. 2017-09-14 17:13:48 +08:00
Cameron McCormack
a7dd19cfb1 style: Don't cache structs if they have been adjusted.
StyleAdjuster looks a bunch of things that we don't record as dependencies.
2017-09-14 17:13:47 +08:00
Cameron McCormack
73ae5ffd94 style: Make structs uncacheable if currentcolor is used on properties not using ComplexColor storage. 2017-09-14 17:13:46 +08:00
Cameron McCormack
1cde26eacb style: Record the property we are computing on computed::Context, if it's a non-inherited one. 2017-09-14 17:13:42 +08:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00
bors-servo
097cea240f Auto merge of #18495 - nnethercote:derive-PropertyDeclaration, r=jdm
Measure PropertyDeclaration more thoroughly.

This patch replaces the handwritten MallocSizeOf implementation for
PropertyDeclaration with a derived one, which gives much more thorough
measurement.

This requires (a) deriving MallocSizeOf for a *lot* of additional types (most
of which already have `derive(HeapSizeOf)` in Servo builds), and (b)
implementing MallocSizeOf for a few more types in the `malloc_size_of` crate.

These changes would significantly improve the reporting coverage for gmail if
it weren't for the fact that SpecifiedUrl isn't measured due to a lack of
clarity about its fields; that can be fixed as a follow-up once bug 1397971 has
landed.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because testing is on the Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/18495)
<!-- Reviewable:end -->
2017-09-14 02:10:40 -05:00
Bobby Holley
1c9b39a8e8 Do a second pass on the sharing cache to reuse style by rule node identity.
MozReview-Commit-ID: H67j3Sbt3gr
2017-09-13 22:06:39 -07:00
Nicholas Nethercote
c5aa2cb986 Measure PropertyDeclaration more thoroughly.
This patch replaces the handwritten MallocSizeOf implementation for
PropertyDeclaration with a derived one, which gives much more thorough
measurement.

This requires (a) deriving MallocSizeOf for a *lot* of additional types (most
of which already have `derive(HeapSizeOf)` in Servo builds), and (b)
implementing MallocSizeOf for a few more types in the `malloc_size_of` crate.

These changes would significantly improve the reporting coverage for gmail if
it weren't for the fact that SpecifiedUrl isn't measured due to a lack of
clarity about its fields; that can be fixed as a follow-up once bug 1397971 has
landed.
2017-09-14 13:18:03 +10:00
bors-servo
e50341d4a9 Auto merge of #18352 - jdm:serialize-fun, r=emilio
Make serialization match Gecko in a few corner cases

This addresses the testcases from https://bugzilla.mozilla.org/show_bug.cgi?id=1345218. Gecko differs from the specification by doing the following:
* reusing longhands that have previously been serialized in order to serialize shorthands
* immediately breaking out of the shorthand loop for the current property as soon as a shorthand is successfully serialized

https://github.com/w3c/csswg-drafts/issues/1774 is filed to track ways that the standard could be made more clear on these points.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [bug 1345218](https://bugzilla.mozilla.org/show_bug.cgi?id=1345218).
- [X] There are tests for these changes

<!-- 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/18352)
<!-- Reviewable:end -->
2017-09-13 10:51:00 -05:00
Boris Chiou
a949e2a057 Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
2017-09-13 18:05:14 +08:00
Josh Matthews
191201de6c Serialize shorthands in preferred order. 2017-09-12 18:31:21 -04:00
bors-servo
7f4cb1861b Auto merge of #18452 - nnethercote:bug-1398737, r=jdm
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.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because tested on Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/18452)
<!-- Reviewable:end -->
2017-09-11 22:11:25 -05: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
Manish Goregaokar
2db5fbbe56 stylo: Replace FontComputationData with typedef 2017-09-11 17:29:39 -07:00
Manish Goregaokar
1ad9463558 stylo: Add (unused) absolute offset to FontComputationData 2017-09-11 16:05:37 -07:00
bors-servo
d2b689cf2e Auto merge of #18444 - ferjm:bug1384221.alias.errors, r=jdm
stylo: Fix error reporting for invalid values in property alias

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [bug 1384221](https://bugzilla.mozilla.org/show_bug.cgi?id=1384221)
- [X] There are [tests](https://bug1384221.bmoattachments.org/attachment.cgi?id=8906527) for these changes

<!-- 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/18444)
<!-- Reviewable:end -->
2017-09-11 12:50:11 -05:00
Fernando Jiménez Moreno
3be7ad8b6f stylo: Fix error reporting for invalid values in property alias 2017-09-11 18:47:12 +02:00
bors-servo
e7f45028dc Auto merge of #18431 - mbrubeck:pdb-size, r=SimonSapin
Use SmallBitVec to optimize size of PropertyDeclarationBlock

https://bugzilla.mozilla.org/show_bug.cgi?id=1398322

<!-- 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/18431)
<!-- Reviewable:end -->
2017-09-11 08:57:07 -05:00