Changeset 113584 in webkit


Ignore:
Timestamp:
Apr 9, 2012 9:34:46 AM (12 years ago)
Author:
robert@webkit.org
Message:

REGRESSION (r94492): Incorrect initial layout of absolutely positioned <input> inside centering div
https://bugs.webkit.org/show_bug.cgi?id=77754

Reviewed by David Hyatt.

Source/WebCore:

The correct static position of an center-aligned, inline, absolutely positioned object with a block child can't be known
until the width of the child has been computed. This means that setStaticPositions() in RenderBlockLineLayout is setting
the position too early, before the width of the child has been finalised. To fix, adjust the static position of the inline
positioned object once its child's width has been calculated.

Test: fast/css/align-positioned-object-on-resize.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::layoutPositionedObjects):

LayoutTests:

  • fast/css/align-positioned-object-on-resize-expected.txt: Added.
  • fast/css/align-positioned-object-on-resize.html: Added.
  • platform/qt/Skipped: Skipped on Qt as window.resizeTo() does not work properly in Qt DRT.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r113583 r113584  
     12012-03-30  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION (r94492): Incorrect initial layout of absolutely positioned <input> inside centering div
     4        https://bugs.webkit.org/show_bug.cgi?id=77754
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/css/align-positioned-object-on-resize-expected.txt: Added.
     9        * fast/css/align-positioned-object-on-resize.html: Added.
     10        * platform/qt/Skipped: Skipped on Qt as window.resizeTo() does not work properly in Qt DRT.
     11
    1122012-04-09  Eric Carlson  <eric.carlson@apple.com>
    213
  • trunk/LayoutTests/platform/qt/Skipped

    r113545 r113584  
    25772577# https://bugs.webkit.org/show_bug.cgi?id=83133
    25782578fast/workers/worker-multi-startup.html
     2579
     2580# https://bugs.webkit.org/show_bug.cgi?id=77754
     2581# window.resizeTo() does not work properly in Qt DRT. The outerWidth changes after a resizeTo()
     2582# but not the innerWidth
     2583fast/css/align-positioned-object-on-resize.html
  • trunk/Source/WebCore/ChangeLog

    r113583 r113584  
     12012-03-30  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION (r94492): Incorrect initial layout of absolutely positioned <input> inside centering div
     4        https://bugs.webkit.org/show_bug.cgi?id=77754
     5
     6        Reviewed by David Hyatt.
     7
     8        The correct static position of an center-aligned, inline, absolutely positioned object with a block child can't be known
     9        until the width of the child has been computed. This means that setStaticPositions() in RenderBlockLineLayout is setting
     10        the position too early, before the width of the child has been finalised. To fix, adjust the static position of the inline
     11        positioned object once its child's width has been calculated.
     12
     13        Test: fast/css/align-positioned-object-on-resize.html
     14
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::layoutPositionedObjects):
     17
    1182012-04-09  Eric Carlson  <eric.carlson@apple.com>
    219
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r113581 r113584  
    24952495            oldLogicalTop = logicalTopForChild(r);
    24962496        }
    2497            
     2497       
    24982498        r->layoutIfNeeded();
    2499        
     2499
     2500        // Adjust the static position of a center-aligned inline positioned object with a block child now that the child's width has been computed.
     2501        if (!r->parent()->isRenderView() && r->parent()->isRenderBlock() && r->firstChild() && r->style()->position() == AbsolutePosition
     2502            && r->style()->isOriginalDisplayInlineType() && (r->style()->textAlign() == CENTER || r->style()->textAlign() == WEBKIT_CENTER)) {
     2503            RenderBlock* block = toRenderBlock(r->parent());
     2504            LayoutUnit blockHeight = block->logicalHeight();
     2505            block->setStaticInlinePositionForChild(r, blockHeight, block->startAlignedOffsetForLine(r, blockHeight, false));
     2506        }
     2507
    25002508        // Lay out again if our estimate was wrong.
    25012509        if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) {
Note: See TracChangeset for help on using the changeset viewer.