Ignore:
Timestamp:
Aug 28, 2013, 9:48:53 AM (12 years ago)
Author:
sergio@webkit.org
Message:

[CSS Grid Layout] Handle 'span' positions during layout
https://bugs.webkit.org/show_bug.cgi?id=119756

Reviewed by Andreas Kling.

From Blink r149133 by <jchaffraix@chromium.org>

Source/WebCore:

Properly handle the 'span' keyword during layout. We only had
parsing support so far but with this change we are able to
recognize these positions and act accordingly.

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::resolveGridPositionsFromStyle):
(WebCore::RenderGrid::resolveGridPositionAgainstOppositePosition):

  • rendering/RenderGrid.h:
  • rendering/style/GridPosition.h:

(WebCore::GridPosition::shouldBeResolvedAgainstOppositePosition):

LayoutTests:

Added some new test cases to verify that we properly resolve
'span' positions.

  • fast/css-grid-layout/grid-item-negative-position-resolution-expected.txt:
  • fast/css-grid-layout/grid-item-negative-position-resolution.html:
  • fast/css-grid-layout/grid-item-spanning-resolution-expected.txt:
  • fast/css-grid-layout/grid-item-spanning-resolution.html:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution.html

    r154731 r154753  
    4949    -webkit-grid-column: 3 / 4;
    5050    -webkit-grid-row: 3 / 4;
     51}
     52
     53.firstRowSpanning3SecondColumn {
     54    -webkit-grid-column: 2;
     55    -webkit-grid-row: 1 / span 3;
     56}
     57
     58.thirdRowSecondColumnSpanning2 {
     59    -webkit-grid-column: 2 / span 2;
     60    -webkit-grid-row: 3;
     61}
     62
     63.spanning3Row5SecondColumn {
     64    -webkit-grid-column: 2;
     65    -webkit-grid-row: span 3 / 5;
     66}
     67
     68.thirdRowSpanning2Column3 {
     69    -webkit-grid-column: span 2 / 3;
     70    -webkit-grid-row: 3;
     71}
     72
     73.underflowSpanning {
     74    -webkit-grid-column: span 3 / 3;
     75    -webkit-grid-row: span 8 / 4;
    5176}
    5277</style>
     
    127152    <div class="sizedToGridArea thirdRowThirdColumnNoSpan" data-offset-x="100" data-offset-y="50" data-expected-width="50" data-expected-height="25"></div>
    128153</div>
     154
     155<div style="position: relative">
     156<div class="grid" id="bigGrid" data-expected-width="200" data-expected-height="100">
     157    <div class="sizedToGridArea firstRowSpanning3SecondColumn" data-offset-x="50" data-offset-y="0" data-expected-width="50" data-expected-height="75"></div>
     158</div>
     159</div>
     160
     161<div style="position: relative">
     162<div class="grid" id="bigGrid" data-expected-width="200" data-expected-height="100">
     163    <div class="sizedToGridArea thirdRowSecondColumnSpanning2" data-offset-x="50" data-offset-y="50" data-expected-width="100" data-expected-height="25"></div>
     164</div>
     165
     166<div style="position: relative">
     167<div class="grid" id="bigGrid" data-expected-width="200" data-expected-height="100">
     168    <div class="sizedToGridArea spanning3Row5SecondColumn" data-offset-x="50" data-offset-y="25" data-expected-width="50" data-expected-height="75"></div>
     169</div>
     170</div>
     171
     172<div style="position: relative">
     173<div class="grid" id="bigGrid" data-expected-width="200" data-expected-height="100">
     174    <div class="sizedToGridArea thirdRowSpanning2Column3" data-offset-x="0" data-offset-y="50" data-expected-width="100" data-expected-height="25"></div>
     175</div>
     176
     177<div style="position: relative">
     178<div class="grid" id="bigGrid" data-expected-width="200" data-expected-height="100">
     179    <div class="sizedToGridArea underflowSpanning" data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="75"></div>
     180</div>
     181
    129182</body>
    130183</html>
Note: See TracChangeset for help on using the changeset viewer.