servo: Merge #17089 - Support currentColor for fill and stroke (from hiikezoe:current-color-for-fill-and-stroke); r=xidorn.
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 30 May 2017 01:47:44 -0500
changeset 409407 ee035e1480b0c216099a39d491bf2a5974e54a02
parent 409406 53c2fb33f93151ee43fae606585098daa27dd895
child 409408 6736d54ffd89b3fe3f28b3e59a8b558517894caf
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17089 - Support currentColor for fill and stroke (from hiikezoe:current-color-for-fill-and-stroke); r=xidorn. <!-- Please describe your changes on the following line: --> This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1368376 --- <!-- 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 - [X] These changes do not require tests because it's for stylo Source-Repo: https://github.com/servo/servo Source-Revision: 9e89b0a2293596f970b60307fff42f955083ca84
servo/components/style/values/specified/mod.rs
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -1172,17 +1172,21 @@ impl ToComputedValue for SVGPaintKind {
 
     #[inline]
     fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
         match *self {
             SVGPaintKind::None => super::computed::SVGPaintKind::None,
             SVGPaintKind::ContextStroke => super::computed::SVGPaintKind::ContextStroke,
             SVGPaintKind::ContextFill => super::computed::SVGPaintKind::ContextFill,
             SVGPaintKind::Color(ref color) => {
-                super::computed::SVGPaintKind::Color(color.to_computed_value(context))
+                let color = match color.parsed {
+                    Color::CurrentColor => cssparser::Color::RGBA(context.style().get_color().clone_color()),
+                    _ => color.to_computed_value(context),
+                };
+                super::computed::SVGPaintKind::Color(color)
             }
             SVGPaintKind::PaintServer(ref server) => {
                 super::computed::SVGPaintKind::PaintServer(server.to_computed_value(context))
             }
         }
     }
 
     #[inline]