| 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 "content/renderer/compositor_bindings/web_layer_impl.h" | 5 #include "cc/blink/web_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event_impl.h" | 8 #include "base/debug/trace_event_impl.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "cc/animation/animation.h" | 12 #include "cc/animation/animation.h" |
| 13 #include "cc/base/region.h" | 13 #include "cc/base/region.h" |
| 14 #include "cc/base/switches.h" | 14 #include "cc/base/switches.h" |
| 15 #include "cc/blink/web_animation_impl.h" |
| 16 #include "cc/blink/web_blend_mode.h" |
| 17 #include "cc/blink/web_filter_operations_impl.h" |
| 18 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
| 15 #include "cc/layers/layer.h" | 19 #include "cc/layers/layer.h" |
| 16 #include "cc/layers/layer_position_constraint.h" | 20 #include "cc/layers/layer_position_constraint.h" |
| 17 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
| 18 #include "content/renderer/compositor_bindings/web_animation_impl.h" | |
| 19 #include "content/renderer/compositor_bindings/web_blend_mode.h" | |
| 20 #include "content/renderer/compositor_bindings/web_filter_operations_impl.h" | |
| 21 #include "content/renderer/compositor_bindings/web_to_cc_animation_delegate_adap
ter.h" | |
| 22 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 22 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 23 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 23 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 24 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" | 24 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" |
| 25 #include "third_party/WebKit/public/platform/WebLayerClient.h" | 25 #include "third_party/WebKit/public/platform/WebLayerClient.h" |
| 26 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 26 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
| 27 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 27 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
| 28 #include "third_party/WebKit/public/platform/WebSize.h" | 28 #include "third_party/WebKit/public/platform/WebSize.h" |
| 29 #include "third_party/skia/include/utils/SkMatrix44.h" | 29 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 30 | 30 |
| 31 using cc::Animation; | 31 using cc::Animation; |
| 32 using cc::Layer; | 32 using cc::Layer; |
| 33 using blink::WebLayer; | 33 using blink::WebLayer; |
| 34 using blink::WebFloatPoint; | 34 using blink::WebFloatPoint; |
| 35 using blink::WebVector; | 35 using blink::WebVector; |
| 36 using blink::WebRect; | 36 using blink::WebRect; |
| 37 using blink::WebSize; | 37 using blink::WebSize; |
| 38 using blink::WebColor; | 38 using blink::WebColor; |
| 39 using blink::WebFilterOperations; | 39 using blink::WebFilterOperations; |
| 40 | 40 |
| 41 namespace content { | 41 namespace cc_blink { |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 bool g_impl_side_painting_enabled = false; | 44 bool g_impl_side_painting_enabled = false; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { | 48 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { |
| 49 web_layer_client_ = NULL; | 49 web_layer_client_ = NULL; |
| 50 layer_->SetLayerClient(this); | 50 layer_->SetLayerClient(this); |
| 51 } | 51 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 void WebLayerImpl::removeFromParent() { | 99 void WebLayerImpl::removeFromParent() { |
| 100 layer_->RemoveFromParent(); | 100 layer_->RemoveFromParent(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void WebLayerImpl::removeAllChildren() { | 103 void WebLayerImpl::removeAllChildren() { |
| 104 layer_->RemoveAllChildren(); | 104 layer_->RemoveAllChildren(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void WebLayerImpl::setBounds(const WebSize& size) { layer_->SetBounds(size); } | 107 void WebLayerImpl::setBounds(const WebSize& size) { |
| 108 layer_->SetBounds(size); |
| 109 } |
| 108 | 110 |
| 109 WebSize WebLayerImpl::bounds() const { | 111 WebSize WebLayerImpl::bounds() const { |
| 110 return layer_->bounds(); | 112 return layer_->bounds(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void WebLayerImpl::setMasksToBounds(bool masks_to_bounds) { | 115 void WebLayerImpl::setMasksToBounds(bool masks_to_bounds) { |
| 114 layer_->SetMasksToBounds(masks_to_bounds); | 116 layer_->SetMasksToBounds(masks_to_bounds); |
| 115 } | 117 } |
| 116 | 118 |
| 117 bool WebLayerImpl::masksToBounds() const { | 119 bool WebLayerImpl::masksToBounds() const { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 178 |
| 177 void WebLayerImpl::setTransformOrigin(const blink::WebFloatPoint3D& point) { | 179 void WebLayerImpl::setTransformOrigin(const blink::WebFloatPoint3D& point) { |
| 178 gfx::Point3F gfx_point = point; | 180 gfx::Point3F gfx_point = point; |
| 179 layer_->SetTransformOrigin(gfx_point); | 181 layer_->SetTransformOrigin(gfx_point); |
| 180 } | 182 } |
| 181 | 183 |
| 182 blink::WebFloatPoint3D WebLayerImpl::transformOrigin() const { | 184 blink::WebFloatPoint3D WebLayerImpl::transformOrigin() const { |
| 183 return layer_->transform_origin(); | 185 return layer_->transform_origin(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void WebLayerImpl::setAnchorPoint(const blink::WebFloatPoint&) {} | |
| 187 | |
| 188 blink::WebFloatPoint WebLayerImpl::anchorPoint() const { | |
| 189 return blink::WebFloatPoint(); | |
| 190 } | |
| 191 | |
| 192 void WebLayerImpl::setAnchorPointZ(float) {} | |
| 193 | |
| 194 float WebLayerImpl::anchorPointZ() const { | |
| 195 return 0.f; | |
| 196 } | |
| 197 | |
| 198 SkMatrix44 WebLayerImpl::transform() const { | 188 SkMatrix44 WebLayerImpl::transform() const { |
| 199 return layer_->transform().matrix(); | 189 return layer_->transform().matrix(); |
| 200 } | 190 } |
| 201 | 191 |
| 202 void WebLayerImpl::setDrawsContent(bool draws_content) { | 192 void WebLayerImpl::setDrawsContent(bool draws_content) { |
| 203 layer_->SetIsDrawable(draws_content); | 193 layer_->SetIsDrawable(draws_content); |
| 204 } | 194 } |
| 205 | 195 |
| 206 bool WebLayerImpl::drawsContent() const { | 196 bool WebLayerImpl::drawsContent() const { |
| 207 return layer_->DrawsContent(); | 197 return layer_->DrawsContent(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 cc::Layer* clip_parent = NULL; | 469 cc::Layer* clip_parent = NULL; |
| 480 if (parent) | 470 if (parent) |
| 481 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 471 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 482 layer_->SetClipParent(clip_parent); | 472 layer_->SetClipParent(clip_parent); |
| 483 } | 473 } |
| 484 | 474 |
| 485 Layer* WebLayerImpl::layer() const { | 475 Layer* WebLayerImpl::layer() const { |
| 486 return layer_.get(); | 476 return layer_.get(); |
| 487 } | 477 } |
| 488 | 478 |
| 489 } // namespace content | 479 } // namespace cc_blink |
| 490 | |
| OLD | NEW |