Bug 1359631 - Convert Toolkit's media/pauseButton.svg to use context paint to improve performance. r=dao draft
authorJonathan Watt <jwatt@jwatt.org>
Tue, 25 Apr 2017 23:42:25 +0100
changeset 568314 32ead08758084553a50169abb8c905d9683252aa
parent 568313 24cdd35008382d2af97b0cbdccea6c42a516a5d8
child 568315 94df10268fb6436b4e86cfe31dbf6dba43c93ced
push id55822
push userjwatt@jwatt.org
push dateTue, 25 Apr 2017 22:53:15 +0000
reviewersdao
bugs1359631
milestone55.0a1
Bug 1359631 - Convert Toolkit's media/pauseButton.svg to use context paint to improve performance. r=dao MozReview-Commit-ID: KuETJOeqDnV
toolkit/themes/shared/media/pauseButton.svg
toolkit/themes/shared/media/videocontrols.css
--- a/toolkit/themes/shared/media/pauseButton.svg
+++ b/toolkit/themes/shared/media/pauseButton.svg
@@ -1,36 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18px" height="18px" viewBox="0 0 18 18">
-  <style>
-    use:not(:target) {
-      display: none;
-    }
-    use {
-      fill: #ffffff;
-    }
-    use[id$="-hover"] {
-      fill: #48a0f7;
-    }
-    use[id$="-active"] {
-      fill: #2d89e6;
-    }
-    use[id$="-focus"] {
-      fill: #48a0f7;
-    }
-    use[id$="-disabled"] {
-      fill: #ffffff;
-    }
-  </style>
-
-
-  <symbol id="pause-shape">
-    <path fill-rule="evenodd" clip-rule="evenodd" d="M6.002,1.953C5.172,1.953,4.5,2.626,4.5,3.455v11.08
+<svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" viewBox="0 0 18 18">
+  <path fill="context-fill" fill-rule="evenodd" d="M6.002,1.953C5.172,1.953,4.5,2.626,4.5,3.455v11.08
         c0,0.83,0.672,1.502,1.502,1.502c0.829,0,1.502-0.672,1.502-1.502V3.455C7.504,2.626,6.831,1.953,6.002,1.953z M12,1.953
         c-0.828,0-1.5,0.672-1.5,1.5v11.094c0,0.828,0.672,1.5,1.5,1.5s1.5-0.672,1.5-1.5V3.453C13.5,2.625,12.828,1.953,12,1.953z"/>
-  </symbol>
+</svg>
 
-  <use id="pause" xlink:href="#pause-shape"/>
-  <use id="pause-hover" xlink:href="#pause-shape"/>
-  <use id="pause-active" xlink:href="#pause-shape"/>
-  <use id="pause-focus" xlink:href="#pause-shape"/>
-  <use id="pause-disalbed" xlink:href="#pause-shape"/>
-</svg>
--- a/toolkit/themes/shared/media/videocontrols.css
+++ b/toolkit/themes/shared/media/videocontrols.css
@@ -91,23 +91,25 @@ audio > xul|videocontrols {
   background-color: transparent;
   background-repeat: no-repeat;
   background-position: center;
   background-origin: content-box;
   background-clip: content-box;
 }
 
 .playButton {
-  background-image: url(chrome://global/skin/media/pauseButton.svg#pause);
+  background-image: url(chrome://global/skin/media/pauseButton.svg);
+  /* uncomment after bug 1350010 lands: context-properties: fill; */
+  fill: #ffffff; /* context-fill for image */
 }
 .playButton:hover {
-  background-image: url(chrome://global/skin/media/pauseButton.svg#pause-hover);
+  fill: #48a0f7; /* context-fill for image */
 }
 .playButton:hover:active {
-  background-image: url(chrome://global/skin/media/pauseButton.svg#pause-active);
+  fill: #2d89e6; /* context-fill for image */
 }
 .playButton[paused] {
   background-image: url(chrome://global/skin/media/playButton.svg#play);
 }
 .playButton[paused]:hover {
   background-image: url(chrome://global/skin/media/playButton.svg#play-hover);
 }
 .playButton[paused]:hover:active {