diff options
Diffstat (limited to 'cc')
-rw-r--r-- | cc/animation/layer_tree_mutation.h | 63 | ||||
-rw-r--r-- | cc/animation/mutable_properties.h | 16 | ||||
-rw-r--r-- | cc/blink/BUILD.gn | 5 | ||||
-rw-r--r-- | cc/blink/cc_blink.gyp | 4 | ||||
-rw-r--r-- | cc/blink/cc_blink_tests.gyp | 1 | ||||
-rw-r--r-- | cc/blink/web_compositor_mutable_state_impl.cc | 72 | ||||
-rw-r--r-- | cc/blink/web_compositor_mutable_state_impl.h | 46 | ||||
-rw-r--r-- | cc/blink/web_compositor_mutable_state_impl_unittest.cc | 172 | ||||
-rw-r--r-- | cc/blink/web_compositor_mutable_state_provider_impl.cc | 34 | ||||
-rw-r--r-- | cc/blink/web_compositor_mutable_state_provider_impl.h | 44 | ||||
-rw-r--r-- | cc/blink/web_layer_impl.cc | 31 | ||||
-rw-r--r-- | cc/layers/layer.cc | 2 | ||||
-rw-r--r-- | cc/layers/layer_impl.cc | 4 | ||||
-rw-r--r-- | cc/layers/layer_impl_unittest.cc | 4 | ||||
-rw-r--r-- | cc/layers/layer_unittest.cc | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 |
16 files changed, 21 insertions, 489 deletions
diff --git a/cc/animation/layer_tree_mutation.h b/cc/animation/layer_tree_mutation.h deleted file mode 100644 index 0fdd592..0000000 --- a/cc/animation/layer_tree_mutation.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 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. - -#ifndef CC_ANIMATION_LAYER_TREE_MUTATION_H_ -#define CC_ANIMATION_LAYER_TREE_MUTATION_H_ - -#include "base/containers/hash_tables.h" -#include "cc/animation/mutable_properties.h" -#include "third_party/skia/include/utils/SkMatrix44.h" - -namespace cc { - -class LayerTreeMutation { - public: - void SetOpacity(float opacity) { - mutated_flags_ |= kMutablePropertyOpacity; - opacity_ = opacity; - } - void SetScrollLeft(float scroll_left) { - mutated_flags_ |= kMutablePropertyScrollLeft; - scroll_left_ = scroll_left; - } - void SetScrollTop(float scroll_top) { - mutated_flags_ |= kMutablePropertyScrollTop; - scroll_top_ = scroll_top; - } - void SetTransform(const SkMatrix44& transform) { - mutated_flags_ |= kMutablePropertyTransform; - transform_ = transform; - } - - bool is_opacity_mutated() const { - return !!(mutated_flags_ & kMutablePropertyOpacity); - } - bool is_scroll_left_mutated() const { - return !!(mutated_flags_ & kMutablePropertyScrollLeft); - } - bool is_scroll_top_mutated() const { - return !!(mutated_flags_ & kMutablePropertyScrollTop); - } - bool is_transform_mutated() const { - return !!(mutated_flags_ & kMutablePropertyTransform); - } - - float opacity() const { return opacity_; } - float scroll_left() const { return scroll_left_; } - float scroll_top() const { return scroll_top_; } - SkMatrix44 transform() const { return transform_; } - - private: - uint32_t mutated_flags_ = 0; - float opacity_ = 0; - float scroll_left_ = 0; - float scroll_top_ = 0; - SkMatrix44 transform_; -}; - -typedef base::hash_map<uint64_t, LayerTreeMutation> LayerTreeMutationMap; - -} // namespace cc - -#endif // CC_ANIMATION_LAYER_TREE_MUTATION_H_ diff --git a/cc/animation/mutable_properties.h b/cc/animation/mutable_properties.h index dfe06b6..daec225 100644 --- a/cc/animation/mutable_properties.h +++ b/cc/animation/mutable_properties.h @@ -5,14 +5,18 @@ #ifndef CC_ANIMATION_MUTABLE_PROPERTIES_H_ #define CC_ANIMATION_MUTABLE_PROPERTIES_H_ +#include <stdint.h> + namespace cc { -enum MutableProperty { - kMutablePropertyNone = 0, - kMutablePropertyOpacity = 1 << 0, - kMutablePropertyScrollLeft = 1 << 1, - kMutablePropertyScrollTop = 1 << 2, - kMutablePropertyTransform = 1 << 3, +struct MutableProperty { + enum : uint32_t { kNone = 0 }; + enum : uint32_t { kOpacity = 1 << 0 }; + enum : uint32_t { kScrollLeft = 1 << 1 }; + enum : uint32_t { kScrollTop = 1 << 2 }; + enum : uint32_t { kTransform = 1 << 3 }; + + enum : int { kNumProperties = 4 }; }; } // namespace cc diff --git a/cc/blink/BUILD.gn b/cc/blink/BUILD.gn index cbdeef8..93915b0 100644 --- a/cc/blink/BUILD.gn +++ b/cc/blink/BUILD.gn @@ -21,10 +21,6 @@ component("blink") { "web_compositor_animation_player_impl.h", "web_compositor_animation_timeline_impl.cc", "web_compositor_animation_timeline_impl.h", - "web_compositor_mutable_state_impl.cc", - "web_compositor_mutable_state_impl.h", - "web_compositor_mutable_state_provider_impl.cc", - "web_compositor_mutable_state_provider_impl.h", "web_compositor_support_impl.cc", "web_compositor_support_impl.h", "web_content_layer_impl.cc", @@ -83,7 +79,6 @@ if (!is_mac) { sources = [ "web_animation_unittest.cc", "web_compositor_animation_player_unittest.cc", - "web_compositor_mutable_state_impl_unittest.cc", "web_float_animation_curve_unittest.cc", "web_layer_impl_fixed_bounds_unittest.cc", diff --git a/cc/blink/cc_blink.gyp b/cc/blink/cc_blink.gyp index 995af72..dc01cae 100644 --- a/cc/blink/cc_blink.gyp +++ b/cc/blink/cc_blink.gyp @@ -37,10 +37,6 @@ 'web_compositor_animation_player_impl.h', 'web_compositor_animation_timeline_impl.cc', 'web_compositor_animation_timeline_impl.h', - 'web_compositor_mutable_state_impl.cc', - 'web_compositor_mutable_state_impl.h', - 'web_compositor_mutable_state_provider_impl.cc', - 'web_compositor_mutable_state_provider_impl.h', 'web_compositor_support_impl.cc', 'web_compositor_support_impl.h', 'web_content_layer_impl.cc', diff --git a/cc/blink/cc_blink_tests.gyp b/cc/blink/cc_blink_tests.gyp index edcd118..f72a5db 100644 --- a/cc/blink/cc_blink_tests.gyp +++ b/cc/blink/cc_blink_tests.gyp @@ -28,7 +28,6 @@ 'web_compositor_animation_player_unittest.cc', 'web_float_animation_curve_unittest.cc', 'web_layer_impl_fixed_bounds_unittest.cc', - 'web_compositor_mutable_state_impl_unittest.cc', ], } ], diff --git a/cc/blink/web_compositor_mutable_state_impl.cc b/cc/blink/web_compositor_mutable_state_impl.cc deleted file mode 100644 index b0421e8..0000000 --- a/cc/blink/web_compositor_mutable_state_impl.cc +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2015 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 "cc/blink/web_compositor_mutable_state_impl.h" - -#include "cc/animation/layer_tree_mutation.h" -#include "cc/layers/layer_impl.h" -#include "cc/trees/layer_tree_impl.h" - -namespace cc_blink { - -WebCompositorMutableStateImpl::WebCompositorMutableStateImpl( - cc::LayerTreeMutation* mutation, - cc::LayerImpl* main_layer, - cc::LayerImpl* scroll_layer) - : mutation_(mutation), - main_layer_(main_layer), - scroll_layer_(scroll_layer) {} - -WebCompositorMutableStateImpl::~WebCompositorMutableStateImpl() {} - -double WebCompositorMutableStateImpl::opacity() const { - return main_layer_->opacity(); -} - -void WebCompositorMutableStateImpl::setOpacity(double opacity) { - if (!main_layer_) - return; - main_layer_->OnOpacityAnimated(opacity); - mutation_->SetOpacity(opacity); -} - -const SkMatrix44& WebCompositorMutableStateImpl::transform() const { - static SkMatrix44 identity; - return main_layer_ ? main_layer_->transform().matrix() : identity; -} - -void WebCompositorMutableStateImpl::setTransform(const SkMatrix44& matrix) { - if (!main_layer_) - return; - main_layer_->OnTransformAnimated(gfx::Transform(matrix)); - mutation_->SetTransform(matrix); -} - -double WebCompositorMutableStateImpl::scrollLeft() const { - return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().x() : 0.0; -} - -void WebCompositorMutableStateImpl::setScrollLeft(double scroll_left) { - if (!scroll_layer_) - return; - gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset(); - offset.set_x(scroll_left); - scroll_layer_->OnScrollOffsetAnimated(offset); - mutation_->SetScrollLeft(scroll_left); -} - -double WebCompositorMutableStateImpl::scrollTop() const { - return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().y() : 0.0; -} - -void WebCompositorMutableStateImpl::setScrollTop(double scroll_top) { - if (!scroll_layer_) - return; - gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset(); - offset.set_y(scroll_top); - scroll_layer_->OnScrollOffsetAnimated(offset); - mutation_->SetScrollTop(scroll_top); -} - -} // namespace cc_blink diff --git a/cc/blink/web_compositor_mutable_state_impl.h b/cc/blink/web_compositor_mutable_state_impl.h deleted file mode 100644 index b052eca..0000000 --- a/cc/blink/web_compositor_mutable_state_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 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. - -#ifndef CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_ -#define CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_ - -#include "cc/blink/cc_blink_export.h" - -#include "third_party/WebKit/public/platform/WebCompositorMutableState.h" - -namespace cc { -class LayerImpl; -class LayerTreeMutation; -} - -namespace cc_blink { - -class WebCompositorMutableStateImpl : public blink::WebCompositorMutableState { - public: - WebCompositorMutableStateImpl(cc::LayerTreeMutation* mutation, - cc::LayerImpl* main_layer, - cc::LayerImpl* scroll_layer); - ~WebCompositorMutableStateImpl() override; - - double opacity() const override; - void setOpacity(double opacity) override; - - const SkMatrix44& transform() const override; - void setTransform(const SkMatrix44& transform) override; - - double scrollLeft() const override; - void setScrollLeft(double scroll_left) override; - - double scrollTop() const override; - void setScrollTop(double scroll_top) override; - - private: - cc::LayerTreeMutation* mutation_; - cc::LayerImpl* main_layer_; - cc::LayerImpl* scroll_layer_; -}; - -} // namespace cc_blink - -#endif // CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_ diff --git a/cc/blink/web_compositor_mutable_state_impl_unittest.cc b/cc/blink/web_compositor_mutable_state_impl_unittest.cc deleted file mode 100644 index d2dc7df..0000000 --- a/cc/blink/web_compositor_mutable_state_impl_unittest.cc +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2015 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 "cc/blink/web_compositor_mutable_state_impl.h" - -#include "cc/animation/layer_tree_mutation.h" -#include "cc/blink/web_compositor_mutable_state_provider_impl.h" -#include "cc/test/fake_impl_task_runner_provider.h" -#include "cc/test/fake_layer_tree_host_impl.h" -#include "cc/test/fake_output_surface.h" -#include "cc/test/layer_tree_host_common_test.h" -#include "cc/test/test_shared_bitmap_manager.h" -#include "cc/test/test_task_graph_runner.h" -#include "cc/trees/layer_tree_host_impl.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace cc_blink { -namespace { - -using cc::FakeImplTaskRunnerProvider; -using cc::FakeLayerTreeHostImpl; -using cc::FakeOutputSurface; -using cc::LayerImpl; -using cc::LayerImplList; -using cc::LayerTreeHostCommonTest; -using cc::LayerTreeMutation; -using cc::LayerTreeMutationMap; -using cc::LayerTreeSettings; -using cc::OutputSurface; -using cc::TestTaskGraphRunner; -using cc::TestSharedBitmapManager; - -using blink::WebCompositorMutableState; - -class WebCompositorMutableStateTest : public LayerTreeHostCommonTest { - public: - WebCompositorMutableStateTest() - : output_surface_(FakeOutputSurface::Create3d()) { - LayerTreeSettings settings; - settings.layer_transforms_should_scale_layer_contents = true; - settings.verify_property_trees = true; - host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_, - &shared_bitmap_manager_, - &task_graph_runner_)); - host_impl_->SetVisible(true); - EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get())); - } - - FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } - - LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } - - private: - TestSharedBitmapManager shared_bitmap_manager_; - TestTaskGraphRunner task_graph_runner_; - FakeImplTaskRunnerProvider task_runner_provider_; - scoped_ptr<OutputSurface> output_surface_; - scoped_ptr<FakeLayerTreeHostImpl> host_impl_; -}; - -TEST_F(WebCompositorMutableStateTest, NoMutableState) { - // In this test, there are no layers with either an element id or mutable - // properties. We should not be able to get any mutable state. - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42); - - gfx::Transform identity_matrix; - gfx::Point3F transform_origin; - gfx::PointF position; - gfx::Size bounds(100, 100); - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, - position, bounds, true, false, true); - root->SetDrawsContent(true); - - host_impl().SetViewportSize(root->bounds()); - host_impl().active_tree()->SetRootLayer(std::move(root)); - host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); - - LayerTreeMutationMap mutations; - WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(), - &mutations); - scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42)); - EXPECT_FALSE(state); -} - -TEST_F(WebCompositorMutableStateTest, MutableStateNoMutableProperties) { - // In this test, there is a layer with an element id, but no mutable - // properties. This should behave just as if we'd had no element id. - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42); - - gfx::Transform identity_matrix; - gfx::Point3F transform_origin; - gfx::PointF position; - gfx::Size bounds(100, 100); - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, - position, bounds, true, false, true); - root->SetDrawsContent(true); - root->SetElementId(42); - - host_impl().SetViewportSize(root->bounds()); - host_impl().active_tree()->SetRootLayer(std::move(root)); - host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); - - LayerTreeMutationMap mutations; - WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(), - &mutations); - scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42)); - EXPECT_FALSE(state); -} - -TEST_F(WebCompositorMutableStateTest, MutableStateMutableProperties) { - // In this test, there is a layer with an element id and mutable properties. - // In this case, we should get a valid mutable state for this element id that - // has a real effect on the corresponding layer. - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42); - - gfx::Transform identity_matrix; - gfx::Point3F transform_origin; - gfx::PointF position; - gfx::Size bounds(100, 100); - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, - position, bounds, true, false, true); - root->SetDrawsContent(true); - root->SetElementId(42); - root->SetMutableProperties( - cc::kMutablePropertyOpacity | cc::kMutablePropertyTransform | - cc::kMutablePropertyScrollLeft | cc::kMutablePropertyScrollTop); - - host_impl().SetViewportSize(root->bounds()); - host_impl().active_tree()->SetRootLayer(std::move(root)); - host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); - - LayerTreeMutationMap mutations; - WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(), - &mutations); - - scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42)); - EXPECT_TRUE(state.get()); - - EXPECT_EQ(1.0, root_layer()->opacity()); - EXPECT_EQ(identity_matrix.ToString(), root_layer()->transform().ToString()); - EXPECT_EQ(0.0, root_layer()->CurrentScrollOffset().x()); - EXPECT_EQ(0.0, root_layer()->CurrentScrollOffset().y()); - - gfx::Transform zero(0, 0, 0, 0, 0, 0); - state->setOpacity(0.5); - state->setTransform(zero.matrix()); - state->setScrollLeft(1.0); - state->setScrollTop(1.0); - - EXPECT_EQ(0.5, root_layer()->opacity()); - EXPECT_EQ(zero.ToString(), root_layer()->transform().ToString()); - EXPECT_EQ(1.0, root_layer()->CurrentScrollOffset().x()); - EXPECT_EQ(1.0, root_layer()->CurrentScrollOffset().y()); - - // The corresponding mutation should reflect the changed values. - EXPECT_EQ(1ul, mutations.size()); - - const LayerTreeMutation& mutation = mutations[42]; - EXPECT_TRUE(mutation.is_opacity_mutated()); - EXPECT_TRUE(mutation.is_transform_mutated()); - EXPECT_TRUE(mutation.is_scroll_left_mutated()); - EXPECT_TRUE(mutation.is_scroll_top_mutated()); - - EXPECT_EQ(0.5, mutation.opacity()); - EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString()); - EXPECT_EQ(1.0, mutation.scroll_left()); - EXPECT_EQ(1.0, mutation.scroll_top()); -} - -} // namespace -} // namespace cc_blink diff --git a/cc/blink/web_compositor_mutable_state_provider_impl.cc b/cc/blink/web_compositor_mutable_state_provider_impl.cc deleted file mode 100644 index 713a542..0000000 --- a/cc/blink/web_compositor_mutable_state_provider_impl.cc +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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 "cc/blink/web_compositor_mutable_state_provider_impl.h" - -#include "cc/blink/web_compositor_mutable_state_impl.h" -#include "cc/layers/layer_impl.h" -#include "cc/trees/layer_tree_impl.h" - -namespace cc_blink { - -WebCompositorMutableStateProviderImpl::WebCompositorMutableStateProviderImpl( - cc::LayerTreeImpl* state, - cc::LayerTreeMutationMap* mutations) - : state_(state), mutations_(mutations) {} - -WebCompositorMutableStateProviderImpl:: - ~WebCompositorMutableStateProviderImpl() {} - -blink::WebPassOwnPtr<blink::WebCompositorMutableState> -WebCompositorMutableStateProviderImpl::getMutableStateFor(uint64_t element_id) { - cc::LayerTreeImpl::ElementLayers layers = - state_->GetMutableLayers(element_id); - - if (!layers.main && !layers.scroll) - return nullptr; - - return blink::adoptWebPtr<blink::WebCompositorMutableState>( - new WebCompositorMutableStateImpl(&(*mutations_)[element_id], layers.main, - layers.scroll)); -} - -} // namespace cc_blink diff --git a/cc/blink/web_compositor_mutable_state_provider_impl.h b/cc/blink/web_compositor_mutable_state_provider_impl.h deleted file mode 100644 index 138103d..0000000 --- a/cc/blink/web_compositor_mutable_state_provider_impl.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 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. - -#ifndef CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_ -#define CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_ - -#include "base/compiler_specific.h" -#include "base/containers/hash_tables.h" -#include "cc/animation/layer_tree_mutation.h" -#include "cc/blink/cc_blink_export.h" - -#include "third_party/WebKit/public/platform/WebCompositorMutableStateProvider.h" - -namespace cc { -class LayerTreeImpl; -} // namespace cc - -namespace cc_blink { - -class WebCompositorMutableStateProviderImpl - : public blink::WebCompositorMutableStateProvider { - public: - // TODO(vollick): after slimming paint v2, this will need to operate on - // property trees, not the layer tree impl. - // - // The LayerTreeImpl and the LayerTreeMutationMap are both owned by caller. - CC_BLINK_EXPORT WebCompositorMutableStateProviderImpl( - cc::LayerTreeImpl* state, - cc::LayerTreeMutationMap* mutations); - - CC_BLINK_EXPORT ~WebCompositorMutableStateProviderImpl() override; - - CC_BLINK_EXPORT blink::WebPassOwnPtr<blink::WebCompositorMutableState> - getMutableStateFor(uint64_t element_id) override WARN_UNUSED_RESULT; - - private: - cc::LayerTreeImpl* state_; - cc::LayerTreeMutationMap* mutations_; -}; - -} // namespace cc_blink - -#endif // CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_ diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc index a901b15..992157b 100644 --- a/cc/blink/web_layer_impl.cc +++ b/cc/blink/web_layer_impl.cc @@ -16,7 +16,6 @@ #include "base/threading/thread_checker.h" #include "base/trace_event/trace_event_impl.h" #include "cc/animation/animation.h" -#include "cc/animation/mutable_properties.h" #include "cc/base/region.h" #include "cc/base/switches.h" #include "cc/blink/web_animation_impl.h" @@ -27,7 +26,6 @@ #include "cc/layers/layer_position_constraint.h" #include "cc/layers/layer_settings.h" #include "cc/trees/layer_tree_host.h" -#include "third_party/WebKit/public/platform/WebCompositorMutableProperties.h" #include "third_party/WebKit/public/platform/WebFloatPoint.h" #include "third_party/WebKit/public/platform/WebFloatRect.h" #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" @@ -563,35 +561,6 @@ uint64_t WebLayerImpl::elementId() const { return layer_->element_id(); } -static_assert( - static_cast<cc::MutableProperty>(blink::WebCompositorMutablePropertyNone) == - cc::kMutablePropertyNone, - "MutableProperty and WebCompositorMutableProperty enums must match"); - -static_assert( - static_cast<cc::MutableProperty>( - blink::WebCompositorMutablePropertyOpacity) == - cc::kMutablePropertyOpacity, - "MutableProperty and WebCompositorMutableProperty enums must match"); - -static_assert( - static_cast<cc::MutableProperty>( - blink::WebCompositorMutablePropertyScrollLeft) == - cc::kMutablePropertyScrollLeft, - "MutableProperty and WebCompositorMutableProperty enums must match"); - -static_assert( - static_cast<cc::MutableProperty>( - blink::WebCompositorMutablePropertyScrollTop) == - cc::kMutablePropertyScrollTop, - "MutableProperty and WebCompositorMutableProperty enums must match"); - -static_assert( - static_cast<cc::MutableProperty>( - blink::WebCompositorMutablePropertyTransform) == - cc::kMutablePropertyTransform, - "MutableProperty and WebCompositorMutableProperty enums must match"); - void WebLayerImpl::setCompositorMutableProperties(uint32_t properties) { layer_->SetMutableProperties(properties); } diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 68e153f..2519daa 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -66,7 +66,7 @@ Layer::Layer(const LayerSettings& settings) clip_tree_index_(-1), property_tree_sequence_number_(-1), element_id_(0), - mutable_properties_(kMutablePropertyNone), + mutable_properties_(MutableProperty::kNone), main_thread_scrolling_reasons_( MainThreadScrollingReason::kNotScrollingOnMain), should_flatten_transform_from_property_tree_(false), diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 540de09..57b62f8 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -94,7 +94,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, sorting_context_id_(0), current_draw_mode_(DRAW_MODE_NONE), element_id_(0), - mutable_properties_(kMutablePropertyNone), + mutable_properties_(MutableProperty::kNone), force_render_surface_(false), frame_timing_requests_dirty_(false), visited_(false), @@ -1720,7 +1720,7 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { state->SetInteger("gpu_memory_usage", base::saturated_cast<int>(GPUMemoryUsageInBytes())); - if (mutable_properties_ != kMutablePropertyNone) { + if (mutable_properties_ != MutableProperty::kNone) { state->SetInteger("element_id", base::saturated_cast<int>(element_id_)); state->SetInteger("mutable_properties", mutable_properties_); } diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index b9fb767..496f4ff 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc @@ -207,7 +207,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( root->SetElementId(2)); EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( - root->SetMutableProperties(kMutablePropertyOpacity)); + root->SetMutableProperties(MutableProperty::kOpacity)); EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( root->SetScrollParent(scroll_parent.get())); EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( @@ -385,7 +385,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( - layer->SetMutableProperties(kMutablePropertyTransform)); + layer->SetMutableProperties(MutableProperty::kTransform)); } TEST(LayerImplTest, SafeOpaqueBackgroundColor) { diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 226b997..5b48056 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -984,7 +984,7 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetElementId(2)); EXPECT_SET_NEEDS_COMMIT( - 1, test_layer->SetMutableProperties(kMutablePropertyTransform)); + 1, test_layer->SetMutableProperties(MutableProperty::kTransform)); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer( dummy_layer1.get())); @@ -2125,15 +2125,15 @@ TEST_F(LayerTest, ElementIdAndMutablePropertiesArePushed) { EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(2); test_layer->SetElementId(2); - test_layer->SetMutableProperties(kMutablePropertyTransform); + test_layer->SetMutableProperties(MutableProperty::kTransform); EXPECT_EQ(0lu, impl_layer->element_id()); - EXPECT_EQ(kMutablePropertyNone, impl_layer->mutable_properties()); + EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); test_layer->PushPropertiesTo(impl_layer.get()); EXPECT_EQ(2lu, impl_layer->element_id()); - EXPECT_EQ(kMutablePropertyTransform, impl_layer->mutable_properties()); + EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); } } // namespace diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 513ce5e..d44aa67 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -50,9 +50,9 @@ namespace cc { namespace { const uint32_t kMainLayerFlags = - kMutablePropertyOpacity | kMutablePropertyTransform; + MutableProperty::kOpacity | MutableProperty::kTransform; const uint32_t kScrollLayerFlags = - kMutablePropertyScrollLeft | kMutablePropertyScrollTop; + MutableProperty::kScrollLeft | MutableProperty::kScrollTop; } // namespace |