Bug 782888 - Do not propagate nsChangeHint_UpdateEffects to text nodes. r=bz
authorCameron McCormack <cam@mcc.id.au>
Fri, 05 Oct 2012 12:47:52 +1000
changeset 109306 7f40ba56870b9aacc2c9df0c9b4071ab0c47bbcc
parent 109305 676ffbbc4e0323d2fc6256c0850b3f316c761968
child 109307 ff5e9f36d02e62e5eccbd06b6b832def81e5f2ac
push id15959
push usercmccormack@mozilla.com
push dateFri, 05 Oct 2012 02:48:06 +0000
treeherdermozilla-inbound@7f40ba56870b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs782888
milestone18.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 782888 - Do not propagate nsChangeHint_UpdateEffects to text nodes. r=bz
layout/base/nsFrameManager.cpp
layout/reftests/svg/dynamic-fill-01-ref.svg
layout/reftests/svg/dynamic-fill-01.svg
layout/reftests/svg/reftest.list
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -981,16 +981,24 @@ CaptureChange(nsStyleContext* aOldContex
               nsChangeHint aChangeToAssume)
 {
   nsChangeHint ourChange = aOldContext->CalcStyleDifference(aNewContext,
                              aParentHintsNotHandledForDescendants);
   NS_ASSERTION(!(ourChange & nsChangeHint_AllReflowHints) ||
                (ourChange & nsChangeHint_NeedReflow),
                "Reflow hint bits set without actually asking for a reflow");
 
+  // nsChangeHint_UpdateEffects is inherited, but it can be set due to changes
+  // in inherited properties (fill and stroke).  Avoid propagating it into
+  // text nodes.
+  if ((ourChange & nsChangeHint_UpdateEffects) &&
+      aContent && !aContent->IsElement()) {
+    ourChange = NS_SubtractHint(ourChange, nsChangeHint_UpdateEffects);
+  }
+
   NS_UpdateHint(ourChange, aChangeToAssume);
   if (NS_UpdateHint(aMinChange, ourChange)) {
     if (!(ourChange & nsChangeHint_ReconstructFrame) || aContent) {
       aChangeList->AppendChange(aFrame, aContent, ourChange);
     }
   }
   aHintsNotHandledForDescendants = NS_HintsNotHandledForDescendantsIn(ourChange);
 }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/dynamic-fill-01-ref.svg
@@ -0,0 +1,12 @@
+<!--
+    Any copyright is dedicated to the Public Domain.
+    http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg">
+
+  <title>Reference for changing fill from url() value to a solid color value not asserting</title>
+
+  <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=782888 -->
+
+  <text style="font: 16px sans-serif; fill: green" x="100" y="100">Hello</text>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/dynamic-fill-01.svg
@@ -0,0 +1,23 @@
+<!--
+    Any copyright is dedicated to the Public Domain.
+    http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
+
+  <title>Test for changing fill from url() value to a solid color value not asserting</title>
+
+  <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=782888 -->
+
+  <linearGradient id="g">
+    <stop stop-color="red"/>
+  </linearGradient>
+
+  <text style="font: 16px sans-serif; fill: url(#g)" x="100" y="100">Hello</text>
+
+  <script>
+    window.addEventListener("MozReftestInvalidate", function() {
+      document.getElementsByTagName("text")[0].style.fill = "green";
+      document.documentElement.removeAttribute("class");
+    }, false);
+  </script>
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -66,16 +66,17 @@ fuzzy-if(/^Windows\x20NT\x206\.1/.test(h
 == dynamic-conditions-10.svg about:blank
 == dynamic-conditions-11.svg pass.svg
 == dynamic-conditions-12.svg pass.svg
 == dynamic-conditions-13.svg about:blank
 == dynamic-clipPath-01.svg pass.svg
 == dynamic-clipPath-02.svg pass.svg
 == dynamic-feFlood-01.svg pass.svg
 == dynamic-feImage-01.svg pass.svg
+== dynamic-fill-01.svg dynamic-fill-01-ref.svg
 == dynamic-filter-contents-01a.svg dynamic-filter-contents-01-ref.svg
 == dynamic-filter-contents-01b.svg dynamic-filter-contents-01-ref.svg
 == dynamic-gradient-contents-01.svg pass.svg
 == dynamic-gradient-contents-02.svg pass.svg
 == dynamic-inner-svg-01.svg pass.svg
 == dynamic-link-style-01.svg pass.svg
 == dynamic-marker-01.svg pass.svg
 == dynamic-marker-02.svg dynamic-marker-02-ref.svg