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

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

Issue 2665133003: [css-grid] Fix behavior of positioned items without specific dimensions (Closed)
Patch Set: Created 3 years, 11 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 42db96d936b8e33d6e1432d45b4730df3e40e458..b69ead57aa2046f5ce7d7bc116f0405c4dc20421 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -75,9 +75,6 @@ namespace blink {
// Used by flexible boxes when flexing this element and by table cells.
typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap;
-static OverrideSizeMap* gExtraInlineOffsetMap = nullptr;
-static OverrideSizeMap* gExtraBlockOffsetMap = nullptr;
-
// Size of border belt for autoscroll. When mouse pointer in border belt,
// autoscroll is started.
static const int autoscrollBeltSize = 20;
@@ -123,7 +120,6 @@ PaintLayerType LayoutBox::layerTypeRequired() const {
void LayoutBox::willBeDestroyed() {
clearOverrideSize();
clearContainingBlockOverrideSize();
- clearExtraInlineAndBlockOffests();
if (isOutOfFlowPositioned())
LayoutBlock::removePositionedObject(this);
@@ -1310,34 +1306,6 @@ void LayoutBox::clearOverrideContainingBlockContentLogicalHeight() {
ensureRareData().m_hasOverrideContainingBlockContentLogicalHeight = false;
}
-LayoutUnit LayoutBox::extraInlineOffset() const {
- return gExtraInlineOffsetMap ? gExtraInlineOffsetMap->get(this)
- : LayoutUnit();
-}
-
-LayoutUnit LayoutBox::extraBlockOffset() const {
- return gExtraBlockOffsetMap ? gExtraBlockOffsetMap->get(this) : LayoutUnit();
-}
-
-void LayoutBox::setExtraInlineOffset(LayoutUnit inlineOffest) {
- if (!gExtraInlineOffsetMap)
- gExtraInlineOffsetMap = new OverrideSizeMap;
- gExtraInlineOffsetMap->set(this, inlineOffest);
-}
-
-void LayoutBox::setExtraBlockOffset(LayoutUnit blockOffest) {
- if (!gExtraBlockOffsetMap)
- gExtraBlockOffsetMap = new OverrideSizeMap;
- gExtraBlockOffsetMap->set(this, blockOffest);
-}
-
-void LayoutBox::clearExtraInlineAndBlockOffests() {
- if (gExtraInlineOffsetMap)
- gExtraInlineOffsetMap->remove(this);
- if (gExtraBlockOffsetMap)
- gExtraBlockOffsetMap->remove(this);
-}
-
LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(
float width) const {
LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalWidth();
@@ -3724,6 +3692,14 @@ void LayoutBox::computeInlineStaticDistance(
if (!logicalLeft.isAuto() || !logicalRight.isAuto())
return;
+ if (child->isGridItem() && child->containingBlock() == child->parent()) {
+ if (child->parent()->style()->direction() == TextDirection::kLtr)
+ logicalLeft.setValue(Fixed, 0);
+ else
+ logicalRight.setValue(Fixed, 0);
+ return;
+ }
svillar 2017/01/31 15:28:40 Mind explaining this change?
Manuel Rego 2017/02/01 09:08:20 So this method is used when in a positioned elemen
svillar 2017/02/01 09:49:07 OK now I understand that we're just setting it to
Manuel Rego 2017/02/01 11:08:08 Actually I've realized we can do this in a differe
Manuel Rego 2017/02/01 11:10:34 Oops sorry this comment is wrong, it was about a d
+
// For multicol we also need to keep track of the block position, since that
// determines which column we're in and thus affects the inline position.
LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition();
@@ -3904,9 +3880,6 @@ void LayoutBox::computePositionedLogicalWidth(
}
}
- if (!style()->hasStaticInlinePosition(isHorizontal))
- computedValues.m_position += extraInlineOffset();
-
computedValues.m_extent += bordersPlusPadding;
}
@@ -4303,9 +4276,6 @@ void LayoutBox::computePositionedLogicalHeight(
}
}
- if (!style()->hasStaticBlockPosition(isHorizontalWritingMode()))
- computedValues.m_position += extraBlockOffset();
-
// Set final height value.
computedValues.m_extent += bordersPlusPadding;
}

Powered by Google App Engine
This is Rietveld 408576698