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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "cc/animation/animation.h" | 9 #include "cc/animation/animation.h" |
10 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { | 218 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { |
219 layer_->SetForceRenderSurface(force_render_surface); | 219 layer_->SetForceRenderSurface(force_render_surface); |
220 } | 220 } |
221 | 221 |
222 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { | 222 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { |
223 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); | 223 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); |
224 } | 224 } |
225 | 225 |
226 blink::WebPoint WebLayerImpl::scrollPosition() const { | 226 blink::WebPoint WebLayerImpl::scrollPosition() const { |
227 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 227 return gfx::PointAtOffsetFromOrigin(layer_->TotalViewportScrollOffset()); |
228 } | |
229 | |
230 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | |
231 layer_->SetMaxScrollOffset(max_scroll_position); | |
232 } | 228 } |
233 | 229 |
234 WebSize WebLayerImpl::maxScrollPosition() const { | 230 WebSize WebLayerImpl::maxScrollPosition() const { |
235 return layer_->max_scroll_offset(); | 231 return layer_->MaxScrollOffset(); |
236 } | 232 } |
237 | 233 |
238 void WebLayerImpl::setScrollable(bool scrollable) { | 234 void WebLayerImpl::setScrollable(WebLayer* clip_layer) { |
239 layer_->SetScrollable(scrollable); | 235 cc::Layer* cc_clip_layer = |
| 236 clip_layer ? static_cast<WebLayerImpl*>(clip_layer)->layer() : 0; |
| 237 layer_->SetScrollable(cc_clip_layer); |
240 } | 238 } |
241 | 239 |
242 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 240 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
243 | 241 |
244 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { | 242 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { |
245 layer_->SetUserScrollable(horizontal, vertical); | 243 layer_->SetUserScrollable(horizontal, vertical); |
246 } | 244 } |
247 | 245 |
248 bool WebLayerImpl::userScrollableHorizontal() const { | 246 bool WebLayerImpl::userScrollableHorizontal() const { |
249 return layer_->user_scrollable_horizontal(); | 247 return layer_->user_scrollable_horizontal(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 389 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
392 cc::Layer* clip_parent = NULL; | 390 cc::Layer* clip_parent = NULL; |
393 if (parent) | 391 if (parent) |
394 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 392 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
395 layer_->SetClipParent(clip_parent); | 393 layer_->SetClipParent(clip_parent); |
396 } | 394 } |
397 | 395 |
398 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 396 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
399 | 397 |
400 } // namespace webkit | 398 } // namespace webkit |
OLD | NEW |