Log Message
[chromium] Transform animation state should be inherited from parents https://bugs.webkit.org/show_bug.cgi?id=81363
Patch by Dana Jansens <[email protected]> on 2012-03-18 Reviewed by Adrienne Walker. Source/WebCore: Adds a drawTransformIsAnimating() and screenSpaceTransformIsAnimating() to the layer classes, and similar to the surface classes. These inherit the values from their parents in the same way that the transforms themselves do, and reflect if the layer's transform is being affected by some active animation. These can be used in main-thread culling when determining if the layer's position is static in the given coordinate space or being animated. Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy * platform/graphics/chromium/LayerChromium.cpp: (WebCore::LayerChromium::LayerChromium): * platform/graphics/chromium/LayerChromium.h: (LayerChromium): (WebCore::LayerChromium::drawTransformIsAnimating): (WebCore::LayerChromium::setDrawTransformIsAnimating): (WebCore::LayerChromium::screenSpaceTransformIsAnimating): (WebCore::LayerChromium::setScreenSpaceTransformIsAnimating): * platform/graphics/chromium/RenderSurfaceChromium.cpp: (WebCore::RenderSurfaceChromium::RenderSurfaceChromium): * platform/graphics/chromium/RenderSurfaceChromium.h: (WebCore::RenderSurfaceChromium::targetSurfaceTransformsAreAnimating): (WebCore::RenderSurfaceChromium::setTargetSurfaceTransformsAreAnimating): (WebCore::RenderSurfaceChromium::screenSpaceTransformsAreAnimating): (WebCore::RenderSurfaceChromium::setScreenSpaceTransformsAreAnimating): (RenderSurfaceChromium): * platform/graphics/chromium/cc/CCLayerImpl.cpp: (WebCore::CCLayerImpl::CCLayerImpl): * platform/graphics/chromium/cc/CCLayerImpl.h: (CCLayerImpl): (WebCore::CCLayerImpl::drawTransformIsAnimating): (WebCore::CCLayerImpl::setDrawTransformIsAnimating): (WebCore::CCLayerImpl::screenSpaceTransformIsAnimating): (WebCore::CCLayerImpl::setScreenSpaceTransformIsAnimating): * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: (WebCore::subtreeShouldBeSkipped): (WebCore::calculateDrawTransformsAndVisibilityInternal): * platform/graphics/chromium/cc/CCRenderSurface.cpp: (WebCore::CCRenderSurface::CCRenderSurface): * platform/graphics/chromium/cc/CCRenderSurface.h: (WebCore::CCRenderSurface::targetSurfaceTransformsAreAnimating): (WebCore::CCRenderSurface::setTargetSurfaceTransformsAreAnimating): (WebCore::CCRenderSurface::screenSpaceTransformsAreAnimating): (WebCore::CCRenderSurface::setScreenSpaceTransformsAreAnimating): (CCRenderSurface): Source/WebKit/chromium: * tests/CCLayerTreeHostCommonTest.cpp: (WebCore::addOpacityAnimationToLayer): (WebCore): (WebCore::addTransformAnimationToLayer): (WebCore::TEST):
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp
- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
- trunk/Source/WebKit/chromium/ChangeLog
- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
Diff
Modified: trunk/Source/WebCore/ChangeLog (111136 => 111137)
--- trunk/Source/WebCore/ChangeLog 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/ChangeLog 2012-03-18 21:58:59 UTC (rev 111137)
@@ -1,3 +1,57 @@
+2012-03-18 Dana Jansens <[email protected]>
+
+ [chromium] Transform animation state should be inherited from parents
+ https://bugs.webkit.org/show_bug.cgi?id=81363
+
+ Reviewed by Adrienne Walker.
+
+ Adds a drawTransformIsAnimating() and screenSpaceTransformIsAnimating()
+ to the layer classes, and similar to the surface classes. These inherit
+ the values from their parents in the same way that the transforms
+ themselves do, and reflect if the layer's transform is being affected
+ by some active animation.
+
+ These can be used in main-thread culling when determining if the layer's
+ position is static in the given coordinate space or being animated.
+
+ Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy
+
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::LayerChromium):
+ * platform/graphics/chromium/LayerChromium.h:
+ (LayerChromium):
+ (WebCore::LayerChromium::drawTransformIsAnimating):
+ (WebCore::LayerChromium::setDrawTransformIsAnimating):
+ (WebCore::LayerChromium::screenSpaceTransformIsAnimating):
+ (WebCore::LayerChromium::setScreenSpaceTransformIsAnimating):
+ * platform/graphics/chromium/RenderSurfaceChromium.cpp:
+ (WebCore::RenderSurfaceChromium::RenderSurfaceChromium):
+ * platform/graphics/chromium/RenderSurfaceChromium.h:
+ (WebCore::RenderSurfaceChromium::targetSurfaceTransformsAreAnimating):
+ (WebCore::RenderSurfaceChromium::setTargetSurfaceTransformsAreAnimating):
+ (WebCore::RenderSurfaceChromium::screenSpaceTransformsAreAnimating):
+ (WebCore::RenderSurfaceChromium::setScreenSpaceTransformsAreAnimating):
+ (RenderSurfaceChromium):
+ * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+ (WebCore::CCLayerImpl::CCLayerImpl):
+ * platform/graphics/chromium/cc/CCLayerImpl.h:
+ (CCLayerImpl):
+ (WebCore::CCLayerImpl::drawTransformIsAnimating):
+ (WebCore::CCLayerImpl::setDrawTransformIsAnimating):
+ (WebCore::CCLayerImpl::screenSpaceTransformIsAnimating):
+ (WebCore::CCLayerImpl::setScreenSpaceTransformIsAnimating):
+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+ (WebCore::subtreeShouldBeSkipped):
+ (WebCore::calculateDrawTransformsAndVisibilityInternal):
+ * platform/graphics/chromium/cc/CCRenderSurface.cpp:
+ (WebCore::CCRenderSurface::CCRenderSurface):
+ * platform/graphics/chromium/cc/CCRenderSurface.h:
+ (WebCore::CCRenderSurface::targetSurfaceTransformsAreAnimating):
+ (WebCore::CCRenderSurface::setTargetSurfaceTransformsAreAnimating):
+ (WebCore::CCRenderSurface::screenSpaceTransformsAreAnimating):
+ (WebCore::CCRenderSurface::setScreenSpaceTransformsAreAnimating):
+ (CCRenderSurface):
+
2012-03-18 Pratik Solanki <[email protected]>
Fix compile when FULLSCREEN_API is not enabled on Mac
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -82,6 +82,8 @@
, m_drawOpacity(0)
, m_drawOpacityIsAnimating(false)
, m_targetRenderSurface(0)
+ , m_drawTransformIsAnimating(false)
+ , m_screenSpaceTransformIsAnimating(false)
, m_contentsScale(1.0)
, m_layerAnimationDelegate(0)
{
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-03-18 21:58:59 UTC (rev 111137)
@@ -197,6 +197,12 @@
void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
RenderSurfaceChromium* targetRenderSurface() const { return m_targetRenderSurface; }
void setTargetRenderSurface(RenderSurfaceChromium* surface) { m_targetRenderSurface = surface; }
+
+ bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
+ void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
+ bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
+ void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
+
// This moves from layer space, with origin in the center to target space with origin in the top left
const TransformationMatrix& drawTransform() const { return m_drawTransform; }
void setDrawTransform(const TransformationMatrix& matrix) { m_drawTransform = matrix; }
@@ -324,6 +330,8 @@
RenderSurfaceChromium* m_targetRenderSurface;
TransformationMatrix m_drawTransform;
TransformationMatrix m_screenSpaceTransform;
+ bool m_drawTransformIsAnimating;
+ bool m_screenSpaceTransformIsAnimating;
IntRect m_drawableContentRect;
float m_contentsScale;
Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -43,6 +43,8 @@
, m_skipsDraw(false)
, m_drawOpacity(1)
, m_drawOpacityIsAnimating(false)
+ , m_targetSurfaceTransformsAreAnimating(false)
+ , m_screenSpaceTransformsAreAnimating(false)
, m_nearestAncestorThatMovesPixels(0)
{
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h 2012-03-18 21:58:59 UTC (rev 111137)
@@ -77,6 +77,11 @@
const TransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
void setReplicaDrawTransform(const TransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
+ bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
+ void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
+ bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
+ void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
+
const IntRect& clipRect() const { return m_clipRect; }
void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
@@ -106,6 +111,8 @@
TransformationMatrix m_drawTransform;
TransformationMatrix m_replicaDrawTransform;
TransformationMatrix m_originTransform;
+ bool m_targetSurfaceTransformsAreAnimating;
+ bool m_screenSpaceTransformsAreAnimating;
FilterOperations m_filters;
IntRect m_clipRect;
Vector<RefPtr<LayerChromium> > m_layerList;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -68,6 +68,8 @@
, m_drawOpacityIsAnimating(false)
, m_debugBorderColor(0, 0, 0, 0)
, m_debugBorderWidth(0)
+ , m_drawTransformIsAnimating(false)
+ , m_screenSpaceTransformIsAnimating(false)
, m_layerAnimationController(CCLayerAnimationControllerImpl::create(this))
{
ASSERT(CCProxy::isImplThread());
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h 2012-03-18 21:58:59 UTC (rev 111137)
@@ -212,6 +212,12 @@
void setDrawTransform(const TransformationMatrix& matrix) { m_drawTransform = matrix; }
const TransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
void setScreenSpaceTransform(const TransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
+
+ bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
+ void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
+ bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
+ void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
+
const IntRect& drawableContentRect() const { return m_drawableContentRect; }
void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
const FloatRect& updateRect() const { return m_updateRect; }
@@ -332,6 +338,8 @@
TransformationMatrix m_drawTransform;
TransformationMatrix m_screenSpaceTransform;
+ bool m_drawTransformIsAnimating;
+ bool m_screenSpaceTransformIsAnimating;
// The rect that contributes to the scissor when this layer is drawn.
// Inherited by the parent layer and further restricted if this layer masks
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -108,7 +108,7 @@
return false;
}
-static bool subtreeShouldBeSkipped(CCLayerImpl* layer)
+static inline bool subtreeShouldBeSkipped(CCLayerImpl* layer)
{
// The opacity of a layer always applies to its children (either implicitly
// via a render surface or explicitly if the parent preserves 3D), so the
@@ -116,7 +116,7 @@
return !layer->opacity();
}
-static bool subtreeShouldBeSkipped(LayerChromium* layer)
+static inline bool subtreeShouldBeSkipped(LayerChromium* layer)
{
// If the opacity is being animated then the opacity on the main thread is unreliable
// (since the impl thread may be using a different opacity), so it should not be trusted.
@@ -281,6 +281,13 @@
TransformationMatrix combinedTransform = parentMatrix;
combinedTransform = combinedTransform.multiply(layerLocalTransform);
+ bool layerIsInAnimatingSubtreeForSurface = layer->transformIsAnimating();
+ bool layerIsInAnimatingSubtreeForScreen = layer->transformIsAnimating();
+ if (layer->parent()) {
+ layerIsInAnimatingSubtreeForSurface |= layer->parent()->drawTransformIsAnimating();
+ layerIsInAnimatingSubtreeForScreen |= layer->parent()->screenSpaceTransformIsAnimating();
+ }
+
FloatRect layerRect(-0.5 * layer->bounds().width(), -0.5 * layer->bounds().height(), layer->bounds().width(), layer->bounds().height());
IntRect transformedLayerRect;
@@ -315,6 +322,12 @@
layerOriginTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0);
renderSurface->setOriginTransform(layerOriginTransform);
+ renderSurface->setTargetSurfaceTransformsAreAnimating(layerIsInAnimatingSubtreeForSurface);
+ renderSurface->setScreenSpaceTransformsAreAnimating(layerIsInAnimatingSubtreeForScreen);
+ layerIsInAnimatingSubtreeForSurface = false;
+ layer->setDrawTransformIsAnimating(layerIsInAnimatingSubtreeForSurface);
+ layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForScreen);
+
// Update the aggregate hierarchy matrix to include the transform of the newly created RenderSurface.
nextHierarchyMatrix.multiply(layerOriginTransform);
@@ -340,6 +353,8 @@
renderSurfaceLayerList.append(layer);
} else {
layer->setDrawTransform(combinedTransform);
+ layer->setDrawTransformIsAnimating(layerIsInAnimatingSubtreeForSurface);
+ layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForScreen);
transformedLayerRect = enclosingIntRect(layer->drawTransform().mapRect(layerRect));
layer->setDrawOpacity(drawOpacity);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -53,6 +53,8 @@
, m_surfacePropertyChanged(false)
, m_drawOpacity(1)
, m_drawOpacityIsAnimating(false)
+ , m_targetSurfaceTransformsAreAnimating(false)
+ , m_screenSpaceTransformsAreAnimating(false)
, m_nearestAncestorThatMovesPixels(0)
{
m_damageTracker = CCDamageTracker::create();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h (111136 => 111137)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h 2012-03-18 21:58:59 UTC (rev 111137)
@@ -89,6 +89,11 @@
void setOriginTransform(const TransformationMatrix& originTransform) { m_originTransform = originTransform; }
const TransformationMatrix& originTransform() const { return m_originTransform; }
+ bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
+ void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
+ bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
+ void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
+
void setClipRect(const IntRect&);
const IntRect& clipRect() const { return m_clipRect; }
@@ -138,6 +143,8 @@
TransformationMatrix m_drawTransform;
TransformationMatrix m_replicaDrawTransform;
TransformationMatrix m_originTransform;
+ bool m_targetSurfaceTransformsAreAnimating;
+ bool m_screenSpaceTransformsAreAnimating;
FilterOperations m_filters;
IntRect m_clipRect;
Vector<CCLayerImpl*> m_layerList;
Modified: trunk/Source/WebKit/chromium/ChangeLog (111136 => 111137)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-18 21:58:59 UTC (rev 111137)
@@ -1,3 +1,16 @@
+2012-03-18 Dana Jansens <[email protected]>
+
+ [chromium] Transform animation state should be inherited from parents
+ https://bugs.webkit.org/show_bug.cgi?id=81363
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::addOpacityAnimationToLayer):
+ (WebCore):
+ (WebCore::addTransformAnimationToLayer):
+ (WebCore::TEST):
+
2012-03-16 James Robinson <[email protected]>
[chromium] Unify the drawing logic for different layer types that output textures to the compositor
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (111136 => 111137)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-03-18 19:28:16 UTC (rev 111136)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-03-18 21:58:59 UTC (rev 111137)
@@ -29,6 +29,8 @@
#include "CCLayerTreeTestCommon.h"
#include "LayerChromium.h"
#include "TransformationMatrix.h"
+#include "TranslateTransformOperation.h"
+#include "cc/CCLayerAnimationController.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -582,6 +584,178 @@
EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id());
}
+static int addOpacityAnimationToLayer(LayerChromium* layer, float startValue, float endValue, double duration)
+{
+ static int id = 0;
+ WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
+ values.insert(new FloatAnimationValue(0, startValue));
+ values.insert(new FloatAnimationValue(duration, endValue));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
+ return id++;
+}
+
+static int addTransformAnimationToLayer(LayerChromium* layer, double duration)
+{
+ static int id = 0;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
+ return id++;
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
+{
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
+ RefPtr<LayerChromium> renderSurface2 = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRoot = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRS1 = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRS2 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ parent->createRenderSurface();
+ parent->addChild(renderSurface1);
+ parent->addChild(childOfRoot);
+ renderSurface1->addChild(childOfRS1);
+ renderSurface1->addChild(renderSurface2);
+ renderSurface2->addChild(childOfRS2);
+ childOfRoot->addChild(grandChildOfRoot);
+ childOfRS1->addChild(grandChildOfRS1);
+ childOfRS2->addChild(grandChildOfRS2);
+
+ // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
+ renderSurface1->setOpacity(0.4);
+ renderSurface2->setOpacity(0.5);
+ addOpacityAnimationToLayer(renderSurface1.get(), 1, 0, 10);
+ addOpacityAnimationToLayer(renderSurface2.get(), 1, 0, 10);
+
+ // Also put an animation on a layer without descendants.
+ addOpacityAnimationToLayer(grandChildOfRoot.get(), 1, 0, 10);
+
+ TransformationMatrix layerTransform;
+ layerTransform.translate(1.0, 1.0);
+ TransformationMatrix sublayerTransform;
+ sublayerTransform.scale3d(10.0, 1.0, 1.0);
+
+ // Put transform animations on child, renderSurface2, grandChildOfRoot, and grandChildOfRS2
+ addTransformAnimationToLayer(childOfRoot.get(), 10);
+ addTransformAnimationToLayer(grandChildOfRoot.get(), 10);
+ addTransformAnimationToLayer(renderSurface2.get(), 10);
+ addTransformAnimationToLayer(grandChildOfRS2.get(), 10);
+
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+
+ executeCalculateDrawTransformsAndVisibility(parent.get());
+
+ // Only layers that are associated with render surfaces should have an actual renderSurface() value.
+ //
+ ASSERT_TRUE(parent->renderSurface());
+ ASSERT_FALSE(childOfRoot->renderSurface());
+ ASSERT_FALSE(grandChildOfRoot->renderSurface());
+
+ ASSERT_TRUE(renderSurface1->renderSurface());
+ ASSERT_FALSE(childOfRS1->renderSurface());
+ ASSERT_FALSE(grandChildOfRS1->renderSurface());
+
+ ASSERT_TRUE(renderSurface2->renderSurface());
+ ASSERT_FALSE(childOfRS2->renderSurface());
+ ASSERT_FALSE(grandChildOfRS2->renderSurface());
+
+ // Verify all targetRenderSurface accessors
+ //
+ EXPECT_EQ(parent->renderSurface(), parent->targetRenderSurface());
+ EXPECT_EQ(parent->renderSurface(), childOfRoot->targetRenderSurface());
+ EXPECT_EQ(parent->renderSurface(), grandChildOfRoot->targetRenderSurface());
+
+ EXPECT_EQ(renderSurface1->renderSurface(), renderSurface1->targetRenderSurface());
+ EXPECT_EQ(renderSurface1->renderSurface(), childOfRS1->targetRenderSurface());
+ EXPECT_EQ(renderSurface1->renderSurface(), grandChildOfRS1->targetRenderSurface());
+
+ EXPECT_EQ(renderSurface2->renderSurface(), renderSurface2->targetRenderSurface());
+ EXPECT_EQ(renderSurface2->renderSurface(), childOfRS2->targetRenderSurface());
+ EXPECT_EQ(renderSurface2->renderSurface(), grandChildOfRS2->targetRenderSurface());
+
+ // Verify drawOpacityIsAnimating values
+ //
+ EXPECT_FALSE(parent->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRoot->drawOpacityIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->drawOpacityIsAnimating());
+ EXPECT_FALSE(renderSurface1->drawOpacityIsAnimating());
+ EXPECT_TRUE(renderSurface1->renderSurface()->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRS1->drawOpacityIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->drawOpacityIsAnimating());
+ EXPECT_FALSE(renderSurface2->drawOpacityIsAnimating());
+ EXPECT_TRUE(renderSurface2->renderSurface()->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRS2->drawOpacityIsAnimating());
+ EXPECT_FALSE(grandChildOfRS2->drawOpacityIsAnimating());
+
+ // Verify drawTransformsAnimatingInTarget values
+ //
+ EXPECT_FALSE(parent->drawTransformIsAnimating());
+ EXPECT_TRUE(childOfRoot->drawTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->renderSurface()->targetSurfaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS1->drawTransformIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface2->drawTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->renderSurface()->targetSurfaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS2->drawTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRS2->drawTransformIsAnimating());
+
+ // Verify drawTransformsAnimatingInScreen values
+ //
+ EXPECT_FALSE(parent->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(childOfRoot->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->renderSurface()->screenSpaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS1->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->renderSurface()->screenSpaceTransformsAreAnimating());
+ EXPECT_TRUE(childOfRS2->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRS2->screenSpaceTransformIsAnimating());
+
+
+ // Sanity check. If these fail there is probably a bug in the test itself.
+ // It is expected that we correctly set up transforms so that the y-component of the screen-space transform
+ // encodes the "depth" of the layer in the tree.
+ EXPECT_FLOAT_EQ(1.0, parent->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(2.0, childOfRoot->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3.0, grandChildOfRoot->screenSpaceTransform().m42());
+
+ EXPECT_FLOAT_EQ(2.0, renderSurface1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3.0, childOfRS1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(4.0, grandChildOfRS1->screenSpaceTransform().m42());
+
+ EXPECT_FLOAT_EQ(3.0, renderSurface2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(4.0, childOfRS2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(5.0, grandChildOfRS2->screenSpaceTransform().m42());
+}
+
// FIXME:
// continue working on https://bugs.webkit.org/show_bug.cgi?id=68942
// - add a test to verify clipping that changes the "center point"
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
