| Differences between
and this patch
- a/LayoutTests/ChangeLog +9 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-06-28  Robert Hogan  <robert@webkit.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Replaced elements squeezed when width is specified as percentage inside a table with Auto layout
6
        https://bugs.webkit.org/show_bug.cgi?id=29447
7
8
        * fast/replaced/table-percent-width.html: Added.
9
1
2011-06-27  Abhishek Arya  <inferno@chromium.org>
10
2011-06-27  Abhishek Arya  <inferno@chromium.org>
2
11
3
        Reviewed by Simon Fraser.
12
        Reviewed by Simon Fraser.
- a/LayoutTests/fast/replaced/table-percent-width.html +42 lines
Line 0 a/LayoutTests/fast/replaced/table-percent-width.html_sec1
1
<html><body>
2
   <table>
3
    <tr>
4
    <td>
5
      <img src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
6
    </td>
7
    </tr>
8
   </table>
9
10
   <table>
11
    <tr>
12
    <td>
13
      <img src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
14
    </td>
15
    </tr>
16
   </table>
17
18
   <table height="50" width="50" border="1">
19
    <tr>
20
    <td>
21
      <img src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
22
    </td>
23
    </tr>
24
   </table>
25
26
   <table height="50" width="50" border="1">
27
    <tr>
28
    <td>
29
      <img src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
30
    </td>
31
    </tr>
32
   </table>
33
34
   <table height="50" width="50" border="1">
35
    <tr>
36
    <td>
37
      <img src="resources/square-blue-100x100.png" width="100%" height="100%" align="LEFT" border="1">
38
    </td>
39
    </tr>
40
   </table>
41
42
</body></html>
- a/LayoutTests/platform/qt/fast/replaced/table-percent-width-expected.txt +30 lines
Line 0 a/LayoutTests/platform/qt/fast/replaced/table-percent-width-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x600
4
  RenderBlock {HTML} at (0,0) size 800x600
5
    RenderBody {BODY} at (8,8) size 784x584
6
      RenderTable {TABLE} at (0,0) size 111x113
7
        RenderTableSection {TBODY} at (0,0) size 111x113
8
          RenderTableRow {TR} at (0,2) size 111x109
9
            RenderTableCell {TD} at (2,2) size 107x109 [r=0 c=0 rs=1 cs=1]
