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

Unified Diff: third_party/WebKit/Source/core/style/GridResolvedPosition.cpp

Issue 1496863004: [css-grid] Simplify method to resolve auto-placed items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kill-grid-resolved-position
Patch Set: Applying suggested changes Created 5 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 | « third_party/WebKit/Source/core/style/GridResolvedPosition.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/style/GridResolvedPosition.cpp
diff --git a/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp b/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
index b80e5fa2be1af65682a183a1f7946f85b16c6655..0c72d8651bf4df79ac90f32526985ea10cad12be 100644
--- a/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
+++ b/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
@@ -155,24 +155,21 @@ static GridSpan resolveGridPositionAgainstOppositePosition(const ComputedStyle&
return definiteGridSpanWithSpanAgainstOpposite(resolvedOppositePosition, position, side);
}
-GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(const ComputedStyle& gridContainerStyle, const LayoutBox& gridItem, GridTrackSizingDirection direction, size_t resolvedInitialPosition)
+size_t GridResolvedPosition::spanSizeForAutoPlacedItem(const ComputedStyle& gridContainerStyle, const LayoutBox& gridItem, GridTrackSizingDirection direction)
{
GridPosition initialPosition, finalPosition;
initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
- GridPositionSide finalSide = finalPositionSide(direction);
-
// This method will only be used when both positions need to be resolved against the opposite one.
ASSERT(initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPosition.shouldBeResolvedAgainstOppositePosition());
- size_t resolvedFinalPosition = resolvedInitialPosition + 1;
-
- if (initialPosition.isSpan())
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, initialPosition, finalSide);
- if (finalPosition.isSpan())
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, finalPosition, finalSide);
+ if (initialPosition.isAuto() && finalPosition.isAuto())
+ return 1;
- return GridSpan::definiteGridSpan(resolvedInitialPosition, resolvedFinalPosition);
+ GridPosition position = initialPosition.isSpan() ? initialPosition : finalPosition;
+ ASSERT(position.isSpan());
+ ASSERT(position.spanPosition());
+ return position.spanPosition();
}
size_t GridResolvedPosition::explicitGridColumnCount(const ComputedStyle& gridContainerStyle)
« no previous file with comments | « third_party/WebKit/Source/core/style/GridResolvedPosition.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698