Bug 1499991 - Ensure no-op will-change changes also get reflected in the change hint. r=heycam,firefox-style-system-reviewers
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 18 Oct 2018 07:53:11 +0000
changeset 490235 b82c3a7696f945a86d775911d22854481ef4a305
parent 490218 638dee1dfab113b0c2333fb62509180cf21c2124
child 490236 32670a4721d4dac1a14315b16db5847a20749027
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersheycam, firefox-style-system-reviewers
bugs1499991
milestone64.0a1
Bug 1499991 - Ensure no-op will-change changes also get reflected in the change hint. r=heycam,firefox-style-system-reviewers Differential Revision: https://phabricator.services.mozilla.com/D9073
layout/style/nsStyleStruct.cpp
testing/web-platform/tests/css/css-will-change/will-change-inherit-dynamic.html
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3903,17 +3903,18 @@ nsStyleDisplay::CalcDifference(const nsS
        mAnimationTimingFunctionCount != aNewData.mAnimationTimingFunctionCount ||
        mAnimationDurationCount != aNewData.mAnimationDurationCount ||
        mAnimationDelayCount != aNewData.mAnimationDelayCount ||
        mAnimationNameCount != aNewData.mAnimationNameCount ||
        mAnimationDirectionCount != aNewData.mAnimationDirectionCount ||
        mAnimationFillModeCount != aNewData.mAnimationFillModeCount ||
        mAnimationPlayStateCount != aNewData.mAnimationPlayStateCount ||
        mAnimationIterationCountCount != aNewData.mAnimationIterationCountCount ||
-       mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate)) {
+       mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate ||
+       mWillChange != aNewData.mWillChange)) {
     hint |= nsChangeHint_NeutralChange;
   }
 
   return hint;
 }
 
 void
 nsStyleDisplay::GenerateCombinedIndividualTransform()
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-will-change/will-change-inherit-dynamic.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: will-change: style changes are properly propagated to children if needed</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1499991">
+<link rel="help" href="https://drafts.csswg.org/css-will-change/#will-change">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="outer">
+  <div id="inner" style="will-change: inherit"></div>
+</div>
+<script>
+  test(function() {
+    assert_equals(getComputedStyle(outer).willChange, "auto");
+    assert_equals(getComputedStyle(inner).willChange, "auto");
+    outer.style.willChange = "color";
+    assert_equals(getComputedStyle(outer).willChange, "color");
+    assert_equals(getComputedStyle(inner).willChange, "color");
+  }, "will-change change is properly propagated to children if needed");
+</script>