| Index: third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
|
| index d622662f420cbf780f2c2a4c67776b3f282c592a..f6d280f53d071f31f870c39502f44c3b29cdc838 100644
|
| --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
|
| @@ -8,6 +8,7 @@
|
| #include "core/layout/compositing/PaintLayerCompositor.h"
|
| #include "core/page/Page.h"
|
| #include "platform/graphics/CompositorMutableProperties.h"
|
| +#include "platform/graphics/CompositorMutation.h"
|
| #include "platform/graphics/GraphicsLayer.h"
|
| #include "platform/testing/URLTestHelpers.h"
|
| #include "public/platform/Platform.h"
|
| @@ -133,7 +134,7 @@ TEST_F(CompositorWorkerTest, plumbingElementIdAndMutableProperties)
|
| WebLayer* tallLayer = webLayerFromElement(tallElement);
|
| EXPECT_TRUE(!tallLayer);
|
|
|
| - Element* proxiedElement = document->getElementById("proxied");
|
| + Element* proxiedElement = document->getElementById("proxied-transform");
|
| WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
|
| EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kTransform);
|
| EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kOpacity));
|
| @@ -210,4 +211,95 @@ TEST_F(CompositorWorkerTest, disconnectedProxies)
|
| EXPECT_EQ(0UL, rootScrollLayer->elementId());
|
| }
|
|
|
| +TEST_F(CompositorWorkerTest, applyingMutationsMultipleElements)
|
| +{
|
| + registerMockedHttpURLLoad("compositor-proxy-basic.html");
|
| + navigateTo(m_baseURL + "compositor-proxy-basic.html");
|
| +
|
| + Document* document = frame()->document();
|
| +
|
| + {
|
| + forceFullCompositingUpdate();
|
| +
|
| + Element* proxiedElement = document->getElementById("proxied-transform");
|
| + WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
|
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kTransform);
|
| + EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kOpacity));
|
| + uint64_t elementId = proxiedLayer->elementId();
|
| + EXPECT_NE(0UL, elementId);
|
| +
|
| + TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44);
|
| + CompositorMutation mutation;
|
| + mutation.setTransform(TransformationMatrix::toSkMatrix44(transformMatrix));
|
| +
|
| + proxiedElement->updateFromCompositorMutation(mutation);
|
| +
|
| + forceFullCompositingUpdate();
|
| + const String& cssValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform);
|
| + EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", cssValue);
|
| + }
|
| + {
|
| + Element* proxiedElement = document->getElementById("proxied-opacity");
|
| + WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
|
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kOpacity);
|
| + EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kTransform));
|
| + uint64_t elementId = proxiedLayer->elementId();
|
| + EXPECT_NE(0UL, elementId);
|
| +
|
| + CompositorMutation mutation;
|
| + mutation.setOpacity(0.5);
|
| +
|
| + proxiedElement->updateFromCompositorMutation(mutation);
|
| +
|
| + forceFullCompositingUpdate();
|
| + const String& cssValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity);
|
| + EXPECT_EQ("0.5", cssValue);
|
| + }
|
| +}
|
| +
|
| +TEST_F(CompositorWorkerTest, applyingMutationsMultipleProperties)
|
| +{
|
| + registerMockedHttpURLLoad("compositor-proxy-basic.html");
|
| + navigateTo(m_baseURL + "compositor-proxy-basic.html");
|
| +
|
| + Document* document = frame()->document();
|
| +
|
| + forceFullCompositingUpdate();
|
| +
|
| + Element* proxiedElement = document->getElementById("proxied-transform-and-opacity");
|
| + WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
|
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kTransform);
|
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kOpacity);
|
| + EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop));
|
| + uint64_t elementId = proxiedLayer->elementId();
|
| + EXPECT_NE(0UL, elementId);
|
| +
|
| + TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44);
|
| + OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation);
|
| + mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix));
|
| + mutation->setOpacity(0.5);
|
| +
|
| + proxiedElement->updateFromCompositorMutation(*mutation);
|
| + {
|
| + const String& transformValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform);
|
| + EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue);
|
| +
|
| + const String& opacityValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity);
|
| + EXPECT_EQ("0.5", opacityValue);
|
| + }
|
| +
|
| + // Verify that updating one property does not impact others
|
| + mutation = adoptPtr(new CompositorMutation);
|
| + mutation->setOpacity(0.8);
|
| +
|
| + proxiedElement->updateFromCompositorMutation(*mutation);
|
| + {
|
| + const String& transformValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform);
|
| + EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue);
|
| +
|
| + const String& opacityValue = document->domWindow()->getComputedStyle(proxiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity);
|
| + EXPECT_EQ("0.8", opacityValue);
|
| + }
|
| +}
|
| +
|
| } // namespace blink
|
|
|