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

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: Created 5 years, 5 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: Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
index 506604ef13e73fdffb736a97f5f622e27f82ff6b..2b1454d3f6a6ad760779a134c6b0178d4933f64e 100644
--- a/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1348,6 +1348,7 @@ void LayoutFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
case ItemPositionCenter:
adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child) / 2);
break;
+ case ItemPositionLastBaseline: // TODO (lajava): This feature is at-risk of being dropped during the CR period.
cbiesinger 2015/08/10 20:45:46 this is also not equivalent to baseline, is it? ma
jfernandez 2015/08/11 13:52:59 Yes, you are right. It's not equivalent, indeed. I
case ItemPositionBaseline: {
// FIXME: If we get here in columns, we want the use the descent, except we currently can't get the ascent/descent of orthogonal children.
// https://bugs.webkit.org/show_bug.cgi?id=98076
@@ -1359,15 +1360,34 @@ 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 paralell to container's inline-axis when column-flow is used.
ikilpatrick 2015/08/02 23:15:37 s/paralell/parallel & below.
jfernandez 2015/08/11 13:52:59 Done.
+ 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 paralell to container's inline-axis when column-flow is used.
+ if (isColumnFlow() && style()->isLeftToRightDirection())
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ case ItemPositionStart:
+ break;
cbiesinger 2015/08/10 20:45:46 I don't think that's correct? start and flex-start
jfernandez 2015/08/11 13:52:59 I think it's correct, but you are right when sayin
+ case ItemPositionEnd:
+ adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child));
+ break;
+ default:
ASSERT_NOT_REACHED();
break;
}

Powered by Google App Engine
This is Rietveld 408576698