| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { | 224 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { |
| 225 layer_->SetForceRenderSurface(force_render_surface); | 225 layer_->SetForceRenderSurface(force_render_surface); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void WebLayerImpl::setScrollPosition(WebKit::WebPoint position) { | 228 void WebLayerImpl::setScrollPosition(WebKit::WebPoint position) { |
| 229 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); | 229 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 WebKit::WebPoint WebLayerImpl::scrollPosition() const { | 232 WebKit::WebPoint WebLayerImpl::scrollPosition() const { |
| 233 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 233 return gfx::PointAtOffsetFromOrigin(layer_->TotalViewportScrollOffset()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // TODO(wjmaclean) Remove this function. |
| 236 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | 237 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { |
| 237 layer_->SetMaxScrollOffset(max_scroll_position); | |
| 238 } | 238 } |
| 239 | 239 |
| 240 WebSize WebLayerImpl::maxScrollPosition() const { | 240 WebSize WebLayerImpl::maxScrollPosition() const { |
| 241 return layer_->max_scroll_offset(); | 241 return layer_->MaxScrollOffset(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void WebLayerImpl::setScrollable(bool scrollable) { | 244 void WebLayerImpl::setScrollable(WebLayer* clip_layer) { |
| 245 layer_->SetScrollable(scrollable); | 245 cc::Layer* cc_clip_layer = |
| 246 clip_layer ? static_cast<WebLayerImpl*>(clip_layer)->layer() : 0; |
| 247 layer_->SetScrollable(cc_clip_layer); |
| 246 } | 248 } |
| 247 | 249 |
| 248 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 250 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
| 249 | 251 |
| 250 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { | 252 void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { |
| 251 layer_->SetUserScrollable(horizontal, vertical); | 253 layer_->SetUserScrollable(horizontal, vertical); |
| 252 } | 254 } |
| 253 | 255 |
| 254 bool WebLayerImpl::userScrollableHorizontal() const { | 256 bool WebLayerImpl::userScrollableHorizontal() const { |
| 255 return layer_->user_scrollable_horizontal(); | 257 return layer_->user_scrollable_horizontal(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void WebLayerImpl::setClipParent(WebKit::WebLayer* parent) { | 399 void WebLayerImpl::setClipParent(WebKit::WebLayer* parent) { |
| 398 cc::Layer* clip_parent = NULL; | 400 cc::Layer* clip_parent = NULL; |
| 399 if (parent) | 401 if (parent) |
| 400 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 402 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 401 layer_->SetClipParent(clip_parent); | 403 layer_->SetClipParent(clip_parent); |
| 402 } | 404 } |
| 403 | 405 |
| 404 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 406 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
| 405 | 407 |
| 406 } // namespace webkit | 408 } // namespace webkit |
| OLD | NEW |