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