Changeset 124671 in webkit


Ignore:
Timestamp:
Aug 3, 2012 4:36:05 PM (12 years ago)
Author:
jchaffraix@webkit.org
Message:

Implement computePreferredLogicalWidths on RenderGrid
https://bugs.webkit.org/show_bug.cgi?id=92908

Reviewed by Ojan Vafai.

Source/WebCore:

This functions implements a primitive computePreferredLogicalWidths
so that we properly handle vertical writing modes.

Covered by fast/css-grid-layout/place-cell-by-index.html.

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::computePreferredLogicalWidths):

  • rendering/RenderGrid.h:

Added computePreferredLogicalWidths.

LayoutTests:

  • fast/css-grid-layout/place-cell-by-index-expected.txt:

Updated the expected file (everything passes now).

  • fast/css-grid-layout/place-cell-by-index.html:

Removed some FIXMEs and added one about the expected offsets making
a wrong assumption. It's fine to keep this testing until we support
this part of the spec.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r124668 r124671  
     12012-08-03  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Implement computePreferredLogicalWidths on RenderGrid
     4        https://bugs.webkit.org/show_bug.cgi?id=92908
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * fast/css-grid-layout/place-cell-by-index-expected.txt:
     9        Updated the expected file (everything passes now).
     10        * fast/css-grid-layout/place-cell-by-index.html:
     11        Removed some FIXMEs and added one about the expected offsets making
     12        a wrong assumption. It's fine to keep this testing until we support
     13        this part of the spec.
     14
    1152012-08-03  Arnaud Renevier  <a.renevier@sisa.samsung.com>
    216
  • trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index-expected.txt

    r122747 r124671  
    33PASS
    44PASS
    5 FAIL:
    6 Expected 110 for height, but got 15.
    7 
    8 <div class="grid" style="-webkit-writing-mode: vertical-rl; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
    9     <div id="a" data-offset-x="40" data-offset-y="0"></div>
    10     <div id="b" data-offset-x="40" data-offset-y="50"></div>
    11     <div id="c" data-offset-x="20" data-offset-y="0"></div>
    12     <div id="d" data-offset-x="20" data-offset-y="50"></div>
    13 </div>
    14 FAIL:
    15 Expected 110 for height, but got 15.
    16 
    17 <div class="grid" style="-webkit-writing-mode: vertical-lr; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
    18     <div id="a" data-offset-x="0" data-offset-y="0"></div>
    19     <div id="b" data-offset-x="0" data-offset-y="50"></div>
    20     <div id="c" data-offset-x="20" data-offset-y="0"></div>
    21     <div id="d" data-offset-x="20" data-offset-y="50"></div>
    22 </div>
     5PASS
     6PASS
  • trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index.html

    r122747 r124671  
    5050<p>Test some simple grid layouts by positioning grid items by index.</p>
    5151
     52<!-- FIXME: The offsets assumes that grid-{column|row}-align are set to 'start', not 'stretch' (the default). Fix
     53     them once we properly implement stretching / alignment. -->
    5254<div style="position: relative">
    5355<div class="grid" data-expected-width="110" data-expected-height="50">
     
    6971
    7072<div style="position: relative">
    71 <!-- FIXME: The height of the grid is wrong because we need to implement computePreferredLogicalWidths(). -->
    7273<div class="grid" style="-webkit-writing-mode: vertical-rl; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
    7374    <div id="a" data-offset-x="40" data-offset-y="0"></div>
     
    7980
    8081<div style="position: relative">
    81 <!-- FIXME: The height of the grid is wrong because we need to implement computePreferredLogicalWidths(). -->
    8282<div class="grid" style="-webkit-writing-mode: vertical-lr; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
    8383    <div id="a" data-offset-x="0" data-offset-y="0"></div>
  • trunk/Source/WebCore/ChangeLog

    r124668 r124671  
     12012-08-03  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Implement computePreferredLogicalWidths on RenderGrid
     4        https://bugs.webkit.org/show_bug.cgi?id=92908
     5
     6        Reviewed by Ojan Vafai.
     7
     8        This functions implements a primitive computePreferredLogicalWidths
     9        so that we properly handle vertical writing modes.
     10
     11        Covered by fast/css-grid-layout/place-cell-by-index.html.
     12
     13        * rendering/RenderGrid.cpp:
     14        (WebCore::RenderGrid::computePreferredLogicalWidths):
     15        * rendering/RenderGrid.h:
     16        Added computePreferredLogicalWidths.
     17
    1182012-08-03  Arnaud Renevier  <a.renevier@sisa.samsung.com>
    219
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r124168 r124671  
    108108}
    109109
     110void RenderGrid::computePreferredLogicalWidths()
     111{
     112    ASSERT(preferredLogicalWidthsDirty());
     113
     114    m_minPreferredLogicalWidth = 0;
     115    m_maxPreferredLogicalWidth = 0;
     116
     117    // FIXME: We don't take our own logical width into account.
     118
     119    const Vector<Length>& trackStyles = style()->gridColumns();
     120
     121    for (size_t i = 0; i < trackStyles.size(); ++i) {
     122        Length trackLength = trackStyles[i];
     123        if (!trackLength.isFixed()) {
     124            notImplemented();
     125            continue;
     126        }
     127
     128        m_minPreferredLogicalWidth += trackLength.intValue();
     129        m_maxPreferredLogicalWidth += trackLength.intValue();
     130    }
     131
     132    // FIXME: We should account for min / max logical width.
     133
     134    // FIXME: Include borders and paddings in inline direction.
     135
     136    setPreferredLogicalWidthsDirty(false);
     137}
     138
    110139void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, Vector<GridTrack>& tracks)
    111140{
  • trunk/Source/WebCore/rendering/RenderGrid.h

    r122747 r124671  
    3939
    4040    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE;
     41    virtual void computePreferredLogicalWidths() OVERRIDE;
    4142
    4243    virtual bool avoidsFloats() const OVERRIDE { return true; }
Note: See TracChangeset for help on using the changeset viewer.