| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 bool WebLayerImpl::hasActiveAnimation() { return layer_->HasActiveAnimation(); } | 222 bool WebLayerImpl::hasActiveAnimation() { return layer_->HasActiveAnimation(); } |
| 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 // TODO(enne): Blink currently always updates scroll offset and layer position |
| 231 // in tandem for frames in RenderLayerCompositor::frameViewDidScroll. |
| 232 // So that this can be removed in Blink, temporarily do that work here. |
| 233 // See: http://crbug.com/256381 |
| 234 layer_->SetPosition(gfx::PointAtOffsetFromOrigin(-layer_->scroll_offset())); |
| 230 } | 235 } |
| 231 | 236 |
| 232 WebKit::WebPoint WebLayerImpl::scrollPosition() const { | 237 WebKit::WebPoint WebLayerImpl::scrollPosition() const { |
| 233 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); | 238 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); |
| 234 } | 239 } |
| 235 | 240 |
| 236 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | 241 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { |
| 237 layer_->SetMaxScrollOffset(max_scroll_position); | 242 layer_->SetMaxScrollOffset(max_scroll_position); |
| 238 } | 243 } |
| 239 | 244 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 layer_->set_did_scroll_callback( | 359 layer_->set_did_scroll_callback( |
| 355 base::Bind(&WebKit::WebLayerScrollClient::didScroll, | 360 base::Bind(&WebKit::WebLayerScrollClient::didScroll, |
| 356 base::Unretained(scroll_client))); | 361 base::Unretained(scroll_client))); |
| 357 } | 362 } |
| 358 | 363 |
| 359 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } | 364 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } |
| 360 | 365 |
| 361 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 366 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
| 362 | 367 |
| 363 } // namespace webkit | 368 } // namespace webkit |
| OLD | NEW |