Changeset 128389 in webkit


Ignore:
Timestamp:
Sep 12, 2012 5:30:07 PM (12 years ago)
Author:
jchaffraix@webkit.org
Message:

REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
https://bugs.webkit.org/show_bug.cgi?id=95892

Reviewed by Ojan Vafai.

Source/WebCore:

r122501 exposed an issue in how preferred logical widths are computed on replaced objects. The code relies on the
logical width computation methods. Unfortunately the previous code relies on the layout information, which may not
be up-to-date during preferred logical width computation.

Test: fast/table/bad-replaced-sizing-preferred-logical-widths.html

fast/replaced/vertical-writing-mode-max-logical-width.html

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::computeMaxPreferredLogicalWidth):
Added this helper method. The main difference with the old code is that it handles the percent logical width
properly before calling the old code path. This is not totally right but before forking the whole code, it's
better to have more evidence that forking preferred logical widths and logical width computation is the way to go.

(WebCore::RenderReplaced::computePreferredLogicalWidths):
Changed to call computeMaxPreferredLogicalWidth. Also fixed an existing bug in vertical-writing modes where we would
add the wrong paddings and borders.

  • rendering/RenderReplaced.h:

(RenderReplaced): Added computeMaxPreferredLogicalWidth.

LayoutTests:

  • fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt: Added.
  • fast/replaced/vertical-writing-mode-max-logical-width-replaced.html: Added.
  • fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt: Added.
  • fast/table/bad-replaced-sizing-preferred-logical-widths.html: Added.
  • fast/table/resources/iframe.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128388 r128389  
     12012-09-12  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
     4        https://bugs.webkit.org/show_bug.cgi?id=95892
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt: Added.
     9        * fast/replaced/vertical-writing-mode-max-logical-width-replaced.html: Added.
     10        * fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt: Added.
     11        * fast/table/bad-replaced-sizing-preferred-logical-widths.html: Added.
     12        * fast/table/resources/iframe.html: Added.
     13
    1142012-09-12  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r128387 r128389  
     12012-09-12  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
     4        https://bugs.webkit.org/show_bug.cgi?id=95892
     5
     6        Reviewed by Ojan Vafai.
     7
     8        r122501 exposed an issue in how preferred logical widths are computed on replaced objects. The code relies on the
     9        logical width computation methods. Unfortunately the previous code relies on the layout information, which may not
     10        be up-to-date during preferred logical width computation.
     11
     12        Test: fast/table/bad-replaced-sizing-preferred-logical-widths.html
     13              fast/replaced/vertical-writing-mode-max-logical-width.html
     14
     15        * rendering/RenderReplaced.cpp:
     16        (WebCore::RenderReplaced::computeMaxPreferredLogicalWidth):
     17        Added this helper method. The main difference with the old code is that it handles the percent logical width
     18        properly before calling the old code path. This is not totally right but before forking the whole code, it's
     19        better to have more evidence that forking preferred logical widths and logical width computation is the way to go.
     20
     21        (WebCore::RenderReplaced::computePreferredLogicalWidths):
     22        Changed to call computeMaxPreferredLogicalWidth. Also fixed an existing bug in vertical-writing modes where we would
     23        add the wrong paddings and borders.
     24
     25        * rendering/RenderReplaced.h:
     26        (RenderReplaced): Added computeMaxPreferredLogicalWidth.
     27
    1282012-09-12  Max Vujovic  <mvujovic@adobe.com>
    229
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r128201 r128389  
    438438}
    439439
     440LayoutUnit RenderReplaced::computeMaxPreferredLogicalWidth() const
     441{
     442    Length logicalWidth = style()->logicalWidth();
     443
     444    // We cannot resolve any percent logical width here as the available logical
     445    // width may not be set on our containing block.
     446    if (logicalWidth.isPercent())
     447        return intrinsicLogicalWidth();
     448
     449    // FIXME: We shouldn't be calling a logical width computing function in preferred
     450    // logical widths computation as the layout information is probably invalid.
     451    return computeReplacedLogicalWidth(false);
     452}
     453
    440454void RenderReplaced::computePreferredLogicalWidths()
    441455{
    442456    ASSERT(preferredLogicalWidthsDirty());
    443457
    444     LayoutUnit borderAndPadding = borderAndPaddingWidth();
    445     m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding;
     458    LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
     459    m_maxPreferredLogicalWidth = computeMaxPreferredLogicalWidth() + borderAndPadding;
    446460
    447461    if (style()->maxWidth().isFixed())
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r123183 r128389  
    6868    virtual bool canHaveChildren() const { return false; }
    6969
     70    LayoutUnit computeMaxPreferredLogicalWidth() const;
    7071    virtual void computePreferredLogicalWidths();
    7172    virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { }
Note: See TracChangeset for help on using the changeset viewer.