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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2811023002: Move LayoutBoxModelObject's PaintLayer member to rare paint data (Closed)
Patch Set: Created 3 years, 8 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/core/layout/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index b14965cd8942153e182585d74d747d5b054ab45a..e2dc4b8813982287cb8aab7ec76158ad8f7107b9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -235,7 +235,7 @@ BackgroundPaintLocation LayoutBoxModelObject::GetBackgroundPaintLocation(
LayoutBoxModelObject::~LayoutBoxModelObject() {
// Our layer should have been destroyed and cleared by now
DCHECK(!HasLayer());
- DCHECK(!layer_);
+ DCHECK(!Layer());
}
void LayoutBoxModelObject::WillBeDestroyed() {
@@ -257,7 +257,8 @@ void LayoutBoxModelObject::WillBeDestroyed() {
LayoutObject::WillBeDestroyed();
- DestroyLayer();
+ if (HasLayer())
+ DestroyLayer();
}
void LayoutBoxModelObject::StyleWillChange(StyleDifference diff,
@@ -329,6 +330,7 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
if (was_floating_before_style_changed && IsFloating())
SetChildNeedsLayout();
CreateLayer();
chrishtr 2017/04/11 21:52:34 Move 333 inside and call this CreateLayerAfterStyl
pdr. 2017/04/11 22:36:01 Done
+ Layer()->InsertOnlyThisLayerAfterStyleChange();
if (Parent() && !NeedsLayout()) {
// FIXME: We should call a specialized version of this function.
Layer()->UpdateLayerPositionsAfterLayout();
@@ -342,7 +344,7 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
SetHasReflection(false);
Layer()->UpdateFilters(old_style, StyleRef());
Layer()->UpdateClipPath(old_style, StyleRef());
- // Calls destroyLayer() which clears m_layer.
+ // Calls DestroyLayer() which clears the layer.
Layer()->RemoveOnlyThisLayerAfterStyleChange();
if (was_floating_before_style_changed && IsFloating())
SetChildNeedsLayout();
@@ -503,23 +505,23 @@ void LayoutBoxModelObject::InvalidateStickyConstraints() {
}
void LayoutBoxModelObject::CreateLayer() {
- DCHECK(!layer_);
- layer_ = WTF::MakeUnique<PaintLayer>(*this);
+ DCHECK(!HasLayer() && !Layer());
+ EnsureRarePaintData().SetLayer(WTF::MakeUnique<PaintLayer>(*this));
SetHasLayer(true);
- layer_->InsertOnlyThisLayerAfterStyleChange();
}
void LayoutBoxModelObject::DestroyLayer() {
+ DCHECK(HasLayer() && Layer());
SetHasLayer(false);
- layer_ = nullptr;
+ GetRarePaintData()->SetLayer(nullptr);
}
bool LayoutBoxModelObject::HasSelfPaintingLayer() const {
- return layer_ && layer_->IsSelfPaintingLayer();
+ return Layer() && Layer()->IsSelfPaintingLayer();
}
PaintLayerScrollableArea* LayoutBoxModelObject::GetScrollableArea() const {
- return layer_ ? layer_->GetScrollableArea() : 0;
+ return Layer() ? Layer()->GetScrollableArea() : nullptr;
}
void LayoutBoxModelObject::AddLayerHitTestRects(

Powered by Google App Engine
This is Rietveld 408576698