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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 248 |
| 249 struct GridItemsSpanGroupRange { | 249 struct GridItemsSpanGroupRange { |
| 250 Vector<GridItemWithSpan>::iterator rangeStart; | 250 Vector<GridItemWithSpan>::iterator rangeStart; |
| 251 Vector<GridItemWithSpan>::iterator rangeEnd; | 251 Vector<GridItemWithSpan>::iterator rangeEnd; |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 LayoutGrid::LayoutGrid(Element* element) | 254 LayoutGrid::LayoutGrid(Element* element) |
| 255 : LayoutBlock(element) | 255 : LayoutBlock(element) |
| 256 , m_gridIsDirty(true) | 256 , m_gridIsDirty(true) |
| 257 , m_orderIterator(this) | 257 , m_orderIterator(this) |
| 258 , m_minContentHeight(-1) | |
| 259 , m_maxContentHeight(-1) | |
| 258 { | 260 { |
| 259 ASSERT(!childrenInline()); | 261 ASSERT(!childrenInline()); |
| 260 } | 262 } |
| 261 | 263 |
| 262 LayoutGrid::~LayoutGrid() | 264 LayoutGrid::~LayoutGrid() |
| 263 { | 265 { |
| 264 } | 266 } |
| 265 | 267 |
| 266 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) | 268 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
| 267 { | 269 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 return oldStyle.gridTemplateColumns().size() != styleRef().gridTemplateColum ns().size() | 303 return oldStyle.gridTemplateColumns().size() != styleRef().gridTemplateColum ns().size() |
| 302 || oldStyle.gridTemplateRows().size() != styleRef().gridTemplateRows().s ize(); | 304 || oldStyle.gridTemplateRows().size() != styleRef().gridTemplateRows().s ize(); |
| 303 } | 305 } |
| 304 | 306 |
| 305 bool LayoutGrid::namedGridLinesDefinitionDidChange(const ComputedStyle& oldStyle ) const | 307 bool LayoutGrid::namedGridLinesDefinitionDidChange(const ComputedStyle& oldStyle ) const |
| 306 { | 308 { |
| 307 return oldStyle.namedGridRowLines() != styleRef().namedGridRowLines() | 309 return oldStyle.namedGridRowLines() != styleRef().namedGridRowLines() |
| 308 || oldStyle.namedGridColumnLines() != styleRef().namedGridColumnLines(); | 310 || oldStyle.namedGridColumnLines() != styleRef().namedGridColumnLines(); |
| 309 } | 311 } |
| 310 | 312 |
| 313 void LayoutGrid::computeGridTrackSizes(GridSizingData& sizingData, LayoutUnit& f reeSpaceForColumns, LayoutUnit& freeSpaceForRows) | |
| 314 { | |
| 315 freeSpaceForColumns = contentLogicalWidth(); | |
| 316 computeUsedBreadthOfGridTracks(ForColumns, sizingData, freeSpaceForColumns); | |
| 317 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); | |
| 318 | |
| 319 freeSpaceForRows = computeContentAndScrollbarLogicalHeightUsing(MainOrPrefer redSize, style()->logicalHeight(), -1); | |
| 320 computeUsedBreadthOfGridTracks(ForRows, sizingData, freeSpaceForRows); | |
| 321 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); | |
| 322 } | |
| 323 | |
| 324 LayoutUnit LayoutGrid::computeTrackBasedLogicalHeight(const GridSizingData& sizi ngData) const | |
| 325 { | |
| 326 LayoutUnit logicalHeight = borderAndPaddingLogicalHeight() + scrollbarLogica lHeight(); | |
| 327 | |
| 328 for (const auto& row : sizingData.rowTracks) | |
| 329 logicalHeight += row.baseSize(); | |
| 330 | |
| 331 return logicalHeight; | |
| 332 } | |
| 333 | |
| 334 void LayoutGrid::updateLogicalHeightDependentGridTracks(const LayoutUnit& trackB asedLogicalHeight, GridSizingData& sizingData, LayoutUnit& availableSpaceForRows ) | |
|
jfernandez
2015/10/19 10:46:22
Which are those dependent tracks ? This function w
svillar
2015/10/19 12:14:20
We need to rerun the algorithm, and it'll indeed u
| |
| 335 { | |
| 336 LayoutUnit contentHeight = contentLogicalHeight(); | |
| 337 if (trackBasedLogicalHeight == contentHeight) | |
| 338 return; | |
| 339 | |
| 340 availableSpaceForRows = contentHeight; | |
| 341 computeUsedBreadthOfGridTracks(ForRows, sizingData, availableSpaceForRows); | |
| 342 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); | |
| 343 } | |
| 344 | |
| 311 void LayoutGrid::layoutBlock(bool relayoutChildren) | 345 void LayoutGrid::layoutBlock(bool relayoutChildren) |
| 312 { | 346 { |
| 313 ASSERT(needsLayout()); | 347 ASSERT(needsLayout()); |
| 314 | 348 |
| 315 if (!relayoutChildren && simplifiedLayout()) | 349 if (!relayoutChildren && simplifiedLayout()) |
| 316 return; | 350 return; |
| 317 | 351 |
| 318 // FIXME: Much of this method is boiler plate that matches LayoutBox::layout Block and Layout*FlexibleBox::layoutBlock. | |
| 319 // It would be nice to refactor some of the duplicate code. | |
| 320 { | 352 { |
| 321 // LayoutState needs this deliberate scope to pop before updating scroll information (which | 353 // LayoutState needs this deliberate scope to pop before updating scroll information (which |
| 322 // may trigger relayout). | 354 // may trigger relayout). |
| 323 LayoutState state(*this, locationOffset()); | 355 LayoutState state(*this, locationOffset()); |
| 324 | 356 |
| 325 LayoutSize previousSize = size(); | 357 LayoutSize previousSize = size(); |
| 326 | 358 |
| 327 setLogicalHeight(0); | |
| 328 updateLogicalWidth(); | 359 updateLogicalWidth(); |
| 329 | 360 |
| 330 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); | 361 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); |
| 331 | 362 |
| 332 layoutGridItems(); | 363 placeItemsOnGrid(); |
| 364 | |
| 365 // TODO(svillar): move freeSpaceRows|Columns to GridSizingData. | |
| 366 LayoutUnit freeSpaceForRows; | |
| 367 LayoutUnit freeSpaceForColumns; | |
| 368 GridSizingData sizingData(gridColumnCount(), gridRowCount()); | |
| 369 computeGridTrackSizes(sizingData, freeSpaceForColumns, freeSpaceForRows) ; | |
| 333 | 370 |
| 334 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 371 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
| 372 LayoutUnit trackBasedLogicalHeight = computeTrackBasedLogicalHeight(sizi ngData); | |
| 373 setLogicalHeight(trackBasedLogicalHeight); | |
| 374 | |
| 335 updateLogicalHeight(); | 375 updateLogicalHeight(); |
| 336 | 376 |
| 377 // The above call might have changed the grid's logical height depending on min|max height restrictions. | |
| 378 // Update the sizes of the rows whose size depends on the logical height (also on definite|indefinite sizes). | |
| 379 updateLogicalHeightDependentGridTracks(trackBasedLogicalHeight, sizingDa ta, freeSpaceForRows); | |
| 380 | |
| 381 applyStretchAlignmentToTracksIfNeeded(ForColumns, sizingData, freeSpaceF orColumns); | |
| 382 applyStretchAlignmentToTracksIfNeeded(ForRows, sizingData, freeSpaceForR ows); | |
| 383 | |
| 384 layoutGridItems(sizingData, freeSpaceForColumns, freeSpaceForRows); | |
| 385 | |
| 337 if (size() != previousSize) | 386 if (size() != previousSize) |
| 338 relayoutChildren = true; | 387 relayoutChildren = true; |
| 339 | 388 |
| 340 layoutPositionedObjects(relayoutChildren || isDocumentElement()); | 389 layoutPositionedObjects(relayoutChildren || isDocumentElement()); |
| 341 | 390 |
| 342 computeOverflow(oldClientAfterEdge); | 391 computeOverflow(oldClientAfterEdge); |
| 343 } | 392 } |
| 344 | 393 |
| 345 updateLayerTransformAfterLayout(); | 394 updateLayerTransformAfterLayout(); |
| 346 updateScrollInfoAfterLayout(); | 395 updateScrollInfoAfterLayout(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 362 | 411 |
| 363 minLogicalWidth += minTrackBreadth; | 412 minLogicalWidth += minTrackBreadth; |
| 364 maxLogicalWidth += maxTrackBreadth; | 413 maxLogicalWidth += maxTrackBreadth; |
| 365 } | 414 } |
| 366 | 415 |
| 367 LayoutUnit scrollbarWidth = intrinsicScrollbarLogicalWidth(); | 416 LayoutUnit scrollbarWidth = intrinsicScrollbarLogicalWidth(); |
| 368 minLogicalWidth += scrollbarWidth; | 417 minLogicalWidth += scrollbarWidth; |
| 369 maxLogicalWidth += scrollbarWidth; | 418 maxLogicalWidth += scrollbarWidth; |
| 370 } | 419 } |
| 371 | 420 |
| 421 LayoutUnit LayoutGrid::computeIntrinsicLogicalContentHeightUsing(const Length& l ogicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPaddi ng) const | |
| 422 { | |
| 423 if (logicalHeightLength.isMinContent()) | |
| 424 return m_minContentHeight; | |
| 425 | |
| 426 if (logicalHeightLength.isMaxContent()) | |
|
jfernandez
2015/10/19 10:46:22
Current LayoutBox: logic doesn't implement the new
svillar
2015/10/19 12:14:20
Yes it does implement the min/max-content, it's ju
| |
| 427 return m_maxContentHeight; | |
| 428 | |
| 429 if (logicalHeightLength.isFitContent()) { | |
| 430 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig ht(ExcludeMarginBorderPadding); | |
| 431 return std::min<LayoutUnit>(m_maxContentHeight, std::max<LayoutUnit>(m_m inContentHeight, fillAvailableExtent)); | |
| 432 } | |
| 433 | |
| 434 if (logicalHeightLength.isFillAvailable()) | |
| 435 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd ing) - borderAndPadding; | |
| 436 ASSERT_NOT_REACHED(); | |
| 437 return 0; | |
| 438 } | |
| 439 | |
| 440 LayoutUnit LayoutGrid::computeContentAndScrollbarLogicalHeightUsing(SizeType hei ghtType, const Length& height, LayoutUnit intrinsicContentHeight) const | |
| 441 { | |
| 442 // The grid container’s auto block size is its max-content size. | |
| 443 if (height.isAuto()) | |
| 444 return heightType == MinSize ? LayoutUnit(0) : m_maxContentHeight + scro llbarLogicalHeight(); | |
| 445 | |
| 446 if (height.isIntrinsic()) | |
| 447 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten tHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight(); | |
| 448 | |
| 449 return LayoutBox::computeContentAndScrollbarLogicalHeightUsing(heightType, h eight, intrinsicContentHeight); | |
| 450 } | |
| 451 | |
| 372 bool LayoutGrid::gridElementIsShrinkToFit() | 452 bool LayoutGrid::gridElementIsShrinkToFit() |
| 373 { | 453 { |
| 374 return isFloatingOrOutOfFlowPositioned(); | 454 return isFloatingOrOutOfFlowPositioned(); |
| 375 } | 455 } |
| 376 | 456 |
| 377 static inline double normalizedFlexFraction(const GridTrack& track, double flexF actor) | 457 static inline double normalizedFlexFraction(const GridTrack& track, double flexF actor) |
| 378 { | 458 { |
| 379 return track.baseSize() / std::max<double>(1, flexFactor); | 459 return track.baseSize() / std::max<double>(1, flexFactor); |
| 380 } | 460 } |
| 381 | 461 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 400 if (trackSize.isContentSized()) | 480 if (trackSize.isContentSized()) |
| 401 sizingData.contentSizedTracksIndex.append(i); | 481 sizingData.contentSizedTracksIndex.append(i); |
| 402 if (trackSize.maxTrackBreadth().isFlex()) | 482 if (trackSize.maxTrackBreadth().isFlex()) |
| 403 flexibleSizedTracksIndex.append(i); | 483 flexibleSizedTracksIndex.append(i); |
| 404 } | 484 } |
| 405 | 485 |
| 406 // 2. Resolve content-based TrackSizingFunctions. | 486 // 2. Resolve content-based TrackSizingFunctions. |
| 407 if (!sizingData.contentSizedTracksIndex.isEmpty()) | 487 if (!sizingData.contentSizedTracksIndex.isEmpty()) |
| 408 resolveContentBasedTrackSizingFunctions(direction, sizingData); | 488 resolveContentBasedTrackSizingFunctions(direction, sizingData); |
| 409 | 489 |
| 490 LayoutUnit totalBaseSizes = 0; | |
| 491 LayoutUnit totalGrowthLimits = 0; | |
| 492 | |
| 410 for (const auto& track: tracks) { | 493 for (const auto& track: tracks) { |
| 411 ASSERT(!track.infiniteGrowthPotential()); | 494 ASSERT(!track.infiniteGrowthPotential()); |
| 412 freeSpace -= track.baseSize(); | 495 totalBaseSizes += track.baseSize(); |
| 496 totalGrowthLimits += track.growthLimit(); | |
| 497 } | |
| 498 freeSpace = initialFreeSpace - totalBaseSizes; | |
| 499 | |
| 500 // Cache our intrinisc heights so that we could resolve them properly in com puteIntrinsicLogicalContentHeightUsing(). | |
| 501 if (direction == ForRows) { | |
| 502 m_minContentHeight = totalBaseSizes; | |
| 503 m_maxContentHeight = totalGrowthLimits; | |
| 413 } | 504 } |
| 414 | 505 |
| 415 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? style()->lo gicalHeight().isAuto() : gridElementIsShrinkToFit(); | 506 // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though. |
| 507 if (hasLineIfEmpty()) { | |
|
Manuel Rego
2015/10/09 14:38:35
Do we need this if "direction == ForColumns"?
Oth
svillar
2015/10/19 12:14:20
Will do that.
| |
| 508 m_minContentHeight = std::max(m_minContentHeight, minimumLogicalHeightFo rEmptyLine()); | |
| 509 m_maxContentHeight = std::max(m_maxContentHeight, m_minContentHeight); | |
| 510 } | |
| 416 | 511 |
| 512 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? initialFree Space == -1 : false; | |
| 417 if (!hasUndefinedRemainingSpace && freeSpace <= 0) | 513 if (!hasUndefinedRemainingSpace && freeSpace <= 0) |
| 418 return; | 514 return; |
| 419 | 515 |
| 420 // 3. Grow all Grid tracks in GridTracks from their baseSize up to their gro wthLimit value until freeSpace is exhausted. | 516 // 3. Grow all Grid tracks in GridTracks from their baseSize up to their gro wthLimit value until freeSpace is exhausted. |
| 421 const size_t tracksSize = tracks.size(); | 517 const size_t tracksSize = tracks.size(); |
| 422 if (!hasUndefinedRemainingSpace) { | 518 if (!hasUndefinedRemainingSpace) { |
| 423 Vector<GridTrack*> tracksForDistribution(tracksSize); | 519 Vector<GridTrack*> tracksForDistribution(tracksSize); |
| 424 for (size_t i = 0; i < tracksSize; ++i) { | 520 for (size_t i = 0; i < tracksSize; ++i) { |
| 425 tracksForDistribution[i] = tracks.data() + i; | 521 tracksForDistribution[i] = tracks.data() + i; |
| 426 tracksForDistribution[i]->setPlannedSize(tracksForDistribution[i]->b aseSize()); | 522 tracksForDistribution[i]->setPlannedSize(tracksForDistribution[i]->b aseSize()); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 457 continue; | 553 continue; |
| 458 | 554 |
| 459 flexFraction = std::max(flexFraction, findFlexFactorUnitSize(tra cks, span, direction, maxContentForChild(*gridItem, direction, sizingData.column Tracks))); | 555 flexFraction = std::max(flexFraction, findFlexFactorUnitSize(tra cks, span, direction, maxContentForChild(*gridItem, direction, sizingData.column Tracks))); |
| 460 } | 556 } |
| 461 } | 557 } |
| 462 } | 558 } |
| 463 | 559 |
| 464 for (const auto& trackIndex : flexibleSizedTracksIndex) { | 560 for (const auto& trackIndex : flexibleSizedTracksIndex) { |
| 465 GridTrackSize trackSize = gridTrackSize(direction, trackIndex); | 561 GridTrackSize trackSize = gridTrackSize(direction, trackIndex); |
| 466 | 562 |
| 467 LayoutUnit baseSize = std::max<LayoutUnit>(tracks[trackIndex].baseSize() , flexFraction * trackSize.maxTrackBreadth().flex()); | 563 LayoutUnit oldBaseSize = tracks[trackIndex].baseSize(); |
| 468 tracks[trackIndex].setBaseSize(baseSize); | 564 LayoutUnit baseSize = std::max<LayoutUnit>(oldBaseSize, flexFraction * t rackSize.maxTrackBreadth().flex()); |
| 469 freeSpace -= baseSize; | 565 if (LayoutUnit increment = baseSize - oldBaseSize) { |
| 566 tracks[trackIndex].setBaseSize(baseSize); | |
| 567 freeSpace -= increment; | |
|
Manuel Rego
2015/10/09 14:38:35
We're changing this regarding the previous code
th
jfernandez
2015/10/19 10:46:22
Wow, that changes seems like a bug fix, but why we
svillar
2015/10/19 12:14:20
Because we need very specific tests for that, as t
| |
| 568 | |
| 569 if (direction == ForRows) | |
| 570 m_maxContentHeight += increment; | |
| 571 } | |
| 470 } | 572 } |
| 471 | 573 |
| 472 // FIXME: Should ASSERT flexible tracks exhaust the freeSpace ? (see issue 7 39613002). | 574 // FIXME: Should ASSERT flexible tracks exhaust the freeSpace ? (see issue 7 39613002). |
| 473 } | 575 } |
| 474 | 576 |
| 475 LayoutUnit LayoutGrid::computeUsedBreadthOfMinLength(GridTrackSizingDirection di rection, const GridLength& gridLength) const | 577 LayoutUnit LayoutGrid::computeUsedBreadthOfMinLength(GridTrackSizingDirection di rection, const GridLength& gridLength) const |
| 476 { | 578 { |
| 477 if (gridLength.isFlex()) | 579 if (gridLength.isFlex()) |
| 478 return 0; | 580 return 0; |
| 479 | 581 |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1279 return; | 1381 return; |
| 1280 | 1382 |
| 1281 LayoutUnit sizeToIncrease = availableSpace / numberOfAutoSizedTracks; | 1383 LayoutUnit sizeToIncrease = availableSpace / numberOfAutoSizedTracks; |
| 1282 for (const auto& trackIndex : autoSizedTracksIndex) { | 1384 for (const auto& trackIndex : autoSizedTracksIndex) { |
| 1283 GridTrack* track = tracks.data() + trackIndex; | 1385 GridTrack* track = tracks.data() + trackIndex; |
| 1284 LayoutUnit baseSize = track->baseSize() + sizeToIncrease; | 1386 LayoutUnit baseSize = track->baseSize() + sizeToIncrease; |
| 1285 track->setBaseSize(baseSize); | 1387 track->setBaseSize(baseSize); |
| 1286 } | 1388 } |
| 1287 } | 1389 } |
| 1288 | 1390 |
| 1289 void LayoutGrid::layoutGridItems() | 1391 void LayoutGrid::layoutGridItems(GridSizingData& sizingData, LayoutUnit& freeSpa ceForColumns, LayoutUnit& freeSpaceForRows) |
| 1290 { | 1392 { |
| 1291 placeItemsOnGrid(); | 1393 populateGridPositions(sizingData, freeSpaceForColumns, freeSpaceForRows); |
| 1292 | |
| 1293 LayoutUnit availableSpaceForColumns = availableLogicalWidth(); | |
| 1294 LayoutUnit availableSpaceForRows = availableLogicalHeight(IncludeMarginBorde rPadding); | |
| 1295 GridSizingData sizingData(gridColumnCount(), gridRowCount()); | |
| 1296 computeUsedBreadthOfGridTracks(ForColumns, sizingData, availableSpaceForColu mns); | |
| 1297 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); | |
| 1298 computeUsedBreadthOfGridTracks(ForRows, sizingData, availableSpaceForRows); | |
| 1299 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); | |
| 1300 | |
| 1301 applyStretchAlignmentToTracksIfNeeded(ForColumns, sizingData, availableSpace ForColumns); | |
| 1302 applyStretchAlignmentToTracksIfNeeded(ForRows, sizingData, availableSpaceFor Rows); | |
| 1303 | |
| 1304 populateGridPositions(sizingData, availableSpaceForColumns, availableSpaceFo rRows); | |
| 1305 m_gridItemsOverflowingGridArea.resize(0); | 1394 m_gridItemsOverflowingGridArea.resize(0); |
| 1306 | 1395 |
| 1307 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | 1396 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { |
| 1308 if (child->isOutOfFlowPositioned()) { | 1397 if (child->isOutOfFlowPositioned()) { |
| 1309 prepareChildForPositionedLayout(*child); | 1398 prepareChildForPositionedLayout(*child); |
| 1310 continue; | 1399 continue; |
| 1311 } | 1400 } |
| 1312 | 1401 |
| 1313 // Because the grid area cannot be styled, we don't need to adjust | 1402 // Because the grid area cannot be styled, we don't need to adjust |
| 1314 // the grid breadth to account for 'box-sizing'. | 1403 // the grid breadth to account for 'box-sizing'. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1338 ASSERT(coordinate.rows.resolvedInitialPosition.toInt() < sizingData.rowT racks.size()); | 1427 ASSERT(coordinate.rows.resolvedInitialPosition.toInt() < sizingData.rowT racks.size()); |
| 1339 #endif | 1428 #endif |
| 1340 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); | 1429 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); |
| 1341 | 1430 |
| 1342 // Keep track of children overflowing their grid area as we might need t o paint them even if the grid-area is | 1431 // Keep track of children overflowing their grid area as we might need t o paint them even if the grid-area is |
| 1343 // not visible | 1432 // not visible |
| 1344 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight | 1433 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight |
| 1345 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt h) | 1434 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt h) |
| 1346 m_gridItemsOverflowingGridArea.append(child); | 1435 m_gridItemsOverflowingGridArea.append(child); |
| 1347 } | 1436 } |
| 1348 | |
| 1349 for (const auto& row : sizingData.rowTracks) | |
| 1350 setLogicalHeight(logicalHeight() + row.baseSize()); | |
| 1351 | |
| 1352 LayoutUnit height = logicalHeight() + borderAndPaddingLogicalHeight() + scro llbarLogicalHeight(); | |
| 1353 if (hasLineIfEmpty()) | |
| 1354 height = std::max(height, minimumLogicalHeightForEmptyLine()); | |
| 1355 | |
| 1356 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. | |
| 1357 setLogicalHeight(height); | |
| 1358 } | 1437 } |
| 1359 | 1438 |
| 1360 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) | 1439 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) |
| 1361 { | 1440 { |
| 1362 ASSERT(child.isOutOfFlowPositioned()); | 1441 ASSERT(child.isOutOfFlowPositioned()); |
| 1363 child.containingBlock()->insertPositionedObject(&child); | 1442 child.containingBlock()->insertPositionedObject(&child); |
| 1364 | 1443 |
| 1365 DeprecatedPaintLayer* childLayer = child.layer(); | 1444 DeprecatedPaintLayer* childLayer = child.layer(); |
| 1366 childLayer->setStaticInlinePosition(borderAndPaddingStart()); | 1445 childLayer->setStaticInlinePosition(borderAndPaddingStart()); |
| 1367 childLayer->setStaticBlockPosition(borderAndPaddingBefore()); | 1446 childLayer->setStaticBlockPosition(borderAndPaddingBefore()); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1903 | 1982 |
| 1904 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 1983 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
| 1905 } | 1984 } |
| 1906 | 1985 |
| 1907 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) | 1986 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) |
| 1908 { | 1987 { |
| 1909 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 1988 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 1910 } | 1989 } |
| 1911 | 1990 |
| 1912 } // namespace blink | 1991 } // namespace blink |
| OLD | NEW |