OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/FrameView.h" | 5 #include "core/frame/FrameView.h" |
6 #include "core/layout/LayoutView.h" | 6 #include "core/layout/LayoutView.h" |
7 #include "core/layout/compositing/CompositedLayerMapping.h" | 7 #include "core/layout/compositing/CompositedLayerMapping.h" |
8 #include "core/layout/compositing/PaintLayerCompositor.h" | 8 #include "core/layout/compositing/PaintLayerCompositor.h" |
9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
10 #include "platform/graphics/CompositorMutableProperties.h" | 10 #include "platform/graphics/CompositorMutableProperties.h" |
| 11 #include "platform/graphics/CompositorMutation.h" |
11 #include "platform/graphics/GraphicsLayer.h" | 12 #include "platform/graphics/GraphicsLayer.h" |
12 #include "platform/testing/URLTestHelpers.h" | 13 #include "platform/testing/URLTestHelpers.h" |
13 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
14 #include "public/platform/WebLayer.h" | 15 #include "public/platform/WebLayer.h" |
15 #include "public/platform/WebLayerTreeView.h" | 16 #include "public/platform/WebLayerTreeView.h" |
16 #include "public/platform/WebUnitTestSupport.h" | 17 #include "public/platform/WebUnitTestSupport.h" |
17 #include "public/web/WebSettings.h" | 18 #include "public/web/WebSettings.h" |
18 #include "public/web/WebViewClient.h" | 19 #include "public/web/WebViewClient.h" |
19 #include "web/WebLocalFrameImpl.h" | 20 #include "web/WebLocalFrameImpl.h" |
20 #include "web/WebViewImpl.h" | 21 #include "web/WebViewImpl.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 registerMockedHttpURLLoad("compositor-proxy-basic.html"); | 216 registerMockedHttpURLLoad("compositor-proxy-basic.html"); |
216 navigateTo(m_baseURL + "compositor-proxy-basic.html"); | 217 navigateTo(m_baseURL + "compositor-proxy-basic.html"); |
217 | 218 |
218 forceFullCompositingUpdate(); | 219 forceFullCompositingUpdate(); |
219 | 220 |
220 Document* document = frame()->document(); | 221 Document* document = frame()->document(); |
221 | 222 |
222 { | 223 { |
223 Element* proxiedElement = document->getElementById("proxied-transform"); | 224 Element* proxiedElement = document->getElementById("proxied-transform"); |
224 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); | 225 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
225 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta
blePropertyTransform); | 226 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta
bleProperty::kTransform); |
226 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu
tablePropertyScrollLeft | CompositorMutablePropertyScrollTop | CompositorMutable
PropertyOpacity)); | 227 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu
tableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorM
utableProperty::kOpacity)); |
227 uint64_t elementId = proxiedLayer->elementId(); | 228 uint64_t elementId = proxiedLayer->elementId(); |
228 EXPECT_NE(0UL, elementId); | 229 EXPECT_NE(0UL, elementId); |
229 | 230 |
230 TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31,
32, 33, 34, 41, 42, 43, 44); | 231 TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31,
32, 33, 34, 41, 42, 43, 44); |
231 OwnPtrWillBeRawPtr<CompositorMutation> mutation = adoptPtr(new Composito
rMutation); | 232 OwnPtrWillBeRawPtr<CompositorMutation> mutation = adoptPtr(new Composito
rMutation); |
232 mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatri
x)); | 233 mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatri
x)); |
233 | 234 |
234 CompositorMutations mutations; | 235 CompositorMutations mutations; |
235 mutations.map.add(elementId, mutation.release()); | 236 mutations.map.add(elementId, mutation.release()); |
236 | 237 |
237 webViewImpl()->applyMutations(mutations); | 238 webViewImpl()->applyMutations(mutations); |
238 | 239 |
239 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue
(CSSPropertyTransform); | 240 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue
(CSSPropertyTransform); |
240 EXPECT_EQ(String("matrix3d(11px, 12px, 13px, 14px, 21px, 22px, 23px, 24p
x, 31px, 32px, 33px, 34px, 41px, 42px, 43px, 44px)"), cssValue); | 241 EXPECT_EQ(String("matrix3d(11px, 12px, 13px, 14px, 21px, 22px, 23px, 24p
x, 31px, 32px, 33px, 34px, 41px, 42px, 43px, 44px)"), cssValue); |
241 } | 242 } |
242 { | 243 { |
243 Element* proxiedElement = document->getElementById("proxied-opacity"); | 244 Element* proxiedElement = document->getElementById("proxied-opacity"); |
244 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); | 245 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
245 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta
blePropertyOpacity); | 246 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMuta
bleProperty::kOpacity); |
246 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu
tablePropertyScrollLeft | CompositorMutablePropertyScrollTop | CompositorMutable
PropertyTransform)); | 247 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMu
tableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorM
utableProperty::kTransform)); |
247 uint64_t elementId = proxiedLayer->elementId(); | 248 uint64_t elementId = proxiedLayer->elementId(); |
248 EXPECT_NE(0UL, elementId); | 249 EXPECT_NE(0UL, elementId); |
249 | 250 |
250 OwnPtrWillBeRawPtr<CompositorMutation> mutation = adoptPtr(new Composito
rMutation); | 251 OwnPtrWillBeRawPtr<CompositorMutation> mutation = adoptPtr(new Composito
rMutation); |
251 mutation->setOpacity(0.5); | 252 mutation->setOpacity(0.5); |
252 | 253 |
253 CompositorMutations mutations; | 254 CompositorMutations mutations; |
254 mutations.map.add(elementId, mutation.release()); | 255 mutations.map.add(elementId, mutation.release()); |
255 | 256 |
256 webViewImpl()->applyMutations(mutations); | 257 webViewImpl()->applyMutations(mutations); |
257 | 258 |
258 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue
(CSSPropertyOpacity); | 259 const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue
(CSSPropertyOpacity); |
259 EXPECT_EQ(String("0.5"), cssValue); | 260 EXPECT_EQ(String("0.5"), cssValue); |
260 } | 261 } |
261 } | 262 } |
262 | 263 |
263 } // namespace blink | 264 } // namespace blink |
OLD | NEW |