WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
addressed reviewer comments
bug-80622-20120723125405.patch (text/plain), 95.76 KB, created by
Shawn Singh
on 2012-07-23 12:54:13 PDT
(
hide
)
Description:
addressed reviewer comments
Filename:
MIME Type:
Creator:
Shawn Singh
Created:
2012-07-23 12:54:13 PDT
Size:
95.76 KB
patch
obsolete
>Subversion Revision: 123347 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6d200f9591c54ef5be57dfd7c513ac616bc02f4b..c4544ae542c1bd486a86981938a2aa8a005aaeb6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,73 @@ >+2012-07-20 Shawn Singh <shawnsingh@chromium.org> >+ >+ [chromium] Refactor CCLayerTreeHostCommon: clean up clipRect and drawableContentRect design >+ https://bugs.webkit.org/show_bug.cgi?id=80622 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ clipRect(), usesLayerClipping(), and drawableContentRect() have been >+ very confusing in CCLayerTreeHostCommon for a while. This patch >+ refactors it so that (1) clipping is only done locally in >+ calcDrawTransforms, and (2) the layer's drawableContentRect value >+ is now meaningful value outside of calcDrawTransforms. >+ Additionally, the layer is now always clipped to the root >+ surface's contentBounds (which are set to the viewport bounds). >+ This refactor not only makes calcDrawTransforms far more readable and intuitive, but >+ this patch enables more upcoming beneficial refactors, including >+ the pending refactor in https://bugs.webkit.org/show_bug.cgi?id=88953. >+ >+ Tests are also significantly updated to keep up with this refactoring change. >+ >+ * platform/graphics/chromium/LayerChromium.cpp: >+ (WebCore::LayerChromium::LayerChromium): >+ * platform/graphics/chromium/LayerChromium.h: >+ (LayerChromium): >+ Removed m_usesLayerClipping and m_clipRect and associated accessors. >+ >+ * platform/graphics/chromium/RenderSurfaceChromium.h: >+ (RenderSurfaceChromium): >+ Updated comment >+ >+ * platform/graphics/chromium/cc/CCLayerImpl.cpp: >+ (WebCore::CCLayerImpl::CCLayerImpl): >+ * platform/graphics/chromium/cc/CCLayerImpl.h: >+ (CCLayerImpl): >+ Removed m_usesLayerClipping and m_clipRect and associated accessors. >+ >+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: >+ (WebCore::CCLayerTreeHost::updateLayers): >+ removed setClipRect code that no longer applies >+ >+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: >+ (WebCore::calculateLayerScissorRect): >+ scissor rect is now a little bit tighter, the intersection between damage and layer's new drawableContentRect. >+ >+ (WebCore::calculateSurfaceScissorRect): >+ scissor rect is now a little bit tighter, except when filters are involved. >+ >+ (WebCore::layerClipsSubtree): >+ new helper function >+ >+ (WebCore): >+ (WebCore::calculateVisibleContentRect): >+ (WebCore::subtreeShouldRenderToSeparateSurface): >+ (WebCore::calculateDrawTransformsInternal): >+ - added drawableContentRectOfSubtree to the function args, it is valid only after recursion returns, >+ - added clipRectFromAncestor and bool ancestorClipsSubtree to function args, this replaces the layer's clipRect and usesLayerClipping. >+ - removed the boolean return value, which was redundant with drawableContentRectOfSubtree. >+ - replaced all the "setDrawableContentRect" logic with more intuitive, clear logic. >+ - now, layer's drawableContentRect represents the clipped bounds of the layer expressed in the target surface space. >+ >+ (WebCore::CCLayerTreeHostCommon::calculateDrawTransforms): >+ (WebCore::pointIsClippedBySurfaceOrClipRect): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: >+ (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): >+ * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: >+ (WebCore::::layerScissorRectInTargetSurface): >+ Updated this accessor. It could be removed in the future, but not appropriate for this patch. >+ >+ * platform/graphics/chromium/cc/CCRenderSurface.h: >+ > 2012-07-23 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r123339. >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index da058fe5b2c6cef9dd2581b284bf842d47f97903..f289940eea3ab284136a03109ab5d5c4a12e7f2b 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,32 @@ >+2012-07-20 Shawn Singh <shawnsingh@chromium.org> >+ >+ [chromium] Refactor CCLayerTreeHostCommon: clean up clipRect and drawableContentRect design >+ https://bugs.webkit.org/show_bug.cgi?id=80622 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Many tests needed to be updated because the semantics of the layer tree have changed: >+ - a few tests that were no longer applicable were removed. >+ - many tests needed to have fixed initialization, properly >+ setting surface contentRect and rootLayer bounds. >+ - because clipRect and usesLayerClipping no longer exists, those places in code had to be removed/changed >+ - the scissorRect tests needed to have updated expectations >+ because after this patch, the rootLayer Surface now clips >+ to its contentBounds. >+ - the clipRect tests were changed to test the layer's new semantics for the drawableContentRect instead. >+ >+ * tests/CCLayerImplTest.cpp: >+ (WebCore::TEST): >+ * tests/CCLayerIteratorTest.cpp: >+ * tests/CCLayerTreeHostCommonTest.cpp: >+ * tests/CCLayerTreeHostImplTest.cpp: >+ * tests/CCLayerTreeHostTest.cpp: >+ * tests/CCOcclusionTrackerTest.cpp: >+ (WebKitTests::CCOcclusionTrackerTest::calcDrawEtc): >+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest): >+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest): >+ * tests/LayerChromiumTest.cpp: >+ > 2012-07-23 Peter Beverloo <peter@chromium.org> > > [Chromium] Buildfix for fixing gclient on the Chromium Windows bot >diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp >index 03203bf1ccd603246839ab2c7c2ba8e075bb6dc7..24827e9468177f40260e2207be9de9ba5e547015 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp >@@ -77,7 +77,6 @@ LayerChromium::LayerChromium() > , m_masksToBounds(false) > , m_opaque(false) > , m_doubleSided(true) >- , m_usesLayerClipping(false) > , m_isNonCompositedContent(false) > , m_preserves3D(false) > , m_useParentBackfaceVisibility(false) >diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h >index 83058e633a6476d24b7724e657162ab8d32e9bd5..abd9e36f8045a0753f7497d604ca9e03bfcd4e21 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h >+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h >@@ -195,9 +195,6 @@ public: > void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; } > bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; } > >- void setUsesLayerClipping(bool usesLayerClipping) { m_usesLayerClipping = usesLayerClipping; } >- bool usesLayerClipping() const { return m_usesLayerClipping; } >- > virtual void setIsNonCompositedContent(bool); > bool isNonCompositedContent() const { return m_isNonCompositedContent; } > >@@ -236,8 +233,6 @@ public: > bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } > void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } > >- const IntRect& clipRect() const { return m_clipRect; } >- void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; } > LayerChromium* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } > void setRenderTarget(LayerChromium* target) { m_renderTarget = target; } > >@@ -351,8 +346,7 @@ private: > IntRect m_visibleContentRect; > > // During drawing, identifies the region outside of which nothing should be drawn. >- // Currently this is set to layer's clipRect if usesLayerClipping is true, otherwise >- // it's renderTarget's RenderSurface contentRect. >+ // This is the intersection of the layer's drawableContentRect and damage (if damage tracking is enabled). > // Uses target surface's space. > IntRect m_scissorRect; > IntPoint m_scrollPosition; >@@ -378,7 +372,6 @@ private: > bool m_masksToBounds; > bool m_opaque; > bool m_doubleSided; >- bool m_usesLayerClipping; > bool m_isNonCompositedContent; > bool m_preserves3D; > bool m_useParentBackfaceVisibility; >@@ -397,9 +390,8 @@ private: > float m_drawOpacity; > bool m_drawOpacityIsAnimating; > >- // Uses target surface space. >- IntRect m_clipRect; > LayerChromium* m_renderTarget; >+ > WebKit::WebTransformationMatrix m_drawTransform; > WebKit::WebTransformationMatrix m_screenSpaceTransform; > bool m_drawTransformIsAnimating; >diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h >index 1681c5ba3a4776c78754b612dea11ad18130926d..4749c130e0424e3efb15efa817ea3739a66303a3 100644 >--- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h >+++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h >@@ -116,8 +116,6 @@ private: > IntRect m_clipRect; > > // During drawing, identifies the region outside of which nothing should be drawn. >- // Currently this is set to layer's clipRect if usesLayerClipping is true, otherwise >- // it's targetRenderSurface's contentRect. > // Uses the space of the surface's target surface. > IntRect m_scissorRect; > >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >index 717d96d1016f5f6736972176263749f290d3b130..8a05a88070f2f5ae21548387d82da7b033033b76 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >@@ -64,7 +64,6 @@ CCLayerImpl::CCLayerImpl(int id) > , m_preserves3D(false) > , m_useParentBackfaceVisibility(false) > , m_drawCheckerboardForMissingTiles(false) >- , m_usesLayerClipping(false) > , m_isNonCompositedContent(false) > , m_drawsContent(false) > , m_forceRenderSurface(false) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h >index 6196c2c4d509f8ca1674d326c1b2c9e5da65530f..25bedc2207e7290ceb7af9b855fdb2c57577f6c2 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h >@@ -148,9 +148,6 @@ public: > void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; } > bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; } > >- void setUsesLayerClipping(bool usesLayerClipping) { m_usesLayerClipping = usesLayerClipping; } >- bool usesLayerClipping() const { return m_usesLayerClipping; } >- > void setIsNonCompositedContent(bool isNonCompositedContent) { m_isNonCompositedContent = isNonCompositedContent; } > bool isNonCompositedContent() const { return m_isNonCompositedContent; } > >@@ -178,10 +175,6 @@ public: > bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } > void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } > >- // Usage: if this->usesLayerClipping() is false, then this clipRect should not be used. >- const IntRect& clipRect() const { return m_clipRect; } >- void setClipRect(const IntRect& rect) { m_clipRect = rect; } >- > const IntRect& scissorRect() const { return m_scissorRect; } > void setScissorRect(const IntRect& rect) { m_scissorRect = rect; } > >@@ -343,7 +336,6 @@ private: > bool m_drawCheckerboardForMissingTiles; > WebKit::WebTransformationMatrix m_sublayerTransform; > WebKit::WebTransformationMatrix m_transform; >- bool m_usesLayerClipping; > bool m_isNonCompositedContent; > > bool m_drawsContent; >@@ -389,12 +381,6 @@ private: > bool m_betweenWillDrawAndDidDraw; > #endif > >- // The rect that contributes to the scissor when this layer is drawn. >- // Inherited by the parent layer and further restricted if this layer masks >- // to bounds. >- // Uses target surface's space. >- IntRect m_clipRect; >- > // During drawing, identifies the region outside of which nothing should be drawn. > // Uses target surface's space. > IntRect m_scissorRect; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >index 377f74d544819ecd24429ed4b59c670118b579a2..d2a79eb1bfbe5f66de1f290be5712bf10a6fa175 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >@@ -467,9 +467,6 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u > rootLayer->createRenderSurface(); > rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(0, 0), deviceViewportSize())); > >- IntRect rootClipRect(IntPoint(), deviceViewportSize()); >- rootLayer->setClipRect(rootClipRect); >- > LayerList updateList; > updateList.append(rootLayer); > >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp >index 3946c23dc5d64566c3aee8c8b92201776945e452..343766a6adfdcc2cffa1b30c8aef6e8d71df8ddb 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp >@@ -72,11 +72,7 @@ static IntRect calculateLayerScissorRect(LayerType* layer, const FloatRect& root > RenderSurfaceType* targetSurface = renderTarget->renderSurface(); > > FloatRect rootScissorRectInTargetSurface = targetSurface->computeRootScissorRectInCurrentSurface(rootScissorRect); >- FloatRect clipAndDamage; >- if (layer->usesLayerClipping()) >- clipAndDamage = intersection(rootScissorRectInTargetSurface, layer->clipRect()); >- else >- clipAndDamage = intersection(rootScissorRectInTargetSurface, targetSurface->contentRect()); >+ FloatRect clipAndDamage = intersection(rootScissorRectInTargetSurface, layer->drawableContentRect()); > > return enclosingIntRect(clipAndDamage); > } >@@ -95,13 +91,21 @@ static IntRect calculateSurfaceScissorRect(LayerType* layer, const FloatRect& ro > > FloatRect clipRect = currentSurface->clipRect(); > >- // For surfaces, empty clipRect means the same as CCLayerImpl::usesLayerClipping being false >+ // For surfaces, empty clipRect means that the surface does not clip anything. > if (clipRect.isEmpty()) > clipRect = intersection(targetSurface->contentRect(), currentSurface->drawableContentRect()); >+ else >+ clipRect.intersect(currentSurface->drawableContentRect()); > > FloatRect rootScissorRectInTargetSurface = targetSurface->computeRootScissorRectInCurrentSurface(rootScissorRect); > > FloatRect clipAndDamage = intersection(rootScissorRectInTargetSurface, clipRect); >+ >+ // If the layer has background filters that move pixels, we cannot scissor as tightly. >+ // FIXME: this should be able to be a tighter scissor, perhaps expanded by the filter outsets? >+ if (layer->backgroundFilters().hasFilterThatMovesPixels()) >+ clipAndDamage = rootScissorRectInTargetSurface; >+ > return enclosingIntRect(clipAndDamage); > } > >@@ -156,14 +160,19 @@ static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMa > } > > template<typename LayerType> >+static inline bool layerClipsSubtree(LayerType* layer) >+{ >+ return layer->masksToBounds() || layer->maskLayer(); >+} >+ >+template<typename LayerType> > static IntRect calculateVisibleContentRect(LayerType* layer) > { > ASSERT(layer->renderTarget()); > > IntRect targetSurfaceRect = layer->renderTarget()->renderSurface()->contentRect(); > >- if (layer->usesLayerClipping()) >- targetSurfaceRect.intersect(layer->clipRect()); >+ targetSurfaceRect.intersect(layer->drawableContentRect()); > > if (targetSurfaceRect.isEmpty() || layer->contentBounds().isEmpty()) > return IntRect(); >@@ -298,7 +307,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig > return true; > > // If the layer clips its descendants but it is not axis-aligned with respect to its parent. >- if (layer->masksToBounds() && !axisAlignedWithRespectToParent && descendantDrawsContent) >+ if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendantDrawsContent) > return true; > > // If the layer has opacity != 1 and does not have a preserves-3d transform style. >@@ -393,10 +402,11 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(CCLayerImpl* > // Recursively walks the layer tree starting at the given node and computes all the > // necessary transformations, clipRects, render surfaces, etc. > template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter> >-static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLayer, const WebTransformationMatrix& parentMatrix, >- const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix, >- RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, >- LayerSorter* layerSorter, int maxTextureSize) >+static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLayer, const WebTransformationMatrix& parentMatrix, >+ const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix, >+ const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, >+ RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, >+ LayerSorter* layerSorter, int maxTextureSize, IntRect& drawableContentRectOfSubtree) > { > // This function computes the new matrix transformations recursively for this > // layer and all its descendants. It also computes the appropriate render surfaces. >@@ -488,9 +498,15 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() > // > >+ // If we early-exit anywhere in this function, the drawableContentRect of this subtree should be considered empty. >+ drawableContentRectOfSubtree = IntRect(); >+ > if (subtreeShouldBeSkipped(layer)) >- return false; >+ return; > >+ IntRect clipRectForSubtree; >+ bool subtreeShouldBeClipped = false; >+ > float drawOpacity = layer->opacity(); > bool drawOpacityIsAnimating = layer->opacityIsAnimating(); > if (layer->parent() && layer->parent()->preserves3D()) { >@@ -544,13 +560,10 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > // nextHierarchyMatrix will only change if this layer uses a new RenderSurface, otherwise remains the same. > WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; > >- // FIXME: This seems like the wrong place to set this >- layer->setUsesLayerClipping(false); >- > if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) { > // Check back-face visibility before continuing with this surface and its subtree > if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfaceBackFaceVisible(layer, combinedTransform)) >- return false; >+ return; > > if (!layer->renderSurface()) > layer->createRenderSurface(); >@@ -594,14 +607,11 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > // Update the aggregate hierarchy matrix to include the transform of the newly created RenderSurface. > nextHierarchyMatrix.multiply(surfaceOriginTransform); > >- // The render surface clipRect contributes to the scissor rect that needs to >- // be applied before drawing the render surface onto its containing >- // surface and is therefore expressed in the parent's coordinate system. >- renderSurface->setClipRect(layer->parent() ? layer->parent()->clipRect() : layer->clipRect()); >- >- // The layer's clipRect can be reset here. The renderSurface will correctly clip the subtree. >- layer->setUsesLayerClipping(false); >- layer->setClipRect(IntRect()); >+ // The new renderSurface here will correctly clip the entire subtree. So, we do >+ // not need to continue propagating the clipping state further down the tree. This >+ // way, we can avoid transforming clipRects from ancestor target surface space to >+ // current target surface space that could cause more w < 0 headaches. >+ subtreeShouldBeClipped = false; > > if (layer->maskLayer()) > layer->maskLayer()->setRenderTarget(layer); >@@ -611,6 +621,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > > if (layer->filters().hasFilterThatMovesPixels()) > nearestAncestorThatMovesPixels = renderSurface; >+ > renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels); > > renderSurfaceLayerList.append(layer); >@@ -627,26 +638,33 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > ASSERT(layer->parent()); > layer->clearRenderSurface(); > >- // Layers inherit the clip rect from their parent. >- layer->setClipRect(layer->parent()->clipRect()); >- if (layer->parent()->usesLayerClipping()) >- layer->setUsesLayerClipping(true); >- >+ // Layers without renderSurfaces directly inherit the ancestor's clip status. >+ subtreeShouldBeClipped = ancestorClipsSubtree; >+ if (ancestorClipsSubtree) >+ clipRectForSubtree = clipRectFromAncestor; >+ > // Layers that are not their own renderTarget will render into the target of their nearest ancestor. > layer->setRenderTarget(layer->parent()->renderTarget()); >+ } else { >+ // FIXME: This root layer special case code should eventually go away. But before that is truly possible, >+ // tests (or code) related to CCOcclusionTracker need to be adjusted so that they do not require >+ // the rootLayer to clip; the root layer's RenderSurface would already clip and should be enough. >+ ASSERT(!layer->parent()); >+ ASSERT(layer->renderSurface()); >+ ASSERT(ancestorClipsSubtree); >+ layer->renderSurface()->setClipRect(clipRectFromAncestor); >+ subtreeShouldBeClipped = true; >+ clipRectForSubtree = clipRectFromAncestor; > } > } > >- if (layer->masksToBounds()) { >- IntRect clipRect = transformedLayerRect; >- >- // If the layer already inherited a clipRect, we need to intersect with it before >- // overriding the layer's clipRect and usesLayerClipping. >- if (layer->usesLayerClipping()) >- clipRect.intersect(layer->clipRect()); >- >- layer->setClipRect(clipRect); >- layer->setUsesLayerClipping(true); >+ if (layerClipsSubtree(layer)) { >+ subtreeShouldBeClipped = true; >+ if (ancestorClipsSubtree && !layer->renderSurface()) { >+ clipRectForSubtree = clipRectFromAncestor; >+ clipRectForSubtree.intersect(transformedLayerRect); >+ } else >+ clipRectForSubtree = transformedLayerRect; > } > > // Note that at this point, layer->drawTransform() is not necessarily the same as local variable drawTransform. >@@ -656,16 +674,6 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0); > layer->setScreenSpaceTransform(layerScreenSpaceTransform); > >- // drawableContentRect() is always stored in the coordinate system of the >- // RenderSurface the layer draws into. >- if (layer->drawsContent()) { >- IntRect drawableContentRect = transformedLayerRect; >- if (layer->usesLayerClipping()) >- drawableContentRect.intersect(layer->clipRect()); >- layer->setDrawableContentRect(drawableContentRect); >- } else >- layer->setDrawableContentRect(IntRect()); >- > WebTransformationMatrix sublayerMatrix = layer->drawTransform(); > > // Flatten to 2D if the layer doesn't preserve 3D. >@@ -695,36 +703,45 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > > WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; > >+ IntRect accumulatedDrawableContentRectOfChildren; > for (size_t i = 0; i < layer->children().size(); ++i) { > LayerType* child = layer->children()[i].get(); >- bool drawsContent = calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, nearestAncestorThatMovesPixels, renderSurfaceLayerList, descendants, layerSorter, maxTextureSize); >- >- if (drawsContent) { >- if (child->renderSurface()) { >- RenderSurfaceType* childRenderSurface = child->renderSurface(); >- IntRect drawableContentRect = layer->drawableContentRect(); >- drawableContentRect.unite(enclosingIntRect(childRenderSurface->drawableContentRect())); >- layer->setDrawableContentRect(drawableContentRect); >+ IntRect drawableContentRectOfChildSubtree; >+ calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, >+ clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels, >+ renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, drawableContentRectOfChildSubtree); >+ if (!drawableContentRectOfChildSubtree.isEmpty()) { >+ accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree); >+ if (child->renderSurface()) > descendants.append(child); >- } else { >- IntRect drawableContentRect = layer->drawableContentRect(); >- drawableContentRect.unite(child->drawableContentRect()); >- layer->setDrawableContentRect(drawableContentRect); >- } > } > } > >- if (layer->masksToBounds() || layer->maskLayer()) { >- IntRect drawableContentRect = layer->drawableContentRect(); >- drawableContentRect.intersect(transformedLayerRect); >- layer->setDrawableContentRect(drawableContentRect); >- } >+ // Compute the total drawableContentRect for this subtree (the rect is in targetSurface space) >+ IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren; >+ if (layer->drawsContent()) >+ localDrawableContentRectOfSubtree.unite(transformedLayerRect); >+ if (subtreeShouldBeClipped) >+ localDrawableContentRectOfSubtree.intersect(clipRectForSubtree); >+ >+ // Compute the layer's drawable content rect (the rect is in targetSurface space) >+ IntRect drawableContentRectOfLayer = transformedLayerRect; >+ if (subtreeShouldBeClipped) >+ drawableContentRectOfLayer.intersect(clipRectForSubtree); >+ layer->setDrawableContentRect(drawableContentRectOfLayer); > >+ // Compute the remaining properties for the render surface, if the layer has one. > if (layer->renderSurface() && layer != rootLayer) { > RenderSurfaceType* renderSurface = layer->renderSurface(); >- IntRect clippedContentRect = layer->drawableContentRect(); >+ IntRect clippedContentRect = localDrawableContentRectOfSubtree; > FloatPoint surfaceCenter = FloatRect(clippedContentRect).center(); > >+ // The render surface clipRect is expressed in the space where this surface draws, i.e. the same space as clipRectFromAncestor. >+ if (ancestorClipsSubtree) >+ renderSurface->setClipRect(clipRectFromAncestor); >+ else >+ renderSurface->setClipRect(IntRect()); >+ > // Restrict the RenderSurface size to the portion that's visible. > FloatSize centerOffsetDueToClipping; > >@@ -733,7 +750,8 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > // its target is not known on the main thread, and we should not use it > // to clip. > if (!layer->replicaLayer() && transformToParentIsKnown(layer)) { >- if (!renderSurface->clipRect().isEmpty() && !clippedContentRect.isEmpty()) { >+ // Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself. >+ if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) { > IntRect surfaceClipRect = CCLayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->originTransform()); > clippedContentRect.intersect(surfaceClipRect); > } >@@ -751,10 +769,6 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > > renderSurface->setContentRect(clippedContentRect); > >- // Since the layer starts a new render surface we need to adjust its >- // clipRect to be expressed in the new surface's coordinate system. >- layer->setClipRect(layer->drawableContentRect()); >- > // Adjust the origin of the transform to be the center of the render surface. > WebTransformationMatrix drawTransform = renderSurface->originTransform(); > drawTransform.translate3d(surfaceCenter.x() + centerOffsetDueToClipping.width(), surfaceCenter.y() + centerOffsetDueToClipping.height(), 0); >@@ -813,13 +827,13 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > ASSERT(renderSurfaceLayerList.last() == layer); > renderSurfaceLayerList.removeLast(); > layer->clearRenderSurface(); >- return false; >+ return; > } > } > > // If neither this layer nor any of its children were added, early out. > if (sortingStartIndex == descendants.size()) >- return false; >+ return; > > // If preserves-3d then sort all the descendants in 3D so that they can be > // drawn from back to front. If the preserves-3d property is also set on the parent then >@@ -827,7 +841,12 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay > if (descendants.size() && layer->preserves3D() && (!layer->parent() || !layer->parent()->preserves3D())) > sortLayers(&descendants.at(sortingStartIndex), descendants.end(), layerSorter); > >- return true; >+ if (layer->renderSurface()) >+ drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()->drawableContentRect()); >+ else >+ drawableContentRectOfSubtree = localDrawableContentRectOfSubtree; >+ >+ return; > } > > // FIXME: Instead of using the following function to set visibility rects on a second >@@ -864,13 +883,19 @@ static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfa > void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* layer, LayerChromium* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize) > { > WebTransformationMatrix scrollCompensationMatrix; >- WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, 0, renderSurfaceLayerList, layerList, 0, maxTextureSize); >+ IntRect drawableContentRect; >+ WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, >+ rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, >+ layerList, 0, maxTextureSize, drawableContentRect); > } > > void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* layer, CCLayerImpl* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextureSize) > { > WebTransformationMatrix scrollCompensationMatrix; >- WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize); >+ IntRect drawableContentRect; >+ WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, >+ rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, >+ layerList, layerSorter, maxTextureSize, drawableContentRect); > } > > void CCLayerTreeHostCommon::calculateVisibleAndScissorRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, const FloatRect& rootScissorRect) >@@ -909,10 +934,10 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& viewportPoint, CCL > if (currentLayer->renderSurface() && !pointHitsRect(viewportPoint, currentLayer->renderSurface()->screenSpaceTransform(), currentLayer->renderSurface()->contentRect())) > return true; > >- // Note that clipRects are actually in targetSurface space, so the transform we >+ // Note that drawableContentRects are actually in targetSurface space, so the transform we > // have to provide is the target surface's screenSpaceTransform. > CCLayerImpl* renderTarget = currentLayer->renderTarget(); >- if (currentLayer->usesLayerClipping() && !pointHitsRect(viewportPoint, renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->clipRect())) >+ if (!pointHitsRect(viewportPoint, renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableContentRect())) > return true; > > currentLayer = currentLayer->parent(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >index 7f1240432b978623f23a4b20b01195c08c529cbf..0d9d7ff41e5eb51fd48f02fffd2d59af9cc41070 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -259,8 +259,6 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur > m_rootLayerImpl->renderSurface()->clearLayerList(); > m_rootLayerImpl->renderSurface()->setContentRect(IntRect(IntPoint(), deviceViewportSize())); > >- m_rootLayerImpl->setClipRect(IntRect(IntPoint(), deviceViewportSize())); >- > { > TRACE_EVENT0("cc", "CCLayerTreeHostImpl::calcDrawEtc"); > WebTransformationMatrix identityMatrix; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp >index 0083ad1dd42b948728587ffc21ef9f8f9866b6ec..39461578f87135a6e7d49a27dd248392b947d660 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp >@@ -510,11 +510,9 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu > template<typename LayerType, typename RenderSurfaceType> > IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::layerScissorRectInTargetSurface(const LayerType* layer) const > { >- const LayerType* renderTarget = m_stack.last().target; >- FloatRect totalScissor = renderTarget->renderSurface()->contentRect(); >- if (layer->usesLayerClipping()) >- totalScissor.intersect(layer->clipRect()); >- return enclosingIntRect(totalScissor); >+ // FIXME: we could remove this helper function, but unit tests currently override this >+ // function, and they need to be verified/adjusted before this can be removed. >+ return layer->scissorRect(); > } > > // Declare the possible functions here for the linker. >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h >index 79fdac4ecc905f13ae878734b0516400afbf5b76..16d8fa1949522e1a546b294905167a6e2a7ababa 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h >@@ -91,7 +91,6 @@ public: > bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; } > void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; } > >- // Usage: this clipRect should not be used if one of the two conditions is true: (a) clipRect() is empty, or (b) owningLayer->parent()->usesLayerClipping() is false. > void setClipRect(const IntRect&); > const IntRect& clipRect() const { return m_clipRect; } > >diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp >index 22cf897cb85c01310698d8cec833b16c30afae56..47edeec9dcc078de162a44b6f8ad66de85b64e11 100644 >--- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp >@@ -167,8 +167,6 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) > > // These properties are internal, and should not be considered "change" when they are used. > EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setIsNonCompositedContent(true)); >- EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setClipRect(arbitraryIntRect)); >- EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUsesLayerClipping(true)); > EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawOpacity(arbitraryNumber)); > EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setRenderTarget(0)); > EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawTransform(arbitraryTransform)); >diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp >index 86a3743255eb2a86c167d50464dedbfe4f71e441..76dc425aa9f6b1e29440e1caf5ac809e24769fc5 100644 >--- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp >@@ -58,7 +58,8 @@ private: > , m_drawsContent(true) > { > setBounds(IntSize(100, 100)); >- setDrawableContentRect(IntRect(0, 0, 100, 100)); >+ setPosition(IntPoint::zero()); >+ setAnchorPoint(IntPoint::zero()); > } > > bool m_drawsContent; >@@ -239,6 +240,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) > RefPtr<TestLayerChromium> root231 = TestLayerChromium::create(); > > rootLayer->createRenderSurface(); >+ rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds())); > > rootLayer->addChild(root1); > rootLayer->addChild(root2); >@@ -256,6 +258,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) > Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; > Vector<RefPtr<LayerChromium> > layerList; > renderSurfaceLayerList.append(rootLayer.get()); >+ > CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), > WebTransformationMatrix(), WebTransformationMatrix(), > renderSurfaceLayerList, layerList, >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp >index 26ae6ca47321d0bda60673cc72037d716b773fc8..0e3e3ece4da97b0b4dcdef82bc296e0f435573e5 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp >@@ -77,6 +77,11 @@ void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) > Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; >+ >+ ASSERT(rootLayer->renderSurface()); >+ ASSERT(!rootLayer->bounds().isEmpty()); >+ rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds())); >+ > CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); > CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); > } >@@ -125,6 +130,7 @@ PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests() > child->addChild(grandChild.release()); > root->addChild(child.release()); > root->createRenderSurface(); >+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); > > return root.release(); > } >@@ -200,7 +206,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) > // Case 4: A change in actual position affects both the draw transform and screen space transform. > WebTransformationMatrix positionTransform; > positionTransform.translate(0, 1.2); >- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); >+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); > executeCalculateDrawTransformsAndVisibility(layer.get()); > EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform * translationToCenter, layer->drawTransform()); > EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform()); >@@ -227,7 +233,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) > // The current implementation of calculateDrawTransforms does this implicitly, but it is > // still worth testing to detect accidental regressions. > expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse(); >- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false); >+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2), IntSize(10, 12), false); > executeCalculateDrawTransformsAndVisibility(layer.get()); > EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); > EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); >@@ -259,7 +265,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) > // Case 2: parent's position affects child and grandChild. > WebTransformationMatrix parentPositionTransform; > parentPositionTransform.translate(0, 1.2); >- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); >+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); > setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); > setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); > executeCalculateDrawTransformsAndVisibility(parent.get()); >@@ -330,24 +336,27 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) > > WebTransformationMatrix identityMatrix; > WebTransformationMatrix parentLayerTransform; >- parentLayerTransform.scale3d(2, 2, 1); >+ parentLayerTransform.scale3d(1, 0.9, 1); > WebTransformationMatrix parentTranslationToAnchor; >- parentTranslationToAnchor.translate(2.5, 3); >+ parentTranslationToAnchor.translate(25, 30); > WebTransformationMatrix parentSublayerMatrix; >- parentSublayerMatrix.scale3d(10, 10, 3.3); >+ parentSublayerMatrix.scale3d(0.9, 1, 3.3); > WebTransformationMatrix parentTranslationToCenter; >- parentTranslationToCenter.translate(5, 6); >+ parentTranslationToCenter.translate(50, 60); > WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() > * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); >+ > WebTransformationMatrix childTranslationToCenter; > childTranslationToCenter.translate(8, 9); >+ WebTransformationMatrix grandChildTranslationToCenter; >+ grandChildTranslationToCenter.translate(4, 5); > > // Child's render surface should not exist yet. > ASSERT_FALSE(child->renderSurface()); > >- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); >+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(100, 120), false); > setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); >- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-0.5, -0.5), IntSize(1, 1), false); >+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(8, 10), false); > executeCalculateDrawTransformsAndVisibility(parent.get()); > > // Render surface should have been created now. >@@ -359,193 +368,16 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) > EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); > EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); > >- // Without clipping, the origin transform and draw transform (in this particular case) should be the same. > EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->originTransform()); >- EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->drawTransform()); >+ >+ // Because the grandChild is the only drawable content, the child's renderSurface will tighten its bounds to the grandChild. >+ // Therefore, the draw transform will have a translation of half-width, half-height of the grandChild's bounds. >+ EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, child->renderTarget()->renderSurface()->drawTransform()); > > // The screen space is the same as the target since the child surface draws into the root. > EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->screenSpaceTransform()); > } > >-TEST(CCLayerTreeHostCommonTest, scissorRectNoClip) >-{ >- DebugScopedSetImplThread thisScopeIsOnImplThread; >- >- /* >- Layers are created as follows: >- >- +--------------------+ >- | 1 | >- | +-----------+ | >- | | 2 | | >- | | +-------------------+ >- | | | 3 | >- | | +-------------------+ >- | | | | >- | +-----------+ | >- | | >- | | >- +--------------------+ >- >- Layers 1, 2 have render surfaces >- */ >- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); >- OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); >- OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); >- >- IntRect rootRect(0, 0, 100, 100); >- IntRect childRect(10, 10, 50, 50); >- IntRect grandChildRect(5, 5, 150, 150); >- >- root->createRenderSurface(); >- root->setAnchorPoint(FloatPoint(0, 0)); >- root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); >- root->setBounds(IntSize(rootRect.width(), rootRect.height())); >- root->setDrawsContent(true); >- root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); >- >- child->setAnchorPoint(FloatPoint(0, 0)); >- child->setPosition(FloatPoint(childRect.x(), childRect.y())); >- child->setOpacity(0.5); >- child->setBounds(IntSize(childRect.width(), childRect.height())); >- child->setDrawsContent(true); >- >- grandChild->setAnchorPoint(FloatPoint(0, 0)); >- grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); >- grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); >- grandChild->setDrawsContent(true); >- >- CCLayerImpl* childPtr = child.get(); >- CCLayerImpl* grandChildPtr = grandChild.get(); >- >- child->addChild(grandChild.release()); >- root->addChild(child.release()); >- >- Vector<CCLayerImpl*> renderSurfaceLayerList; >- { >- WebTransformationMatrix identityMatrix; >- Vector<CCLayerImpl*> layerList; >- int dummyMaxTextureSize = 512; >- CCLayerSorter layerSorter; >- >- renderSurfaceLayerList.append(root.get()); >- >- CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize); >- >- FloatRect dummyDamageRect; >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect); >- } >- >- ASSERT_TRUE(childPtr->renderSurface()); >- ASSERT_TRUE(root->renderSurface()); >- ASSERT_FALSE(grandChildPtr->renderSurface()); >- >- EXPECT_EQ(renderSurfaceLayerList.size(), 2U); >- >- ASSERT_EQ(root->clipRect(), IntRect(0, 0, 0, 0)); >- >- // Layer's clipRect is a union of all its children's bounds >- ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height())); >- ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, 0, 0)); >- >- ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0)); >- ASSERT_EQ(childPtr->renderSurface()->clipRect(), IntRect(0, 0, 0, 0)); >- >- ASSERT_FALSE(root->usesLayerClipping()); >- ASSERT_FALSE(childPtr->usesLayerClipping()); >- ASSERT_FALSE(grandChildPtr->usesLayerClipping()); >- >- // Damage the entire screen >- IntRect rootDamage(rootRect); >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); >- >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- >- // child surface doesn't have a clip rect, therefore it will be computed as intersection >- // between root surface's contentrect and child surface's drawable content rect. >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(childRect.x(), childRect.y(), rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >- >- EXPECT_EQ(root->scissorRect(), IntRect(rootRect)); >- >- // The damage is the entire rootRect, but child layer starts at an offset. >- // Even though it has bounds, it is not clipping to bounds so its children >- // (which extend beyond the bounds) extend the scissor rect >- EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >- >- // Grand child will have the same scissor rect as it doesn't have a surface >- // of its own >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >- >- // Empty damage >- rootDamage = IntRect(0, 0, 0, 0); >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); >- >- // Empty damage == empty scissor >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- >- EXPECT_EQ(root->scissorRect(), IntRect(0, 0, 0, 0)); >- EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, 0, 0)); >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, 0, 0)); >- >- // Partial damage within child >- rootDamage = IntRect(10, 10, 20, 20); >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); >- >- // Scissors are not computed for root >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- >- // Entire damage rect is within the root surface >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), rootDamage); >- >- // Entire damage rect is within the layer >- EXPECT_EQ(root->scissorRect(), rootDamage); >- >- // Entire damage rect is within the layer, but with different offset >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >- >- // Grand child does not have its own surface, so its scissor rect is identical to child's >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >- >- // Partial damage beyond child >- rootDamage = IntRect(10, 10, 80, 80); >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); >- >- // Scissors are not computed for root >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- >- // Entire damage rect is within the root surface >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), rootDamage); >- >- // Entire damage rect is within the layer >- EXPECT_EQ(root->scissorRect(), rootDamage); >- >- // Entire damage rect is within the layer, but with different offset >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >- >- // Grand child does not have its own surface, so its scissor rect is identical to child's >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >- >- // Partial damage beyond root >- rootDamage = IntRect(10, 10, 110, 110); >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); >- >- // Scissors are not computed for root >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- >- // Root surface does not have a clipRect, so its contentRect will be used to intersect with damage. >- // Result is that root damage rect is clipped at root layer boundary >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >- >- // Root does not use layer clipping, so its content rect will be used to intersect with damage >- // Result is that root damage rect is clipped at root layer boundary >- EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >- >- // Children's content rects are bigger than the root's so they don't clip the damage rect, but change its offset. >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >-} >- > TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) > { > DebugScopedSetImplThread thisScopeIsOnImplThread; >@@ -623,39 +455,27 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) > > EXPECT_EQ(renderSurfaceLayerList.size(), 2U); > >- // Now root is clipping to its bounds >- ASSERT_EQ(root->clipRect(), rootRect); >- >- // Layer's clipRect is a union of all its children's bounds >- ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height())); >- ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, 0, 0)); >- >- ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0)); >- >+ ASSERT_EQ(root->renderSurface()->clipRect(), rootRect); > // Child surface's clipping rect is now set to root's > ASSERT_EQ(childPtr->renderSurface()->clipRect(), rootRect); > >- ASSERT_TRUE(root->usesLayerClipping()); >- ASSERT_FALSE(childPtr->usesLayerClipping()); >- ASSERT_FALSE(grandChildPtr->usesLayerClipping()); >- > // Damage the entire screen > IntRect rootDamage(rootRect); > CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); > > EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(rootRect)); >+ // Child's renderSurface would have expanded to include the 150x150 grandChild located at (5, 5), and then have been clipped by the parent. >+ IntRect expectedChildRenderSurfaceScissor = intersection(rootRect, IntRect(10, 10, 155, 155)); >+ EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), expectedChildRenderSurfaceScissor); > > EXPECT_EQ(root->scissorRect(), IntRect(rootRect)); > >- // The damage is the entire rootRect, but child layer starts at an offset. >- // Even though it has bounds, it is not clipping to bounds so its children >- // (which extend beyond the bounds) extend the scissor rect >- EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >+ // The child layer is not clipped by anything (that clip is already represented by the rootSurface clipping the child's surface) >+ // So here, the expected scissor is just the child layer's rect expressed in targetSurface (child surface) space. >+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, childRect.width(), childRect.height())); > >- // Grand child will have the same scissor rect as it doesn't have a surface >- // of its own >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >+ // Grand child is (indirectly) clipped by the root surface. But the scissor is expressed in the targetSurface (child surface) space. >+ EXPECT_INT_RECT_EQ(grandChildPtr->scissorRect(), IntRect(5, 5, 85, 85)); > > // Empty damage > rootDamage = IntRect(0, 0, 0, 0); >@@ -685,8 +505,8 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) > // Entire damage rect is within the layer, but with different offset > EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); > >- // Grand child does not have its own surface, so its scissor rect is identical to child's >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >+ // Grand child scissor is the damage intersected with the clipped grandChild layer rect (expressed in targetSurface space). >+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(5, 5, 15, 15)); > > // Partial damage beyond child > rootDamage = IntRect(10, 10, 80, 80); >@@ -701,11 +521,12 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) > // Entire damage rect is within the layer > EXPECT_EQ(root->scissorRect(), rootDamage); > >- // Entire damage rect is within the layer, but with different offset >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >+ // Child layer overlaps a portion of the damage rect. >+ EXPECT_INT_RECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), childRect.width(), childRect.height())); > >- // Grand child does not have its own surface, so its scissor rect is identical to child's >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >+ // Grand child scissor is the intersection of damage and grandChild rect, expressed in child surface. >+ // The damage fits entirely within the grandChild. >+ EXPECT_INT_RECT_EQ(grandChildPtr->scissorRect(), IntRect(5, 5, 75, 75)); > > // Partial damage beyond root > rootDamage = IntRect(10, 10, 110, 110); >@@ -714,17 +535,13 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) > // Scissors are not computed for root > EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); > >- // Root surface does not have a clipRect, so its contentRect will be used to intersect with damage. >- // Result is that root damage rect is clipped at root layer boundary >+ // Root damage rect is clipped at root layer boundary. > EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >- >- // Root does not use layer clipping, so its content rect will be used to intersect with damage >- // Result is that root damage rect is clipped at root layer boundary > EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); > > // Now the scissor rects are clipped by surfaces contentRect >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >- EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >+ EXPECT_INT_RECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), childRect.width(), childRect.height())); >+ EXPECT_INT_RECT_EQ(grandChildPtr->scissorRect(), IntRect(5, 5, 105, 105)); > } > > TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) >@@ -813,38 +630,26 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) > > EXPECT_EQ(renderSurfaceLayerList.size(), 3U); > >- // Now root is clipping to its bounds >- ASSERT_EQ(root->clipRect(), rootRect); >- >- ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, childRect.x() + grandChildRect.width() , childRect.y() + grandChildRect.height())); >- >- // Grandchild now clips >- ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height())); >- >- ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0)); >- >+ EXPECT_INT_RECT_EQ(root->renderSurface()->clipRect(), rootRect); > // Child surface's clipping rect is now set to root's >- ASSERT_EQ(childPtr->renderSurface()->clipRect(), rootRect); >- >- ASSERT_TRUE(root->usesLayerClipping()); >- ASSERT_FALSE(childPtr->usesLayerClipping()); >- ASSERT_FALSE(grandChildPtr->usesLayerClipping()); >+ EXPECT_INT_RECT_EQ(childPtr->renderSurface()->clipRect(), rootRect); > > // Damage the entire screen > IntRect rootDamage(rootRect); > CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage); > >- EXPECT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >- EXPECT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), IntRect(rootRect)); >+ ASSERT_EQ(root->renderTarget()->renderSurface()->scissorRect(), IntRect(0, 0, 0, 0)); >+ // Child's renderSurface would have expanded to include the grandChild1 and grandChild2, and then have been clipped by the parent. >+ IntRect expectedChildRenderSurfaceScissor = intersection(rootRect, IntRect(10, 10, 160, 160)); >+ ASSERT_EQ(childPtr->renderTarget()->renderSurface()->scissorRect(), expectedChildRenderSurfaceScissor); > > EXPECT_EQ(root->scissorRect(), IntRect(rootRect)); > >- // The damage is the entire rootRect, but child layer starts at an offset. >- // Even though it has bounds, it is not clipping to bounds so its children >- // (which extend beyond the bounds) extend the scissor rect >- EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y())); >+ // The child layer is not clipped by anything (that clip is already represented by the rootSurface clipping the child's surface) >+ // So here, the expected scissor is just the child layer's rect expressed in targetSurface (child surface) space. >+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, childRect.width(), childRect.height())); > >- // Grand child is now scissored by the render surface >+ // Grand child now draws to its own render surface, so the scissorRect is in that surface's space. > EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x() - grandChildRect.x(), rootRect.height() - childRect.y() - grandChildRect.y())); > > // Empty damage >@@ -891,8 +696,8 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) > // Entire damage rect is within the layer > EXPECT_EQ(root->scissorRect(), rootDamage); > >- // Entire damage rect is within the layer, but with different offset >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height())); >+ // Entire damage rect is within the layer, but it is still clipped with respect to the root. >+ EXPECT_INT_RECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), childRect.width(), childRect.height())); > > // Grand child now gets scissored by its target surface as well as root > EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width() - grandChildRect.x(), rootDamage.height() - grandChildRect.y())); >@@ -912,8 +717,7 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) > // Result is that root damage rect is clipped at root layer boundary > EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); > >- // Now the scissor rects are clipped by surfaces contentRect >- EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y())); >+ EXPECT_INT_RECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), childRect.width(), childRect.height())); > > // Grandchild's scissor rect is clipped by its target surface > EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width() - grandChildRect.x(), rootDamage.height() - grandChildRect.y())); >@@ -1001,7 +805,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) > > // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface. > renderSurface1->setOpacity(0.5); >- renderSurface2->setOpacity(0.33f); >+ renderSurface2->setOpacity(0.33); > > // All layers in the tree are initialized with an anchor at .25 and a size of (10,10). > // matrix "A" is the composite layer transform used in all layers, centered about the anchor point >@@ -1131,14 +935,15 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) > RefPtr<LayerChromium> parent = LayerChromium::create(); > RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); > RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); >- renderSurface1->setOpacity(0.9f); >+ renderSurface1->setOpacity(0.9); > > const WebTransformationMatrix identityMatrix; >+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); > setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); > setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); > > parent->createRenderSurface(); >- parent->setClipRect(IntRect(0, 0, 10, 10)); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > parent->addChild(renderSurface1); > renderSurface1->createRenderSurface(); > renderSurface1->addChild(child); >@@ -1196,11 +1001,12 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) > renderSurface1->setForceRenderSurface(true); > > const WebTransformationMatrix identityMatrix; >+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); > setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); > setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); > > parent->createRenderSurface(); >- parent->setClipRect(IntRect(0, 0, 10, 10)); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > parent->addChild(renderSurface1); > renderSurface1->addChild(child); > >@@ -1589,15 +1395,19 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit > child->setIsContainerForFixedPositionLayers(true); > grandChild->setPosition(FloatPoint(8, 6)); > grandChild->setForceRenderSurface(true); >- greatGrandChild->setPosition(FloatPoint(140, 120)); >+ greatGrandChild->setPosition(FloatPoint(40, 60)); > greatGrandChild->setForceRenderSurface(true); > fixedPositionChild->setFixedToContainerLayer(true); > fixedPositionChild->setDrawsContent(true); > > // The additional rotations, which are non-commutative with translations, help to > // verify that we have correct order-of-operations in the final scroll compensation. >+ // Note that rotating about the center of the layer ensures we do not accidentally >+ // clip away layers that we want to test. > WebTransformationMatrix rotationAboutZ; >+ rotationAboutZ.translate(50, 50); > rotationAboutZ.rotate3d(0, 0, 90); >+ rotationAboutZ.translate(-50, -50); > grandChild->setTransform(rotationAboutZ); > greatGrandChild->setTransform(rotationAboutZ); > >@@ -1616,7 +1426,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit > expectedGrandChildTransform.translate(50, 50); > > WebTransformationMatrix expectedGreatGrandChildSurfaceOriginTransform; >- expectedGreatGrandChildSurfaceOriginTransform.translate(140, 120); >+ expectedGreatGrandChildSurfaceOriginTransform.translate(40, 60); > expectedGreatGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); > > WebTransformationMatrix expectedGreatGrandChildTransform; >@@ -1657,7 +1467,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit > WebTransformationMatrix compoundOriginTransform; // transform from greatGrandChildSurface's origin to the root surface. > compoundOriginTransform.translate(8, 6); // origin translation of grandChild > compoundOriginTransform.multiply(rotationAboutZ); // rotation of grandChild >- compoundOriginTransform.translate(140, 120); // origin translation of greatGrandChild >+ compoundOriginTransform.translate(40, 60); // origin translation of greatGrandChild > compoundOriginTransform.multiply(rotationAboutZ); // rotation of greatGrandChild > > expectedFixedPositionChildTransform.makeIdentity(); >@@ -1854,16 +1664,16 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) > setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); > > child->setMasksToBounds(true); >- child->setOpacity(0.4f); >+ child->setOpacity(0.4); > grandChild->setOpacity(0.5); >- greatGrandChild->setOpacity(0.4f); >+ greatGrandChild->setOpacity(0.4); > > Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; > > // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -1877,67 +1687,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) > EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); > } > >-TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) >-{ >- // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that >- // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734. >- >- const WebTransformationMatrix identityMatrix; >- RefPtr<LayerChromium> parent = LayerChromium::create(); >- RefPtr<LayerChromium> child = LayerChromium::create(); >- RefPtr<LayerChromium> grandChild = LayerChromium::create(); >- RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(); >- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); >- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); >- parent->createRenderSurface(); >- parent->addChild(child); >- child->addChild(grandChild); >- grandChild->addChild(greatGrandChild); >- >- // leafNode1 ensures that parent and child are kept on the renderSurfaceLayerList, >- // even though grandChild and greatGrandChild should be clipped. >- child->addChild(leafNode1); >- greatGrandChild->addChild(leafNode2); >- >- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); >- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); >- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false); >- setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); >- setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); >- setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); >- >- child->setMasksToBounds(true); >- child->setOpacity(0.4f); >- grandChild->setOpacity(0.5); >- greatGrandChild->setOpacity(0.4f); >- >- // Contaminate the grandChild and greatGrandChild's clipRect to reproduce the crash >- // bug found in http://code.google.com/p/chromium/issues/detail?id=106734. In this >- // bug, the clipRect was not re-computed for layers that create RenderSurfaces, and >- // therefore leafNode2 thinks it should draw itself. As a result, an extra >- // renderSurface remains on the renderSurfaceLayerList, which violates the assumption >- // that an empty renderSurface will always be the last item on the list, which >- // ultimately caused the crash. >- child->setClipRect(IntRect(IntPoint::zero(), IntSize(20, 20))); >- greatGrandChild->setClipRect(IntRect(IntPoint::zero(), IntSize(1234, 1234))); >- >- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; >- Vector<RefPtr<LayerChromium> > dummyLayerList; >- int dummyMaxTextureSize = 512; >- >- // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); >- renderSurfaceLayerList.append(parent.get()); >- >- CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >- >- CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); >- >- ASSERT_EQ(2U, renderSurfaceLayerList.size()); >- EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); >- EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); >-} >- > TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) > { > // When a renderSurface has a clipRect, it is used to clip the contentRect >@@ -1971,15 +1720,15 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) > setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); > > parent->setMasksToBounds(true); >- child->setOpacity(0.4f); >- grandChild->setOpacity(0.4f); >+ child->setOpacity(0.4); >+ grandChild->setOpacity(0.4); > > Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; > >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > parent->createRenderSurface(); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -1997,8 +1746,8 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) > renderSurfaceLayerList.clear(); > dummyLayerList.clear(); > >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > parent->createRenderSurface(); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2010,14 +1759,14 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) > EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); > } > >-TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) >+TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) > { >- // Verify that layers get the appropriate clipRects when their parent masksToBounds is true. >+ // Verify that layers get the appropriate drawableContentRect when their parent masksToBounds is true. > // >- // grandChild1 - completely inside the region; clipRect should be the mask region (larger than this layer's bounds). >- // grandChild2 - partially clipped but NOT masksToBounds; the clipRect should be the parent's clipRect regardless of the layer's bounds. >- // grandChild3 - partially clipped and masksToBounds; the clipRect will be the intersection of layerBounds and the mask region. >- // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty. >+ // grandChild1 - completely inside the region; drawableContentRect should be the layer rect expressed in target space. >+ // grandChild2 - partially clipped but NOT masksToBounds; the clipRect will be the intersection of layerBounds and the mask region. >+ // grandChild3 - partially clipped and masksToBounds; the drawableContentRect will still be the intersection of layerBounds and the mask region. >+ // grandChild4 - outside parent's clipRect; the drawableContentRect should be empty. > // > > const WebTransformationMatrix identityMatrix; >@@ -2044,10 +1793,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) > > child->setMasksToBounds(true); > grandChild3->setMasksToBounds(true); >- grandChild4->setMasksToBounds(true); > > // Force everyone to be a render surface. >- child->setOpacity(0.4f); >+ child->setOpacity(0.4); > grandChild1->setOpacity(0.5); > grandChild2->setOpacity(0.5); > grandChild3->setOpacity(0.5); >@@ -2058,7 +1806,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) > int dummyMaxTextureSize = 512; > > // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2066,17 +1814,17 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) > CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); > > >- EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild1->clipRect()); >- EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild2->clipRect()); >- EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->clipRect()); >- EXPECT_TRUE(grandChild4->clipRect().isEmpty()); >+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); >+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); >+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); >+ EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); > } > > TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) > { > // Verify that renderSurfaces (and their layers) get the appropriate clipRects when their parent masksToBounds is true. > // >- // Layers that own renderSurfaces (at least for now) do not inherit any clipRect; >+ // Layers that own renderSurfaces (at least for now) do not inherit any clipping; > // instead the surface will enforce the clip for the entire subtree. They may still > // have a clipRect of their own layer bounds, however, if masksToBounds was true. > // >@@ -2122,7 +1870,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) > grandChild4->setMasksToBounds(true); > > // Force everyone to be a render surface. >- child->setOpacity(0.4f); >+ child->setOpacity(0.4); > grandChild1->setOpacity(0.5); > grandChild2->setOpacity(0.5); > grandChild3->setOpacity(0.5); >@@ -2133,7 +1881,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) > int dummyMaxTextureSize = 512; > > // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); >+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2149,12 +1897,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) > EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); > EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); > EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); >- >- // Layers do not inherit the clipRect from their owned surfaces, but if masksToBounds is true, they do create their own clipRect. >- EXPECT_FALSE(grandChild1->usesLayerClipping()); >- EXPECT_FALSE(grandChild2->usesLayerClipping()); >- EXPECT_TRUE(grandChild3->usesLayerClipping()); >- EXPECT_TRUE(grandChild4->usesLayerClipping()); > } > > TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) >@@ -2619,7 +2361,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; > parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2724,7 +2465,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; > parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2811,7 +2551,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) > int dummyMaxTextureSize = 512; > > parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -2885,7 +2624,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin > Vector<RefPtr<LayerChromium> > dummyLayerList; > int dummyMaxTextureSize = 512; > parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); >@@ -3703,7 +3441,6 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTranformsInHighDPI) > > parent->createRenderSurface(); > parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); >- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); > renderSurfaceLayerList.append(parent.get()); > > const double deviceScaleFactor = 1.5; >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >index dd525fcbf7788f240c1b2b46cb3d15a3301215b9..1419164b5299b25a82c509c35cc83408de3ecbd2 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >@@ -137,10 +137,15 @@ public: > root->setMaxScrollPosition(contentSize); > root->setBounds(contentSize); > root->setContentBounds(contentSize); >+ root->setPosition(FloatPoint(0, 0)); >+ root->setAnchorPoint(FloatPoint(0, 0)); >+ > OwnPtr<CCLayerImpl> contents = CCLayerImpl::create(2); > contents->setDrawsContent(true); > contents->setBounds(contentSize); > contents->setContentBounds(contentSize); >+ contents->setPosition(FloatPoint(0, 0)); >+ contents->setAnchorPoint(FloatPoint(0, 0)); > root->addChild(contents.release()); > m_hostImpl->setRootLayer(root.release()); > } >@@ -838,13 +843,18 @@ TEST_F(CCLayerTreeHostImplTest, scrollNonCompositedRoot) > OwnPtr<CCLayerImpl> contentLayer = CCLayerImpl::create(1); > contentLayer->setIsNonCompositedContent(true); > contentLayer->setDrawsContent(true); >- contentLayer->setPosition(IntPoint(5, 5)); >+ contentLayer->setPosition(FloatPoint(0, 0)); >+ contentLayer->setAnchorPoint(FloatPoint(0, 0)); > contentLayer->setBounds(surfaceSize); > contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2)); > > OwnPtr<CCLayerImpl> scrollLayer = CCLayerImpl::create(2); > scrollLayer->setScrollable(true); > scrollLayer->setMaxScrollPosition(surfaceSize); >+ scrollLayer->setBounds(surfaceSize); >+ scrollLayer->setContentBounds(surfaceSize); >+ scrollLayer->setPosition(FloatPoint(0, 0)); >+ scrollLayer->setAnchorPoint(FloatPoint(0, 0)); > scrollLayer->addChild(contentLayer.release()); > > m_hostImpl->setRootLayer(scrollLayer.release()); >@@ -862,6 +872,8 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) > { > IntSize surfaceSize(10, 10); > OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); >+ root->setBounds(surfaceSize); >+ root->setContentBounds(surfaceSize); > root->addChild(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); > m_hostImpl->setRootLayer(root.release()); > m_hostImpl->setViewportSize(surfaceSize); >@@ -1038,6 +1050,8 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) > { > IntSize surfaceSize(10, 10); > OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); >+ root->setBounds(surfaceSize); >+ root->setContentBounds(surfaceSize); > // Also mark the root scrollable so it becomes the root scroll layer. > root->setScrollable(true); > int scrollLayerId = 2; >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >index b0e9ee8d6c8bca933738df4beb0f6f0f6de4de45..ca3e21c3d55115bc6072739033a8b92f15398c6d 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >@@ -2176,8 +2176,14 @@ public: > virtual void beginTest() OVERRIDE > { > m_layerTreeHost->setViewportSize(IntSize(10, 10)); >+ m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); >+ > m_rootScrollLayer = ContentLayerChromium::create(&m_mockDelegate); > m_rootScrollLayer->setBounds(IntSize(10, 10)); >+ >+ m_rootScrollLayer->setPosition(FloatPoint(0, 0)); >+ m_rootScrollLayer->setAnchorPoint(FloatPoint(0, 0)); >+ > m_rootScrollLayer->setIsDrawable(true); > m_rootScrollLayer->setScrollable(true); > m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100)); >@@ -2188,6 +2194,10 @@ public: > m_childLayer->setIsDrawable(true); > m_childLayer->setScrollable(true); > m_childLayer->setMaxScrollPosition(IntSize(100, 100)); >+ >+ m_childLayer->setPosition(FloatPoint(0, 0)); >+ m_childLayer->setAnchorPoint(FloatPoint(0, 0)); >+ > m_rootScrollLayer->addChild(m_childLayer); > postSetNeedsCommitToMainThread(); > } >diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp >index 87bde511722851768363bc88954c3bca70e9bb68..b559db12cae442c611e95a596f5843510eb6c7ef 100644 >--- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp >+++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp >@@ -263,7 +263,6 @@ protected: > ASSERT(!root->renderSurface()); > root->createRenderSurface(); > root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); >- root->setClipRect(IntRect(IntPoint::zero(), root->bounds())); > m_renderSurfaceLayerListImpl.append(m_root.get()); > > CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, &layerSorter, dummyMaxTextureSize); >@@ -282,7 +281,6 @@ protected: > ASSERT(!root->renderSurface()); > root->createRenderSurface(); > root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); >- root->setClipRect(IntRect(IntPoint::zero(), root->bounds())); > m_renderSurfaceLayerListChromium.append(m_root); > > CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize); >@@ -2069,7 +2067,7 @@ protected: > > this->visitLayer(surfaceChild2, occlusion); > this->enterLayer(surfaceChild, occlusion); >- EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); >+ EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); > this->leaveLayer(surfaceChild, occlusion); > this->enterLayer(surface, occlusion); > EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); >@@ -2121,7 +2119,7 @@ protected: > > this->visitLayer(surfaceChild2, occlusion); > this->enterLayer(surfaceChild, occlusion); >- EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); >+ EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); > this->leaveLayer(surfaceChild, occlusion); > this->enterLayer(surface, occlusion); > EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); >diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp >index 004022b66c198ec490534d175b4f50d476940d0b..a932ab61c2a80d6388cfa25f399d438cb16dcc98 100644 >--- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp >+++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp >@@ -495,10 +495,8 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) > > // Test properties that should not call needsDisplay and needsCommit when changed. > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50))); >- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUsesLayerClipping(true)); > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setIsNonCompositedContent(true)); > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5)); >- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setRenderTarget(0)); > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); > EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix()));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 80622
:
152333
|
153194
|
153568
|
153842
| 153843