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

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: 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
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 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 2475
2476 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) { 2476 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) {
2477 ASSERT(child.isOutOfFlowPositioned()); 2477 ASSERT(child.isOutOfFlowPositioned());
2478 child.containingBlock()->insertPositionedObject(&child); 2478 child.containingBlock()->insertPositionedObject(&child);
2479 2479
2480 PaintLayer* childLayer = child.layer(); 2480 PaintLayer* childLayer = child.layer();
2481 childLayer->setStaticInlinePosition(borderAndPaddingStart()); 2481 childLayer->setStaticInlinePosition(borderAndPaddingStart());
2482 childLayer->setStaticBlockPosition(borderAndPaddingBefore()); 2482 childLayer->setStaticBlockPosition(borderAndPaddingBefore());
2483 } 2483 }
2484 2484
2485 void LayoutGrid::layoutPositionedObjects(bool relayoutChildren, 2485 void LayoutGrid::layoutPositionedObject(LayoutBox* child,
jfernandez 2016/11/18 16:18:22 Ditto.
2486 PositionedLayoutBehavior info) { 2486 bool relayoutChildren,
2487 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); 2487 PositionedLayoutBehavior info) {
2488 if (!positionedDescendants) 2488 if (!isOrthogonalChild(*child)) {
2489 return; 2489 // FIXME: Properly support orthogonal writing mode.
2490
2491 for (auto* child : *positionedDescendants) {
2492 if (isOrthogonalChild(*child)) {
2493 // FIXME: Properly support orthogonal writing mode.
2494 continue;
2495 }
2496 2490
2497 LayoutUnit columnOffset = LayoutUnit(); 2491 LayoutUnit columnOffset = LayoutUnit();
2498 LayoutUnit columnBreadth = LayoutUnit(); 2492 LayoutUnit columnBreadth = LayoutUnit();
2499 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, 2493 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset,
2500 columnBreadth); 2494 columnBreadth);
2501 LayoutUnit rowOffset = LayoutUnit(); 2495 LayoutUnit rowOffset = LayoutUnit();
2502 LayoutUnit rowBreadth = LayoutUnit(); 2496 LayoutUnit rowBreadth = LayoutUnit();
2503 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadth); 2497 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadth);
2504 2498
2505 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); 2499 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth);
2506 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); 2500 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth);
2507 child->setExtraInlineOffset(columnOffset); 2501 child->setExtraInlineOffset(columnOffset);
2508 child->setExtraBlockOffset(rowOffset); 2502 child->setExtraBlockOffset(rowOffset);
2509 2503
2510 if (child->parent() == this) { 2504 if (child->parent() == this) {
2511 PaintLayer* childLayer = child->layer(); 2505 PaintLayer* childLayer = child->layer();
2512 childLayer->setStaticInlinePosition(borderStart() + columnOffset); 2506 childLayer->setStaticInlinePosition(borderStart() + columnOffset);
2513 childLayer->setStaticBlockPosition(borderBefore() + rowOffset); 2507 childLayer->setStaticBlockPosition(borderBefore() + rowOffset);
2514 } 2508 }
2515 } 2509 }
2516 2510
2517 LayoutBlock::layoutPositionedObjects(relayoutChildren, info); 2511 LayoutBlock::layoutPositionedObject(child, relayoutChildren, info);
2518 } 2512 }
2519 2513
2520 void LayoutGrid::offsetAndBreadthForPositionedChild( 2514 void LayoutGrid::offsetAndBreadthForPositionedChild(
2521 const LayoutBox& child, 2515 const LayoutBox& child,
2522 GridTrackSizingDirection direction, 2516 GridTrackSizingDirection direction,
2523 LayoutUnit& offset, 2517 LayoutUnit& offset,
2524 LayoutUnit& breadth) { 2518 LayoutUnit& breadth) {
2525 ASSERT(!isOrthogonalChild(child)); 2519 ASSERT(!isOrthogonalChild(child));
2526 bool isForColumns = direction == ForColumns; 2520 bool isForColumns = direction == ForColumns;
2527 2521
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 if (!m_gridItemArea.isEmpty()) 3489 if (!m_gridItemArea.isEmpty())
3496 GridPainter(*this).paintChildren(paintInfo, paintOffset); 3490 GridPainter(*this).paintChildren(paintInfo, paintOffset);
3497 } 3491 }
3498 3492
3499 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { 3493 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const {
3500 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); 3494 SECURITY_DCHECK(m_hasDefiniteLogicalHeight);
3501 return m_hasDefiniteLogicalHeight.value(); 3495 return m_hasDefiniteLogicalHeight.value();
3502 } 3496 }
3503 3497
3504 } // namespace blink 3498 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698