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

Unified Diff: Source/core/layout/LayoutFlexibleBox.cpp

Issue 1268753002: [css-flexbox] Implementing new CSS Box Alignment values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggested changes. Created 5 years, 4 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 | « LayoutTests/css3/flexbox/flex-align-new-values.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
index 0a676c9316df5f2186bf503278dda462b71ce7a6..f0977885e5615063f700b0c17b16b8c5a1fec265 100644
--- a/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1348,15 +1348,35 @@ void LayoutFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
minMarginAfterBaseline = std::min(minMarginAfterBaseline, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child) - startOffset);
break;
}
- case ItemPositionLastBaseline:
- case ItemPositionSelfStart:
- case ItemPositionSelfEnd:
- case ItemPositionStart:
- case ItemPositionEnd:
+ case ItemPositionSelfStart: {
+ bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child->styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : child->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritingMode();
+ if (!hasSameCrossStartEdges)
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ }
+ case ItemPositionSelfEnd: {
+ bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child->styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : child->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritingMode();
+ if (hasSameCrossStartEdges)
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ }
case ItemPositionLeft:
+ // Cross-axis is only parallel to container's inline-axis when column-flow is used.
+ if (isColumnFlow() && !style()->isLeftToRightDirection())
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
case ItemPositionRight:
- // FIXME: File a bug about implementing that. The extended grammar
- // is not enabled by default so we shouldn't hit this codepath.
+ // Cross-axis is only parallel to container's inline-axis when column-flow is used.
+ if (isColumnFlow() && style()->isLeftToRightDirection())
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ case ItemPositionStart:
cbiesinger 2015/08/11 23:04:58 Ah, you're right about start vs flex-start, thanks
+ break;
+ case ItemPositionEnd:
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ case ItemPositionLastBaseline: // TODO (lajava): This feature is at-risk of being dropped during the CR period.
+ default:
ASSERT_NOT_REACHED();
break;
}
« no previous file with comments | « LayoutTests/css3/flexbox/flex-align-new-values.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698