Commit graph

264 commits

Author SHA1 Message Date
Boris Chiou
6dd8b159d7 Bug 1374233 - Part 12: Implement ToAnimatedValue for LineHeight.
Besides, we replace its type with
GenericLineHeight<NonNegativeNumber, NonNegativeAu>.

MozReview-Commit-ID: GGOGXyUFJsJ
2017-08-04 14:23:28 +08:00
Boris Chiou
ebedea5860 Bug 1374233 - Part 11: Implement ToAnimatedValue for background-size.
MozReview-Commit-ID: DMcvpaqHdy9
2017-08-04 14:23:26 +08:00
Boris Chiou
bd0a098ef1 Bug 1374233 - Part 9: Add NonNegativeLengthOrPercentageOrNumber for stroke-{width|dasharry}.
Also add SVGWidth which use NonNegativeSVGLengthOrPercentage
as the LengthType for stroke-width.

MozReview-Commit-ID: 8gD0fVe2eAe
2017-08-04 14:23:24 +08:00
Boris Chiou
e72a0f126e Bug 1374233 - Part 7: Add NonNegativeLengthOrPercentage.
For padding-{*} and grid-{*}-gap.

MozReview-Commit-ID: 81G0b1k6JnD
2017-08-04 14:23:21 +08:00
Boris Chiou
9d69cb2866 Bug 1374233 - Part 6: Add PositiveInteger and PositiveIntegerOrAuto for column-count.
column-count should be a positive integer or auto.

MozReview-Commit-ID: 9LFvrYo8De5
2017-08-04 14:23:17 +08:00
Boris Chiou
190cd5b952 Bug 1374233 - Part 5: Use NonNegativeLength and NonNegativeAu for border-spacing.
We already have NonNegativeLength and NonNegativeAu, so we can re-use it
to define the specified value and the computed value of border-spacing.
And then implement ToAnimatedValue for it.

MozReview-Commit-ID: CLckpKMYVXU
2017-08-04 14:22:36 +08:00
Boris Chiou
2ef38ce67a Bug 1374233 - Part 4: Add NonNegativeLengthOr{Auto|Normal|Number}.
Add NonNegativeLength, which could be computed to NonNegativeAu. So we
can declare Either<NonNegativeLength, X>, X=Auto, Normal, or Number.

NonNegativeLengthOrAuto is for column-width.
NonNegativeLengthOrNormal is for column-gap.
NonNegativeLengthOrNumber is for -moz-tab-size.

MozReview-Commit-ID: AfU8XpA1um0
2017-08-04 14:22:32 +08:00
Boris Chiou
191c2a282b Bug 1374233 - Part 2: Add NonNegativeAu.
Add values::computed::NonNegativeAu, so BorderSideWith could be computed
to this non-negative Au, for the following properties:
1. outline-width
2. border-{*}-width
3. column-rule-width
4. -webkit-text-stroke-width

MozReview-Commit-ID: ASHaB2F7VtM
2017-08-04 14:21:57 +08:00
Boris Chiou
4cc97746f2 Bug 1374233 - Part 1: Add NonNegativeNumber and GreaterThanOrEqualToOneNumber.
NonNegativeNumber: for -moz-box-flex, flex-grow, and flex-shrink.
GreaterThanOrEqualToOneNumber: for stroke-miterlimit.

MozReview-Commit-ID: Kgbt99BPdVA
2017-08-04 14:21:21 +08:00
Xidorn Quan
ef4352d2a5 Add context-{fill,stroke}-opacity support to {fill,stroke}-opacity. 2017-08-02 10:35:18 +10:00
Xidorn Quan
7827ca6bb5 Make stroke-dasharray accept context-value. 2017-08-02 10:35:17 +10:00
Xidorn Quan
aa80859a71 Add SVGLength which accepts context-value, and use it for stroke-{width,dashoffset}. 2017-08-02 10:03:15 +10:00
Xidorn Quan
0071c7663f Add svg mods and move SVG-related types into them. 2017-08-02 10:03:08 +10:00
Hiroyuki Ikezoe
b0a91ecd3a Fix multiply matrix order for skew. 2017-07-29 08:45:48 +09:00
Hiroyuki Ikezoe
81e51b31d6 Fix rotate_to_matrix.
We used transposed matrices for rotate before this fix.

