| 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 "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" | 15 #include "cc/blink/web_animation_impl.h" |
| 16 #include "cc/blink/web_blend_mode.h" | 16 #include "cc/blink/web_blend_mode.h" |
| 17 #include "cc/blink/web_filter_operations_impl.h" | 17 #include "cc/blink/web_filter_operations_impl.h" |
| 18 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" | 18 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
| 19 #include "cc/layers/layer.h" | 19 #include "cc/layers/layer.h" |
| 20 #include "cc/layers/layer_position_constraint.h" | 20 #include "cc/layers/layer_position_constraint.h" |
| 21 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.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 #include "ui/gfx/geometry/rect_conversions.h" |
| 30 #include "ui/gfx/geometry/vector2d_conversions.h" | 31 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 31 | 32 |
| 32 using cc::Animation; | 33 using cc::Animation; |
| 33 using cc::Layer; | 34 using cc::Layer; |
| 34 using blink::WebLayer; | 35 using blink::WebLayer; |
| 35 using blink::WebFloatPoint; | 36 using blink::WebFloatPoint; |
| 36 using blink::WebVector; | 37 using blink::WebVector; |
| 37 using blink::WebRect; | 38 using blink::WebRect; |
| 38 using blink::WebSize; | 39 using blink::WebSize; |
| 39 using blink::WebColor; | 40 using blink::WebColor; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 70 // static | 71 // static |
| 71 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { | 72 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { |
| 72 g_impl_side_painting_enabled = enabled; | 73 g_impl_side_painting_enabled = enabled; |
| 73 } | 74 } |
| 74 | 75 |
| 75 int WebLayerImpl::id() const { | 76 int WebLayerImpl::id() const { |
| 76 return layer_->id(); | 77 return layer_->id(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void WebLayerImpl::invalidateRect(const blink::WebFloatRect& rect) { | 80 void WebLayerImpl::invalidateRect(const blink::WebFloatRect& rect) { |
| 81 layer_->SetNeedsDisplayRect(gfx::ToEnclosingRect(rect)); |
| 82 } |
| 83 |
| 84 void WebLayerImpl::invalidateRect(const blink::WebRect& rect) { |
| 80 layer_->SetNeedsDisplayRect(rect); | 85 layer_->SetNeedsDisplayRect(rect); |
| 81 } | 86 } |
| 82 | 87 |
| 83 void WebLayerImpl::invalidate() { | 88 void WebLayerImpl::invalidate() { |
| 84 layer_->SetNeedsDisplay(); | 89 layer_->SetNeedsDisplay(); |
| 85 } | 90 } |
| 86 | 91 |
| 87 void WebLayerImpl::addChild(WebLayer* child) { | 92 void WebLayerImpl::addChild(WebLayer* child) { |
| 88 layer_->AddChild(static_cast<WebLayerImpl*>(child)->layer()); | 93 layer_->AddChild(static_cast<WebLayerImpl*>(child)->layer()); |
| 89 } | 94 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (parent) | 477 if (parent) |
| 473 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 478 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 474 layer_->SetClipParent(clip_parent); | 479 layer_->SetClipParent(clip_parent); |
| 475 } | 480 } |
| 476 | 481 |
| 477 Layer* WebLayerImpl::layer() const { | 482 Layer* WebLayerImpl::layer() const { |
| 478 return layer_.get(); | 483 return layer_.get(); |
| 479 } | 484 } |
| 480 | 485 |
| 481 } // namespace cc_blink | 486 } // namespace cc_blink |
| OLD | NEW |