haikuwebkit/LayoutTests/fast/css-grid-layout/implicit-tracks-before-expl...

113 lines
498 B
Plaintext
Raw Permalink Normal View History

[css-grid] Initial support for implicit grid before explicit grid https://bugs.webkit.org/show_bug.cgi?id=155014 Reviewed by Darin Adler. Source/WebCore: Change GridSpan to store int instead of unsigned. This allows us to resolve positions before the explicit grid with negative values. This patch adds a new type of GridSpan called "Untranslated". This type is only used in populateExplicitGridAndOrderIterator(). Where we store the smallest negative position in both axis. Then the GridSpans are translated into positive values, using the offset calculated before. This is done in placeItemsOnGrid() and from that moment the rest of the code uses "Definite" GridSpans, which returns only positive positions (unsigned instead of int). This allows us to don't have to modify the rest of the code, as it keeps using GridSpans as before. Let's use an example to explain how it works. Imagine that we've a 2 columns grid and 2 items placed like: * Item A: grid-column: -5; * Item B: grid-column: 1; Initially we'll use "Unstranslated" GridSpans with the following values: * Item A: GridSpan(-2, -1) * Item B: GridSpan(0, 1) Then we'll translate them using the smallest position as offset (-2) so we've "Definite" GridSpans: * Item A: GridSpan(0, 1) * Item B: GridSpan(2, 3) Test: fast/css-grid-layout/implicit-tracks-before-explicit.html * css/CSSParser.cpp: (WebCore::CSSParser::parseGridTemplateAreasRow): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): (WebCore::RenderGrid::gridTrackSize): (WebCore::RenderGrid::insertItemIntoGrid): (WebCore::RenderGrid::placeItemsOnGrid): (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid): (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): (WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid): Deleted. (WebCore::RenderGrid::layoutPositionedObject): Deleted. * rendering/RenderGrid.h: * rendering/style/GridCoordinate.h: (WebCore::GridSpan::untranslatedDefiniteGridSpan): (WebCore::GridSpan::translatedDefiniteGridSpan): (WebCore::GridSpan::integerSpan): (WebCore::GridSpan::untranslatedResolvedInitialPosition): (WebCore::GridSpan::untranslatedResolvedFinalPosition): (WebCore::GridSpan::resolvedInitialPosition): (WebCore::GridSpan::resolvedFinalPosition): (WebCore::GridSpan::begin): (WebCore::GridSpan::end): (WebCore::GridSpan::isTranslatedDefinite): (WebCore::GridSpan::isIndefinite): (WebCore::GridSpan::translate): (WebCore::GridSpan::GridSpan): (WebCore::GridSpan::operator==): Deleted. (WebCore::GridSpan::GridSpanIterator::GridSpanIterator): Deleted. (WebCore::GridSpan::GridSpanIterator::operator unsigned&): Deleted. * rendering/style/GridResolvedPosition.cpp: (WebCore::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition): (WebCore::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition): (WebCore::resolveNamedGridLinePositionAgainstOppositePosition): (WebCore::resolveGridPositionAgainstOppositePosition): (WebCore::resolveGridPositionFromStyle): (WebCore::GridResolvedPosition::resolveGridPositionsFromStyle): (WebCore::GridResolvedPosition::spanSizeForAutoPlacedItem): Deleted. LayoutTests: Updated results in current tests and added specific test for this. * fast/css-grid-layout/grid-auto-flow-resolution.html: * fast/css-grid-layout/grid-item-negative-position-resolution.html: * fast/css-grid-layout/grid-item-spanning-resolution.html: * fast/css-grid-layout/implicit-tracks-before-explicit-expected.txt: Added. * fast/css-grid-layout/implicit-tracks-before-explicit.html: Added. Canonical link: https://commits.webkit.org/173329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 10:15:23 +00:00
This test checks that it's possible to create implicit tracks before the explicit ones using negative indexes.
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
PASS
X
XX
XXX
XXXX
XXXXX
PASS
X
XX
XXX
XXXX
XXXXX
PASS