зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #17467 - Add get_zero_value for IntermediateSVGPaint (from mantaroh:svg-zero-value); r=birtles
<!-- Please describe your changes on the following line: --> This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1371199 --- <!-- 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 <!-- Either: --> There are tests for these changes, a test case will be landed in reftests in https://bugzilla.mozilla.org/show_bug.cgi?id=1371199 <!-- 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. --> Source-Repo: https://github.com/servo/servo Source-Revision: d2bc0ff6314f75a7742567b1f7133a8c76120538 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : c23ae4807b7480952dc83847f9a0cefec795cb22
This commit is contained in:
Родитель
5734680cc7
Коммит
9d1921e798
|
@ -2765,7 +2765,7 @@ impl Animatable for IntermediateRGBA {
|
|||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
Some(IntermediateRGBA::new(0., 0., 0., 1.))
|
||||
Some(IntermediateRGBA::transparent())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -2982,6 +2982,14 @@ impl Animatable for IntermediateSVGPaint {
|
|||
Ok(self.kind.compute_squared_distance(&other.kind)? +
|
||||
self.fallback.compute_squared_distance(&other.fallback)?)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
Some(IntermediateSVGPaint {
|
||||
kind: option_try!(self.kind.get_zero_value()),
|
||||
fallback: self.fallback.and_then(|v| v.get_zero_value()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Animatable for IntermediateSVGPaintKind {
|
||||
|
@ -3012,6 +3020,18 @@ impl Animatable for IntermediateSVGPaintKind {
|
|||
_ => Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
match self {
|
||||
&SVGPaintKind::Color(ref color) => color.get_zero_value()
|
||||
.map(SVGPaintKind::Color),
|
||||
&SVGPaintKind::None |
|
||||
&SVGPaintKind::ContextFill |
|
||||
&SVGPaintKind::ContextStroke => Some(self.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
|
Загрузка…
Ссылка в новой задаче