| 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/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/layers/layer.h" | 15 #include "cc/layers/layer.h" |
| 16 #include "cc/layers/layer_position_constraint.h" | 16 #include "cc/layers/layer_position_constraint.h" |
| 17 #include "cc/trees/layer_tree_host.h" |
| 17 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 18 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 18 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 19 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 19 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" | 20 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" |
| 20 #include "third_party/WebKit/public/platform/WebLayerClient.h" | 21 #include "third_party/WebKit/public/platform/WebLayerClient.h" |
| 21 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 22 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
| 22 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 23 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
| 23 #include "third_party/WebKit/public/platform/WebSize.h" | 24 #include "third_party/WebKit/public/platform/WebSize.h" |
| 24 #include "third_party/skia/include/utils/SkMatrix44.h" | 25 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 25 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" | 26 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" |
| 26 #include "webkit/renderer/compositor_bindings/web_blend_mode.h" | 27 #include "webkit/renderer/compositor_bindings/web_blend_mode.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 254 } |
| 254 | 255 |
| 255 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { | 256 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { |
| 256 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); | 257 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); |
| 257 } | 258 } |
| 258 | 259 |
| 259 blink::WebPoint WebLayerImpl::scrollPosition() const { | 260 blink::WebPoint WebLayerImpl::scrollPosition() const { |
| 260 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 261 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | 264 WebSize WebLayerImpl::maxScrollPosition() const { |
| 264 layer_->SetMaxScrollOffset(max_scroll_position); | 265 return layer_->MaxScrollOffset(); |
| 265 } | 266 } |
| 266 | 267 |
| 267 WebSize WebLayerImpl::maxScrollPosition() const { | 268 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { |
| 268 return layer_->max_scroll_offset(); | 269 cc::Layer* cc_clip_layer = |
| 269 } | 270 clip_layer ? static_cast<WebLayerImpl*>(clip_layer)->layer() : 0; |
| 270 | 271 layer_->SetScrollClipLayerId(cc_clip_layer->id()); |
| 271 void WebLayerImpl::setScrollable(bool scrollable) { | |
| 272 layer_->SetScrollable(scrollable); | |
| 273 } | 272 } |
| 274 | 273 |
| 275 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 274 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
| 276 | 275 |
| 277 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { | 276 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { |
| 278 layer_->SetUserScrollable(horizontal, vertical); | 277 layer_->SetUserScrollable(horizontal, vertical); |
| 279 } | 278 } |
| 280 | 279 |
| 281 bool WebLayerImpl::userScrollableHorizontal() const { | 280 bool WebLayerImpl::userScrollableHorizontal() const { |
| 282 return layer_->user_scrollable_horizontal(); | 281 return layer_->user_scrollable_horizontal(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 444 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
| 446 cc::Layer* clip_parent = NULL; | 445 cc::Layer* clip_parent = NULL; |
| 447 if (parent) | 446 if (parent) |
| 448 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 447 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 449 layer_->SetClipParent(clip_parent); | 448 layer_->SetClipParent(clip_parent); |
| 450 } | 449 } |
| 451 | 450 |
| 452 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 451 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
| 453 | 452 |
| 454 } // namespace webkit | 453 } // namespace webkit |
| OLD | NEW |