зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1491954 - Flip boolean half way for path interpolation r=emilio
According to the new svg 2 spec update (#543), we flip the flag half way for path interpolation. Differential Revision: https://phabricator.services.mozilla.com/D6192 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
486d98a2d8
Коммит
ae2cd2accd
|
@ -111,11 +111,12 @@ test(function(t) {
|
|||
test(function(t) {
|
||||
var target = addDiv(t);
|
||||
var dist = getDistance(target, 'offset-path',
|
||||
'path("M 0 0 A 5 5 10 0 0 30 30")',
|
||||
'path("M 0 0 A 5 5 10 0 1 30 30")',
|
||||
'path("M 0 0 A 4 4 5 0 0 20 20")');
|
||||
assert_equals(dist,
|
||||
Math.sqrt(1 * 1 * 2 + // radii
|
||||
5 * 5 + // angle
|
||||
1 * 1 + // flag
|
||||
10 * 10 * 2),
|
||||
'path("M 0 0 A 5 5 10 0 1 30 30") and ' +
|
||||
'path("M 0 0 A 4 4 5 0 0 20 20")');
|
||||
|
|
|
@ -835,11 +835,6 @@ const pathFunctionTests = [
|
|||
end: "path('M 0 0 H 500')",
|
||||
expected: ["path", '"M 0 0 H 500"']
|
||||
},
|
||||
{
|
||||
start: "path('M 10 10 A 10 20 30 1 0 140 450')",
|
||||
end: "path('M 10 10 A 50 60 70 0 1 380 290')",
|
||||
expected: ["path", '"M 10 10 A 50 60 70 0 1 380 290"']
|
||||
},
|
||||
// match
|
||||
{
|
||||
start: "path('M 100 100')",
|
||||
|
@ -886,6 +881,11 @@ const pathFunctionTests = [
|
|||
end: "path('M 10 10 A 50 60 70 0 1 380 290')",
|
||||
expected: ["path", '"M 10 10 A 20 30 40 0 1 200 410"']
|
||||
},
|
||||
{
|
||||
start: "path('M 10 10 A 10 20 30 1 0 140 450')",
|
||||
end: "path('M 10 10 A 50 60 70 0 1 380 290')",
|
||||
expected: ["path", '"M 10 10 A 20 30 40 1 0 200 410"']
|
||||
},
|
||||
// mix relative and absolute coordinates
|
||||
{
|
||||
start: "path('m 10 20 h 30 v 60 h 10 v -10 l 110 60')",
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::slice;
|
|||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::SequenceWriter;
|
||||
use values::CSSFloat;
|
||||
use values::animated::{Animate, Procedure};
|
||||
use values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
|
||||
/// The SVG path data.
|
||||
|
@ -198,9 +198,7 @@ pub enum PathCommand {
|
|||
rx: CSSFloat,
|
||||
ry: CSSFloat,
|
||||
angle: CSSFloat,
|
||||
#[animation(constant)]
|
||||
large_arc_flag: ArcFlag,
|
||||
#[animation(constant)]
|
||||
sweep_flag: ArcFlag,
|
||||
point: CoordPair,
|
||||
absolute: IsAbsolute,
|
||||
|
@ -538,6 +536,34 @@ impl ToCss for ArcFlag {
|
|||
}
|
||||
}
|
||||
|
||||
impl Animate for ArcFlag {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
(self.0 as i32)
|
||||
.animate(&(other.0 as i32), procedure)
|
||||
.map(|v| ArcFlag(v > 0))
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputeSquaredDistance for ArcFlag {
|
||||
#[inline]
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
(self.0 as i32).compute_squared_distance(&(other.0 as i32))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for ArcFlag {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
// The 2 ArcFlags in EllipticalArc determine which one of the 4 different arcs will be
|
||||
// used. (i.e. From 4 combinations). In other words, if we change the flag, we get a
|
||||
// different arc. Therefore, we return *self.
|
||||
// https://svgwg.org/svg2-draft/paths.html#PathDataEllipticalArcCommands
|
||||
Ok(*self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// SVG Path parser.
|
||||
struct PathParser<'a> {
|
||||
chars: Peekable<Cloned<slice::Iter<'a, u8>>>,
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
[offset-path-interpolation-002.html]
|
||||
[Animation between "path('M 100 400 A 10 20 30 1 0 140 450')" and "path('M 300 200 A 50 60 70 0 1 380 290')" at progress -1]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('M 100 400 A 10 20 30 1 0 140 450')" and "path('M 300 200 A 50 60 70 0 1 380 290')" at progress 0.125]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('M 100 400 A 10 20 30 1 0 140 450')" and "path('M 300 200 A 50 60 70 0 1 380 290')" at progress 0.875]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('M 100 400 A 10 20 30 1 0 140 450')" and "path('M 300 200 A 50 60 70 0 1 380 290')" at progress 2]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress -1]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress 0]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress 0.125]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress 0.875]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress 1]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 100 400 a 10 20 30 1 0 40 50')" and "path('m 300 200 a 50 60 70 0 1 80 90')" at progress 2]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
|
@ -1,20 +0,0 @@
|
|||
[offset-path-interpolation-004.html]
|
||||
[Animation between "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')" and "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" at progress -1]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')" and "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" at progress 0]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')" and "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" at progress 0.125]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')" and "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" at progress 0.875]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
||||
|
||||
[Animation between "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')" and "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" at progress 2]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=653928
|
Загрузка…
Ссылка в новой задаче