Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2513953002: [css-grid] Avoid double loop in positioned objects layout (Closed)
Patch Set: New version overriding layoutPositionedObjects() Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 2484
2485 void LayoutGrid::layoutPositionedObjects(bool relayoutChildren, 2485 void LayoutGrid::layoutPositionedObjects(bool relayoutChildren,
2486 PositionedLayoutBehavior info) { 2486 PositionedLayoutBehavior info) {
2487 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); 2487 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects();
2488 if (!positionedDescendants) 2488 if (!positionedDescendants)
2489 return; 2489 return;
2490 2490
2491 for (auto* child : *positionedDescendants) { 2491 for (auto* child : *positionedDescendants) {
2492 if (isOrthogonalChild(*child)) { 2492 if (isOrthogonalChild(*child)) {
2493 // FIXME: Properly support orthogonal writing mode. 2493 // FIXME: Properly support orthogonal writing mode.
2494 layoutPositionedObject(child, relayoutChildren, info);
2494 continue; 2495 continue;
2495 } 2496 }
2496 2497
2497 LayoutUnit columnOffset = LayoutUnit(); 2498 LayoutUnit columnOffset = LayoutUnit();
2498 LayoutUnit columnBreadth = LayoutUnit(); 2499 LayoutUnit columnBreadth = LayoutUnit();
2499 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, 2500 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset,
2500 columnBreadth); 2501 columnBreadth);
2501 LayoutUnit rowOffset = LayoutUnit(); 2502 LayoutUnit rowOffset = LayoutUnit();
2502 LayoutUnit rowBreadth = LayoutUnit(); 2503 LayoutUnit rowBreadth = LayoutUnit();
2503 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadth); 2504 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadth);
2504 2505
2505 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); 2506 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth);
2506 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); 2507 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth);
2507 child->setExtraInlineOffset(columnOffset); 2508 child->setExtraInlineOffset(columnOffset);
2508 child->setExtraBlockOffset(rowOffset); 2509 child->setExtraBlockOffset(rowOffset);
2509 2510
2510 if (child->parent() == this) { 2511 if (child->parent() == this) {
2511 PaintLayer* childLayer = child->layer(); 2512 PaintLayer* childLayer = child->layer();
2512 childLayer->setStaticInlinePosition(borderStart() + columnOffset); 2513 childLayer->setStaticInlinePosition(borderStart() + columnOffset);
2513 childLayer->setStaticBlockPosition(borderBefore() + rowOffset); 2514 childLayer->setStaticBlockPosition(borderBefore() + rowOffset);
2514 } 2515 }
2516
2517 layoutPositionedObject(child, relayoutChildren, info);
2515 } 2518 }
2516
2517 LayoutBlock::layoutPositionedObjects(relayoutChildren, info);
2518 } 2519 }
2519 2520
2520 void LayoutGrid::offsetAndBreadthForPositionedChild( 2521 void LayoutGrid::offsetAndBreadthForPositionedChild(
2521 const LayoutBox& child, 2522 const LayoutBox& child,
2522 GridTrackSizingDirection direction, 2523 GridTrackSizingDirection direction,
2523 LayoutUnit& offset, 2524 LayoutUnit& offset,
2524 LayoutUnit& breadth) { 2525 LayoutUnit& breadth) {
2525 ASSERT(!isOrthogonalChild(child)); 2526 ASSERT(!isOrthogonalChild(child));
2526 bool isForColumns = direction == ForColumns; 2527 bool isForColumns = direction == ForColumns;
2527 2528
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 if (!m_gridItemArea.isEmpty()) 3496 if (!m_gridItemArea.isEmpty())
3496 GridPainter(*this).paintChildren(paintInfo, paintOffset); 3497 GridPainter(*this).paintChildren(paintInfo, paintOffset);
3497 } 3498 }
3498 3499
3499 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { 3500 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const {
3500 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); 3501 SECURITY_DCHECK(m_hasDefiniteLogicalHeight);
3501 return m_hasDefiniteLogicalHeight.value(); 3502 return m_hasDefiniteLogicalHeight.value();
3502 } 3503 }
3503 3504
3504 } // namespace blink 3505 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698