| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/trace_event/trace_event_impl.h" | 14 #include "base/trace_event/trace_event_impl.h" |
| 15 #include "cc/animation/animation.h" | 15 #include "cc/animation/animation.h" |
| 16 #include "cc/animation/mutable_properties.h" |
| 16 #include "cc/base/region.h" | 17 #include "cc/base/region.h" |
| 17 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
| 18 #include "cc/blink/web_animation_impl.h" | 19 #include "cc/blink/web_animation_impl.h" |
| 19 #include "cc/blink/web_blend_mode.h" | 20 #include "cc/blink/web_blend_mode.h" |
| 20 #include "cc/blink/web_filter_operations_impl.h" | 21 #include "cc/blink/web_filter_operations_impl.h" |
| 21 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" | 22 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
| 22 #include "cc/layers/layer.h" | 23 #include "cc/layers/layer.h" |
| 23 #include "cc/layers/layer_position_constraint.h" | 24 #include "cc/layers/layer_position_constraint.h" |
| 24 #include "cc/layers/layer_settings.h" | 25 #include "cc/layers/layer_settings.h" |
| 25 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
| 27 #include "third_party/WebKit/public/platform/WebCompositorMutableProperties.h" |
| 26 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 28 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 27 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 29 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 28 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 30 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
| 29 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 31 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
| 30 #include "third_party/WebKit/public/platform/WebSize.h" | 32 #include "third_party/WebKit/public/platform/WebSize.h" |
| 31 #include "third_party/skia/include/utils/SkMatrix44.h" | 33 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 32 #include "ui/gfx/geometry/rect_conversions.h" | 34 #include "ui/gfx/geometry/rect_conversions.h" |
| 33 #include "ui/gfx/geometry/vector2d_conversions.h" | 35 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 34 | 36 |
| 35 using cc::Animation; | 37 using cc::Animation; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 489 } |
| 488 | 490 |
| 489 void WebLayerImpl::setLayerClient(cc::LayerClient* client) { | 491 void WebLayerImpl::setLayerClient(cc::LayerClient* client) { |
| 490 layer_->SetLayerClient(client); | 492 layer_->SetLayerClient(client); |
| 491 } | 493 } |
| 492 | 494 |
| 493 const cc::Layer* WebLayerImpl::ccLayer() const { | 495 const cc::Layer* WebLayerImpl::ccLayer() const { |
| 494 return layer_.get(); | 496 return layer_.get(); |
| 495 } | 497 } |
| 496 | 498 |
| 499 void WebLayerImpl::setElementId(uint64_t id) { |
| 500 layer_->SetElementId(id); |
| 501 } |
| 502 |
| 503 uint64_t WebLayerImpl::elementId() const { |
| 504 return layer_->element_id(); |
| 505 } |
| 506 |
| 507 static_assert( |
| 508 static_cast<cc::MutableProperty>(blink::WebCompositorMutablePropertyNone) == |
| 509 cc::kMutablePropertyNone, |
| 510 "MutableProperty and WebCompositorMutableProperty enums must match"); |
| 511 |
| 512 static_assert( |
| 513 static_cast<cc::MutableProperty>( |
| 514 blink::WebCompositorMutablePropertyOpacity) == |
| 515 cc::kMutablePropertyOpacity, |
| 516 "MutableProperty and WebCompositorMutableProperty enums must match"); |
| 517 |
| 518 static_assert( |
| 519 static_cast<cc::MutableProperty>( |
| 520 blink::WebCompositorMutablePropertyScrollLeft) == |
| 521 cc::kMutablePropertyScrollLeft, |
| 522 "MutableProperty and WebCompositorMutableProperty enums must match"); |
| 523 |
| 524 static_assert( |
| 525 static_cast<cc::MutableProperty>( |
| 526 blink::WebCompositorMutablePropertyScrollTop) == |
| 527 cc::kMutablePropertyScrollTop, |
| 528 "MutableProperty and WebCompositorMutableProperty enums must match"); |
| 529 |
| 530 static_assert( |
| 531 static_cast<cc::MutableProperty>( |
| 532 blink::WebCompositorMutablePropertyTransform) == |
| 533 cc::kMutablePropertyTransform, |
| 534 "MutableProperty and WebCompositorMutableProperty enums must match"); |
| 535 |
| 536 void WebLayerImpl::setCompositorMutableProperties(uint32_t properties) { |
| 537 layer_->SetMutableProperties(properties); |
| 538 } |
| 539 |
| 540 uint32_t WebLayerImpl::compositorMutableProperties() const { |
| 541 return layer_->mutable_properties(); |
| 542 } |
| 543 |
| 497 void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { | 544 void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { |
| 498 cc::Layer* scroll_parent = nullptr; | 545 cc::Layer* scroll_parent = nullptr; |
| 499 if (parent) | 546 if (parent) |
| 500 scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 547 scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 501 layer_->SetScrollParent(scroll_parent); | 548 layer_->SetScrollParent(scroll_parent); |
| 502 } | 549 } |
| 503 | 550 |
| 504 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 551 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
| 505 cc::Layer* clip_parent = nullptr; | 552 cc::Layer* clip_parent = nullptr; |
| 506 if (parent) | 553 if (parent) |
| 507 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 554 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 508 layer_->SetClipParent(clip_parent); | 555 layer_->SetClipParent(clip_parent); |
| 509 } | 556 } |
| 510 | 557 |
| 511 Layer* WebLayerImpl::layer() const { | 558 Layer* WebLayerImpl::layer() const { |
| 512 return layer_.get(); | 559 return layer_.get(); |
| 513 } | 560 } |
| 514 | 561 |
| 515 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { | 562 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { |
| 516 contents_opaque_is_fixed_ = fixed; | 563 contents_opaque_is_fixed_ = fixed; |
| 517 } | 564 } |
| 518 | 565 |
| 519 } // namespace cc_blink | 566 } // namespace cc_blink |
| OLD | NEW |