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

Unified Diff: third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp

Issue 1599673002: compositor-worker: Remove code from cc_blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix blink_platform_unittests Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c149cf8c44b93a15519bd18402718c5a962f968d
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
@@ -0,0 +1,78 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/graphics/CompositorMutableState.h"
+
+#include "cc/layers/layer_impl.h"
+#include "cc/trees/layer_tree_impl.h"
+#include "platform/graphics/CompositorMutation.h"
+
+namespace blink {
+CompositorMutableState::CompositorMutableState(CompositorMutation* mutation, cc::LayerImpl* main, cc::LayerImpl* scroll)
+ : m_mutation(mutation)
+ , m_mainLayer(main)
+ , m_scrollLayer(scroll)
+{
+}
+
+CompositorMutableState::~CompositorMutableState() {}
+
+double CompositorMutableState::opacity() const
+{
+ return m_mainLayer->opacity();
+}
+
+void CompositorMutableState::setOpacity(double opacity)
+{
+ if (!m_mainLayer)
+ return;
+ m_mainLayer->OnOpacityAnimated(opacity);
+ m_mutation->setOpacity(opacity);
+}
+
+const SkMatrix44& CompositorMutableState::transform() const
+{
+ return m_mainLayer ? m_mainLayer->transform().matrix() : SkMatrix44::I();
+}
+
+void CompositorMutableState::setTransform(const SkMatrix44& matrix)
+{
+ if (!m_mainLayer)
+ return;
+ m_mainLayer->OnTransformAnimated(gfx::Transform(matrix));
+ m_mutation->setTransform(matrix);
+}
+
+double CompositorMutableState::scrollLeft() const
+{
+ return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().x() : 0.0;
+}
+
+void CompositorMutableState::setScrollLeft(double scrollLeft)
+{
+ if (!m_scrollLayer)
+ return;
+
+ gfx::ScrollOffset offset = m_scrollLayer->CurrentScrollOffset();
+ offset.set_x(scrollLeft);
+ m_scrollLayer->OnScrollOffsetAnimated(offset);
+ m_mutation->setScrollLeft(scrollLeft);
+}
+
+double CompositorMutableState::scrollTop() const
+{
+ return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().y() : 0.0;
+}
+
+void CompositorMutableState::setScrollTop(double scrollTop)
+{
+ if (!m_scrollLayer)
+ return;
+ gfx::ScrollOffset offset = m_scrollLayer->CurrentScrollOffset();
+ offset.set_y(scrollTop);
+ m_scrollLayer->OnScrollOffsetAnimated(offset);
+ m_mutation->setScrollTop(scrollTop);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698