Commit graph

4994 commits

Author SHA1 Message Date
Jeremy Chen
adcd86deb2 stylo: Do not skip parent display-based style fixups for NAC that is not a NAC root
Stylo is currently skipping parent display-based style fixups for all NAC,
whereas we probably only want to do this for NAC roots.

In this patch, we ensure that we skip it for NAC roots, and pseudo-elements,
but not other NAC.
2017-08-31 10:28:02 +08:00
Emilio Cobos Álvarez
c69f769285
Revert "Rewrite CounterStyleOrNone::from_gecko_value to use fewer binding functions"
This reverts commit 65c2047df2.
2017-08-30 14:21:13 +02:00
bors-servo
3fa5d83ab7 Auto merge of #18234 - BorisChiou:stylo/transform/distance_mismatch, r=birtles,nox
stylo: Bug 1390039 - Implement compute_distance for mismatched transform lists.

Implement ComputeSquaredDistance for mismatched transform lists.
In order to do this, we have to convert a transform list into a 3d matrix,
so I move the code from layout module into style module for reusing it.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1390039](https://bugzilla.mozilla.org/show_bug.cgi?id=1390039).
- [X] These changes do not require tests because this is a Gecko feature and I add many tests in Gecko already.

<!-- 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/18234)
<!-- Reviewable:end -->
2017-08-30 06:03:32 -05:00
bors-servo
5dee83d54d Auto merge of #18300 - emilio:die-hvp-die, r=nox
style: Remove HasViewportPercentage.

It's not needed since #18268, let's kill it.

<!-- 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/18300)
<!-- Reviewable:end -->
2017-08-30 04:31:11 -05:00
Boris Chiou
5c5a72c1d8 Return Err(()) if determinant is not 1 or -1 while decomposing the 2d matrix.
This may happen in some cases, and we shouldn't panic in debug mode,
so let's return Err(()) for it to fall back to discrete animation.
2017-08-30 13:58:33 +08:00
bors-servo
88e7906191 Auto merge of #18304 - upsuper:counter-style-clone, r=heycam
Rewrite CounterStyleOrNone::from_gecko_value to use fewer binding functions

This is the Servo side change of [bug 1393189](https://bugzilla.mozilla.org/show_bug.cgi?id=1393189).

<!-- 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/18304)
<!-- Reviewable:end -->
2017-08-29 23:18:06 -05:00
Xidorn Quan
65c2047df2 Rewrite CounterStyleOrNone::from_gecko_value to use fewer binding functions 2017-08-30 13:52:19 +10:00
Xidorn Quan
4f6752ed1a Harden assert for creating atom from raw pointer. 2017-08-30 12:36:45 +10:00
Emilio Cobos Álvarez
36ff89bd28
style: Remove HasViewportPercentage.
It's not needed since #18268
2017-08-29 23:51:21 +02:00
bors-servo
473934c989 Auto merge of #18268 - emilio:dirty-viewport-followup, r=SimonSapin
style: Recascade the document instead of using the dirty_on_viewport_size_change bit

This allows us to simplify a lot of code.

On top of #18267.

<!-- 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/18268)
<!-- Reviewable:end -->
2017-08-29 14:18:58 -05:00
bors-servo
b2f8974ab8 Auto merge of #18290 - jdm:selectorerr, r=heycam
Report more specific CSS selector errors

Report more specific errors for invalid CSS selectors. Reviewed by @heycam in https://bugzilla.mozilla.org/show_bug.cgi?id=1384216.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [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/18290)
<!-- Reviewable:end -->
2017-08-29 09:46:22 -05:00
bors-servo
5062dc5914 Auto merge of #18293 - emilio:selector-map-box, r=SimonSapin
style: Box the PerPseudo<SelectorMap>, so we don't waste a lot of space.

<!-- 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/18293)
<!-- Reviewable:end -->
2017-08-29 07:37:55 -05:00
Emilio Cobos Álvarez
f28a62ccf3
style: Box the PerPseudo<SelectorMap>, so we don't waste a lot of space.
MozReview-Commit-ID: JmVqI6zNHql
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-29 14:23:57 +02:00
bors-servo
1c4d0d2d5d Auto merge of #18292 - emilio:animate-nan, r=nox
style: Prevent Animate to generate NaN float values.

