Chromium Code Reviews| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 } | 393 } |
| 394 | 394 |
| 395 bool LayoutGrid::namedGridLinesDefinitionDidChange( | 395 bool LayoutGrid::namedGridLinesDefinitionDidChange( |
| 396 const ComputedStyle& oldStyle) const { | 396 const ComputedStyle& oldStyle) const { |
| 397 return oldStyle.namedGridRowLines() != styleRef().namedGridRowLines() || | 397 return oldStyle.namedGridRowLines() != styleRef().namedGridRowLines() || |
| 398 oldStyle.namedGridColumnLines() != styleRef().namedGridColumnLines(); | 398 oldStyle.namedGridColumnLines() != styleRef().namedGridColumnLines(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 size_t LayoutGrid::gridColumnCount() const { | 401 size_t LayoutGrid::gridColumnCount() const { |
| 402 DCHECK(!m_gridIsDirty); | 402 DCHECK(!m_gridIsDirty); |
| 403 // Due to limitations in our internal representation, we cannot know the | 403 return m_grid.size() ? m_grid[0].size() : 0; |
| 404 // number of columns from m_grid *if* there is no row (because m_grid would be | |
| 405 // empty). That's why in that case we need to get it from the style. Note that | |
| 406 // we know for sure that there are't any implicit tracks, because not having | |
| 407 // rows implies that there are no "normal" children (out-of-flow children are | |
| 408 // not stored in m_grid). | |
| 409 return m_grid.size() ? m_grid[0].size() | |
| 410 : GridPositionsResolver::explicitGridColumnCount( | |
| 411 styleRef(), m_autoRepeatColumns); | |
| 412 } | 404 } |
| 413 | 405 |
| 414 size_t LayoutGrid::gridRowCount() const { | 406 size_t LayoutGrid::gridRowCount() const { |
| 415 DCHECK(!m_gridIsDirty); | 407 DCHECK(!m_gridIsDirty); |
| 416 return m_grid.size(); | 408 return m_grid.size(); |
| 417 } | 409 } |
| 418 | 410 |
| 419 LayoutUnit LayoutGrid::computeTrackBasedLogicalHeight( | 411 LayoutUnit LayoutGrid::computeTrackBasedLogicalHeight( |
| 420 const GridSizingData& sizingData) const { | 412 const GridSizingData& sizingData) const { |
| 421 LayoutUnit logicalHeight; | 413 LayoutUnit logicalHeight; |
| 422 | 414 |
| 423 for (const auto& row : sizingData.rowTracks) | 415 for (const auto& row : sizingData.rowTracks) |
| 424 logicalHeight += row.baseSize(); | 416 logicalHeight += row.baseSize(); |
| 425 | 417 |
| 426 logicalHeight += guttersSize(ForRows, 0, sizingData.rowTracks.size(), | 418 logicalHeight += guttersSize(ForRows, 0, sizingData.rowTracks.size(), |
| 427 sizingData.sizingOperation); | 419 sizingData.sizingOperation); |
| 428 | 420 |
| 429 return logicalHeight; | 421 return logicalHeight; |
| 430 } | 422 } |
| 431 | 423 |
| 432 void LayoutGrid::computeTrackSizesForDefiniteSize( | 424 void LayoutGrid::computeTrackSizesForDefiniteSize( |
| 433 GridTrackSizingDirection direction, | 425 GridTrackSizingDirection direction, |
| 434 GridSizingData& sizingData, | 426 GridSizingData& sizingData, |
| 435 LayoutUnit availableSpace) const { | 427 LayoutUnit availableSpace) const { |
| 436 DCHECK(sizingData.isValidTransition(direction)); | 428 DCHECK(sizingData.isValidTransition(direction)); |
| 437 sizingData.setAvailableSpace(availableSpace); | 429 sizingData.setAvailableSpace(availableSpace); |
| 438 sizingData.freeSpace(direction) = | 430 sizingData.freeSpace(direction) = |
| 439 availableSpace - | 431 availableSpace - |
| 440 guttersSize(direction, 0, | 432 guttersSize(direction, 0, |
| 441 direction == ForRows ? gridRowCount() : gridColumnCount(), | 433 direction == ForRows ? gridRowCount() : gridColumnCount(), |
|
Manuel Rego
2016/11/22 09:57:24
Why you don't use numTracks() here?
| |
| 442 sizingData.sizingOperation); | 434 sizingData.sizingOperation); |
| 443 sizingData.sizingOperation = TrackSizing; | 435 sizingData.sizingOperation = TrackSizing; |
| 444 | 436 |
| 445 LayoutUnit baseSizes, growthLimits; | 437 LayoutUnit baseSizes, growthLimits; |
| 446 computeUsedBreadthOfGridTracks(direction, sizingData, baseSizes, | 438 computeUsedBreadthOfGridTracks(direction, sizingData, baseSizes, |
| 447 growthLimits); | 439 growthLimits); |
| 448 ASSERT(tracksAreWiderThanMinTrackBreadth(direction, sizingData)); | 440 ASSERT(tracksAreWiderThanMinTrackBreadth(direction, sizingData)); |
| 449 sizingData.nextState(); | 441 sizingData.nextState(); |
| 450 } | 442 } |
| 451 | 443 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 } | 498 } |
| 507 | 499 |
| 508 updateLogicalWidth(); | 500 updateLogicalWidth(); |
| 509 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); | 501 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); |
| 510 | 502 |
| 511 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); | 503 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); |
| 512 | 504 |
| 513 updateAutoRepeatTracksAndSetDirtyIfNeeded(TrackSizing); | 505 updateAutoRepeatTracksAndSetDirtyIfNeeded(TrackSizing); |
| 514 placeItemsOnGrid(); | 506 placeItemsOnGrid(); |
| 515 | 507 |
| 516 GridSizingData sizingData(gridColumnCount(), gridRowCount()); | 508 GridSizingData sizingData(numTracks(ForColumns), numTracks(ForRows)); |
| 517 | 509 |
| 518 // 1- First, the track sizing algorithm is used to resolve the sizes of the | 510 // 1- First, the track sizing algorithm is used to resolve the sizes of the |
| 519 // grid columns. | 511 // grid columns. |
| 520 // At this point the logical width is always definite as the above call to | 512 // At this point the logical width is always definite as the above call to |
| 521 // updateLogicalWidth() properly resolves intrinsic sizes. We cannot do the | 513 // updateLogicalWidth() properly resolves intrinsic sizes. We cannot do the |
| 522 // same for heights though because many code paths inside | 514 // same for heights though because many code paths inside |
| 523 // updateLogicalHeight() require a previous call to setLogicalHeight() to | 515 // updateLogicalHeight() require a previous call to setLogicalHeight() to |
| 524 // resolve heights properly (like for positioned items for example). | 516 // resolve heights properly (like for positioned items for example). |
| 525 LayoutUnit availableSpaceForColumns = availableLogicalWidth(); | 517 LayoutUnit availableSpaceForColumns = availableLogicalWidth(); |
| 526 computeTrackSizesForDefiniteSize(ForColumns, sizingData, | 518 computeTrackSizesForDefiniteSize(ForColumns, sizingData, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 return gapAccumulator; | 676 return gapAccumulator; |
| 685 } | 677 } |
| 686 | 678 |
| 687 void LayoutGrid::computeIntrinsicLogicalWidths( | 679 void LayoutGrid::computeIntrinsicLogicalWidths( |
| 688 LayoutUnit& minLogicalWidth, | 680 LayoutUnit& minLogicalWidth, |
| 689 LayoutUnit& maxLogicalWidth) const { | 681 LayoutUnit& maxLogicalWidth) const { |
| 690 const_cast<LayoutGrid*>(this)->updateAutoRepeatTracksAndSetDirtyIfNeeded( | 682 const_cast<LayoutGrid*>(this)->updateAutoRepeatTracksAndSetDirtyIfNeeded( |
| 691 IntrinsicSizeComputation); | 683 IntrinsicSizeComputation); |
| 692 const_cast<LayoutGrid*>(this)->placeItemsOnGrid(); | 684 const_cast<LayoutGrid*>(this)->placeItemsOnGrid(); |
| 693 | 685 |
| 694 GridSizingData sizingData(gridColumnCount(), gridRowCount()); | 686 GridSizingData sizingData(numTracks(ForColumns), numTracks(ForRows)); |
| 695 computeTrackSizesForIndefiniteSize(ForColumns, sizingData, minLogicalWidth, | 687 computeTrackSizesForIndefiniteSize(ForColumns, sizingData, minLogicalWidth, |
| 696 maxLogicalWidth); | 688 maxLogicalWidth); |
| 697 | 689 |
| 698 LayoutUnit scrollbarWidth = LayoutUnit(scrollbarLogicalWidth()); | 690 LayoutUnit scrollbarWidth = LayoutUnit(scrollbarLogicalWidth()); |
| 699 minLogicalWidth += scrollbarWidth; | 691 minLogicalWidth += scrollbarWidth; |
| 700 maxLogicalWidth += scrollbarWidth; | 692 maxLogicalWidth += scrollbarWidth; |
| 701 } | 693 } |
| 702 | 694 |
| 703 void LayoutGrid::computeTrackSizesForIndefiniteSize( | 695 void LayoutGrid::computeTrackSizesForIndefiniteSize( |
| 704 GridTrackSizingDirection direction, | 696 GridTrackSizingDirection direction, |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2021 : area.rows; | 2013 : area.rows; |
| 2022 if (majorAxisPositions.isIndefinite()) | 2014 if (majorAxisPositions.isIndefinite()) |
| 2023 autoMajorAxisAutoGridItems.append(child); | 2015 autoMajorAxisAutoGridItems.append(child); |
| 2024 else | 2016 else |
| 2025 specifiedMajorAxisAutoGridItems.append(child); | 2017 specifiedMajorAxisAutoGridItems.append(child); |
| 2026 continue; | 2018 continue; |
| 2027 } | 2019 } |
| 2028 insertItemIntoGrid(*child, area); | 2020 insertItemIntoGrid(*child, area); |
| 2029 } | 2021 } |
| 2030 | 2022 |
| 2031 DCHECK_GE(gridRowCount(), GridPositionsResolver::explicitGridRowCount( | 2023 #if ENABLE(ASSERT) |
| 2032 *style(), m_autoRepeatRows)); | 2024 if (!m_gridItemArea.isEmpty()) { |
| 2033 DCHECK_GE(gridColumnCount(), GridPositionsResolver::explicitGridColumnCount( | 2025 DCHECK_GE(gridRowCount(), GridPositionsResolver::explicitGridRowCount( |
| 2034 *style(), m_autoRepeatColumns)); | 2026 *style(), m_autoRepeatRows)); |
| 2027 DCHECK_GE(gridColumnCount(), GridPositionsResolver::explicitGridColumnCount( | |
| 2028 *style(), m_autoRepeatColumns)); | |
| 2029 } | |
| 2030 #endif | |
| 2035 | 2031 |
| 2036 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); | 2032 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); |
| 2037 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); | 2033 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); |
| 2038 | 2034 |
| 2039 m_grid.shrinkToFit(); | 2035 m_grid.shrinkToFit(); |
| 2040 | 2036 |
| 2041 // Compute collapsable tracks for auto-fit. | 2037 // Compute collapsable tracks for auto-fit. |
| 2042 m_autoRepeatEmptyColumns = computeEmptyTracksForAutoRepeat(ForColumns); | 2038 m_autoRepeatEmptyColumns = computeEmptyTracksForAutoRepeat(ForColumns); |
| 2043 m_autoRepeatEmptyRows = computeEmptyTracksForAutoRepeat(ForRows); | 2039 m_autoRepeatEmptyRows = computeEmptyTracksForAutoRepeat(ForRows); |
| 2044 | 2040 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2113 } | 2109 } |
| 2114 | 2110 |
| 2115 std::unique_ptr<GridArea> | 2111 std::unique_ptr<GridArea> |
| 2116 LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid( | 2112 LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid( |
| 2117 const LayoutBox& gridItem, | 2113 const LayoutBox& gridItem, |
| 2118 GridTrackSizingDirection specifiedDirection, | 2114 GridTrackSizingDirection specifiedDirection, |
| 2119 const GridSpan& specifiedPositions) const { | 2115 const GridSpan& specifiedPositions) const { |
| 2120 GridTrackSizingDirection crossDirection = | 2116 GridTrackSizingDirection crossDirection = |
| 2121 specifiedDirection == ForColumns ? ForRows : ForColumns; | 2117 specifiedDirection == ForColumns ? ForRows : ForColumns; |
| 2122 const size_t endOfCrossDirection = | 2118 const size_t endOfCrossDirection = |
| 2123 crossDirection == ForColumns ? gridColumnCount() : gridRowCount(); | 2119 crossDirection == ForColumns ? gridColumnCount() : gridRowCount(); |
|
Manuel Rego
2016/11/22 09:57:24
Ditto.
| |
| 2124 size_t crossDirectionSpanSize = | 2120 size_t crossDirectionSpanSize = |
| 2125 GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem, | 2121 GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem, |
| 2126 crossDirection); | 2122 crossDirection); |
| 2127 GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan( | 2123 GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan( |
| 2128 endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize); | 2124 endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize); |
| 2129 return wrapUnique( | 2125 return wrapUnique( |
| 2130 new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions | 2126 new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions |
| 2131 : specifiedPositions, | 2127 : specifiedPositions, |
| 2132 specifiedDirection == ForColumns ? specifiedPositions | 2128 specifiedDirection == ForColumns ? specifiedPositions |
| 2133 : crossDirectionPositions)); | 2129 : crossDirectionPositions)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2198 std::pair<size_t, size_t>& autoPlacementCursor) { | 2194 std::pair<size_t, size_t>& autoPlacementCursor) { |
| 2199 GridSpan minorAxisPositions = | 2195 GridSpan minorAxisPositions = |
| 2200 cachedGridSpan(gridItem, autoPlacementMinorAxisDirection()); | 2196 cachedGridSpan(gridItem, autoPlacementMinorAxisDirection()); |
| 2201 ASSERT(!cachedGridSpan(gridItem, autoPlacementMajorAxisDirection()) | 2197 ASSERT(!cachedGridSpan(gridItem, autoPlacementMajorAxisDirection()) |
| 2202 .isTranslatedDefinite()); | 2198 .isTranslatedDefinite()); |
| 2203 size_t majorAxisSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem( | 2199 size_t majorAxisSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem( |
| 2204 *style(), gridItem, autoPlacementMajorAxisDirection()); | 2200 *style(), gridItem, autoPlacementMajorAxisDirection()); |
| 2205 | 2201 |
| 2206 const size_t endOfMajorAxis = | 2202 const size_t endOfMajorAxis = |
| 2207 (autoPlacementMajorAxisDirection() == ForColumns) ? gridColumnCount() | 2203 (autoPlacementMajorAxisDirection() == ForColumns) ? gridColumnCount() |
| 2208 : gridRowCount(); | 2204 : gridRowCount(); |
|
Manuel Rego
2016/11/22 09:57:24
Ditto.
| |
| 2209 size_t majorAxisAutoPlacementCursor = | 2205 size_t majorAxisAutoPlacementCursor = |
| 2210 autoPlacementMajorAxisDirection() == ForColumns | 2206 autoPlacementMajorAxisDirection() == ForColumns |
| 2211 ? autoPlacementCursor.second | 2207 ? autoPlacementCursor.second |
| 2212 : autoPlacementCursor.first; | 2208 : autoPlacementCursor.first; |
| 2213 size_t minorAxisAutoPlacementCursor = | 2209 size_t minorAxisAutoPlacementCursor = |
| 2214 autoPlacementMajorAxisDirection() == ForColumns | 2210 autoPlacementMajorAxisDirection() == ForColumns |
| 2215 ? autoPlacementCursor.first | 2211 ? autoPlacementCursor.first |
| 2216 : autoPlacementCursor.second; | 2212 : autoPlacementCursor.second; |
| 2217 | 2213 |
| 2218 std::unique_ptr<GridArea> emptyGridArea; | 2214 std::unique_ptr<GridArea> emptyGridArea; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2247 if (emptyGridArea) { | 2243 if (emptyGridArea) { |
| 2248 // Check that it fits in the minor axis direction, as we shouldn't grow | 2244 // Check that it fits in the minor axis direction, as we shouldn't grow |
| 2249 // in that direction here (it was already managed in | 2245 // in that direction here (it was already managed in |
| 2250 // populateExplicitGridAndOrderIterator()). | 2246 // populateExplicitGridAndOrderIterator()). |
| 2251 size_t minorAxisFinalPositionIndex = | 2247 size_t minorAxisFinalPositionIndex = |
| 2252 autoPlacementMinorAxisDirection() == ForColumns | 2248 autoPlacementMinorAxisDirection() == ForColumns |
| 2253 ? emptyGridArea->columns.endLine() | 2249 ? emptyGridArea->columns.endLine() |
| 2254 : emptyGridArea->rows.endLine(); | 2250 : emptyGridArea->rows.endLine(); |
| 2255 const size_t endOfMinorAxis = | 2251 const size_t endOfMinorAxis = |
| 2256 autoPlacementMinorAxisDirection() == ForColumns ? gridColumnCount() | 2252 autoPlacementMinorAxisDirection() == ForColumns ? gridColumnCount() |
| 2257 : gridRowCount(); | 2253 : gridRowCount(); |
|
Manuel Rego
2016/11/22 09:57:24
Ditto.
| |
| 2258 if (minorAxisFinalPositionIndex <= endOfMinorAxis) | 2254 if (minorAxisFinalPositionIndex <= endOfMinorAxis) |
| 2259 break; | 2255 break; |
| 2260 | 2256 |
| 2261 // Discard empty grid area as it does not fit in the minor axis | 2257 // Discard empty grid area as it does not fit in the minor axis |
| 2262 // direction. We don't need to create a new empty grid area yet as we | 2258 // direction. We don't need to create a new empty grid area yet as we |
| 2263 // might find a valid one in the next iteration. | 2259 // might find a valid one in the next iteration. |
| 2264 emptyGridArea = nullptr; | 2260 emptyGridArea = nullptr; |
| 2265 } | 2261 } |
| 2266 | 2262 |
| 2267 // As we're moving to the next track in the major axis we should reset the | 2263 // As we're moving to the next track in the major axis we should reset the |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2538 // tracks per spec. | 2534 // tracks per spec. |
| 2539 int smallestStart = | 2535 int smallestStart = |
| 2540 abs(isForColumns ? m_smallestColumnStart : m_smallestRowStart); | 2536 abs(isForColumns ? m_smallestColumnStart : m_smallestRowStart); |
| 2541 int startLine = positions.untranslatedStartLine() + smallestStart; | 2537 int startLine = positions.untranslatedStartLine() + smallestStart; |
| 2542 int endLine = positions.untranslatedEndLine() + smallestStart; | 2538 int endLine = positions.untranslatedEndLine() + smallestStart; |
| 2543 | 2539 |
| 2544 GridPosition startPosition = isForColumns ? child.style()->gridColumnStart() | 2540 GridPosition startPosition = isForColumns ? child.style()->gridColumnStart() |
| 2545 : child.style()->gridRowStart(); | 2541 : child.style()->gridRowStart(); |
| 2546 GridPosition endPosition = isForColumns ? child.style()->gridColumnEnd() | 2542 GridPosition endPosition = isForColumns ? child.style()->gridColumnEnd() |
| 2547 : child.style()->gridRowEnd(); | 2543 : child.style()->gridRowEnd(); |
| 2548 int lastLine = isForColumns ? gridColumnCount() : gridRowCount(); | 2544 int lastLine = numTracks(direction); |
| 2549 | 2545 |
| 2550 bool startIsAuto = | 2546 bool startIsAuto = |
| 2551 startPosition.isAuto() || | 2547 startPosition.isAuto() || |
| 2552 (startPosition.isNamedGridArea() && | 2548 (startPosition.isNamedGridArea() && |
| 2553 !NamedLineCollection::isValidNamedLineOrArea( | 2549 !NamedLineCollection::isValidNamedLineOrArea( |
| 2554 startPosition.namedGridLine(), styleRef(), | 2550 startPosition.namedGridLine(), styleRef(), |
| 2555 GridPositionsResolver::initialPositionSide(direction))) || | 2551 GridPositionsResolver::initialPositionSide(direction))) || |
| 2556 (startLine < 0) || (startLine > lastLine); | 2552 (startLine < 0) || (startLine > lastLine); |
| 2557 bool endIsAuto = endPosition.isAuto() || | 2553 bool endIsAuto = endPosition.isAuto() || |
| 2558 (endPosition.isNamedGridArea() && | 2554 (endPosition.isNamedGridArea() && |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3494 const LayoutPoint& paintOffset) const { | 3490 const LayoutPoint& paintOffset) const { |
| 3495 if (!m_gridItemArea.isEmpty()) | 3491 if (!m_gridItemArea.isEmpty()) |
| 3496 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 3492 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 3497 } | 3493 } |
| 3498 | 3494 |
| 3499 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { | 3495 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { |
| 3500 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); | 3496 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); |
| 3501 return m_hasDefiniteLogicalHeight.value(); | 3497 return m_hasDefiniteLogicalHeight.value(); |
| 3502 } | 3498 } |
| 3503 | 3499 |
| 3500 size_t LayoutGrid::numTracks(GridTrackSizingDirection direction) const { | |
| 3501 // Due to limitations in our internal representation, we cannot know the | |
| 3502 // number of columns from m_grid *if* there is no row (because m_grid would be | |
| 3503 // empty). That's why in that case we need to get it from the style. Note that | |
| 3504 // we know for sure that there are't any implicit tracks, because not having | |
| 3505 // rows implies that there are no "normal" children (out-of-flow children are | |
| 3506 // not stored in m_grid). | |
| 3507 if (direction == ForRows) | |
| 3508 return m_grid.size(); | |
| 3509 | |
| 3510 return m_grid.size() ? m_grid[0].size() | |
| 3511 : GridPositionsResolver::explicitGridColumnCount( | |
| 3512 styleRef(), m_autoRepeatColumns); | |
| 3513 } | |
| 3514 | |
| 3504 } // namespace blink | 3515 } // namespace blink |
| OLD | NEW |