Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 1341 break; | 1341 break; |
| 1342 } | 1342 } |
| 1343 case ItemPositionFlexStart: | 1343 case ItemPositionFlexStart: |
| 1344 break; | 1344 break; |
| 1345 case ItemPositionFlexEnd: | 1345 case ItemPositionFlexEnd: |
| 1346 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child)); | 1346 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child)); |
| 1347 break; | 1347 break; |
| 1348 case ItemPositionCenter: | 1348 case ItemPositionCenter: |
| 1349 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child) / 2); | 1349 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child) / 2); |
| 1350 break; | 1350 break; |
| 1351 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
| |
| 1351 case ItemPositionBaseline: { | 1352 case ItemPositionBaseline: { |
| 1352 // 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. | 1353 // 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. |
| 1353 // https://bugs.webkit.org/show_bug.cgi?id=98076 | 1354 // https://bugs.webkit.org/show_bug.cgi?id=98076 |
| 1354 LayoutUnit ascent = marginBoxAscentForChild(*child); | 1355 LayoutUnit ascent = marginBoxAscentForChild(*child); |
| 1355 LayoutUnit startOffset = maxAscent - ascent; | 1356 LayoutUnit startOffset = maxAscent - ascent; |
| 1356 adjustAlignmentForChild(*child, startOffset); | 1357 adjustAlignmentForChild(*child, startOffset); |
| 1357 | 1358 |
| 1358 if (style()->flexWrap() == FlexWrapReverse) | 1359 if (style()->flexWrap() == FlexWrapReverse) |
| 1359 minMarginAfterBaseline = std::min(minMarginAfterBaseline, av ailableAlignmentSpaceForChild(lineCrossAxisExtent, *child) - startOffset); | 1360 minMarginAfterBaseline = std::min(minMarginAfterBaseline, av ailableAlignmentSpaceForChild(lineCrossAxisExtent, *child) - startOffset); |
| 1360 break; | 1361 break; |
| 1361 } | 1362 } |
| 1362 case ItemPositionLastBaseline: | 1363 case ItemPositionSelfStart: { |
| 1363 case ItemPositionSelfStart: | 1364 bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child- >styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : ch ild->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritin gMode(); |
| 1364 case ItemPositionSelfEnd: | 1365 if (!hasSameCrossStartEdges) |
| 1366 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child)); | |
| 1367 break; | |
| 1368 } | |
| 1369 case ItemPositionSelfEnd: { | |
| 1370 bool hasSameCrossStartEdges = hasOrthogonalFlow(*child) ? child- >styleRef().isLeftToRightDirection() == styleRef().isLeftToRightDirection() : ch ild->styleRef().isFlippedBlocksWritingMode() == styleRef().isFlippedBlocksWritin gMode(); | |
| 1371 if (hasSameCrossStartEdges) | |
| 1372 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child)); | |
| 1373 break; | |
| 1374 } | |
| 1375 case ItemPositionLeft: | |
| 1376 // Cross-axis is only paralell to container's inline-axis when c olumn-flow is used. | |
|
ikilpatrick
2015/08/02 23:15:37
s/paralell/parallel
& below.
jfernandez
2015/08/11 13:52:59
Done.
| |
| 1377 if (isColumnFlow() && !style()->isLeftToRightDirection()) | |
| 1378 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child)); | |
| 1379 break; | |
| 1380 case ItemPositionRight: | |
| 1381 // Cross-axis is only paralell to container's inline-axis when c olumn-flow is used. | |
| 1382 if (isColumnFlow() && style()->isLeftToRightDirection()) | |
| 1383 adjustAlignmentForChild(*child, availableAlignmentSpaceForCh ild(lineCrossAxisExtent, *child)); | |
| 1384 break; | |
| 1365 case ItemPositionStart: | 1385 case ItemPositionStart: |
| 1386 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
| |
| 1366 case ItemPositionEnd: | 1387 case ItemPositionEnd: |
| 1367 case ItemPositionLeft: | 1388 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild( lineCrossAxisExtent, *child)); |
| 1368 case ItemPositionRight: | 1389 break; |
| 1369 // FIXME: File a bug about implementing that. The extended gramm ar | 1390 default: |
| 1370 // is not enabled by default so we shouldn't hit this codepath. | |
| 1371 ASSERT_NOT_REACHED(); | 1391 ASSERT_NOT_REACHED(); |
| 1372 break; | 1392 break; |
| 1373 } | 1393 } |
| 1374 } | 1394 } |
| 1375 minMarginAfterBaselines.append(minMarginAfterBaseline); | 1395 minMarginAfterBaselines.append(minMarginAfterBaseline); |
| 1376 } | 1396 } |
| 1377 | 1397 |
| 1378 if (style()->flexWrap() != FlexWrapReverse) | 1398 if (style()->flexWrap() != FlexWrapReverse) |
| 1379 return; | 1399 return; |
| 1380 | 1400 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1455 ASSERT(child); | 1475 ASSERT(child); |
| 1456 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; | 1476 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; |
| 1457 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 1477 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
| 1458 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; | 1478 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; |
| 1459 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1479 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1460 } | 1480 } |
| 1461 } | 1481 } |
| 1462 } | 1482 } |
| 1463 | 1483 |
| 1464 } | 1484 } |
| OLD | NEW |