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

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

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.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
index 2d62d3f45373ba0903fe8f90b3f4dedc0c4a62d1..c3c68d259320058d19c4ef99387cdcb63fb34ec3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
@@ -81,13 +81,11 @@ struct LayoutBoxModelObjectRareData {
//
// The reason for this partial implementation is that the 2 classes inheriting
// from it (LayoutBox and LayoutInline) have different requirements but need to
-// have a PaintLayer.
-// For a full implementation of the box model, see LayoutBox.
+// have a PaintLayer. For a full implementation of the box model, see LayoutBox.
//
-// An important member of this class is PaintLayer. This class is
-// central to painting and hit-testing (see its class comment).
-// PaintLayers are instantiated for several reasons based on the
-// return value of layerTypeRequired().
+// An important member of this class is PaintLayer which is stored in a rare-
chrishtr 2017/04/11 21:52:34 nit: "PaintLayer, which"
pdr. 2017/04/11 22:36:01 Done
+// data pattern (see: Layer()). PaintLayers are instantiated for several reasons
+// based on the return value of layerTypeRequired().
// Interestingly, most SVG objects inherit from LayoutSVGModelObject and thus
// can't have a PaintLayer. This is an unfortunate artifact of our
// design as it limits code sharing and prevents hardware accelerating SVG
@@ -178,15 +176,16 @@ class CORE_EXPORT LayoutBoxModelObject : public LayoutObject {
virtual int PixelSnappedOffsetHeight(const Element*) const;
bool HasSelfPaintingLayer() const;
- PaintLayer* Layer() const { return layer_.get(); }
+ PaintLayer* Layer() const {
+ return GetRarePaintData() ? GetRarePaintData()->Layer() : nullptr;
+ }
+ // The type of PaintLayer to instantiate. Any value returned from this
+ // function other than NoPaintLayer will lead to a PaintLayer being created.
+ virtual PaintLayerType LayerTypeRequired() const = 0;
PaintLayerScrollableArea* GetScrollableArea() const;
virtual void UpdateFromStyle();
- // The type of PaintLayer to instantiate. Any value returned from this
- // function other than NoPaintLayer will populate |m_layer|.
- virtual PaintLayerType LayerTypeRequired() const = 0;
-
// This will work on inlines to return the bounding box of all of the lines'
// border boxes.
virtual IntRect BorderBoundingBox() const = 0;
@@ -546,10 +545,6 @@ class CORE_EXPORT LayoutBoxModelObject : public LayoutObject {
return *rare_data_.get();
}
- // The PaintLayer associated with this object. |m_layer| can be nullptr
- // depending on the return value of layerTypeRequired().
- std::unique_ptr<PaintLayer> layer_;
-
std::unique_ptr<LayoutBoxModelObjectRareData> rare_data_;
};

Powered by Google App Engine
This is Rietveld 408576698