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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/css3/flexbox/flex-align-new-values.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 // 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. 1341 // 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.
1342 // https://bugs.webkit.org/show_bug.cgi?id=98076 1342 // https://bugs.webkit.org/show_bug.cgi?id=98076
1343 LayoutUnit ascent = marginBoxAscentForChild(*child); 1343 LayoutUnit ascent = marginBoxAscentForChild(*child);
1344 LayoutUnit startOffset = maxAscent - ascent; 1344 LayoutUnit startOffset = maxAscent - ascent;
1345 adjustAlignmentForChild(*child, startOffset); 1345 adjustAlignmentForChild(*child, startOffset);
1346 1346
1347 if (style()->flexWrap() == FlexWrapReverse) 1347 if (style()->flexWrap() == FlexWrapReverse)
1348 minMarginAfterBaseline = std::min(minMarginAfterBaseline, av ailableAlignmentSpaceForChild(lineCrossAxisExtent, *child) - startOffset); 1348 minMarginAfterBaseline = std::min(minMarginAfterBaseline, av ailableAlignmentSpaceForChild(lineCrossAxisExtent, *child) - startOffset);
1349 break; 1349 break;
1350 } 1350 }
1351 case ItemPositionLastBaseline: 1351 case ItemPositionSelfStart: {
1352 case ItemPositionSelfStart: 1352 bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child- >styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : ch ild->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritin gMode();
1353 case ItemPositionSelfEnd: 1353 if (!hasSameCrossStartEdges)
1354 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child));
1355 break;
1356 }
1357 case ItemPositionSelfEnd: {
1358 bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child- >styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : ch ild->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritin gMode();
1359 if (hasSameCrossStartEdges)
1360 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child));
1361 break;
1362 }
1363 case ItemPositionLeft:
1364 // Cross-axis is only parallel to container's inline-axis when c olumn-flow is used.
1365 if (isColumnFlow() && !style()->isLeftToRightDirection())
1366 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child));
1367 break;
1368 case ItemPositionRight:
1369 // Cross-axis is only parallel to container's inline-axis when c olumn-flow is used.
1370 if (isColumnFlow() && style()->isLeftToRightDirection())
1371 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child));
1372 break;
1354 case ItemPositionStart: 1373 case ItemPositionStart:
cbiesinger 2015/08/11 23:04:58 Ah, you're right about start vs flex-start, thanks
1374 break;
1355 case ItemPositionEnd: 1375 case ItemPositionEnd:
1356 case ItemPositionLeft: 1376 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child));
1357 case ItemPositionRight: 1377 break;
1358 // FIXME: File a bug about implementing that. The extended gramm ar 1378 case ItemPositionLastBaseline: // TODO (lajava): This feature is at- risk of being dropped during the CR period.
1359 // is not enabled by default so we shouldn't hit this codepath. 1379 default:
1360 ASSERT_NOT_REACHED(); 1380 ASSERT_NOT_REACHED();
1361 break; 1381 break;
1362 } 1382 }
1363 } 1383 }
1364 minMarginAfterBaselines.append(minMarginAfterBaseline); 1384 minMarginAfterBaselines.append(minMarginAfterBaseline);
1365 } 1385 }
1366 1386
1367 if (style()->flexWrap() != FlexWrapReverse) 1387 if (style()->flexWrap() != FlexWrapReverse)
1368 return; 1388 return;
1369 1389
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 ASSERT(child); 1464 ASSERT(child);
1445 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1465 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1446 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1466 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1447 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1467 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1448 adjustAlignmentForChild(*child, newOffset - originalOffset); 1468 adjustAlignmentForChild(*child, newOffset - originalOffset);
1449 } 1469 }
1450 } 1470 }
1451 } 1471 }
1452 1472
1453 } 1473 }
OLDNEW
« 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