Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: cc/blink/web_layer_impl.cc

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/base/math_util.cc ('k') | cc/blink/web_scroll_offset_animation_curve_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/blink/web_layer_impl.h" 5 #include "cc/blink/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/blink/web_animation_impl.h" 15 #include "cc/blink/web_animation_impl.h"
16 #include "cc/blink/web_blend_mode.h" 16 #include "cc/blink/web_blend_mode.h"
17 #include "cc/blink/web_filter_operations_impl.h" 17 #include "cc/blink/web_filter_operations_impl.h"
18 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" 18 #include "cc/blink/web_to_cc_animation_delegate_adapter.h"
19 #include "cc/layers/layer.h" 19 #include "cc/layers/layer.h"
20 #include "cc/layers/layer_position_constraint.h" 20 #include "cc/layers/layer_position_constraint.h"
21 #include "cc/trees/layer_tree_host.h" 21 #include "cc/trees/layer_tree_host.h"
22 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 22 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
23 #include "third_party/WebKit/public/platform/WebFloatRect.h" 23 #include "third_party/WebKit/public/platform/WebFloatRect.h"
24 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" 24 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
25 #include "third_party/WebKit/public/platform/WebLayerClient.h" 25 #include "third_party/WebKit/public/platform/WebLayerClient.h"
26 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" 26 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
27 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 27 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
28 #include "third_party/WebKit/public/platform/WebSize.h" 28 #include "third_party/WebKit/public/platform/WebSize.h"
29 #include "third_party/skia/include/utils/SkMatrix44.h" 29 #include "third_party/skia/include/utils/SkMatrix44.h"
30 #include "ui/gfx/geometry/vector2d_conversions.h"
30 31
31 using cc::Animation; 32 using cc::Animation;
32 using cc::Layer; 33 using cc::Layer;
33 using blink::WebLayer; 34 using blink::WebLayer;
34 using blink::WebFloatPoint; 35 using blink::WebFloatPoint;
35 using blink::WebVector; 36 using blink::WebVector;
36 using blink::WebRect; 37 using blink::WebRect;
37 using blink::WebSize; 38 using blink::WebSize;
38 using blink::WebColor; 39 using blink::WebColor;
39 using blink::WebFilterOperations; 40 using blink::WebFilterOperations;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 262
262 bool WebLayerImpl::hasActiveAnimation() { 263 bool WebLayerImpl::hasActiveAnimation() {
263 return layer_->HasActiveAnimation(); 264 return layer_->HasActiveAnimation();
264 } 265 }
265 266
266 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { 267 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) {
267 layer_->SetForceRenderSurface(force_render_surface); 268 layer_->SetForceRenderSurface(force_render_surface);
268 } 269 }
269 270
270 void WebLayerImpl::setScrollPosition(blink::WebPoint position) { 271 void WebLayerImpl::setScrollPosition(blink::WebPoint position) {
271 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); 272 layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y));
272 } 273 }
273 274
274 blink::WebPoint WebLayerImpl::scrollPosition() const { 275 blink::WebPoint WebLayerImpl::scrollPosition() const {
275 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); 276 return gfx::PointAtOffsetFromOrigin(
277 gfx::ScrollOffsetToFlooredVector2d(layer_->scroll_offset()));
276 } 278 }
277 279
278 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) { 280 void WebLayerImpl::setScrollClipLayer(WebLayer* clip_layer) {
279 if (!clip_layer) { 281 if (!clip_layer) {
280 layer_->SetScrollClipLayerId(Layer::INVALID_ID); 282 layer_->SetScrollClipLayerId(Layer::INVALID_ID);
281 return; 283 return;
282 } 284 }
283 layer_->SetScrollClipLayerId(clip_layer->id()); 285 layer_->SetScrollClipLayerId(clip_layer->id());
284 } 286 }
285 287
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (parent) 472 if (parent)
471 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); 473 clip_parent = static_cast<WebLayerImpl*>(parent)->layer();
472 layer_->SetClipParent(clip_parent); 474 layer_->SetClipParent(clip_parent);
473 } 475 }
474 476
475 Layer* WebLayerImpl::layer() const { 477 Layer* WebLayerImpl::layer() const {
476 return layer_.get(); 478 return layer_.get();
477 } 479 }
478 480
479 } // namespace cc_blink 481 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/base/math_util.cc ('k') | cc/blink/web_scroll_offset_animation_curve_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698