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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 DCHECK(sizingData.sizingState > GridSizingData::RowSizingFirstIteration); | 423 DCHECK(sizingData.sizingState > GridSizingData::RowSizingFirstIteration); |
424 | 424 |
425 // In orthogonal flow cases column track's size is determined by using the c omputed | 425 // In orthogonal flow cases column track's size is determined by using the c omputed |
426 // row track's size, which it was estimated during the first cycle of the si zing | 426 // row track's size, which it was estimated during the first cycle of the si zing |
427 // algorithm. Hence we need to repeat computeUsedBreadthOfGridTracks for bot h, | 427 // algorithm. Hence we need to repeat computeUsedBreadthOfGridTracks for bot h, |
428 // columns and rows, to determine the final values. | 428 // columns and rows, to determine the final values. |
429 // TODO (lajava): orthogonal flows is just one of the cases which may requir e | 429 // TODO (lajava): orthogonal flows is just one of the cases which may requir e |
430 // a new cycle of the sizing algorithm; there may be more. In addition, not all the | 430 // a new cycle of the sizing algorithm; there may be more. In addition, not all the |
431 // cases with orthogonal flows require this extra cycle; we need a more spec ific | 431 // cases with orthogonal flows require this extra cycle; we need a more spec ific |
432 // condition to detect whether child's min-content contribution has changed or not. | 432 // condition to detect whether child's min-content contribution has changed or not. |
433 if (m_hasAnyOrthogonalChild) { | 433 if (!m_orthogonalChildren.isEmpty()) { |
434 computeTrackSizesForDefiniteSize(ForColumns, sizingData, availableSpaceF orColumns); | 434 computeTrackSizesForDefiniteSize(ForColumns, sizingData, availableSpaceF orColumns); |
435 computeTrackSizesForDefiniteSize(ForRows, sizingData, availableSpaceForR ows); | 435 computeTrackSizesForDefiniteSize(ForRows, sizingData, availableSpaceForR ows); |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 void LayoutGrid::layoutBlock(bool relayoutChildren) | 439 void LayoutGrid::layoutBlock(bool relayoutChildren) |
440 { | 440 { |
441 ASSERT(needsLayout()); | 441 ASSERT(needsLayout()); |
442 | 442 |
443 if (!relayoutChildren && simplifiedLayout()) | 443 if (!relayoutChildren && simplifiedLayout()) |
444 return; | 444 return; |
445 | 445 |
446 SubtreeLayoutScope layoutScope(*this); | 446 SubtreeLayoutScope layoutScope(*this); |
447 | 447 |
448 { | 448 { |
449 // LayoutState needs this deliberate scope to pop before updating scroll information (which | 449 // LayoutState needs this deliberate scope to pop before updating scroll information (which |
450 // may trigger relayout). | 450 // may trigger relayout). |
451 LayoutState state(*this, locationOffset()); | 451 LayoutState state(*this, locationOffset()); |
452 | 452 |
453 LayoutSize previousSize = size(); | 453 LayoutSize previousSize = size(); |
454 | 454 |
455 // We need to clear both own and containingBlock override sizes to ensur e we get the same | |
456 // result when grid's intrinsic size it's computed again. | |
cbiesinger
2016/09/27 09:47:42
Please add "in the updateLogicalWidth call below"
| |
457 if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) || styleRef ().logicalWidth().isIntrinsicOrAuto()) { | |
458 for (auto* child : m_orthogonalChildren) { | |
cbiesinger
2016/09/27 09:47:42
This is a little subtle because m_orthogonalChildr
| |
459 if (child->isOutOfFlowPositioned()) | |
460 continue; | |
461 child->clearOverrideSize(); | |
462 child->clearContainingBlockOverrideSize(); | |
463 child->forceLayout(); | |
464 } | |
465 } | |
466 | |
455 updateLogicalWidth(); | 467 updateLogicalWidth(); |
456 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); | 468 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); |
457 | 469 |
458 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); | 470 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); |
459 | 471 |
460 // TODO(svillar): we won't need to do this once the intrinsic width comp utation is isolated | 472 // TODO(svillar): we won't need to do this once the intrinsic width comp utation is isolated |
461 // from the LayoutGrid object state (it should not touch any attribute) (see crbug.com/627812) | 473 // from the LayoutGrid object state (it should not touch any attribute) (see crbug.com/627812) |
462 if (m_autoRepeatColumns && m_autoRepeatColumns != computeAutoRepeatTrack sCount(ForColumns, TrackSizing)) | 474 if (m_autoRepeatColumns && m_autoRepeatColumns != computeAutoRepeatTrack sCount(ForColumns, TrackSizing)) |
463 dirtyGrid(); | 475 dirtyGrid(); |
464 placeItemsOnGrid(TrackSizing); | 476 placeItemsOnGrid(TrackSizing); |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1561 m_autoRepeatColumns = computeAutoRepeatTracksCount(ForColumns, sizingOpe ration); | 1573 m_autoRepeatColumns = computeAutoRepeatTracksCount(ForColumns, sizingOpe ration); |
1562 m_autoRepeatRows = computeAutoRepeatTracksCount(ForRows, sizingOperation); | 1574 m_autoRepeatRows = computeAutoRepeatTracksCount(ForRows, sizingOperation); |
1563 | 1575 |
1564 populateExplicitGridAndOrderIterator(); | 1576 populateExplicitGridAndOrderIterator(); |
1565 | 1577 |
1566 // We clear the dirty bit here as the grid sizes have been updated. | 1578 // We clear the dirty bit here as the grid sizes have been updated. |
1567 m_gridIsDirty = false; | 1579 m_gridIsDirty = false; |
1568 | 1580 |
1569 Vector<LayoutBox*> autoMajorAxisAutoGridItems; | 1581 Vector<LayoutBox*> autoMajorAxisAutoGridItems; |
1570 Vector<LayoutBox*> specifiedMajorAxisAutoGridItems; | 1582 Vector<LayoutBox*> specifiedMajorAxisAutoGridItems; |
1571 m_hasAnyOrthogonalChild = false; | 1583 m_orthogonalChildren.shrink(0); |
1572 for (LayoutBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { | 1584 for (LayoutBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { |
1573 if (child->isOutOfFlowPositioned()) | 1585 if (child->isOutOfFlowPositioned()) |
1574 continue; | 1586 continue; |
1575 | 1587 |
1576 m_hasAnyOrthogonalChild = m_hasAnyOrthogonalChild || isOrthogonalChild(* child); | 1588 if (isOrthogonalChild(*child)) |
1589 m_orthogonalChildren.append(child); | |
1577 | 1590 |
1578 GridArea area = cachedGridArea(*child); | 1591 GridArea area = cachedGridArea(*child); |
1579 if (!area.rows.isIndefinite()) | 1592 if (!area.rows.isIndefinite()) |
1580 area.rows.translate(abs(m_smallestRowStart)); | 1593 area.rows.translate(abs(m_smallestRowStart)); |
1581 if (!area.columns.isIndefinite()) | 1594 if (!area.columns.isIndefinite()) |
1582 area.columns.translate(abs(m_smallestColumnStart)); | 1595 area.columns.translate(abs(m_smallestColumnStart)); |
1583 m_gridItemArea.set(child, area); | 1596 m_gridItemArea.set(child, area); |
1584 | 1597 |
1585 if (area.rows.isIndefinite() || area.columns.isIndefinite()) { | 1598 if (area.rows.isIndefinite() || area.columns.isIndefinite()) { |
1586 GridSpan majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? area.columns : area.rows; | 1599 GridSpan majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? area.columns : area.rows; |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2667 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2680 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
2668 } | 2681 } |
2669 | 2682 |
2670 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const | 2683 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const |
2671 { | 2684 { |
2672 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); | 2685 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); |
2673 return m_hasDefiniteLogicalHeight.value(); | 2686 return m_hasDefiniteLogicalHeight.value(); |
2674 } | 2687 } |
2675 | 2688 |
2676 } // namespace blink | 2689 } // namespace blink |
OLD | NEW |