Skip to content

Commit

Permalink
Remove LayerImpl::masks_to_bounds and mirror_count
Browse files Browse the repository at this point in the history
They were not used except that masks_to_bounds affected debug color
which has not been used by blink since BGPT.

Change-Id: Ia72d544662e7f7c597f7438f19ef107d01b69da2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1966809
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724910}
  • Loading branch information
wangxianzhu authored and Commit Bot committed Dec 14, 2019
1 parent d01db49 commit 025f420
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 134 deletions.
8 changes: 0 additions & 8 deletions cc/debug/debug_colors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ int DebugColors::ContentLayerBorderWidth(float device_scale_factor) {
return Scale(2, device_scale_factor);
}

// Masking layers are pale blue and wide.
SkColor DebugColors::MaskingLayerBorderColor() {
return SkColorSetARGB(48, 128, 255, 255);
}
int DebugColors::MaskingLayerBorderWidth(float device_scale_factor) {
return Scale(20, device_scale_factor);
}

// Other container layers are yellow.
SkColor DebugColors::ContainerLayerBorderColor() {
return SkColorSetARGB(192, 255, 255, 0);
Expand Down
3 changes: 0 additions & 3 deletions cc/debug/debug_colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class CC_DEBUG_EXPORT DebugColors {
static SkColor ContentLayerBorderColor();
static int ContentLayerBorderWidth(float device_scale_factor);

static SkColor MaskingLayerBorderColor();
static int MaskingLayerBorderWidth(float device_scale_factor);

static SkColor ContainerLayerBorderColor();
static int ContainerLayerBorderWidth(float device_scale_factor);

Expand Down
2 changes: 0 additions & 2 deletions cc/layers/layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1331,10 +1331,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
if (subtree_property_changed_)
layer->NoteLayerPropertyChanged();
layer->set_may_contain_video(may_contain_video_);
layer->SetMasksToBounds(inputs_.masks_to_bounds);
layer->SetNonFastScrollableRegion(inputs_.non_fast_scrollable_region);
layer->SetTouchActionRegion(inputs_.touch_action_region);
layer->SetMirrorCount(inputs_.mirror_count);
// TODO(sunxd): Pass the correct region for wheel event handlers, see
// https://crbug.com/841364.
EventListenerProperties mouse_wheel_props =
Expand Down
20 changes: 1 addition & 19 deletions cc/layers/layer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
layer_property_changed_not_from_property_trees_(false),
layer_property_changed_from_property_trees_(false),
may_contain_video_(false),
masks_to_bounds_(false),
contents_opaque_(false),
use_parent_backface_visibility_(false),
should_check_backface_visibility_(false),
Expand All @@ -75,8 +74,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
scrollbars_hidden_(false),
needs_show_scrollbars_(false),
raster_even_if_not_drawn_(false),
has_transform_node_(false),
mirror_count_(0) {
has_transform_node_(false) {
DCHECK_GT(layer_id_, 0);

DCHECK(layer_tree_impl_);
Expand Down Expand Up @@ -235,12 +233,6 @@ void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const {
return;
}

if (masks_to_bounds_) {
*color = DebugColors::MaskingLayerBorderColor();
*width = DebugColors::MaskingLayerBorderWidth(device_scale_factor);
return;
}

*color = DebugColors::ContainerLayerBorderColor();
*width = DebugColors::ContainerLayerBorderWidth(device_scale_factor);
}
Expand Down Expand Up @@ -365,7 +357,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {

layer->has_transform_node_ = has_transform_node_;
layer->offset_to_transform_parent_ = offset_to_transform_parent_;
layer->masks_to_bounds_ = masks_to_bounds_;
layer->contents_opaque_ = contents_opaque_;
layer->may_contain_video_ = may_contain_video_;
layer->use_parent_backface_visibility_ = use_parent_backface_visibility_;
Expand All @@ -386,7 +377,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->clip_tree_index_ = clip_tree_index_;
layer->scroll_tree_index_ = scroll_tree_index_;
layer->has_will_change_transform_hint_ = has_will_change_transform_hint_;
layer->mirror_count_ = mirror_count_;
layer->scrollbars_hidden_ = scrollbars_hidden_;
if (needs_show_scrollbars_)
layer->needs_show_scrollbars_ = needs_show_scrollbars_;
Expand Down Expand Up @@ -616,10 +606,6 @@ SkColor LayerImpl::SafeOpaqueBackgroundColor() const {
return color;
}

void LayerImpl::SetMasksToBounds(bool masks_to_bounds) {
masks_to_bounds_ = masks_to_bounds;
}

void LayerImpl::SetContentsOpaque(bool opaque) {
contents_opaque_ = opaque;
}
Expand All @@ -643,10 +629,6 @@ void LayerImpl::SetElementId(ElementId element_id) {
layer_tree_impl_->AddToElementLayerList(element_id_, this);
}

void LayerImpl::SetMirrorCount(int mirror_count) {
mirror_count_ = mirror_count;
}

void LayerImpl::UnionUpdateRect(const gfx::Rect& update_rect) {
update_rect_.Union(update_rect);
}
Expand Down
13 changes: 1 addition & 12 deletions cc/layers/layer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ class CC_EXPORT LayerImpl {
// non-opaque color. Tries to return background_color(), if possible.
SkColor SafeOpaqueBackgroundColor() const;

void SetMasksToBounds(bool masks_to_bounds);
bool masks_to_bounds() const { return masks_to_bounds_; }

void SetContentsOpaque(bool opaque);
bool contents_opaque() const { return contents_opaque_; }

Expand All @@ -182,9 +179,6 @@ class CC_EXPORT LayerImpl {
void SetElementId(ElementId element_id);
ElementId element_id() const { return element_id_; }

void SetMirrorCount(int mirror_count);
int mirror_count() const { return mirror_count_; }

bool IsAffectedByPageScale() const;

bool Is3dSorted() const { return GetSortingContextId() != 0; }
Expand Down Expand Up @@ -489,9 +483,8 @@ class CC_EXPORT LayerImpl {
// damage from animations. http://crbug.com/755828.
bool layer_property_changed_not_from_property_trees_ : 1;
bool layer_property_changed_from_property_trees_ : 1;
bool may_contain_video_ : 1;

bool masks_to_bounds_ : 1;
bool may_contain_video_ : 1;
bool contents_opaque_ : 1;
bool use_parent_backface_visibility_ : 1;
bool should_check_backface_visibility_ : 1;
Expand Down Expand Up @@ -560,10 +553,6 @@ class CC_EXPORT LayerImpl {
bool raster_even_if_not_drawn_ : 1;

bool has_transform_node_ : 1;

// Number of layers mirroring this layer. If greater than zero, forces a
// render pass for the layer so it can be embedded by the mirroring layer.
int mirror_count_;
};

} // namespace cc
Expand Down
5 changes: 0 additions & 5 deletions cc/layers/layer_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ TEST_F(LayerImplTest, VerifyPendingLayerChangesAreTrackedProperly) {
// Create a simple LayerImpl tree:
host_impl()->CreatePendingTree();
LayerImpl* root = EnsureRootLayerInPendingTree();
root->SetMasksToBounds(true);
CreateClipNode(root);
root->layer_tree_impl()->ResetAllChangeTracking();

Expand Down Expand Up @@ -148,7 +147,6 @@ TEST_F(LayerImplTest, VerifyPendingLayerChangesAreTrackedProperly) {

// After setting all these properties already, setting to the exact same
// values again should not cause any change.
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(root->bounds()));
Expand Down Expand Up @@ -226,8 +224,6 @@ TEST_F(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
// Unrelated functions, always set to new values, always set needs update.
host_impl()->active_tree()->set_needs_update_draw_properties();
UpdateActiveTreeDrawProperties();
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true);
layer->NoteLayerPropertyChanged());
CreateClipNode(layer);
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true);
layer->NoteLayerPropertyChanged());
Expand All @@ -248,7 +244,6 @@ TEST_F(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
host_impl()->active_tree()->SetFilterMutated(layer->element_id(),
arbitrary_filters));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
Expand Down
1 change: 0 additions & 1 deletion cc/layers/layer_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ TEST_F(LayerPerfTest, ImplPushPropertiesTo) {
test_layer->SetSafeOpaqueBackgroundColor(background_color);
test_layer->SetDrawsContent(draws_content);
test_layer->SetContentsOpaque(contents_opaque);
test_layer->SetMasksToBounds(masks_to_bounds);

test_layer->PushPropertiesTo(impl_layer.get());

Expand Down
20 changes: 0 additions & 20 deletions cc/layers/layer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1557,26 +1557,6 @@ TEST_F(LayerTest, SetElementIdNotUsingLayerLists) {
test_layer->SetLayerTreeHost(nullptr);
}

// Verifies that mirror count is pushed to the LayerImpl.
TEST_F(LayerTest, MirrorCountIsPushed) {
scoped_refptr<Layer> test_layer = Layer::Create();
std::unique_ptr<LayerImpl> impl_layer =
LayerImpl::Create(host_impl_.active_tree(), 1);
test_layer->SetLayerTreeHost(layer_tree_host_.get());
EXPECT_EQ(0, test_layer->mirror_count());
EXPECT_EQ(0, impl_layer->mirror_count());

test_layer->IncrementMirrorCount();
EXPECT_EQ(1, test_layer->mirror_count());
EXPECT_EQ(0, impl_layer->mirror_count());

test_layer->PushPropertiesTo(impl_layer.get());
EXPECT_EQ(1, test_layer->mirror_count());
EXPECT_EQ(1, impl_layer->mirror_count());

test_layer->SetLayerTreeHost(nullptr);
}

// Verifies that when mirror count of the layer is incremented or decremented,
// SetPropertyTreesNeedRebuild() and SetNeedsPushProperties() are called
// appropriately.
Expand Down
2 changes: 0 additions & 2 deletions cc/layers/mirror_layer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ TEST_F(MirrorLayerTest, PushProperties) {
MirrorLayerImpl::Create(host_impl_.pending_tree(), mirror->id());

// Verify that impl layers have default property values.
EXPECT_EQ(0, mirrored_impl->mirror_count());
EXPECT_EQ(0, mirror_impl->mirrored_layer_id());

SynchronizeTrees();

// Verify that property values are pushed to impl layers.
EXPECT_EQ(1, mirrored_impl->mirror_count());
EXPECT_EQ(mirrored_impl->id(), mirror_impl->mirrored_layer_id());
}

Expand Down
Loading

0 comments on commit 025f420

Please sign in to comment.