Bug 686281 - (Bug Fix: will-change-stacking-context-mask-1.html fail) Expands shorthand prop to longhands; r:=dbaron draft
authorCJKu <cku@mozilla.com>
Thu, 12 Nov 2015 17:04:51 +0800
changeset 308391 fda93af3c68e87555913605f7cc8786cad409345
parent 308390 8200ec8e47c0fbeb1b058b960733f84a04eefc21
child 308392 748780499bde65fba661032d1981f84284cdafa1
push id7465
push usercku@mozilla.com
push dateThu, 12 Nov 2015 09:05:57 +0000
bugs686281
milestone45.0a1
Bug 686281 - (Bug Fix: will-change-stacking-context-mask-1.html fail) Expands shorthand prop to longhands; r:=dbaron
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -5936,21 +5936,36 @@ 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 &&
-            nsCSSProps::PropHasFlags(prop,
-                                     CSS_PROPERTY_CREATES_STACKING_CONTEXT))
-        {
-          display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
+
+        if (prop != eCSSProperty_UNKNOWN) {
+          // 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;