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

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

Issue 2665133003: [css-grid] Fix behavior of positioned items without specific dimensions (Closed)
Patch Set: Add comment requested in the review Created 3 years, 7 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/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index 9b70c14246c0977c6e1645927061b89b3aec95f0..55f34d19d221a4ad0565c7856fde5f87eb2ffd3f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1263,16 +1263,20 @@ void LayoutGrid::LayoutPositionedObjects(bool relayout_children,
child->SetOverrideContainingBlockContentLogicalWidth(column_breadth);
child->SetOverrideContainingBlockContentLogicalHeight(row_breadth);
- child->SetExtraInlineOffset(column_offset);
- child->SetExtraBlockOffset(row_offset);
- if (child->Parent() == this) {
- PaintLayer* child_layer = child->Layer();
- child_layer->SetStaticInlinePosition(BorderStart() + column_offset);
- child_layer->SetStaticBlockPosition(BorderBefore() + row_offset);
- }
+ child->SetX(LayoutUnit());
+ child->SetY(LayoutUnit());
svillar 2017/05/08 11:18:10 Why do we need this?
Manuel Rego 2017/05/08 13:29:44 Actually this is a leftover from a previous versio
+
+ // Mark for layout as we're resetting the position before and we relay in
+ // generic layout logic for positioned items in order to get the offsets
+ // properly resolved.
+ SubtreeLayoutScope layout_scope(*child);
+ layout_scope.SetChildNeedsLayout(child);
svillar 2017/05/08 11:18:10 Why are you using a SubtreeLayoutScope here? Would
Manuel Rego 2017/05/08 13:29:44 I just copied it from LayoutBlock::LayoutPositione
LayoutPositionedObject(child, relayout_children, info);
+
+ child->SetLogicalLocation(LayoutPoint(child->LogicalLeft() + column_offset,
+ child->LogicalTop() + row_offset));
}
}
@@ -1364,11 +1368,8 @@ void LayoutGrid::OffsetAndBreadthForPositionedChild(
breadth = std::max(end - start, LayoutUnit());
offset = start;
- if (is_for_columns && !StyleRef().IsLeftToRightDirection() &&
- !child.StyleRef().HasStaticInlinePosition(
- child.IsHorizontalWritingMode())) {
- // If the child doesn't have a static inline position (i.e. "left" and/or
- // "right" aren't "auto", we need to calculate the offset from the left
+ if (is_for_columns && !StyleRef().IsLeftToRightDirection()) {
+ // We always want to calculate the static position from the left
// (even if we're in RTL).
if (end_is_auto) {
offset = LayoutUnit();

Powered by Google App Engine
This is Rietveld 408576698