This should fix the assertions in https://bugzilla.mozilla.org/show_bug.cgi?id=1394558.

<!-- 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/18292)
<!-- Reviewable:end -->
2017-08-29 05:18:33 -05:00
Emilio Cobos Álvarez
a7210fd082
style: Prevent Animate to generate NaN float values. 2017-08-29 11:57:50 +02:00
bors-servo
bea11cadf9 Auto merge of #18275 - Manishearth:coorddata-unsafe, r=nox
Mark the CoordData traits as unsafe

r? @nox

<!-- 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/18275)
<!-- Reviewable:end -->
2017-08-29 03:57:16 -05:00
bors-servo
bd9cf3ce98 Auto merge of #18281 - emilio:more-parse-dumbness, r=jdm
style: Avoid scanning the longhand id twice in the fast path of PropertyDeclarationBlock::parse_common

This makes the overhead of this function much lower according to `perf`.

And in general makes sense, removing overhead from the fast path.

<!-- 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/18281)
<!-- Reviewable:end -->
2017-08-29 02:48:09 -05:00
bors-servo
441ae08d24 Auto merge of #18280 - emilio:parse-dumbness, r=jdm
style: Avoid dropping a parse error on the floor when checking whether a prop is enabled.

<!-- 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/18280)
<!-- Reviewable:end -->
2017-08-29 01:34:57 -05:00
Manish Goregaokar
799437430e Mark the CoordData traits as unsafe 2017-08-28 22:28:20 -07:00
bors-servo
4804e211e8 Auto merge of #18276 - tromey:cssparser-line-number-offset, r=SimonSapin
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.

---

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #_N/A_ (github issue number if applicable).

- [ ] There are tests for these changes OR
- [x] These changes do not require tests because pre-existing tests cover this change.

<!-- 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/18276)
<!-- Reviewable:end -->
2017-08-28 22:57:13 -05:00
Josh Matthews
8e20a6a110 Report unknown pseudos (bug 1384216). 2017-08-28 17:19:28 -07:00
bors-servo
9e2f243b4d Auto merge of #18282 - emilio:moar-parsing, r=jdm
style: Remove uninlineable function in PropertyDeclarationIterator.

That literally made no sense, and is probably leftover from where we passed Map
directly there.

<!-- 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/18282)
<!-- Reviewable:end -->
2017-08-28 19:18:37 -05:00
bors-servo
d68c57158d Auto merge of #18279 - jdm:rearrange, r=emilio
Prioritize parsing non-custom property names.

This should cause a slight improvement in the common case where we are parsing non-custom property names.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- 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/18279)
<!-- Reviewable:end -->
2017-08-28 18:14:59 -05:00
Anthony Ramine
ef9d614349 Fix impl of ToComputedValue for TrackSize<T> 2017-08-28 22:48:08 +02:00
Emilio Cobos Álvarez
f6e4c5547c
style: Remove uninlineable function in PropertyDeclarationIterator.
That literally made no sense, and is probably leftover from where we passed Map
directly there.
2017-08-28 21:25:25 +02:00
Emilio Cobos Álvarez
344d53bd29
style: Avoid scanning the longhand id twice in the fast path of PropertyDeclarationBlock::push_common.
This makes the overhead of this function much lower according to `perf`.

And in general makes sense, removing overhead from the fast path.

MozReview-Commit-ID: 4dJRap9dxNG
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-28 21:20:46 +02:00
Emilio Cobos Álvarez
8a0a690384
style: Avoid dropping a parse error on the floor when checking whether a prop is enabled. 2017-08-28 21:05:06 +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
4a949e112d Prioritize parsing non-custom property names. 2017-08-28 11:20:24 -07:00
bors-servo
a266e96d28 Auto merge of #18239 - servo:derive-all-the-things, r=emilio
Refactor how we handle trait bounds in style_derive