https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined
2017-07-29 08:45:13 +09:00
Boris Chiou
902819590f Rewrite compute_squared_distance for AnimatedFilterList. 2017-07-28 11:27:46 +08:00
Boris Chiou
20e3508ca3 Implement compute_distance for Angle.
When computing the distance between two filter functions, e.g.
HueRotate(0deg) and HueRotate(-360deg), we got an Err(()) and unwrap it
immediately in compute_filter_square_distance(), which causes a crash.
The root-cause is that we don't implement computed_distance of Angle, and we
assume we always get a valid result from compute_squared_distance() for
each filter function.
2017-07-27 15:23:44 +08:00
Hiroyuki Ikezoe
123e5d33c2 MatrixDecomposed3D.add_weighted() is called with zero value for other_portion in case of iteration composite.
In the case where we accumulate transform:none onto decomposed matrix for
iteration composite whose iteration count is over 2, we pass zero
other_portion and self_portion which is over 1.0.  We should care about the
case.
2017-07-27 06:20:35 +09:00
Boris Zbarsky
648c0a3d0b Remove the inherited_style getter from StyleBuilder.
The concept of inherited style is about to get a bit more complicated, and this
will prevent consumers from doing it wrong.

Part 1 of Gecko bug1382806.  r=emilio
2017-07-26 13:40:02 -04:00
Simon Sapin
eb98ae6e04 Update cssparser to 0.18
https://github.com/servo/rust-cssparser/pull/171
2017-07-24 11:39:12 +02:00
Brian Birtles
8e7011da8a Iterate through properties in priority order when computing keyframes
This is largely just a translation of Gecko's
PropertyPriorityIterator[1] into rust with the exception that IDL sort
order is only defined for shorthands since that's all we currently
require.

[1] http://searchfox.org/mozilla-central/rev/3a3af33f513071ea829debdfbc628caebcdf6996/dom/animation/KeyframeUtils.cpp#151
2017-07-24 13:50:18 +09:00
bors-servo
f594ae58a6 Auto merge of #17788 - emilio:clean-cascade, r=heycam
style: Cleanup the cascade a good bit.

Was about the time.

<!-- 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/17788)
<!-- Reviewable:end -->
2017-07-20 02:36:15 -07:00
Emilio Cobos Álvarez
e374a54050
style: Cleanup the cascade a good bit. 2017-07-20 11:20:37 +02:00
Jeremy Chen
22a16ccee7 stylo: Fix Y scale computation while decomposing a 3D matrix.
While decomposing a 3D matrix, we should normalize the 2nd row right after the
Y scale computation. However, we accidentally use the length of the 1st row to
do the normalization. This causes the wrong Scale3D function while decomposing,
and then leads to the wrong decomposed 3D matrix.

Here, we correct it by using the right value (the length of the 2nd row).

r=hiro https://bugzilla.mozilla.org/show_bug.cgi?id=1381196
2017-07-20 10:58:01 +08:00
bors-servo
d76d097891 Auto merge of #17774 - servo:derive-all-the-things, r=emilio
Prepare some code for future derivation 🌊

<!-- 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/17774)
<!-- Reviewable:end -->
2017-07-19 01:56:05 -07:00
Anthony Ramine
98bf832169 Move Animatable::get_zero_value to ToAnimatedZero::to_animated_zero 2017-07-19 10:19:44 +02:00
Anthony Ramine
99592cc3d1 Put Animatable at the start of animated_properties 2017-07-19 10:19:42 +02:00
Emilio Cobos Álvarez
fe8638a618
style: More ComputedValuesInner cleanup.
MozReview-Commit-ID: 8rkAP3pMEpD
2017-07-18 17:35:59 +02:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Emilio Cobos Álvarez
310be02ba8
style: Respect calc for percentages. 2017-07-14 13:43:27 +02:00
Simon Sapin
34c5a21691 Merge per-property substitute_variables* functions into one. 2017-07-13 16:23:36 +02:00
Brian Birtles
255b4e10c7 Tidy up check for zero-length lists when interpolating 2017-07-12 09:55:03 +09:00
bors-servo
2ddbc92d90 Auto merge of #17655 - jdm:stylo-error-reporter, r=emilio
Hook up Stylo error reporter to Firefox devtools

