| 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/renderer/compositor_bindings/web_layer_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/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 "cc/layers/layer_position_constraint.h" |
| 12 #include "third_party/WebKit/public/platform/WebCompositingReasons.h" | 12 #include "third_party/WebKit/public/platform/WebCompositingReasons.h" |
| 13 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 13 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 14 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 14 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 15 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 15 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
| 16 #include "third_party/WebKit/public/platform/WebSize.h" | 16 #include "third_party/WebKit/public/platform/WebSize.h" |
| 17 #include "third_party/skia/include/utils/SkMatrix44.h" | 17 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 18 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" | 18 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" |
| 19 #include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" |
| 19 | 20 |
| 20 using cc::Animation; | 21 using cc::Animation; |
| 21 using cc::Layer; | 22 using cc::Layer; |
| 22 using WebKit::WebLayer; | 23 using WebKit::WebLayer; |
| 23 using WebKit::WebFloatPoint; | 24 using WebKit::WebFloatPoint; |
| 24 using WebKit::WebVector; | 25 using WebKit::WebVector; |
| 25 using WebKit::WebRect; | 26 using WebKit::WebRect; |
| 26 using WebKit::WebSize; | 27 using WebKit::WebSize; |
| 27 using WebKit::WebColor; | 28 using WebKit::WebColor; |
| 28 using WebKit::WebFilterOperations; | 29 using WebKit::WebFilterOperations; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 149 |
| 149 void WebLayerImpl::setBackgroundColor(WebColor color) { | 150 void WebLayerImpl::setBackgroundColor(WebColor color) { |
| 150 layer_->SetBackgroundColor(color); | 151 layer_->SetBackgroundColor(color); |
| 151 } | 152 } |
| 152 | 153 |
| 153 WebColor WebLayerImpl::backgroundColor() const { | 154 WebColor WebLayerImpl::backgroundColor() const { |
| 154 return layer_->background_color(); | 155 return layer_->background_color(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void WebLayerImpl::setFilters(const WebFilterOperations& filters) { | 158 void WebLayerImpl::setFilters(const WebFilterOperations& filters) { |
| 158 layer_->SetFilters(filters); | 159 #if WEB_FILTER_OPERATIONS_IS_VIRTUAL |
| 160 const WebFilterOperationsImpl& filters_impl = |
| 161 static_cast<const WebFilterOperationsImpl&>(filters); |
| 162 layer_->SetFilters(filters_impl.AsFilterOperations()); |
| 163 #else |
| 164 layer_->SetFilters(ConvertWebFilterOperationsToFilterOperations(filters)); |
| 165 #endif |
| 159 } | 166 } |
| 160 | 167 |
| 161 void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { | 168 void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { |
| 162 layer_->SetBackgroundFilters(filters); | 169 #if WEB_FILTER_OPERATIONS_IS_VIRTUAL |
| 170 const WebFilterOperationsImpl& filters_impl = |
| 171 static_cast<const WebFilterOperationsImpl&>(filters); |
| 172 layer_->SetBackgroundFilters(filters_impl.AsFilterOperations()); |
| 173 #else |
| 174 layer_->SetBackgroundFilters( |
| 175 ConvertWebFilterOperationsToFilterOperations(filters)); |
| 176 #endif |
| 163 } | 177 } |
| 164 | 178 |
| 165 void WebLayerImpl::setFilter(SkImageFilter* filter) { | 179 void WebLayerImpl::setFilter(SkImageFilter* filter) { |
| 166 layer_->SetFilter(skia::SharePtr(filter)); | 180 layer_->SetFilter(skia::SharePtr(filter)); |
| 167 } | 181 } |
| 168 | 182 |
| 169 void WebLayerImpl::setDebugName(WebKit::WebString name) { | 183 void WebLayerImpl::setDebugName(WebKit::WebString name) { |
| 170 layer_->SetDebugName(UTF16ToASCII(name)); | 184 layer_->SetDebugName(UTF16ToASCII(name)); |
| 171 } | 185 } |
| 172 | 186 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void WebLayerImpl::setScrollClient( | 356 void WebLayerImpl::setScrollClient( |
| 343 WebKit::WebLayerScrollClient* scroll_client) { | 357 WebKit::WebLayerScrollClient* scroll_client) { |
| 344 layer_->set_layer_scroll_client(scroll_client); | 358 layer_->set_layer_scroll_client(scroll_client); |
| 345 } | 359 } |
| 346 | 360 |
| 347 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } | 361 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } |
| 348 | 362 |
| 349 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 363 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
| 350 | 364 |
| 351 } // namespace WebKit | 365 } // namespace WebKit |
| OLD | NEW |