Changeset 19717 in webkit


Ignore:
Timestamp:
Feb 19, 2007, 5:41:26 PM (18 years ago)
Author:
hyatt
Message:

Fix for Radar 4981605, regression where button grows randomly when a select is
opened. With the new form controls, the WinIE quirk for using line width
ended up being used for them more.

This patch removes the quirk after verifying that Firefox doesn't implement
the quirk at all. usesLineWidth is being renamed to shrinksToAvoidFloats to
make it clear that the new method only applies to block objects that avoid floats
and that have auto width.

Also fixed a regression where whitespace after a floating <select> at the start
of a block got incorrectly rendered. Make sure skipWhitespace always skips
through floating/positioned elements regardless of the whitespace setting (this
way the white-space:pre value on floating <select>s doesn't cause trouble).

Reviewed by darin

fast/block/float/float-avoidance.html

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::collapseMargins): (WebCore::RenderBlock::clearFloatsIfNeeded): (WebCore::RenderBlock::layoutBlockChildren): (WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::containingBlockWidth):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::shrinkToAvoidFloats):
  • rendering/RenderObject.h:
  • rendering/bidi.cpp: (WebCore::RenderBlock::skipWhitespace):
Location:
trunk
Files:
4 added
60 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/block/float/001-expected.checksum

    r11995 r19717  
    1 1e213edf86af12cb76c772971d212f18
     12e381c086dcbe2557cc33f703289db96
  • trunk/LayoutTests/fast/block/float/002-expected.checksum

    r11995 r19717  
    1 a8790b5dce1dc2206f2328db682476cc
     159a3e0054803b21a872b12d02104f4e7
  • trunk/LayoutTests/fast/block/float/003-expected.checksum

    r11995 r19717  
    1 c905989ed4b43a61441a64d78604d1a4
     18e5ff5cc798e907ad6efce9e1872078a
  • trunk/LayoutTests/fast/block/float/004-expected.checksum

    r11995 r19717  
    1 e9dc64b4a20112c13454c9263bb8292e
     1ea0fb2f0a1e7d23a1d172191d2ad11b1
  • trunk/LayoutTests/fast/block/float/005-expected.checksum

    r11995 r19717  
    1 7411d6491e67b55d955d06a60bd4685f
     1484ba8786294e3d52deb206740fc03d9
  • trunk/LayoutTests/fast/block/float/006-expected.checksum

    r11995 r19717  
    1 1ebd4d6d97960399012b8fb0c0cdf904
     1e2a5e5b74350912119aa141e2f627fd9
  • trunk/LayoutTests/fast/block/float/007-expected.checksum

    r11995 r19717  
    1 8be95e11606ecf169dfeea218d1fb078
     1779b6ae32a13a45d86949b72cbadf4a3
  • trunk/LayoutTests/fast/block/float/008-expected.checksum

    r12842 r19717  
    1 d727c60bb4ee994b1f9c0b82028348c3
     1d3d1230681fa6260543a8414472aac43
  • trunk/LayoutTests/fast/block/float/009-expected.checksum

    r11995 r19717  
    1 8b6179afaf0e29a94f479b8357163e62
     1ca4733645a8b642b86a3229fa4b8307f
  • trunk/LayoutTests/fast/block/float/010-expected.checksum

    r11995 r19717  
    1 e3f8bc2da1f0ae8d5cc06f24049e5707
     1144c665160e660e6365bb632bd8cb8df
  • trunk/LayoutTests/fast/block/float/011-expected.checksum

    r11995 r19717  
    1 c6159de0a027283ef08c2caaaf026721
     18c4dcf4fd72f7d4194077c71fea3c0f9
  • trunk/LayoutTests/fast/block/float/012-expected.checksum

    r11995 r19717  
    1 dc7cf68b07eac1ee5fff3f1e6fd5ed14
     1703ee64c9fe9f8745fa36b0f441ae645
  • trunk/LayoutTests/fast/block/float/013-expected.checksum

    r19696 r19717  
    1 f069ee9081d2de062f2c9e90efa023b9
     176249c23fcdddcecf3cdb08b2120b225
  • trunk/LayoutTests/fast/block/float/014-expected.checksum

    r11995 r19717  
    1 402c40d2d9915db7cee9e40012973031
     1c0e418c07b3e8b36679401f51c7fc06c
  • trunk/LayoutTests/fast/block/float/015-expected.checksum

    r13918 r19717  
    1 d264dfe059bdbb978d6f7168ea4e202d
     1d5c6ffbb94ab964401d540a3f8705a46
  • trunk/LayoutTests/fast/block/float/016-expected.checksum

    r11995 r19717  
    1 7ab0bf08fd711624f9e351decbe16987
     19d25c866be5f6dd01b1b0211d571673b
  • trunk/LayoutTests/fast/block/float/017-expected.checksum

    r11995 r19717  
    1 e3bee7e2a2dc19cf5af51dcdb3e0c9c5
     13abe36efdb3c7ed8b826ce1f1fb54afc
  • trunk/LayoutTests/fast/block/float/018-expected.checksum

    r11995 r19717  
    1 796993e6941e7283d981c05d241efd52
     1ea41c5000cf369d6451ba271ae792e5d
  • trunk/LayoutTests/fast/block/float/019-expected.checksum

    r15011 r19717  
    1 685234c43e59b6bd3b35d325c1813a0d
     10a8c14f9b38fbe02a67014c46e90f805
  • trunk/LayoutTests/fast/block/float/020-expected.checksum

    r11995 r19717  
    1 fe6033f27279aa17cd35579062a6eb47
     121ba9ce2839494ad94023cbc9c8035b4
  • trunk/LayoutTests/fast/block/float/021-expected.checksum

    r12842 r19717  
    1 a67dcf2413b14b555294fad8e4d57452
     13c97a0f357bbcc19ec738436fa90b308
  • trunk/LayoutTests/fast/block/float/022-expected.checksum

    r11995 r19717  
    1 7231a79f7834f9b781afabf3349a9359
     1e04dd9f04059e0f53e8d10cc792a76f7
  • trunk/LayoutTests/fast/block/float/023-expected.checksum

    r11995 r19717  
    1 fcf89a75e066581e8f343c5f5ca41b81
     1a6698185d9b433d76f864ea6aadf5fbc
  • trunk/LayoutTests/fast/block/float/024-expected.checksum

    r11995 r19717  
    1 6d5c20d736862c0bd0a42bf9acedc804
     14f45f3124055c067c4af816e9b7ad7fa
  • trunk/LayoutTests/fast/block/float/025-expected.checksum

    r13918 r19717  
    1 7e490e91059bb904ebf6f5feb46e5fcf
     11166645fb13ba1e5e2865fa635d655bd
  • trunk/LayoutTests/fast/block/float/025-expected.txt

    r14684 r19717  
    3131      RenderBlock {DIV} at (0,1016) size 769x200
    3232        RenderBlock (floating) {DIV} at (0,0) size 200x200 [bgcolor=#FF0000]
    33         RenderBlock {HR} at (200,0) size 286x2 [border: (1px inset #000000)]
     33        RenderBlock {HR} at (200,0) size 386x2 [border: (1px inset #000000)]
    3434      RenderBlock {DIV} at (0,1216) size 769x200
    3535        RenderBlock (floating) {DIV} at (0,0) size 200x200 [bgcolor=#FF0000]
    36         RenderImage {IMG} at (200,0) size 284x50 [bgcolor=#008000]
     36        RenderImage {IMG} at (200,0) size 384x50 [bgcolor=#008000]
    3737layer at (208,208) size 569x55 clip at (210,210) size 550x36
    3838  RenderBlock {DIV} at (200,0) size 569x55 [border: (2px solid #0000FF)]
     
    4040      text run at (2,2) width 543: "This is an overflow:scroll region. It should sit on the same line as the float and wrap as"
    4141      text run at (2,20) width 283: "needed to fit within the remaining line width."
    42 layer at (208,816) size 288x91 clip at (210,818) size 269x72
    43   RenderBlock {DIV} at (200,0) size 288x91 [border: (2px solid #0000FF)]
    44     RenderText {#text} at (2,2) size 267x72
    45       text run at (2,2) width 267: "This is an overflow:scroll region. It should"
    46       text run at (2,20) width 255: "sit on the same line as the float and wrap"
    47       text run at (2,38) width 256: "as needed to fit within the remaining line"
    48       text run at (2,56) width 40: "width."
     42layer at (208,816) size 388x73 clip at (210,818) size 369x54
     43  RenderBlock {DIV} at (200,0) size 388x73 [border: (2px solid #0000FF)]
     44    RenderText {#text} at (2,2) size 364x54
     45      text run at (2,2) width 364: "This is an overflow:scroll region. It should sit on the same"
     46      text run at (2,20) width 324: "line as the float and wrap as needed to fit within the"
     47      text run at (2,38) width 134: "remaining line width."
  • trunk/LayoutTests/fast/block/float/026-expected.checksum

    r13918 r19717  
    1 c598902996ebe99e5ea8a409be69d4e7
     1feefb7a18aaa48528f61911306da91f5
  • trunk/LayoutTests/fast/block/float/026-expected.txt

    r14684 r19717  
    3333      RenderBlock {DIV} at (0,1016) size 769x200
    3434        RenderBlock (floating) {DIV} at (569,0) size 200x200 [bgcolor=#FF0000]
    35         RenderBlock {HR} at (283,0) size 286x2 [border: (1px inset #000000)]
     35        RenderBlock {HR} at (183,0) size 386x2 [border: (1px inset #000000)]
    3636      RenderBlock {DIV} at (0,1216) size 769x200
    3737        RenderBlock (floating) {DIV} at (569,0) size 200x200 [bgcolor=#FF0000]
    38         RenderImage {IMG} at (285,0) size 284x50 [bgcolor=#008000]
     38        RenderImage {IMG} at (185,0) size 384x50 [bgcolor=#008000]
    3939layer at (8,208) size 569x55 clip at (10,210) size 550x36
    4040  RenderBlock {DIV} at (0,0) size 569x55 [border: (2px solid #0000FF)]
     
    4343      text run at (269,20) width 4 RTL: "."
    4444      text run at (273,20) width 279: "needed to fit within the remaining line width"
    45 layer at (289,816) size 288x91 clip at (291,818) size 269x72
    46   RenderBlock {DIV} at (281,0) size 288x91 [border: (2px solid #0000FF)]
    47     RenderText {#text} at (4,2) size 267x72
    48       text run at (4,2) width 267: "This is an overflow:scroll region. It should"
    49       text run at (16,20) width 255: "sit on the same line as the float and wrap"
    50       text run at (15,38) width 256: "as needed to fit within the remaining line"
    51       text run at (231,56) width 4 RTL: "."
    52       text run at (235,56) width 36: "width"
     45layer at (189,816) size 388x73 clip at (191,818) size 369x54
     46  RenderBlock {DIV} at (181,0) size 388x73 [border: (2px solid #0000FF)]
     47    RenderText {#text} at (7,2) size 364x54
     48      text run at (7,2) width 364: "This is an overflow:scroll region. It should sit on the same"
     49      text run at (47,20) width 324: "line as the float and wrap as needed to fit within the"
     50      text run at (237,38) width 4 RTL: "."
     51      text run at (241,38) width 130: "remaining line width"
  • trunk/LayoutTests/fast/block/float/027-expected.checksum

    r13918 r19717  
    1 7e490e91059bb904ebf6f5feb46e5fcf
     11166645fb13ba1e5e2865fa635d655bd
  • trunk/LayoutTests/fast/block/float/027-expected.txt

    r14684 r19717  
    3131      RenderBlock {DIV} at (0,1016) size 769x200
    3232        RenderBlock (floating) {DIV} at (0,0) size 200x200 [bgcolor=#FF0000]
    33         RenderBlock {HR} at (200,0) size 286x2 [border: (1px inset #000000)]
     33        RenderBlock {HR} at (200,0) size 386x2 [border: (1px inset #000000)]
    3434      RenderBlock {DIV} at (0,1216) size 769x200
    3535        RenderBlock (floating) {DIV} at (0,0) size 200x200 [bgcolor=#FF0000]
  • trunk/LayoutTests/fast/block/float/028-expected.checksum

    r13918 r19717  
    1 c598902996ebe99e5ea8a409be69d4e7
     1feefb7a18aaa48528f61911306da91f5
  • trunk/LayoutTests/fast/block/float/028-expected.txt

    r14684 r19717  
    3333      RenderBlock {DIV} at (0,1016) size 769x200
    3434        RenderBlock (floating) {DIV} at (569,0) size 200x200 [bgcolor=#FF0000]
    35         RenderBlock {HR} at (283,0) size 286x2 [border: (1px inset #000000)]
     35        RenderBlock {HR} at (183,0) size 386x2 [border: (1px inset #000000)]
    3636      RenderBlock {DIV} at (0,1216) size 769x200
    3737        RenderBlock (floating) {DIV} at (569,0) size 200x200 [bgcolor=#FF0000]
  • trunk/LayoutTests/fast/block/float/029-expected.checksum

    r11995 r19717  
    1 b3f0fc532149cd09eedfcc94b196c76a
     10ddc0b5eeaa209948725a9139d3e721a
  • trunk/LayoutTests/fast/block/float/030-expected.checksum

    r11995 r19717  
    1 3bf8f68fb935e3dd5f9a844ed9897c71
     13c1c52a064319e655f8b3ca54cdc33f0
  • trunk/LayoutTests/fast/block/float/031-expected.checksum

    r11995 r19717  
    1 6b25e66a296bcff246223821f91f275e
     14e16c207556a80165d9c02827c895192
  • trunk/LayoutTests/fast/block/float/033-expected.checksum

    r12842 r19717  
    1 3237bbb3f4d5e767076450ee7faedc0c
     1fd80fbc71e810380d3ddd1a041a9329c
  • trunk/LayoutTests/fast/block/float/034-expected.checksum

    r11995 r19717  
    1 bffb815d8c5bde0e44c4b0f1fe2b2351
     11b08b867dd804be8fd21a633acbb784b
  • trunk/LayoutTests/fast/block/float/035-expected.checksum

    r11995 r19717  
    1 95a1a43f748e72793612a9b0465e61b4
     16e0b13d6ab9ef7c139777e1479f12fc8
  • trunk/LayoutTests/fast/block/float/float-in-float-hit-testing-expected.checksum

    r13599 r19717  
    1 da275db40e8219ac99c5624bafaa94e5
     1f8b93e1335a92105330f6cc91d5e3d96
  • trunk/LayoutTests/fast/block/float/float-in-float-painting-expected.checksum

    r13599 r19717  
    1 5b3e5ff06482910a31fea19622907ed5
     18ec730092835b37266dd8a8d8d54b017
  • trunk/LayoutTests/fast/block/float/multiple-float-positioning-expected.checksum

    r12988 r19717  
    1 e51c551874bca640aa4b5a2217d1c183
     16d1f566c2cf000c14bda4583d15bea74
  • trunk/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.checksum

    r15232 r19717  
    1 aa772cd531e0c23cd2bf793e07a00add
     19bfc2c092b785dbc25e48556f9c77c34
  • trunk/LayoutTests/fast/block/float/nowrap-clear-min-width-expected.checksum

    r19493 r19717  
    1 6b0ecc73552409651fdf34f695a73063
     118f1f64eab31dfb69467a497de9442d7
  • trunk/LayoutTests/fast/block/float/table-relayout-expected.checksum

    r14899 r19717  
    1 0f89e1bdbe82505749e78b85fe3356ec
     1e3a2e9fe2ef20960e1e0713894eb9765
  • trunk/LayoutTests/fast/block/float/tableshifting-expected.checksum

    r11995 r19717  
    1 145a0ca008af23e7f29b4aa50cc28906
     1ae53627d0ea64cae094580f73fb70bcd
  • trunk/LayoutTests/fast/block/float/vertical-move-relayout-expected.checksum

    r13463 r19717  
    1 b0755b59cd236003e0bb75d0310d679e
     1bd5870950c8730e0e973c52c1ad0b6ea
  • trunk/WebCore/ChangeLog

    r19716 r19717  
     12007-02-19  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for Radar 4981605, regression where button grows randomly when a select is
     4        opened.  With the new form controls, the WinIE quirk for using line width
     5        ended up being used for them more.
     6
     7        This patch removes the quirk after verifying that Firefox doesn't implement
     8        the quirk at all.  usesLineWidth is being renamed to shrinksToAvoidFloats to
     9        make it clear that the new method only applies to block objects that avoid floats
     10        and that have auto width.
     11
     12        Also fixed a regression where whitespace after a floating <select> at the start
     13        of a block got incorrectly rendered.  Make sure skipWhitespace always skips
     14        through floating/positioned elements regardless of the whitespace setting (this
     15        way the white-space:pre value on floating <select>s doesn't cause trouble).
     16
     17        Reviewed by darin
     18
     19        fast/block/float/float-avoidance.html
     20
     21        * rendering/RenderBlock.cpp:
     22        (WebCore::RenderBlock::collapseMargins):
     23        (WebCore::RenderBlock::clearFloatsIfNeeded):
     24        (WebCore::RenderBlock::layoutBlockChildren):
     25        (WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout):
     26        * rendering/RenderBox.cpp:
     27        (WebCore::RenderBox::containingBlockWidth):
     28        * rendering/RenderObject.cpp:
     29        (WebCore::RenderObject::shrinkToAvoidFloats):
     30        * rendering/RenderObject.h:
     31        * rendering/bidi.cpp:
     32        (WebCore::RenderBlock::skipWhitespace):
     33
    1342007-02-19  Zalan Bujtas  <zbujtas@gmail.com>
    235
  • trunk/WebCore/rendering/RenderBlock.cpp

    r19706 r19717  
    884884    child->setPos(child->xPos(), ypos);
    885885    if (ypos != yPosEstimate) {
    886         if ((child->style()->width().isPercent() || child->style()->width().isAuto()) && child->usesLineWidth())
    887             // The child's width is a percentage of the line width.
     886        if (child->shrinkToAvoidFloats())
     887            // The child's width depends on the line width.
    888888            // When the child shifts to clear an item, its width can
    889889            // change (because it has more available line width).
     
    939939        // underneath a float, we might have to do another layout to take into account
    940940        // the extra space we now have available.
    941         if ((child->style()->width().isPercent() || child->style()->width().isAuto()) && child->usesLineWidth())
    942             // The child's width is a percentage of the line width.
     941        if (child->shrinkToAvoidFloats())
     942            // The child's width depends on the line width.
    943943            // When the child shifts to clear an item, its width can
    944944            // change (because it has more available line width).
     
    11211121        // If an element might be affected by the presence of floats, then always mark it for
    11221122        // layout.
    1123         if (!child->avoidsFloats() || child->usesLineWidth()) {
     1123        if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) {
    11241124            int fb = floatBottom();
    11251125            if (fb > m_height || fb > yPosEstimate)
     
    25732573        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    25742574            if (isBlockFlow() && !child->isFloatingOrPositioned() &&
    2575                 ((floatToRemove ? child->containsFloat(floatToRemove) : child->containsFloats()) || child->usesLineWidth()))
     2575                ((floatToRemove ? child->containsFloat(floatToRemove) : child->containsFloats()) || child->shrinkToAvoidFloats()))
    25762576                child->markAllDescendantsWithFloatsForLayout(floatToRemove);
    25772577        }
  • trunk/WebCore/rendering/RenderBox.cpp

    r19702 r19717  
    737737    if (!cb)
    738738        return 0;
    739     if (usesLineWidth())
     739    if (shrinkToAvoidFloats())
    740740        return cb->lineWidth(m_y);
    741741    return cb->availableWidth();
  • trunk/WebCore/rendering/RenderObject.cpp

    r19696 r19717  
    29082908}
    29092909
    2910 bool RenderObject::usesLineWidth() const
    2911 {
    2912     // 1. All auto-width objects that avoid floats should always use lineWidth
    2913     // 2. For objects with a specified width, we match WinIE's behavior:
    2914     // (a) tables use contentWidth
    2915     // (b) <hr>s use lineWidth
    2916     // (c) all other objects use lineWidth in quirks mode and contentWidth in strict mode.
    2917     return (avoidsFloats() && (style()->width().isAuto() || isHR() || (style()->htmlHacks() && !isTable())));
     2910bool RenderObject::shrinkToAvoidFloats() const
     2911{
     2912    // FIXME: Technically we should be able to shrink replaced elements on a line, but this is difficult to accomplish, since this
     2913    // involves doing a relayout during findNextLineBreak and somehow overriding the containingBlockWidth method to return the
     2914    // current remaining width on a line.
     2915    if (isInline() || !avoidsFloats())
     2916        return false;
     2917
     2918    // All auto-width objects that avoid floats should always use lineWidth.
     2919    return style()->width().isAuto();
    29182920}
    29192921
  • trunk/WebCore/rendering/RenderObject.h

    r19696 r19717  
    752752
    753753    virtual bool avoidsFloats() const;
    754     bool usesLineWidth() const;
     754    bool shrinkToAvoidFloats() const;
    755755
    756756    // positioning of inline children (bidi)
  • trunk/WebCore/rendering/bidi.cpp

    r19621 r19717  
    19961996    // object iteration process.
    19971997    int w = lineWidth(m_height);
    1998     while (!it.atEnd() && (it.obj->isInlineFlow() || (shouldCollapseWhiteSpace(it.obj->style()) && !it.obj->isBR() &&
    1999           (it.current() == ' ' || it.current() == '\t' || (!shouldPreserveNewline(it.obj) && it.current() == '\n') ||
    2000           it.current() == softHyphen || skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
     1998    while (!it.atEnd() && (it.obj->isFloatingOrPositioned() || it.obj->isInlineFlow() ||
     1999           (shouldCollapseWhiteSpace(it.obj->style()) && !it.obj->isBR() &&
     2000            (it.current() == ' ' || it.current() == '\t' || (!shouldPreserveNewline(it.obj) && it.current() == '\n') ||
     2001             it.current() == softHyphen || skipNonBreakingSpace(it))))) {
    20012002        if (it.obj->isFloatingOrPositioned()) {
    20022003            RenderObject *o = it.obj;
Note: See TracChangeset for help on using the changeset viewer.