10
              RenderImage {IMG} at (1,1) size 107x107 [border: (1px solid #000000)]
11
      RenderTable {TABLE} at (0,113) size 109x106
12
        RenderTableSection {TBODY} at (0,0) size 109x106
13
          RenderTableRow {TR} at (0,2) size 109x102
14
            RenderTableCell {TD} at (2,2) size 105x102 [r=0 c=0 rs=1 cs=1]
15
              RenderImage {IMG} at (1,1) size 100x100 [border: (1px solid #000000)]
16
      RenderTable {TABLE} at (0,219) size 50x52 [border: (1px outset #808080)]
17
        RenderTableSection {TBODY} at (1,1) size 48x50
18
          RenderTableRow {TR} at (0,2) size 48x46
19
            RenderTableCell {TD} at (2,2) size 44x46 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
20
              RenderImage {IMG} at (2,2) size 42x42 [border: (1px solid #000000)]
21
      RenderTable {TABLE} at (0,271) size 50x50 [border: (1px outset #808080)]
22
        RenderTableSection {TBODY} at (1,1) size 48x48
23
          RenderTableRow {TR} at (0,2) size 48x44
24
            RenderTableCell {TD} at (2,3) size 44x42 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
25
              RenderImage {IMG} at (2,2) size 38x38 [border: (1px solid #000000)]
26
      RenderTable {TABLE} at (0,321) size 50x50 [border: (1px outset #808080)]
27
        RenderTableSection {TBODY} at (1,1) size 48x48
28
          RenderTableRow {TR} at (0,2) size 48x44
29
            RenderTableCell {TD} at (2,3) size 44x42 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
30
              RenderImage {IMG} at (2,2) size 42x38 [border: (1px solid #000000)]
- a/Source/WebCore/ChangeLog +20 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-06-28  Robert Hogan  <robert@webkit.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Replaced elements squeezed when width is specified as percentage inside a table with Auto layout
6
        https://bugs.webkit.org/show_bug.cgi?id=29447
7
8
        If inserting a 'replaced' element (e.g. image, plugin) in a table cell that is not descendant from
9
        a block with fixed layout then do not squeeze the element, let it use its intrinsic width and height.
10
11
        Test: fast/replaced/table-percent-width.html
12
13
        * rendering/RenderBox.cpp:
14
        (WebCore::avoidSqueezingWidth):
15
        (WebCore::avoidSqueezingHeight):
16
        (WebCore::RenderBox::containingBlockReplacedLogicalWidthForContent):
17
        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
18
        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
19
        * rendering/RenderBox.h:
20
1
2011-06-27  Abhishek Arya  <inferno@chromium.org>
21
2011-06-27  Abhishek Arya  <inferno@chromium.org>
2
22
3
        Reviewed by Simon Fraser.
23
        Reviewed by Simon Fraser.
- a/Source/WebCore/rendering/RenderBox.cpp -9 / +38 lines
Lines 1175-1180 IntRect RenderBox::clipRect(const IntPoint& location) a/Source/WebCore/rendering/RenderBox.cpp_sec1
1175
    return clipRect;
1175
    return clipRect;
1176
}
1176
}
1177
1177
1178
static bool avoidSqueezingWidth(RenderBlock* cb)
1179
{
1180
    while (cb && !cb->isRenderView()) {
1181
        if (!cb->style()->logicalWidth().isAuto() && !cb->style()->logicalWidth().isPercent())
1182
            return false;
1183
        cb = cb->containingBlock();
1184
    }
1185
    return true;
1186
}
1187
1188
static bool avoidSqueezingHeight(RenderBlock* cb)
1189
{
1190
    while (cb && !cb->isRenderView()) {
1191
        if (!cb->style()->logicalHeight().isAuto() && !cb->style()->logicalHeight().isPercent())
1192
            return false;
1193
        cb = cb->containingBlock();
1194
    }
1195
    return true;
1196
}
1197
1198
int RenderBox::containingBlockReplacedLogicalWidthForContent() const
1199
{
1200
    RenderBlock* cb = containingBlock();
1201
    if (cb->isTableCell()) {
1202
        // Don't let table cells squeeze percent-height replaced elements
1203
        // <http://bugs.webkit.org/show_bug.cgi?id=29447>
1204
        if (avoidSqueezingWidth(cb))
1205
            return max(shrinkToAvoidFloats() ? cb->availableLogicalWidthForLine(y(), false) : cb->availableLogicalWidth(), intrinsicLogicalWidth());
1206
    }
1207
    return containingBlockLogicalWidthForContent();
1208
}
1209
1178
int RenderBox::containingBlockLogicalWidthForContent() const
1210
int RenderBox::containingBlockLogicalWidthForContent() const
1179
{
1211
{
1180
    RenderBlock* cb = containingBlock();
1212
    RenderBlock* cb = containingBlock();
Lines 1954-1960 int RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const a/Source/WebCore/rendering/RenderBox.cpp_sec2
1954
            // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
1986
            // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
1955
            // containing block's block-flow.
1987
            // containing block's block-flow.
1956
            // https://bugs.webkit.org/show_bug.cgi?id=46496
1988
            // https://bugs.webkit.org/show_bug.cgi?id=46496
1957
            const int cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
1989
            const int cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockReplacedLogicalWidthForContent();
1958
            if (cw > 0)
1990
            if (cw > 0)
1959
                return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
1991
                return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
1960
        }
1992
        }
Lines 2014-2027 int RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const a/Source/WebCore/rendering/RenderBox.cpp_sec3
2014
                // table cells using percentage heights.
2046
                // table cells using percentage heights.
2015
                // FIXME: This needs to be made block-flow-aware.  If the cell and image are perpendicular block-flows, this isn't right.
2047
                // FIXME: This needs to be made block-flow-aware.  If the cell and image are perpendicular block-flows, this isn't right.
2016
                // https://bugs.webkit.org/show_bug.cgi?id=46997
2048
                // https://bugs.webkit.org/show_bug.cgi?id=46997
2017
                while (cb && !cb->isRenderView() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercent())) {
2049
                if (cb->isTableCell() && avoidSqueezingHeight(toRenderBlock(cb))) {
2018
                    if (cb->isTableCell()) {
2050
                    // Don't let table cells squeeze percent-height replaced elements
2019
                        // Don't let table cells squeeze percent-height replaced elements
2051
                    // <http://bugs.webkit.org/show_bug.cgi?id=15359>
2020
                        // <http://bugs.webkit.org/show_bug.cgi?id=15359>
2052
                    availableHeight = max(availableHeight, intrinsicLogicalHeight());
2021
                        availableHeight = max(availableHeight, intrinsicLogicalHeight());
2053
                    return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
2022
                        return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
2023
                    }
2024
                    cb = cb->containingBlock();
2025
                }
2054
                }
2026
            }
2055
            }
2027
            return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
2056
            return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
- a/Source/WebCore/rendering/RenderBox.h +1 lines
Lines 287-292 public: a/Source/WebCore/rendering/RenderBox.h_sec1
287
287
288
    virtual int containingBlockLogicalWidthForContent() const;
288
    virtual int containingBlockLogicalWidthForContent() const;
289
    int perpendicularContainingBlockLogicalHeight() const;
289
    int perpendicularContainingBlockLogicalHeight() const;
290
    int containingBlockReplacedLogicalWidthForContent() const;
290
    
291
    
291
    virtual void computeLogicalWidth();
292
    virtual void computeLogicalWidth();
292
    virtual void computeLogicalHeight();
293
    virtual void computeLogicalHeight();

Return to Bug 29447