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

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

Issue 2430663002: [css-grid] Use firstInFlowChildBox API for iterate over the grid items (Closed)
Patch Set: Created 4 years, 2 months 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // information (which may trigger relayout). 485 // information (which may trigger relayout).
486 LayoutState state(*this, locationOffset()); 486 LayoutState state(*this, locationOffset());
487 487
488 LayoutSize previousSize = size(); 488 LayoutSize previousSize = size();
489 489
490 // We need to clear both own and containingBlock override sizes to 490 // We need to clear both own and containingBlock override sizes to
491 // ensure we get the same result when grid's intrinsic size is 491 // ensure we get the same result when grid's intrinsic size is
492 // computed again in the updateLogicalWidth call bellow. 492 // computed again in the updateLogicalWidth call bellow.
493 if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) || 493 if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) ||
494 styleRef().logicalWidth().isIntrinsicOrAuto()) { 494 styleRef().logicalWidth().isIntrinsicOrAuto()) {
495 for (auto* child = firstChildBox(); child; 495 for (auto* child = firstInFlowChildBox(); child;
496 child = child->nextInFlowSiblingBox()) { 496 child = child->nextInFlowSiblingBox()) {
497 if (child->isOutOfFlowPositioned() || !isOrthogonalChild(*child)) 497 if (!isOrthogonalChild(*child))
498 continue; 498 continue;
499 child->clearOverrideSize(); 499 child->clearOverrideSize();
500 child->clearContainingBlockOverrideSize(); 500 child->clearContainingBlockOverrideSize();
501 child->forceLayout(); 501 child->forceLayout();
502 } 502 }
503 } 503 }
504 504
505 updateLogicalWidth(); 505 updateLogicalWidth();
506 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); 506 m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight();
507 507
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 1988
1989 m_smallestRowStart = m_smallestColumnStart = 0; 1989 m_smallestRowStart = m_smallestColumnStart = 0;
1990 1990
1991 size_t maximumRowIndex = 1991 size_t maximumRowIndex =
1992 GridPositionsResolver::explicitGridRowCount(*style(), m_autoRepeatRows); 1992 GridPositionsResolver::explicitGridRowCount(*style(), m_autoRepeatRows);
1993 size_t maximumColumnIndex = GridPositionsResolver::explicitGridColumnCount( 1993 size_t maximumColumnIndex = GridPositionsResolver::explicitGridColumnCount(
1994 *style(), m_autoRepeatColumns); 1994 *style(), m_autoRepeatColumns);
1995 1995
1996 ASSERT(m_gridItemsIndexesMap.isEmpty()); 1996 ASSERT(m_gridItemsIndexesMap.isEmpty());
1997 size_t childIndex = 0; 1997 size_t childIndex = 0;
1998 for (LayoutBox* child = firstChildBox(); child; 1998 for (LayoutBox* child = firstInFlowChildBox(); child;
1999 child = child->nextInFlowSiblingBox()) { 1999 child = child->nextInFlowSiblingBox()) {
2000 if (child->isOutOfFlowPositioned())
2001 continue;
2002
2003 populator.collectChild(child); 2000 populator.collectChild(child);
2004 m_gridItemsIndexesMap.set(child, childIndex++); 2001 m_gridItemsIndexesMap.set(child, childIndex++);
2005 2002
2006 // This function bypasses the cache (cachedGridArea()) as it is used to 2003 // This function bypasses the cache (cachedGridArea()) as it is used to
2007 // build it. 2004 // build it.
2008 GridSpan rowPositions = 2005 GridSpan rowPositions =
2009 GridPositionsResolver::resolveGridPositionsFromStyle( 2006 GridPositionsResolver::resolveGridPositionsFromStyle(
2010 *style(), *child, ForRows, m_autoRepeatRows); 2007 *style(), *child, ForRows, m_autoRepeatRows);
2011 GridSpan columnPositions = 2008 GridSpan columnPositions =
2012 GridPositionsResolver::resolveGridPositionsFromStyle( 2009 GridPositionsResolver::resolveGridPositionsFromStyle(
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 if (!m_gridItemArea.isEmpty()) 3319 if (!m_gridItemArea.isEmpty())
3323 GridPainter(*this).paintChildren(paintInfo, paintOffset); 3320 GridPainter(*this).paintChildren(paintInfo, paintOffset);
3324 } 3321 }
3325 3322
3326 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { 3323 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const {
3327 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); 3324 SECURITY_DCHECK(m_hasDefiniteLogicalHeight);
3328 return m_hasDefiniteLogicalHeight.value(); 3325 return m_hasDefiniteLogicalHeight.value();
3329 } 3326 }
3330 3327
3331 } // namespace blink 3328 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698