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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "cc/animation/animation.h" | 11 #include "cc/animation/animation.h" |
12 #include "cc/base/region.h" | 12 #include "cc/base/region.h" |
13 #include "cc/layers/layer.h" | 13 #include "cc/layers/layer.h" |
14 #include "cc/layers/layer_position_constraint.h" | 14 #include "cc/layers/layer_position_constraint.h" |
| 15 #include "cc/trees/layer_tree_host.h" |
15 #include "third_party/WebKit/public/platform/WebCompositingReasons.h" | 16 #include "third_party/WebKit/public/platform/WebCompositingReasons.h" |
16 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 17 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
17 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 18 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
18 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" | 19 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" |
19 #include "third_party/WebKit/public/platform/WebLayerClient.h" | 20 #include "third_party/WebKit/public/platform/WebLayerClient.h" |
20 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" | 21 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" |
21 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 22 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
22 #include "third_party/WebKit/public/platform/WebSize.h" | 23 #include "third_party/WebKit/public/platform/WebSize.h" |
23 #include "third_party/skia/include/utils/SkMatrix44.h" | 24 #include "third_party/skia/include/utils/SkMatrix44.h" |
24 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" | 25 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 238 |
238 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { | 239 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { |
239 layer_->SetForceRenderSurface(force_render_surface); | 240 layer_->SetForceRenderSurface(force_render_surface); |
240 } | 241 } |
241 | 242 |
242 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { | 243 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { |
243 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); | 244 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); |
244 } | 245 } |
245 | 246 |
246 blink::WebPoint WebLayerImpl::scrollPosition() const { | 247 blink::WebPoint WebLayerImpl::scrollPosition() const { |
247 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 248 return gfx::PointAtOffsetFromOrigin(layer_->BlinkScrollOffset()); |
248 } | |
249 | |
250 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | |
251 layer_->SetMaxScrollOffset(max_scroll_position); | |
252 } | 249 } |
253 | 250 |
254 WebSize WebLayerImpl::maxScrollPosition() const { | 251 WebSize WebLayerImpl::maxScrollPosition() const { |
255 return layer_->max_scroll_offset(); | 252 return layer_->MaxScrollOffset(); |
256 } | 253 } |
257 | 254 |
258 void WebLayerImpl::setScrollable(bool scrollable) { | 255 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { |
259 layer_->SetScrollable(scrollable); | 256 cc::Layer* cc_clip_layer = |
| 257 clip_layer ? static_cast<WebLayerImpl*>(clip_layer)->layer() : 0; |
| 258 layer_->SetScrollClipLayer(cc_clip_layer); |
260 } | 259 } |
261 | 260 |
262 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 261 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
263 | 262 |
264 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { | 263 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { |
265 layer_->SetUserScrollable(horizontal, vertical); | 264 layer_->SetUserScrollable(horizontal, vertical); |
266 } | 265 } |
267 | 266 |
268 bool WebLayerImpl::userScrollableHorizontal() const { | 267 bool WebLayerImpl::userScrollableHorizontal() const { |
269 return layer_->user_scrollable_horizontal(); | 268 return layer_->user_scrollable_horizontal(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 441 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
443 cc::Layer* clip_parent = NULL; | 442 cc::Layer* clip_parent = NULL; |
444 if (parent) | 443 if (parent) |
445 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 444 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
446 layer_->SetClipParent(clip_parent); | 445 layer_->SetClipParent(clip_parent); |
447 } | 446 } |
448 | 447 |
449 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 448 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
450 | 449 |
451 } // namespace webkit | 450 } // namespace webkit |
OLD | NEW |