Diff
Modified: trunk/Source/WebCore/ChangeLog (114762 => 114763)
--- trunk/Source/WebCore/ChangeLog 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebCore/ChangeLog 2012-04-20 17:57:18 UTC (rev 114763)
@@ -1,3 +1,25 @@
+2012-04-20 Dana Jansens <[email protected]>
+
+ [chromium] Some filters require inflating damage rect in CCDamageTracker
+ https://bugs.webkit.org/show_bug.cgi?id=84373
+
+ Reviewed by James Robinson.
+
+ When a layer is blurred, damaged pixels are blurred out into a radius
+ and their damage should be expanded to include total blurred region.
+
+ Unit test: CCDamageTrackerTest.verifyDamageForBlurredSurface
+
+ * platform/graphics/chromium/cc/CCDamageTracker.cpp:
+ (WebCore::CCDamageTracker::updateDamageTrackingState):
+ (WebCore::CCDamageTracker::expandDamageRectWithForegroundFilters):
+ (WebCore):
+ * platform/graphics/chromium/cc/CCDamageTracker.h:
+ (WebCore):
+ (CCDamageTracker):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+ (WebCore::CCLayerTreeHostImpl::trackDamageForAllSurfaces):
+
2012-04-20 Sami Kyostila <[email protected]>
[chromium] Don't crash when scrolling empty layer tree
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp (114762 => 114763)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp 2012-04-20 17:57:18 UTC (rev 114763)
@@ -34,6 +34,7 @@
#include "cc/CCDamageTracker.h"
+#include "FilterOperations.h"
#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTreeHostCommon.h"
#include "cc/CCRenderSurface.h"
@@ -56,7 +57,7 @@
{
}
-void CCDamageTracker::updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer)
+void CCDamageTracker::updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const FilterOperations& filters)
{
//
// This function computes the "damage rect" of a target surface, and updates the state
@@ -136,6 +137,8 @@
m_currentDamageRect = damageFromActiveLayers;
m_currentDamageRect.uniteIfNonZero(damageFromSurfaceMask);
m_currentDamageRect.uniteIfNonZero(damageFromLeftoverRects);
+
+ expandDamageRectWithForegroundFilters(filters);
}
// The next history map becomes the current map for the next frame.
@@ -307,6 +310,17 @@
}
}
+void CCDamageTracker::expandDamageRectWithForegroundFilters(const FilterOperations& filters)
+{
+ // Filters can spread damage around in the surface.
+ if (filters.hasFilterThatMovesPixels()) {
+ int top, right, bottom, left;
+ filters.getOutsets(top, right, bottom, left);
+ m_currentDamageRect.move(-left, -top);
+ m_currentDamageRect.expand(left + right, top + bottom);
+ }
+}
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h (114762 => 114763)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h 2012-04-20 17:57:18 UTC (rev 114763)
@@ -35,6 +35,7 @@
class CCLayerImpl;
class CCRenderSurface;
+class FilterOperations;
// Computes the region where pixels have actually changed on a RenderSurface. This region is used
// to scissor what is actually drawn to the screen to save GPU computation and bandwidth.
@@ -44,7 +45,7 @@
~CCDamageTracker();
void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
- void updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer);
+ void updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const FilterOperations&);
const FloatRect& currentDamageRect() { return m_currentDamageRect; }
private:
@@ -61,6 +62,8 @@
void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect);
void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect);
+ void expandDamageRectWithForegroundFilters(const FilterOperations&);
+
// To correctly track exposed regions, two hashtables of rects are maintained.
// The "current" map is used to compute exposed regions of the current frame, while
// the "next" map is used to collect layer rects that are used in the next frame.
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (114762 => 114763)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-04-20 17:57:18 UTC (rev 114763)
@@ -211,7 +211,7 @@
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
- renderSurface->damageTracker()->updateDamageTrackingState(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurface->surfacePropertyChangedOnlyFromDescendant(), renderSurface->contentRect(), renderSurfaceLayer->maskLayer());
+ renderSurface->damageTracker()->updateDamageTrackingState(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurface->surfacePropertyChangedOnlyFromDescendant(), renderSurface->contentRect(), renderSurfaceLayer->maskLayer(), renderSurfaceLayer->filters());
}
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (114762 => 114763)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-04-20 17:57:18 UTC (rev 114763)
@@ -1,3 +1,15 @@
+2012-04-20 Dana Jansens <[email protected]>
+
+ [chromium] Some filters require inflating damage rect in CCDamageTracker
+ https://bugs.webkit.org/show_bug.cgi?id=84373
+
+ Reviewed by James Robinson.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::emulateDrawingOneFrame):
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
2012-04-20 Sami Kyostila <[email protected]>
[chromium] Don't crash when scrolling empty layer tree
Modified: trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp (114762 => 114763)
--- trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp 2012-04-20 17:54:48 UTC (rev 114762)
+++ trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp 2012-04-20 17:57:18 UTC (rev 114763)
@@ -70,7 +70,7 @@
// Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors.
for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) {
CCRenderSurface* targetSurface = renderSurfaceLayerList[i]->renderSurface();
- targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), targetSurface->surfacePropertyChangedOnlyFromDescendant(), targetSurface->contentRect(), renderSurfaceLayerList[i]->maskLayer());
+ targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), targetSurface->surfacePropertyChangedOnlyFromDescendant(), targetSurface->contentRect(), renderSurfaceLayerList[i]->maskLayer(), renderSurfaceLayerList[i]->filters());
}
root->resetAllChangeTrackingForSubtree();
@@ -315,6 +315,32 @@
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
+TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface)
+{
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+ CCLayerImpl* child = root->children()[0].get();
+
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(5, WebCore::Percent), FilterOperation::BLUR));
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+ root->setFilters(filters);
+
+ // Setting the filter will damage the whole surface.
+ emulateDrawingOneFrame(root.get());
+
+ // Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
+ child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ emulateDrawingOneFrame(root.get());
+
+ // Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
+ FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ FloatRect expectedDamageRect = FloatRect(110, 111, 12, 13);
+ expectedDamageRect.move(-outsetLeft, -outsetTop);
+ expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+}
+
TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
{
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
@@ -877,7 +903,7 @@
ASSERT_TRUE(root->renderSurface() == root->targetRenderSurface());
CCRenderSurface* targetSurface = root->renderSurface();
targetSurface->clearLayerList();
- targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0);
+ targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, FilterOperations());
FloatRect damageRect = targetSurface->damageTracker()->currentDamageRect();
EXPECT_TRUE(damageRect.isEmpty());