Bug 1215484 - make SVG in an image context ignore author colours to match how we treat raster images, and in a non-image context respect them to match html. f=dao, r=roc
authorRobert Longson <longsonr@gmail.com>
Tue, 20 Oct 2015 13:12:36 +0100
changeset 268532 a56701c4ae3ddc2d59816d297bedc1e9ebd358f9
parent 268531 02044477b071e9c4f54d457cdd2d58570d39b52a
child 268533 69a3deeebc3306991a47fd7309ebd5545ae1be63
push id29552
push userkwierso@gmail.com
push dateTue, 20 Oct 2015 20:22:39 +0000
treeherdermozilla-central@0416fbbd3a63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1215484
milestone44.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
Bug 1215484 - make SVG in an image context ignore author colours to match how we treat raster images, and in a non-image context respect them to match html. f=dao, r=roc
layout/base/nsPresContext.cpp
layout/style/nsCSSPropList.h
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -693,17 +693,17 @@ nsPresContext::GetDocumentColorPreferenc
   mBackgroundColor = NS_ComposeColors(NS_RGB(0xFF, 0xFF, 0xFF),
                                       mBackgroundColor);
 
 
   // Now deal with the pref:
   // 0 = default: always, except in high contrast mode
   // 1 = always
   // 2 = never
-  if (sDocumentColorsSetting == 1) {
+  if (sDocumentColorsSetting == 1 || mDocument->IsBeingUsedAsImage()) {
     mUseDocumentColors = true;
   } else if (sDocumentColorsSetting == 2) {
     mUseDocumentColors = isChromeDocShell || mIsChromeOriginImage;
   } else {
     MOZ_ASSERT(!useAccessibilityTheme ||
                !(isChromeDocShell || mIsChromeOriginImage),
                "The accessibility theme should only be on for non-chrome");
     mUseDocumentColors = !useAccessibilityTheme;
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -3842,17 +3842,18 @@ CSS_PROP_SVGRESET(
     VARIANT_HK,
     kDominantBaselineKTable,
     offsetof(nsStyleSVGReset, mDominantBaseline),
     eStyleAnimType_EnumU8)
 CSS_PROP_SVG(
     fill,
     fill,
     Fill,
-    CSS_PROPERTY_PARSE_FUNCTION,
+    CSS_PROPERTY_PARSE_FUNCTION |
+        CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED,
     "",
     0,
     kContextPatternKTable,
     offsetof(nsStyleSVG, mFill),
     eStyleAnimType_PaintServer)
 CSS_PROP_SVG(
     fill-opacity,
     fill_opacity,
@@ -4010,17 +4011,18 @@ CSS_PROP_SVGRESET(
     VARIANT_HN,
     nullptr,
     offsetof(nsStyleSVGReset, mStopOpacity),
     eStyleAnimType_float)
 CSS_PROP_SVG(
     stroke,
     stroke,
     Stroke,
-    CSS_PROPERTY_PARSE_FUNCTION,
+    CSS_PROPERTY_PARSE_FUNCTION |
+        CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED,
     "",
     0,
     kContextPatternKTable,
     offsetof(nsStyleSVG, mStroke),
     eStyleAnimType_PaintServer)
 CSS_PROP_SVG(
     stroke-dasharray,
     stroke_dasharray,