Bug 700221. Don't pay attention to whether author color are allowed when deciding whether a change to a non-color property should drop native theming. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 21 Dec 2011 16:53:21 -0500
changeset 83212 88663cf7f5c1bfbf071ed7e8464f8e1ebdb4a17c
parent 83211 2ea529d88ec1bb68fd77c9805c4569a655b25c1d
child 83213 ed120f1a9dea1d36a81719d91d5a7814b4be7704
push id4306
push userbzbarsky@mozilla.com
push dateWed, 21 Dec 2011 22:04:26 +0000
treeherdermozilla-inbound@88663cf7f5c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs700221
milestone12.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 700221. Don't pay attention to whether author color are allowed when deciding whether a change to a non-color property should drop native theming. r=dbaron
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -7130,42 +7130,44 @@ nsRuleNode::HasAuthorSpecifiedRules(nsSt
     eCSSProperty_padding_left_value,
     eCSSProperty_padding_start_value,
     eCSSProperty_padding_end_value,
   };
 
   // Number of properties we care about
   size_t nValues = 0;
 
-  size_t backColorIndex = size_t(-1);
-
   nsCSSValue* values[NS_ARRAY_LENGTH(backgroundValues) +
                      NS_ARRAY_LENGTH(borderValues) +
                      NS_ARRAY_LENGTH(paddingValues)];
 
+  nsCSSProperty properties[NS_ARRAY_LENGTH(backgroundValues) +
+                           NS_ARRAY_LENGTH(borderValues) +
+                           NS_ARRAY_LENGTH(paddingValues)];
+
   if (ruleTypeMask & NS_AUTHOR_SPECIFIED_BACKGROUND) {
     for (PRUint32 i = 0, i_end = ArrayLength(backgroundValues);
          i < i_end; ++i) {
-      if (backgroundValues[i] == eCSSProperty_background_color) {
-        backColorIndex = nValues;
-      }
+      properties[nValues] = backgroundValues[i];
       values[nValues++] = ruleData.ValueFor(backgroundValues[i]);
     }
   }
 
   if (ruleTypeMask & NS_AUTHOR_SPECIFIED_BORDER) {
     for (PRUint32 i = 0, i_end = ArrayLength(borderValues);
          i < i_end; ++i) {
+      properties[nValues] = borderValues[i];
       values[nValues++] = ruleData.ValueFor(borderValues[i]);
     }
   }
 
   if (ruleTypeMask & NS_AUTHOR_SPECIFIED_PADDING) {
     for (PRUint32 i = 0, i_end = ArrayLength(paddingValues);
          i < i_end; ++i) {
+      properties[nValues] = paddingValues[i];
       values[nValues++] = ruleData.ValueFor(paddingValues[i]);
     }
   }
 
   nsStyleContext* styleContext = aStyleContext;
 
   // We need to be careful not to count styles covered up by user-important or
   // UA-important declarations.  But we do want to catch explicit inherit
@@ -7206,21 +7208,24 @@ nsRuleNode::HasAuthorSpecifiedRules(nsSt
         } else {
           // If any of the values we care about was set by the above rule,
           // we have author style.
           for (PRUint32 i = 0; i < nValues; ++i) {
             if (values[i]->GetUnit() != eCSSUnit_Null &&
                 values[i]->GetUnit() != eCSSUnit_Dummy && // see above
                 values[i]->GetUnit() != eCSSUnit_DummyInherit) {
               // If author colors are not allowed, only claim to have
-              // author-specified rules if we're looking at the background
-              // color and it's set to transparent.  Anything else should get
-              // set to a dummy value instead.
+              // author-specified rules if we're looking at a non-color
+              // property or if we're looking at the background color and it's
+              // set to transparent.  Anything else should get set to a dummy
+              // value instead.
               if (aAuthorColorsAllowed ||
-                  (i == backColorIndex &&
+                  !nsCSSProps::PropHasFlags(properties[i],
+                     CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED) ||
+                  (properties[i] == eCSSProperty_background_color &&
                    !values[i]->IsNonTransparentColor())) {
                 return true;
               }
 
               values[i]->SetDummyValue();
             }
           }
         }