Bug 1059498 - Use the inner dirty rect when initializing the visible rect of display items inside the SVG filter stacking context. r=roc
authorMarkus Stange <mstange@themasta.com>
Tue, 02 Sep 2014 11:13:44 +0200
changeset 226272 39a8d9b2b639b3a62c460af952b21d0b683c2858
parent 226271 f3aa5e7c39e4ad75a0ca8c0b863b1ce435d2a0aa
child 226273 01df38521c54a163e8f521eae1c60efa8aca61b6
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1059498
milestone34.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 1059498 - Use the inner dirty rect when initializing the visible rect of display items inside the SVG filter stacking context. r=roc
layout/generic/nsFrame.cpp
layout/reftests/bugs/1059498-1-ref.html
layout/reftests/bugs/1059498-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1954,19 +1954,24 @@ nsIFrame::BuildDisplayListForStackingCon
         NS_WARNING("Unable to untransform dirty rect!");
         // This should only happen if the transform is singular, in which case nothing is visible anyway
         dirtyRect.SetEmpty();
       }
     }
     inTransform = true;
   }
 
+  bool usingSVGEffects = nsSVGIntegrationUtils::UsingEffectsForFrame(this);
+  if (usingSVGEffects) {
+    dirtyRect =
+      nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
+  }
+
   bool useOpacity = HasVisualOpacity() && !nsSVGUtils::CanOptimizeOpacity(this);
   bool useBlendMode = disp->mMixBlendMode != NS_STYLE_BLEND_NORMAL;
-  bool usingSVGEffects = nsSVGIntegrationUtils::UsingEffectsForFrame(this);
   bool useStickyPosition = disp->mPosition == NS_STYLE_POSITION_STICKY &&
     IsScrollFrameActive(nsLayoutUtils::GetNearestScrollableFrame(GetParent(),
                         nsLayoutUtils::SCROLLABLE_SAME_DOC |
                         nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN));
 
   nsDisplayListBuilder::AutoBuildingDisplayList
     buildingDisplayList(aBuilder, this, dirtyRect, true);
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
@@ -1982,21 +1987,16 @@ nsIFrame::BuildDisplayListForStackingCon
 
   nsDisplayListCollection set;
   {
     DisplayListClipState::AutoSaveRestore nestedClipState(aBuilder);
     nsDisplayListBuilder::AutoInTransformSetter
       inTransformSetter(aBuilder, inTransform);
     CheckForTouchEventHandler(aBuilder, this);
 
-    if (usingSVGEffects) {
-      dirtyRect =
-        nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
-    }
-
     nsRect clipPropClip;
     if (ApplyClipPropClipping(aBuilder, this, disp, &clipPropClip,
                               nestedClipState)) {
       dirtyRect.IntersectRect(dirtyRect, clipPropClip);
     }
 
     MarkAbsoluteFramesForDisplayList(aBuilder, dirtyRect);
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1059498-1-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Test for bug 1059498 - Paint parts of the filter that are caused by parts of the source that are invisible</title>
+
+<style>
+
+body {
+  margin: 0;
+}
+
+#result {
+  width: 100px;
+  height: 30px;
+  background-color: lime;
+}
+
+</style>
+
+<div id="result"></div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1059498-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Test for bug 1059498 - Paint parts of the filter that are caused by parts of the source that are invisible</title>
+
+<style>
+
+body {
+  margin: 0;
+}
+
+#filtered {
+  margin-top: -110px;
+  width: 100px;
+  height: 100px;
+  background-color: white;
+  filter: url(#filter);
+}
+
+</style>
+
+<div id="filtered"></div>
+
+<svg height="0">
+  <defs>
+    <filter id="filter" filterUnits="objectBoundingBox"
+            x="0%" y="0%" width="100%" height="200%"
+            color-interpolation-filters="sRGB">
+      <feDropShadow stdDeviation="0" dx="0" dy="40" flood-color="lime"/>
+    </filter>
+  </defs>
+</svg>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1825,8 +1825,9 @@ pref(browser.display.use_document_fonts,
 == 1025914-1.html 1025914-1-ref.html
 == 1042104-1.html 1042104-1-ref.html
 == 1044198-1.html 1044198-1-ref.html
 == 1049499-1.html 1049499-1-ref.html
 == 1050788-1.html about:blank
 == 1053035-1-flex.html 1053035-1-ref.html
 test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.html
 == 1059167-1.html 1059167-1-ref.html
+== 1059498-1.html 1059498-1-ref.html