OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/blink/web_layer_impl.h" | 5 #include "cc/blink/web_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "base/trace_event/trace_event_impl.h" | 17 #include "base/trace_event/trace_event_impl.h" |
18 #include "cc/animation/animation.h" | 18 #include "cc/animation/animation.h" |
19 #include "cc/base/region.h" | 19 #include "cc/base/region.h" |
20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
21 #include "cc/blink/web_animation_impl.h" | |
22 #include "cc/blink/web_blend_mode.h" | 21 #include "cc/blink/web_blend_mode.h" |
23 #include "cc/blink/web_filter_operations_impl.h" | |
24 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" | 22 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
25 #include "cc/layers/layer.h" | 23 #include "cc/layers/layer.h" |
26 #include "cc/layers/layer_position_constraint.h" | 24 #include "cc/layers/layer_position_constraint.h" |
27 #include "cc/layers/layer_settings.h" | 25 #include "cc/layers/layer_settings.h" |
28 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
29 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 27 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
30 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 28 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
31 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 29 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
32 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 30 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
33 #include "third_party/WebKit/public/platform/WebSize.h" | 31 #include "third_party/WebKit/public/platform/WebSize.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 221 } |
224 | 222 |
225 void WebLayerImpl::setBackgroundColor(WebColor color) { | 223 void WebLayerImpl::setBackgroundColor(WebColor color) { |
226 layer_->SetBackgroundColor(color); | 224 layer_->SetBackgroundColor(color); |
227 } | 225 } |
228 | 226 |
229 WebColor WebLayerImpl::backgroundColor() const { | 227 WebColor WebLayerImpl::backgroundColor() const { |
230 return layer_->background_color(); | 228 return layer_->background_color(); |
231 } | 229 } |
232 | 230 |
233 void WebLayerImpl::setFilters(const WebFilterOperations& filters) { | 231 void WebLayerImpl::setFilters(const cc::FilterOperations& filters) { |
234 const WebFilterOperationsImpl& filters_impl = | 232 layer_->SetFilters(filters); |
235 static_cast<const WebFilterOperationsImpl&>(filters); | |
236 layer_->SetFilters(filters_impl.AsFilterOperations()); | |
237 } | 233 } |
238 | 234 |
239 void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { | 235 void WebLayerImpl::setBackgroundFilters(const cc::FilterOperations& filters) { |
240 const WebFilterOperationsImpl& filters_impl = | 236 layer_->SetBackgroundFilters(filters); |
241 static_cast<const WebFilterOperationsImpl&>(filters); | |
242 layer_->SetBackgroundFilters(filters_impl.AsFilterOperations()); | |
243 } | 237 } |
244 | 238 |
245 void WebLayerImpl::setAnimationDelegate( | 239 void WebLayerImpl::setAnimationDelegate( |
246 blink::WebCompositorAnimationDelegate* delegate) { | 240 blink::WebCompositorAnimationDelegate* delegate) { |
247 if (!delegate) { | 241 if (!delegate) { |
248 animation_delegate_adapter_.reset(); | 242 animation_delegate_adapter_.reset(); |
249 layer_->set_layer_animation_delegate(nullptr); | 243 layer_->set_layer_animation_delegate(nullptr); |
250 return; | 244 return; |
251 } | 245 } |
252 animation_delegate_adapter_.reset( | 246 animation_delegate_adapter_.reset( |
253 new WebToCCAnimationDelegateAdapter(delegate)); | 247 new WebToCCAnimationDelegateAdapter(delegate)); |
254 layer_->set_layer_animation_delegate(animation_delegate_adapter_.get()); | 248 layer_->set_layer_animation_delegate(animation_delegate_adapter_.get()); |
255 } | 249 } |
256 | 250 |
257 bool WebLayerImpl::addAnimation(blink::WebCompositorAnimation* animation) { | 251 bool WebLayerImpl::addAnimation(cc::Animation* animation) { |
258 bool result = layer_->AddAnimation( | 252 return layer_->AddAnimation(make_scoped_ptr(animation)); |
259 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation()); | |
260 delete animation; | |
261 return result; | |
262 } | 253 } |
263 | 254 |
264 void WebLayerImpl::removeAnimation(int animation_id) { | 255 void WebLayerImpl::removeAnimation(int animation_id) { |
265 layer_->RemoveAnimation(animation_id); | 256 layer_->RemoveAnimation(animation_id); |
266 } | 257 } |
267 | 258 |
268 void WebLayerImpl::pauseAnimation(int animation_id, double time_offset) { | 259 void WebLayerImpl::pauseAnimation(int animation_id, double time_offset) { |
269 layer_->PauseAnimation(animation_id, time_offset); | 260 layer_->PauseAnimation(animation_id, time_offset); |
270 } | 261 } |
271 | 262 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 533 |
543 Layer* WebLayerImpl::layer() const { | 534 Layer* WebLayerImpl::layer() const { |
544 return layer_.get(); | 535 return layer_.get(); |
545 } | 536 } |
546 | 537 |
547 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { | 538 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { |
548 contents_opaque_is_fixed_ = fixed; | 539 contents_opaque_is_fixed_ = fixed; |
549 } | 540 } |
550 | 541 |
551 } // namespace cc_blink | 542 } // namespace cc_blink |
OLD | NEW |