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

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

Issue 2919473002: [css-grid] Apply flow-aware logic for margins during stretching (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a3d2251f604ddcf99a55b211e97605c555f5ae2a..7fc73fa0fb4ad9c87f35d65e03aabf709f273ee8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1483,11 +1483,12 @@ static LayoutUnit ComputeOverflowAlignmentOffset(OverflowAlignment overflow,
return LayoutUnit();
}
-// FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to
-// LayoutBox.
-LayoutUnit LayoutGrid::MarginLogicalHeightForChild(
+LayoutUnit LayoutGrid::MarginLogicalSizeForChild(
+ GridTrackSizingDirection direction,
const LayoutBox& child) const {
- return IsHorizontalWritingMode() ? child.MarginHeight() : child.MarginWidth();
+ return FlowAwareDirectionForChild(child, direction) == kForColumns
+ ? child.MarginLogicalWidth()
+ : child.MarginLogicalHeight();
}
LayoutUnit LayoutGrid::ComputeMarginLogicalSizeForChild(
@@ -1520,10 +1521,12 @@ LayoutUnit LayoutGrid::AvailableAlignmentSpaceForChildBeforeStretching(
// performed before children are laid out, so we can't use the child cached
// values. Hence, we need to compute margins in order to determine the
// available height before stretching.
+ GridTrackSizingDirection child_block_flow_direction =
+ FlowAwareDirectionForChild(child, kForRows);
return grid_area_breadth_for_child -
(child.NeedsLayout()
? ComputeMarginLogicalSizeForChild(kBlockDirection, child)
- : MarginLogicalHeightForChild(child));
+ : MarginLogicalSizeForChild(child_block_flow_direction, child));
}
StyleSelfAlignmentData LayoutGrid::AlignSelfForChild(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698