Chromium Code Reviews| 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 |