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

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

Issue 2262973002: Switch override containing block sizes to use LayoutRareData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index a937370a4c0a89180fc907f7102ce38e54e8549a..8669771cae41f185469771d6624d8ac2c7c4a1f3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -71,10 +71,6 @@ namespace blink {
// Used by flexible boxes when flexing this element and by table cells.
typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap;
-// Used by grid elements to properly size their grid items.
-// FIXME: Move these into LayoutBoxRareData.
-static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = nullptr;
-static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = nullptr;
static OverrideSizeMap* gExtraInlineOffsetMap = nullptr;
static OverrideSizeMap* gExtraBlockOffsetMap = nullptr;
@@ -1139,58 +1135,54 @@ LayoutUnit LayoutBox::overrideLogicalContentHeight() const
// TODO (lajava) Now that we have implemented these functions based on physical direction, we'd rather remove the logical ones.
LayoutUnit LayoutBox::overrideContainingBlockContentLogicalWidth() const
{
- ASSERT(hasOverrideContainingBlockLogicalWidth());
- return gOverrideContainingBlockLogicalWidthMap->get(this);
+ DCHECK(hasOverrideContainingBlockLogicalWidth());
+ return m_rareData->m_overrideContainingBlockContentLogicalWidth;
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
LayoutUnit LayoutBox::overrideContainingBlockContentLogicalHeight() const
{
- ASSERT(hasOverrideContainingBlockLogicalHeight());
- return gOverrideContainingBlockLogicalHeightMap->get(this);
+ DCHECK(hasOverrideContainingBlockLogicalHeight());
+ return m_rareData->m_overrideContainingBlockContentLogicalHeight;
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
bool LayoutBox::hasOverrideContainingBlockLogicalWidth() const
{
- return gOverrideContainingBlockLogicalWidthMap && gOverrideContainingBlockLogicalWidthMap->contains(this);
+ return m_rareData && m_rareData->m_overrideContainingBlockContentLogicalWidth != LayoutUnit(-2);
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
bool LayoutBox::hasOverrideContainingBlockLogicalHeight() const
{
- return gOverrideContainingBlockLogicalHeightMap && gOverrideContainingBlockLogicalHeightMap->contains(this);
+ return m_rareData && m_rareData->m_overrideContainingBlockContentLogicalHeight != LayoutUnit(-2);
jfernandez 2016/08/22 14:56:03 thinking about this ... is this "-2" value intende
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
void LayoutBox::setOverrideContainingBlockContentLogicalWidth(LayoutUnit logicalWidth)
{
- if (!gOverrideContainingBlockLogicalWidthMap)
- gOverrideContainingBlockLogicalWidthMap = new OverrideSizeMap;
- gOverrideContainingBlockLogicalWidthMap->set(this, logicalWidth);
+ DCHECK_NE(logicalWidth, LayoutUnit(-2));
+ ensureRareData().m_overrideContainingBlockContentLogicalWidth = logicalWidth;
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
void LayoutBox::setOverrideContainingBlockContentLogicalHeight(LayoutUnit logicalHeight)
{
- if (!gOverrideContainingBlockLogicalHeightMap)
- gOverrideContainingBlockLogicalHeightMap = new OverrideSizeMap;
- gOverrideContainingBlockLogicalHeightMap->set(this, logicalHeight);
+ DCHECK_NE(logicalHeight, LayoutUnit(-2));
+ ensureRareData().m_overrideContainingBlockContentLogicalHeight = logicalHeight;
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
void LayoutBox::clearContainingBlockOverrideSize()
{
- if (gOverrideContainingBlockLogicalWidthMap)
- gOverrideContainingBlockLogicalWidthMap->remove(this);
- clearOverrideContainingBlockContentLogicalHeight();
+ ensureRareData().m_overrideContainingBlockContentLogicalWidth = LayoutUnit(-2);
+ ensureRareData().m_overrideContainingBlockContentLogicalHeight = LayoutUnit(-2);
}
// TODO (lajava) Shouldn't we implement these functions based on physical direction ?.
void LayoutBox::clearOverrideContainingBlockContentLogicalHeight()
{
- if (gOverrideContainingBlockLogicalHeightMap)
- gOverrideContainingBlockLogicalHeightMap->remove(this);
+ ensureRareData().m_overrideContainingBlockContentLogicalHeight = LayoutUnit(-2);
}
LayoutUnit LayoutBox::extraInlineOffset() const

Powered by Google App Engine
This is Rietveld 408576698