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

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

Issue 1544423002: Improve positioned/percentHeight descendant/container tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: virtual destructor Created 4 years, 12 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/LayoutBox.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h
index 31aefb616e45aebfedcc0c7e5271334ffa4c2b1a..f5c0726e7c4f0c32e13f3f6df3e4e253bf356cd7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -58,8 +58,11 @@ public:
, m_overrideLogicalContentHeight(-1)
, m_overrideLogicalContentWidth(-1)
, m_previousBorderBoxSize(-1, -1)
+ , m_positionedContainer(nullptr)
+ , m_percentHeightContainer(nullptr)
{
}
+ virtual ~LayoutBoxRareData() { }
esprehn 2016/01/06 19:37:25 we make this non-virtual in ElementRareData/NodeRa
Xianzhu 2016/01/06 20:49:07 Done.
// For inline replaced elements, the inline box that owns us.
InlineBox* m_inlineBoxWrapper;
@@ -78,6 +81,11 @@ public:
LayoutUnit m_pageLogicalOffset;
LayoutUnit m_paginationStrut;
+
+ // Points to the LayoutBlock whose LayoutBlockRareData::m_positionedDescendants contains this LayoutBox.
+ LayoutBlock* m_positionedContainer;
+ // Points to the LayoutBlock whose LayoutBlockRareData::m_percentHeightDescendants contains this LayoutBox.
+ LayoutBlock* m_percentHeightContainer;
};
// LayoutBox implements the full CSS box model.
@@ -849,6 +857,15 @@ public:
void clearPreviousPaintInvalidationRects() override;
+ LayoutBlock* positionedContainer() const { return m_rareData ? m_rareData->m_positionedContainer : nullptr; }
+ void setPositionedContainer(LayoutBlock*);
+ void removeFromPositionedContainer();
+
+ LayoutBlock* percentHeightContainer() const { return m_rareData ? m_rareData->m_percentHeightContainer : nullptr; }
+ void setPercentHeightContainer(LayoutBlock*);
+ void removeFromPercentHeightContainer();
+ void clearPercentHeightDescendants();
+
protected:
void willBeDestroyed() override;
@@ -887,6 +904,15 @@ protected:
bool hasNonCompositedScrollbars() const final;
void excludeScrollbars(LayoutRect&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
+ LayoutBoxRareData* rareData() const { return m_rareData.get(); }
+ LayoutBoxRareData& ensureRareData()
+ {
+ if (!m_rareData)
+ m_rareData = adoptPtr(createRareData());
esprehn 2016/01/06 19:37:25 adoptPtr should be at the creation site, not aroun
Xianzhu 2016/01/06 20:49:07 Done.
+ return *m_rareData.get();
+ }
+ virtual LayoutBoxRareData* createRareData() { return new LayoutBoxRareData; }
esprehn 2016/01/06 19:37:25 PassOwnPtr, you should never leak like this.
Xianzhu 2016/01/06 20:49:07 Done.
+
private:
bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const;
bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const;
@@ -937,13 +963,6 @@ private:
// details about those widths.
virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDirty(); }
- LayoutBoxRareData& ensureRareData()
- {
- if (!m_rareData)
- m_rareData = adoptPtr(new LayoutBoxRareData());
- return *m_rareData.get();
- }
-
bool needToSavePreviousBoxSizes();
void savePreviousBoxSizesIfNeeded();
LayoutSize computePreviousBorderBoxSize(const LayoutSize& previousBoundsSize) const;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698