Changeset 140358 in webkit


Ignore:
Timestamp:
Jan 21, 2013 1:58:23 PM (11 years ago)
Author:
robert@webkit.org
Message:

Misaligned logo on www.nzherald.co.nz possibly due to negative margin-top
https://bugs.webkit.org/show_bug.cgi?id=14664

Reviewed by David Hyatt.

Source/WebCore:

Test: fast/block/float/clear-negative-margin-top.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::collapseMargins): If a negative margin pulls a block up so that floats from
siblings overhang, then ensure addOverHangingFloats() uses the revised logical top position when
deciding whether a float does indeed overhang into the block after margin-collapsing.
(WebCore::RenderBlock::clearFloatsIfNeeded):

LayoutTests:

  • fast/block/float/clear-negative-margin-top-expected.html: Added.
  • fast/block/float/clear-negative-margin-top.html: Added.
  • platform/chromium-win/fast/block/float/024-expected.txt:
  • platform/chromium-win/fast/block/margin-collapse/empty-clear-blocks-expected.txt:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140355 r140358  
     12013-01-21  Robert Hogan  <robert@webkit.org>
     2
     3        Misaligned logo on www.nzherald.co.nz possibly due to negative margin-top
     4        https://bugs.webkit.org/show_bug.cgi?id=14664
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/block/float/clear-negative-margin-top-expected.html: Added.
     9        * fast/block/float/clear-negative-margin-top.html: Added.
     10        * platform/chromium-win/fast/block/float/024-expected.txt:
     11        * platform/chromium-win/fast/block/margin-collapse/empty-clear-blocks-expected.txt:
     12
    1132013-01-21  Zan Dobersek  <zdobersek@igalia.com>
    214
  • trunk/LayoutTests/platform/chromium-win/fast/block/float/024-expected.txt

    r127163 r140358  
    1919      RenderBlock {DIV} at (0,293) size 800x72 [bgcolor=#DDDDDD] [border: (2px solid #000000)]
    2020        RenderBlock (floating) {DIV} at (2,2) size 32x32 [bgcolor=#FFFFFF]
    21         RenderBlock {DIV} at (2,50) size 796x0
     21        RenderBlock {DIV} at (2,34) size 796x0
    2222        RenderBlock (anonymous) at (2,50) size 796x20
    2323          RenderText {#text} at (0,0) size 488x19
  • trunk/LayoutTests/platform/chromium-win/fast/block/margin-collapse/empty-clear-blocks-expected.txt

    r127163 r140358  
    7777        RenderText {#text} at (100,0) size 271x19
    7878          text run at (100,0) width 271: "This paragraph has a bottom margin of 50px."
    79       RenderBlock {SPAN} at (0,825) size 769x0
     79      RenderBlock {SPAN} at (0,795) size 769x0
    8080      RenderBlock {SPAN} at (0,825) size 769x20
    8181        RenderText {#text} at (0,0) size 242x19
     
    102102          RenderText {#text} at (100,0) size 271x19
    103103            text run at (100,0) width 271: "This paragraph has a bottom margin of 50px."
    104         RenderBlock {SPAN} at (10,140) size 749x0
     104        RenderBlock {SPAN} at (10,110) size 749x0
  • trunk/Source/WebCore/ChangeLog

    r140352 r140358  
     12013-01-21  Robert Hogan  <robert@webkit.org>
     2
     3        Misaligned logo on www.nzherald.co.nz possibly due to negative margin-top
     4        https://bugs.webkit.org/show_bug.cgi?id=14664
     5
     6        Reviewed by David Hyatt.
     7
     8        Test: fast/block/float/clear-negative-margin-top.html
     9
     10        * rendering/RenderBlock.cpp:
     11        (WebCore::RenderBlock::collapseMargins): If a negative margin pulls a block up so that floats from
     12        siblings overhang, then ensure addOverHangingFloats() uses the revised logical top position when
     13        deciding whether a float does indeed overhang into the block after margin-collapsing.
     14        (WebCore::RenderBlock::clearFloatsIfNeeded):
     15
    1162013-01-21  Rik Cabanier  <cabanier@adobe.com>
    217
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r140244 r140358  
    20582058    // overhang from the previous sibling are added to our parent. If the child's previous sibling itself is a float the child will avoid
    20592059    // or clear it anyway, so don't worry about any floating children it may contain.
     2060    LayoutUnit oldLogicalHeight = logicalHeight();
     2061    setLogicalHeight(logicalTop);
    20602062    RenderObject* prev = child->previousSibling();
    20612063    if (prev && prev->isBlockFlow() && !prev->isFloatingOrOutOfFlowPositioned()) {
     
    20642066            addOverhangingFloats(block, false);
    20652067    }
     2068    setLogicalHeight(oldLogicalHeight);
    20662069
    20672070    return logicalTop;
     
    20992102        LayoutUnit collapsedMargin = collapsedMarginBeforeForChild(child);
    21002103        setLogicalHeight(child->logicalTop() - collapsedMargin);
    2101         heightIncrease -= collapsedMargin;
     2104        // A negative collapsed margin-top value cancels itself out as it has already been factored into |yPos| above.
     2105        heightIncrease -= max(LayoutUnit(), collapsedMargin);
    21022106    } else
    21032107        // Increase our height by the amount we had to clear.
Note: See TracChangeset for help on using the changeset viewer.