Reviewed by @emilio in https://bugzilla.mozilla.org/show_bug.cgi?id=1352669.

---
- [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/17655)
<!-- Reviewable:end -->
2017-07-10 18:13:44 -07:00
Josh Matthews
a08371e8eb stylo: Create error reporters linked to documents (bug 1352669) 2017-07-10 20:46:08 -04:00
Hiroyuki Ikezoe
0d43281fad Consider f64 epsilon for add_weighted portions.
This patch also degrade assert! to debug_assert! since crash reports don't show
us useful information so far (no assertion messages at all).
2017-07-11 08:42:28 +09:00
bors-servo
f11a922760 Auto merge of #17430 - upsuper:font-weight-int, r=nox
Store font-weight as integer directly

It doesn't make much sense to store `font-weight` as separate enums, especially given that we would need to support (somehow) arbitrary font weight value when we implement CSS Fonts Level 4.

This PR refactors the `font-weight` a bit to make it store as `u16` directly.

<!-- 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/17430)
<!-- Reviewable:end -->
2017-07-06 16:18:36 -07:00
Gecko Backout
32269fa7cc Backed out changeset fec394734f83 (bug 17624) for build bustage a=backout CLOSED TREE
Backs out https://github.com/servo/servo/pull/17624
2017-07-06 21:58:15 +00:00
Josh Matthews
dc2a500f4b stylo: Create error reporters linked to documents (bug 1352669) 2017-07-06 14:05:52 -04:00
Xidorn Quan
8b842f5417 Use integer for specified and computed font-weight 2017-07-06 15:31:24 +10:00
Brian Birtles
59a3142200 Handle zero-length lists in add_weighted 2017-07-06 06:38:17 +09:00
Anthony Ramine
4a2ede9b3a Kill delegate_animate from vector_longhand
The impl is now always generated if animation_value_type is ComputedValue.
2017-07-05 11:22:00 +02:00
Daisuke Akatsuka
d885747a18 implements nsStyleImage type properties animatable 2017-07-05 13:10:58 +09:00
Anthony Ramine
6f6ee6e036 Make Animatable::get_zero_value return a Result<Self, ()> 2017-06-30 15:39:55 +02:00
bors-servo
9a13cf6bda Auto merge of #17560 - servo:derive-all-the-things, r=<try>
Introduce ToAnimatedValue 🎥

<!-- 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/17560)
<!-- Reviewable:end -->
2017-06-29 06:49:39 -07:00
Anthony Ramine
9ab0b9b4ac Introduce ToAnimatedValue 🎥 2017-06-29 14:03:15 +02:00
Boris Chiou
a67797c485 Build an identity matrix for InterpolateMatrix.
We have to build an identity matrix while add_weighted() between
InterpolateMatrix and none transform in some cases, e.g. trigger a
transition from a mid-point of another transition to none.
2017-06-28 13:03:05 -07:00
Anthony Ramine
201d7e79e7 Make text-shadow and box-shadow use SimpleShadow 2017-06-28 16:28:25 +02:00
Anthony Ramine
395f6be0a6 Use the Separator trait for the filter property 2017-06-27 23:40:16 +02:00
Anthony Ramine
813883e1bd Don't use SmallVec<[T; 1]> for computed values with an empty default 2017-06-27 23:37:51 +02:00
bors-servo
567f5e8985 Auto merge of #17477 - servo:closures-by-ref, r=emilio
Pass some 48-bytes closures by references instead of by value.

This reduced the generated code size by 74 KB: https://bugzilla.mozilla.org/show_bug.cgi?id=1375222#c4

<!-- 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/17477)
<!-- Reviewable:end -->
2017-06-23 03:51:23 -07:00