Diff
Modified: trunk/Source/WebCore/ChangeLog (118802 => 118803)
--- trunk/Source/WebCore/ChangeLog 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/ChangeLog 2012-05-29 17:46:03 UTC (rev 118803)
@@ -1,3 +1,30 @@
+2012-05-29 Dana Jansens <[email protected]>
+
+ [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect
+ https://bugs.webkit.org/show_bug.cgi?id=87677
+
+ Reviewed by Adrienne Walker.
+
+ When a contributing surface is visited, and we have not visited another
+ surface, then we know the surface is completely unoccluded. However, the
+ root scissor rect should still be applied, and anything outside of it
+ should be considered occluded.
+
+ Unit test: WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor
+
+ * platform/graphics/chromium/RenderSurfaceChromium.cpp:
+ (WebCore::RenderSurfaceChromium::targetRenderSurface):
+ (WebCore):
+ * platform/graphics/chromium/RenderSurfaceChromium.h:
+ (RenderSurfaceChromium):
+ * platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
+ (WebCore::::unoccludedContributingSurfaceContentRect):
+ * platform/graphics/chromium/cc/CCRenderSurface.cpp:
+ (WebCore::CCRenderSurface::targetRenderSurface):
+ (WebCore):
+ * platform/graphics/chromium/cc/CCRenderSurface.h:
+ (CCRenderSurface):
+
2012-05-29 Jonathan Dong <[email protected]>
[BlackBerry] Refactoring http/proxy authentication to use authcallback mechanism introduced with libcurl
Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp (118802 => 118803)
--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp 2012-05-29 17:46:03 UTC (rev 118803)
@@ -64,6 +64,14 @@
return drawableContentRect;
}
+RenderSurfaceChromium* RenderSurfaceChromium::targetRenderSurface() const
+{
+ LayerChromium* parent = m_owningLayer->parent();
+ if (!parent)
+ return 0;
+ return parent->targetRenderSurface();
+}
+
bool RenderSurfaceChromium::hasReplica() const
{
return m_owningLayer->replicaLayer();
Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h (118802 => 118803)
--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h 2012-05-29 17:46:03 UTC (rev 118803)
@@ -108,6 +108,8 @@
void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; }
const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
+ RenderSurfaceChromium* targetRenderSurface() const;
+
bool hasReplica() const;
bool hasMask() const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp (118802 => 118803)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp 2012-05-29 17:46:03 UTC (rev 118803)
@@ -439,34 +439,45 @@
// This should be called while the contributing render surface is still considered the current target in the occlusion tracker.
ASSERT(surface == m_stack.last().surface);
- // A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is
- // found just below the top of the stack (if it exists).
- if (m_stack.size() < 2)
- return contentRect;
if (contentRect.isEmpty())
return contentRect;
- const StackObject& secondLast = m_stack[m_stack.size() - 2];
-
IntRect surfaceClipRect = surface->clipRect();
if (surfaceClipRect.isEmpty()) {
- const RenderSurfaceType* targetSurface = secondLast.surface;
- surfaceClipRect = intersection(targetSurface->contentRect(), enclosingIntRect(surface->drawableContentRect()));
+ const RenderSurfaceType* targetSurface = surface->targetRenderSurface();
+ if (targetSurface)
+ surfaceClipRect = intersection(targetSurface->contentRect(), enclosingIntRect(surface->drawableContentRect()));
+ else
+ surfaceClipRect = m_scissorRectInScreenSpace;
}
+ // A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is
+ // found just below the top of the stack (if it exists).
+ bool hasOcclusion = m_stack.size() > 1;
+
const TransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform();
const TransformationMatrix& transformToTarget = forReplica ? surface->replicaOriginTransform() : surface->originTransform();
IntRect unoccludedInScreen = contentRect;
- if (surfaceTransformsToScreenKnown(surface))
- unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, secondLast.occlusionInScreen);
+ if (surfaceTransformsToScreenKnown(surface)) {
+ if (hasOcclusion) {
+ const StackObject& secondLast = m_stack[m_stack.size() - 2];
+ unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, secondLast.occlusionInScreen);
+ } else
+ unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, Region());
+ }
if (unoccludedInScreen.isEmpty())
return unoccludedInScreen;
IntRect unoccludedInTarget = contentRect;
- if (surfaceTransformsToTargetKnown(surface))
- unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, secondLast.occlusionInTarget);
+ if (surfaceTransformsToTargetKnown(surface)) {
+ if (hasOcclusion) {
+ const StackObject& secondLast = m_stack[m_stack.size() - 2];
+ unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, secondLast.occlusionInTarget);
+ } else
+ unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, Region());
+ }
return intersection(unoccludedInScreen, unoccludedInTarget);
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp (118802 => 118803)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp 2012-05-29 17:46:03 UTC (rev 118803)
@@ -391,6 +391,14 @@
return m_owningLayer ? m_owningLayer->id() : 0;
}
+CCRenderSurface* CCRenderSurface::targetRenderSurface() const
+{
+ CCLayerImpl* parent = m_owningLayer->parent();
+ if (!parent)
+ return 0;
+ return parent->targetRenderSurface();
+}
+
bool CCRenderSurface::hasReplica() const
{
return m_owningLayer->replicaLayer();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h (118802 => 118803)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h 2012-05-29 17:46:03 UTC (rev 118803)
@@ -138,6 +138,7 @@
ManagedTexture* backgroundTexture() const { return m_backgroundTexture.get(); }
int owningLayerId() const;
+ CCRenderSurface* targetRenderSurface() const;
bool hasReplica() const;
Modified: trunk/Source/WebKit/chromium/ChangeLog (118802 => 118803)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-29 17:46:03 UTC (rev 118803)
@@ -1,3 +1,15 @@
+2012-05-29 Dana Jansens <[email protected]>
+
+ [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect
+ https://bugs.webkit.org/show_bug.cgi?id=87677
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor):
+ (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest):
+ (WebKitTests):
+
2012-05-29 David Barr <[email protected]>
Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
Modified: trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp (118802 => 118803)
--- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-05-29 17:23:02 UTC (rev 118802)
+++ trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-05-29 17:46:03 UTC (rev 118803)
@@ -2426,6 +2426,45 @@
ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface);
template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ // This test verifies that the top-most surface is considered occluded outside of its scissor rect and outside the screen's scissor rect.
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
+ this->calcDrawEtc(parent);
+
+ {
+ // Make a screen scissor rect that is larger than the root layer's.
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(surface, occlusion);
+
+ // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
+ this->enterContributingSurface(surface, occlusion);
+ // Make sure the parent's clipRect clips the unoccluded region of the child surface.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300)));
+ }
+ this->resetLayerIterator();
+ {
+ // Make a screen scissor rect that is smaller than the root layer's.
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100));
+
+ this->visitLayer(surface, occlusion);
+
+ // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
+ this->enterContributingSurface(surface, occlusion);
+ // Make sure the screen scissor rect clips the unoccluded region of the child surface.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300)));
+ }
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor);
+
+template<class Types, bool opaqueLayers>
class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> {
protected:
void runMyTest()