Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // | |
|
Ian Vollick
2016/01/22 21:56:53
unnecessary?
majidvp
2016/01/22 23:32:06
Done.
| |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 | 5 |
| 5 #include "core/frame/FrameView.h" | 6 #include "core/frame/FrameView.h" |
| 6 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 7 #include "core/layout/compositing/CompositedLayerMapping.h" | 8 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 8 #include "core/layout/compositing/PaintLayerCompositor.h" | 9 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 9 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| 10 #include "platform/graphics/CompositorMutableProperties.h" | 11 #include "platform/graphics/CompositorMutableProperties.h" |
| 12 #include "platform/graphics/CompositorMutation.h" | |
| 11 #include "platform/graphics/GraphicsLayer.h" | 13 #include "platform/graphics/GraphicsLayer.h" |
| 12 #include "platform/testing/URLTestHelpers.h" | 14 #include "platform/testing/URLTestHelpers.h" |
| 13 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
| 14 #include "public/platform/WebLayer.h" | 16 #include "public/platform/WebLayer.h" |
| 15 #include "public/platform/WebLayerTreeView.h" | 17 #include "public/platform/WebLayerTreeView.h" |
| 16 #include "public/platform/WebUnitTestSupport.h" | 18 #include "public/platform/WebUnitTestSupport.h" |
| 17 #include "public/web/WebSettings.h" | 19 #include "public/web/WebSettings.h" |
| 18 #include "public/web/WebViewClient.h" | 20 #include "public/web/WebViewClient.h" |
| 19 #include "web/WebLocalFrameImpl.h" | 21 #include "web/WebLocalFrameImpl.h" |
| 20 #include "web/WebViewImpl.h" | 22 #include "web/WebViewImpl.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 navigateTo(m_baseURL + "compositor-proxy-basic.html"); | 128 navigateTo(m_baseURL + "compositor-proxy-basic.html"); |
| 127 | 129 |
| 128 forceFullCompositingUpdate(); | 130 forceFullCompositingUpdate(); |
| 129 | 131 |
| 130 Document* document = frame()->document(); | 132 Document* document = frame()->document(); |
| 131 | 133 |
| 132 Element* tallElement = document->getElementById("tall"); | 134 Element* tallElement = document->getElementById("tall"); |
| 133 WebLayer* tallLayer = webLayerFromElement(tallElement); | 135 WebLayer* tallLayer = webLayerFromElement(tallElement); |
| 134 EXPECT_TRUE(!tallLayer); | 136 EXPECT_TRUE(!tallLayer); |
| 135 | 137 |
| 136 Element* proxiedElement = document->getElementById("proxied"); | 138 Element* proxiedElement = document->getElementById("proxied-transform"); |
| 137 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); | 139 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
| 138 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kTransform); | 140 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kTransform); |
| 139 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutabl eProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutab leProperty::kOpacity)); | 141 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutabl eProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutab leProperty::kOpacity)); |
| 140 EXPECT_NE(0UL, proxiedLayer->elementId()); | 142 EXPECT_NE(0UL, proxiedLayer->elementId()); |
| 141 | 143 |
| 142 Element* scrollElement = document->getElementById("proxied-scroller"); | 144 Element* scrollElement = document->getElementById("proxied-scroller"); |
| 143 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); | 145 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); |
| 144 EXPECT_TRUE(scrollLayer->compositorMutableProperties() & (CompositorMutableP roperty::kScrollLeft | CompositorMutableProperty::kScrollTop)); | 146 EXPECT_TRUE(scrollLayer->compositorMutableProperties() & (CompositorMutableP roperty::kScrollLeft | CompositorMutableProperty::kScrollTop)); |
| 145 EXPECT_FALSE(scrollLayer->compositorMutableProperties() & (CompositorMutable Property::kTransform | CompositorMutableProperty::kOpacity)); | 147 EXPECT_FALSE(scrollLayer->compositorMutableProperties() & (CompositorMutable Property::kTransform | CompositorMutableProperty::kOpacity)); |
| 146 EXPECT_NE(0UL, scrollLayer->elementId()); | 148 EXPECT_NE(0UL, scrollLayer->elementId()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 Element* scrollElement = document->getElementById("proxied-scroller"); | 205 Element* scrollElement = document->getElementById("proxied-scroller"); |
| 204 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); | 206 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); |
| 205 EXPECT_FALSE(!!scrollLayer->compositorMutableProperties()); | 207 EXPECT_FALSE(!!scrollLayer->compositorMutableProperties()); |
| 206 EXPECT_EQ(0UL, scrollLayer->elementId()); | 208 EXPECT_EQ(0UL, scrollLayer->elementId()); |
| 207 | 209 |
| 208 WebLayer* rootScrollLayer = getRootScrollLayer(); | 210 WebLayer* rootScrollLayer = getRootScrollLayer(); |
| 209 EXPECT_FALSE(!!rootScrollLayer->compositorMutableProperties()); | 211 EXPECT_FALSE(!!rootScrollLayer->compositorMutableProperties()); |
| 210 EXPECT_EQ(0UL, rootScrollLayer->elementId()); | 212 EXPECT_EQ(0UL, rootScrollLayer->elementId()); |
| 211 } | 213 } |
| 212 | 214 |
| 215 TEST_F(CompositorWorkerTest, applyingMutations) | |
| 216 { | |
| 217 registerMockedHttpURLLoad("compositor-proxy-basic.html"); | |
| 218 navigateTo(m_baseURL + "compositor-proxy-basic.html"); | |
| 219 | |
| 220 forceFullCompositingUpdate(); | |
| 221 | |
| 222 Document* document = frame()->document(); | |
| 223 | |
| 224 { | |
| 225 Element* proxiedElement = document->getElementById("proxied-transform"); | |
| 226 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); | |
| 227 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta bleProperty::kTransform); | |
| 228 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu tableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorM utableProperty::kOpacity)); | |
| 229 uint64_t elementId = proxiedLayer->elementId(); | |
| 230 EXPECT_NE(0UL, elementId); | |
| 231 | |
| 232 TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); | |
| 233 OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); | |
| 234 mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatri x)); | |
| 235 | |
| 236 CompositorMutations mutations; | |
| 237 mutations.map.add(elementId, mutation.release()); | |
| 238 | |
| 239 webViewImpl()->applyMutations(mutations); | |
| 240 forceFullCompositingUpdate(); | |
| 241 | |
| 242 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue (CSSPropertyTransform); | |
| 243 EXPECT_EQ(String("matrix3d(11px, 12px, 13px, 14px, 21px, 22px, 23px, 24p x, 31px, 32px, 33px, 34px, 41px, 42px, 43px, 44px)"), cssValue); | |
| 244 } | |
| 245 { | |
| 246 Element* proxiedElement = document->getElementById("proxied-opacity"); | |
| 247 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); | |
| 248 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta bleProperty::kOpacity); | |
| 249 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu tableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorM utableProperty::kTransform)); | |
| 250 uint64_t elementId = proxiedLayer->elementId(); | |
| 251 EXPECT_NE(0UL, elementId); | |
| 252 | |
| 253 OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); | |
| 254 mutation->setOpacity(0.5); | |
| 255 | |
| 256 CompositorMutations mutations; | |
| 257 mutations.map.add(elementId, mutation.release()); | |
| 258 | |
| 259 webViewImpl()->applyMutations(mutations); | |
| 260 forceFullCompositingUpdate(); | |
| 261 | |
| 262 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue (CSSPropertyOpacity); | |
| 263 EXPECT_EQ(String("0.5"), cssValue); | |
| 264 } | |
| 265 } | |
| 266 | |
| 213 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |