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

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

Issue 1447893002: compositor-worker: Introduce WebCompositorMutableState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again. Created 5 years 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/blink/web_compositor_mutable_state_impl.h"
6
7 #include "cc/animation/layer_tree_mutation.h"
8 #include "cc/layers/layer_impl.h"
9 #include "cc/trees/layer_tree_impl.h"
10
11 namespace cc_blink {
12
13 WebCompositorMutableStateImpl::WebCompositorMutableStateImpl(
14 cc::LayerTreeMutation* mutation,
15 cc::LayerImpl* main_layer,
16 cc::LayerImpl* scroll_layer)
17 : mutation_(mutation),
18 main_layer_(main_layer),
19 scroll_layer_(scroll_layer) {}
20
21 WebCompositorMutableStateImpl::~WebCompositorMutableStateImpl() {}
22
23 double WebCompositorMutableStateImpl::opacity() const {
24 return main_layer_->opacity();
25 }
26
27 void WebCompositorMutableStateImpl::setOpacity(double opacity) {
28 if (!main_layer_)
29 return;
30 main_layer_->OnOpacityAnimated(opacity);
31 mutation_->SetOpacity(opacity);
32 }
33
34 const SkMatrix44& WebCompositorMutableStateImpl::transform() const {
35 static SkMatrix44 identity;
36 return main_layer_ ? main_layer_->transform().matrix() : identity;
37 }
38
39 void WebCompositorMutableStateImpl::setTransform(const SkMatrix44& matrix) {
40 if (!main_layer_)
41 return;
42 main_layer_->OnTransformAnimated(gfx::Transform(matrix));
ajuma 2015/12/14 19:41:47 Are property tree nodes currently created for muta
Ian Vollick 2015/12/14 20:22:06 This is certainly necessary, but it is in a future
43 mutation_->SetTransform(matrix);
44 }
45
46 double WebCompositorMutableStateImpl::scrollLeft() const {
47 return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().x() : 0.0;
48 }
49
50 void WebCompositorMutableStateImpl::setScrollLeft(double scroll_left) {
51 if (!scroll_layer_)
52 return;
53 gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset();
54 offset.set_x(scroll_left);
55 scroll_layer_->OnScrollOffsetAnimated(offset);
56 mutation_->SetScrollLeft(scroll_left);
57 }
58
59 double WebCompositorMutableStateImpl::scrollTop() const {
60 return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().y() : 0.0;
61 }
62
63 void WebCompositorMutableStateImpl::setScrollTop(double scroll_top) {
64 if (!scroll_layer_)
65 return;
66 gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset();
67 offset.set_y(scroll_top);
68 scroll_layer_->OnScrollOffsetAnimated(offset);
69 mutation_->SetScrollTop(scroll_top);
70 }
71
72 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698