| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 return; | 1397 return; |
| 1398 | 1398 |
| 1399 bool containerHasHorizontalWritingMode = isHorizontalWritingMode(); | 1399 bool containerHasHorizontalWritingMode = isHorizontalWritingMode(); |
| 1400 for (auto* child : *positionedDescendants) { | 1400 for (auto* child : *positionedDescendants) { |
| 1401 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != cont
ainerHasHorizontalWritingMode; | 1401 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != cont
ainerHasHorizontalWritingMode; |
| 1402 if (hasOrthogonalWritingMode) { | 1402 if (hasOrthogonalWritingMode) { |
| 1403 // FIXME: Properly support orthogonal writing mode. | 1403 // FIXME: Properly support orthogonal writing mode. |
| 1404 continue; | 1404 continue; |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 // FIXME: Detect properly if start/end is auto for inexistent named grid
lines. | |
| 1408 LayoutUnit columnOffset = LayoutUnit(); | 1407 LayoutUnit columnOffset = LayoutUnit(); |
| 1409 LayoutUnit columnBreadth = LayoutUnit(); | 1408 LayoutUnit columnBreadth = LayoutUnit(); |
| 1410 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, col
umnBreadth); | 1409 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, col
umnBreadth); |
| 1411 LayoutUnit rowOffset = LayoutUnit(); | 1410 LayoutUnit rowOffset = LayoutUnit(); |
| 1412 LayoutUnit rowBreadth = LayoutUnit(); | 1411 LayoutUnit rowBreadth = LayoutUnit(); |
| 1413 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadt
h); | 1412 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadt
h); |
| 1414 | 1413 |
| 1415 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); | 1414 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); |
| 1416 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); | 1415 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); |
| 1417 child->setExtraInlineOffset(columnOffset); | 1416 child->setExtraInlineOffset(columnOffset); |
| 1418 child->setExtraBlockOffset(rowOffset); | 1417 child->setExtraBlockOffset(rowOffset); |
| 1419 } | 1418 } |
| 1420 | 1419 |
| 1421 LayoutBlock::layoutPositionedObjects(relayoutChildren, info); | 1420 LayoutBlock::layoutPositionedObjects(relayoutChildren, info); |
| 1422 } | 1421 } |
| 1423 | 1422 |
| 1424 void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid
TrackSizingDirection direction, LayoutUnit& offset, LayoutUnit& breadth) | 1423 void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid
TrackSizingDirection direction, LayoutUnit& offset, LayoutUnit& breadth) |
| 1425 { | 1424 { |
| 1426 ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode()); | 1425 ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode()); |
| 1427 | 1426 |
| 1428 OwnPtr<GridSpan> positions = GridResolvedPosition::resolveGridPositionsFromS
tyle(*style(), child, direction); | 1427 OwnPtr<GridSpan> positions = GridResolvedPosition::resolveGridPositionsFromS
tyle(*style(), child, direction); |
| 1429 if (!positions) { | 1428 if (!positions) { |
| 1430 offset = LayoutUnit(); | 1429 offset = LayoutUnit(); |
| 1431 breadth = (direction == ForColumns) ? clientLogicalWidth() : clientLogic
alHeight(); | 1430 breadth = (direction == ForColumns) ? clientLogicalWidth() : clientLogic
alHeight(); |
| 1432 return; | 1431 return; |
| 1433 } | 1432 } |
| 1434 | 1433 |
| 1435 bool startIsAuto = (direction == ForColumns) ? child.style()->gridColumnStar
t().isAuto() : child.style()->gridRowStart().isAuto(); | 1434 GridPosition startPosition = (direction == ForColumns) ? child.style()->grid
ColumnStart() : child.style()->gridRowStart(); |
| 1436 bool endIsAuto = (direction == ForColumns) ? child.style()->gridColumnEnd().
isAuto() : child.style()->gridRowEnd().isAuto(); | 1435 GridPosition endPosition = (direction == ForColumns) ? child.style()->gridCo
lumnEnd() : child.style()->gridRowEnd(); |
| 1436 bool startIsAuto = startPosition.isAuto() || (startPosition.isNamedGridArea(
) && !GridResolvedPosition::isValidNamedLineOrArea(startPosition.namedGridLine()
, styleRef(), GridResolvedPosition::initialPositionSide(direction))); |
| 1437 bool endIsAuto = endPosition.isAuto() || (endPosition.isNamedGridArea() && !
GridResolvedPosition::isValidNamedLineOrArea(endPosition.namedGridLine(), styleR
ef(), GridResolvedPosition::finalPositionSide(direction))); |
| 1437 | 1438 |
| 1438 GridResolvedPosition firstPosition = GridResolvedPosition(0); | 1439 GridResolvedPosition firstPosition = GridResolvedPosition(0); |
| 1439 GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positio
ns->resolvedInitialPosition; | 1440 GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positio
ns->resolvedInitialPosition; |
| 1440 GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForCo
lumns ? gridColumnCount() : gridRowCount()) - 1); | 1441 GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForCo
lumns ? gridColumnCount() : gridRowCount()) - 1); |
| 1441 GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->r
esolvedFinalPosition; | 1442 GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->r
esolvedFinalPosition; |
| 1442 | 1443 |
| 1443 // Positioned children do not grow the grid, so we need to clamp the positio
ns to avoid ending up outside of it. | 1444 // Positioned children do not grow the grid, so we need to clamp the positio
ns to avoid ending up outside of it. |
| 1444 initialPosition = std::min<GridResolvedPosition>(initialPosition, lastPositi
on); | 1445 initialPosition = std::min<GridResolvedPosition>(initialPosition, lastPositi
on); |
| 1445 finalPosition = std::min<GridResolvedPosition>(finalPosition, lastPosition); | 1446 finalPosition = std::min<GridResolvedPosition>(finalPosition, lastPosition); |
| 1446 | 1447 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 | 1927 |
| 1927 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 1928 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
| 1928 } | 1929 } |
| 1929 | 1930 |
| 1930 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1931 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
| 1931 { | 1932 { |
| 1932 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 1933 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 1933 } | 1934 } |
| 1934 | 1935 |
| 1935 } // namespace blink | 1936 } // namespace blink |
| OLD | NEW |