Bug 686281 - Expands will-change of a shorthand prop to longhand ones; r=dbaron. draft
authorCJKu <cku@mozilla.com>
Thu, 10 Dec 2015 09:43:10 -0500
changeset 314890 a9ce493ee731a3ae8256094c6bb25cd802669067
parent 314889 7fe44d2d5d0599d0e1d3bf1d9366c3974fc0758e
child 314891 d1c6e033afe631d08b9348b49e78c52aa377e8e0
push id8289
push usercku@mozilla.com
push dateThu, 10 Dec 2015 14:43:35 +0000
reviewersdbaron
bugs686281
milestone45.0a1
Bug 686281 - Expands will-change of a shorthand prop to longhand ones; r=dbaron.
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -6084,21 +6084,35 @@ nsRuleNode::ComputeDisplayData(void* aSt
         if (buffer.EqualsLiteral("scroll-position")) {
           display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL;
         }
 
         nsCSSProperty prop =
           nsCSSProps::LookupProperty(buffer,
                                      nsCSSProps::eEnabledForAllContent);
         if (prop != eCSSProperty_UNKNOWN &&
-            prop != eCSSPropertyExtra_variable &&
-            nsCSSProps::PropHasFlags(prop,
-                                     CSS_PROPERTY_CREATES_STACKING_CONTEXT))
-        {
-          display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
+            prop != eCSSPropertyExtra_variable) {
+          // If the property given is a shorthand, it indicates the expectation
+          // for all the longhands the shorthand expands to.
+          if (nsCSSProps::IsShorthand(prop)) {
+            for (const nsCSSProperty* shorthands =
+                   nsCSSProps::SubpropertyEntryFor(prop);
+                 *shorthands != eCSSProperty_UNKNOWN; ++shorthands) {
+              if (nsCSSProps::PropHasFlags(*shorthands,
+                                      CSS_PROPERTY_CREATES_STACKING_CONTEXT)) {
+                display->mWillChangeBitField |=
+                  NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
+                break;
+              }
+            }
+          } else if (nsCSSProps::PropHasFlags(prop,
+                                      CSS_PROPERTY_CREATES_STACKING_CONTEXT)) {
+            display->mWillChangeBitField |=
+              NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
+          }
         }
       }
     }
     break;
   }
 
   case eCSSUnit_Inherit:
     display->mWillChange = parentDisplay->mWillChange;