<!-- 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/18239)
<!-- Reviewable:end -->
2017-08-28 10:13:13 -05:00
bors-servo
96b4e064a1 Auto merge of #18267 - emilio:dirty-on-viewport-size-change, r=SimonSapin
style: Don't look for viewport units in stylesheets.

Use whether we've computed any viewport unit instead.

This is more accurate (we avoid restyling unnecessarily if we've found anything
ever on the stylesheet, but that hasn't matched).

This has the benefit of also matching Gecko, and simplify some code and
fishyness around, and also hopefully speeding up stylesheet parsing.

<!-- 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/18267)
<!-- Reviewable:end -->
2017-08-28 08:48:47 -05:00
Emilio Cobos Álvarez
dcbe196ed5
style: Remove NODE_NEEDS_DIRTY_ON_VIEWPORT_SIZE_CHANGE.
Recascading is enough.
2017-08-28 14:40:48 +02:00
Emilio Cobos Álvarez
2291ce4767
style: Remove CascadeInfo. 2017-08-28 14:40:47 +02:00
bors-servo
94c870726f Auto merge of #18261 - emilio:silly-pseudo-style, r=heycam
style: Really only resolve applicable ::before / ::after.

<!-- 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/18261)
<!-- Reviewable:end -->
2017-08-28 07:01:51 -05:00
Emilio Cobos Álvarez
14d60a7e89
style: Really only resolve applicable ::before / ::after.
MozReview-Commit-ID: 4dIykkUdIxZ
2017-08-28 14:00:43 +02:00
Anthony Ramine
ba4136b5a8 Document how style traits can be derived 2017-08-28 12:26:43 +02:00
Anthony Ramine
41c3be54ea Implement #[distance(fallback)] for #[derive(ComputeSquaredDistance)] 2017-08-28 12:26:42 +02:00
Anthony Ramine
4faadb489f Implement #[css(derive_debug)]
This makes #[derive(ToCss)] derive Debug with a simple call to the to_css method.
2017-08-28 12:26:40 +02:00
Anthony Ramine
1ace6d4c7f Derive Animate for computed::Angle 2017-08-28 12:26:39 +02:00
Anthony Ramine
b543b17cf0 Derive Animate for BackgroundSize<L> 2017-08-28 12:26:38 +02:00
Anthony Ramine
318d8696e5 Derive Animate and ComputeSquaredDistance for computed font-size-adjust 2017-08-28 12:26:37 +02:00
Anthony Ramine
4a4bf89575 Implement #[animate(fallback)] for #[derive(Animate)]
This allows us to derive the Animate trait, providing a fallback function
for when the 2 values aren't similar.
2017-08-28 12:26:36 +02:00
Anthony Ramine
3751fe9fdc Derive ToComputedValue for TrackBreadth<L> 2017-08-28 12:26:35 +02:00
Emilio Cobos Álvarez
15e71c5670
style: Don't look for viewport units in stylesheets.
Use whether we've computed any viewport unit instead.

This is more accurate (we avoid restyling unnecessarily if we've found anything
ever on the stylesheet, but that hasn't matched).

This has the benefit of also matching Gecko, and simplify some code and
fishyness around, and also hopefully speeding up stylesheet parsing.
2017-08-28 12:05:22 +02:00
Anthony Ramine
735e093de7 Implement #[compute(clone)] for #[derive(ToComputedValue)] 2017-08-28 10:39:53 +02:00
Anthony Ramine
efc852f6e3 Improve handling of trait bounds when deriving fmap-like traits 2017-08-28 10:39:50 +02:00
Anthony Ramine
8101887d31 Support #[animation(constant)] when deriving ToAnimatedZero 2017-08-28 10:39:32 +02:00
Anthony Ramine
405e34aa74 Derive a bunch of animation traits for some SVG types 2017-08-28 10:39:17 +02:00
Anthony Ramine
eaf2f1ec33 Introduce #[animation(constant)] for the Animate trait
This allows us to handle fields that should be the same during animations.
2017-08-28 10:39:10 +02:00
Hiroyuki Ikezoe
21db77eb4e Don't fallback to discrete animations within animate(). 2017-08-28 14:16:34 +09:00