OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "webkit/compositor_bindings/web_layer_impl.h" | 5 #include "webkit/compositor_bindings/web_layer_impl.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| 11 #include "cc/layers/layer_position_constraint.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerPositionCon
straint.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
14 #include "third_party/skia/include/utils/SkMatrix44.h" | 16 #include "third_party/skia/include/utils/SkMatrix44.h" |
15 #include "webkit/compositor_bindings/web_animation_impl.h" | 17 #include "webkit/compositor_bindings/web_animation_impl.h" |
16 | 18 |
17 using cc::Animation; | 19 using cc::Animation; |
18 using cc::Layer; | 20 using cc::Layer; |
19 using WebKit::WebLayer; | 21 using WebKit::WebLayer; |
20 using WebKit::WebFloatPoint; | 22 using WebKit::WebFloatPoint; |
21 using WebKit::WebVector; | 23 using WebKit::WebVector; |
22 using WebKit::WebRect; | 24 using WebKit::WebRect; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 ++i; | 304 ++i; |
303 } | 305 } |
304 return result; | 306 return result; |
305 } | 307 } |
306 | 308 |
307 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) { | 309 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) { |
308 layer_->SetIsContainerForFixedPositionLayers(enable); | 310 layer_->SetIsContainerForFixedPositionLayers(enable); |
309 } | 311 } |
310 | 312 |
311 bool WebLayerImpl::isContainerForFixedPositionLayers() const { | 313 bool WebLayerImpl::isContainerForFixedPositionLayers() const { |
312 return layer_->is_container_for_fixed_position_layers(); | 314 return layer_->IsContainerForFixedPositionLayers(); |
313 } | 315 } |
314 | 316 |
315 void WebLayerImpl::setFixedToContainerLayer(bool enable) { | 317 static WebKit::WebLayerPositionConstraint ToWebLayerPositionConstraint( |
316 layer_->SetFixedToContainerLayer(enable); | 318 const cc::LayerPositionConstraint& constraint) { |
| 319 WebKit::WebLayerPositionConstraint web_constraint; |
| 320 web_constraint.isFixedPosition = constraint.is_fixed_position(); |
| 321 web_constraint.isFixedToRightEdge = constraint.is_fixed_to_right_edge(); |
| 322 web_constraint.isFixedToBottomEdge = constraint.is_fixed_to_bottom_edge(); |
| 323 return web_constraint; |
317 } | 324 } |
318 | 325 |
319 bool WebLayerImpl::fixedToContainerLayer() const { | 326 static cc::LayerPositionConstraint ToLayerPositionConstraint( |
320 return layer_->fixed_to_container_layer(); | 327 const WebKit::WebLayerPositionConstraint& web_constraint) { |
| 328 cc::LayerPositionConstraint constraint; |
| 329 constraint.set_is_fixed_position(web_constraint.isFixedPosition); |
| 330 constraint.set_is_fixed_to_right_edge(web_constraint.isFixedToRightEdge); |
| 331 constraint.set_is_fixed_to_bottom_edge(web_constraint.isFixedToBottomEdge); |
| 332 return constraint; |
| 333 } |
| 334 |
| 335 void WebLayerImpl::setPositionConstraint( |
| 336 const WebKit::WebLayerPositionConstraint& constraint) { |
| 337 layer_->SetPositionConstraint(ToLayerPositionConstraint(constraint)); |
| 338 } |
| 339 |
| 340 WebKit::WebLayerPositionConstraint WebLayerImpl::positionConstraint() const { |
| 341 return ToWebLayerPositionConstraint(layer_->position_constraint()); |
321 } | 342 } |
322 | 343 |
323 void WebLayerImpl::setScrollClient( | 344 void WebLayerImpl::setScrollClient( |
324 WebKit::WebLayerScrollClient* scroll_client) { | 345 WebKit::WebLayerScrollClient* scroll_client) { |
325 layer_->set_layer_scroll_client(scroll_client); | 346 layer_->set_layer_scroll_client(scroll_client); |
326 } | 347 } |
327 | 348 |
328 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } | 349 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } |
329 | 350 |
330 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 351 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
331 | 352 |
332 } // namespace WebKit | 353 } // namespace WebKit |
OLD | NEW |