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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 637033003: [CSS Grid Layout] Fix positioned grid children position and size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderGrid.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 14b62cf4e6fde8e87eab1fe29ee2b785d199c97a..d72a527411d9ae371a875b2e96b82558038d27cc 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -72,6 +72,8 @@ typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap;
// FIXME: Move these into RenderBoxRareData.
static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0;
static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0;
+static OverrideSizeMap* gExtraInlineOffsetMap = 0;
+static OverrideSizeMap* gExtraBlockOffsetMap = 0;
// Size of border belt for autoscroll. When mouse pointer in border belt,
@@ -103,6 +105,7 @@ void RenderBox::willBeDestroyed()
{
clearOverrideSize();
clearContainingBlockOverrideSize();
+ clearExtraInlineAndBlockOffests();
RenderBlock::removePercentHeightDescendantIfNeeded(this);
@@ -1019,6 +1022,38 @@ void RenderBox::clearOverrideContainingBlockContentLogicalHeight()
gOverrideContainingBlockLogicalHeightMap->remove(this);
}
+LayoutUnit RenderBox::extraInlineOffset() const
+{
+ return gExtraInlineOffsetMap ? gExtraInlineOffsetMap->get(this) : LayoutUnit(0);
+}
+
+LayoutUnit RenderBox::extraBlockOffset() const
+{
+ return gExtraBlockOffsetMap ? gExtraBlockOffsetMap->get(this) : LayoutUnit(0);
+}
+
+void RenderBox::setExtraInlineOffset(LayoutUnit inlineOffest)
+{
+ if (!gExtraInlineOffsetMap)
+ gExtraInlineOffsetMap = new OverrideSizeMap;
+ gExtraInlineOffsetMap->set(this, inlineOffest);
+}
+
+void RenderBox::setExtraBlockOffset(LayoutUnit blockOffest)
+{
+ if (!gExtraBlockOffsetMap)
+ gExtraBlockOffsetMap = new OverrideSizeMap;
+ gExtraBlockOffsetMap->set(this, blockOffest);
+}
+
+void RenderBox::clearExtraInlineAndBlockOffests()
+{
+ if (gExtraInlineOffsetMap)
+ gExtraInlineOffsetMap->remove(this);
+ if (gExtraBlockOffsetMap)
+ gExtraBlockOffsetMap->remove(this);
+}
+
LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const
{
LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
@@ -2616,6 +2651,9 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
}
}
+ if (hasOverrideContainingBlockLogicalWidth())
+ return overrideContainingBlockContentLogicalWidth();
+
if (containingBlock->isBox())
return toRenderBox(containingBlock)->clientLogicalWidth();
@@ -2656,6 +2694,9 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
}
}
+ if (hasOverrideContainingBlockLogicalHeight())
+ return overrideContainingBlockContentLogicalHeight();
+
if (containingBlock->isBox()) {
const RenderBlock* cb = containingBlock->isRenderBlock() ?
toRenderBlock(containingBlock) : containingBlock->containingBlock();
@@ -2842,6 +2883,9 @@ void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu
}
}
+ if (!style()->hasStaticInlinePosition(isHorizontal))
+ computedValues.m_position += extraInlineOffset();
+
computedValues.m_extent += bordersPlusPadding;
}
@@ -3141,6 +3185,9 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp
}
}
+ if (!style()->hasStaticBlockPosition(isHorizontalWritingMode()))
+ computedValues.m_position += extraBlockOffset();
+
// Set final height value.
computedValues.m_extent += bordersPlusPadding;
}
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698