Changeset 126911 in webkit


Ignore:
Timestamp:
Aug 28, 2012 12:18:40 PM (12 years ago)
Author:
robert@webkit.org
Message:

REGRESSION (r94492): Unstable layout of static block inside text-align: center div
https://bugs.webkit.org/show_bug.cgi?id=77754

Reviewed by David Hyatt.

Source/WebCore:

Text-align of 'center' on an out-of-flow element determines its x-position in the line - it
doesn't mean that the element should be centred in the line as though it were a block of text.

This is a partial revert of http://trac.webkit.org/changeset/113584 and a correction to
http://trac.webkit.org/changeset/94492.

Tests: fast/css/center-align-absolute-position-inline-block.html

fast/css/center-align-absolute-position.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::layoutPositionedObjects): Remove an update to the static position when

it depended on the child's width. Reverts code added in r113584.

  • rendering/RenderBlock.h:

(RenderBlock): Remove child parameter from startAlignedOffsetForLine()

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::setStaticPositions): ditto
(WebCore::RenderBlock::startAlignedOffsetForLine): No need to account for the child's width when calculating

the offset for the line.

LayoutTests:

  • fast/css/align-positioned-object-on-resize-expected.txt: Removed.
  • fast/css/align-positioned-object-on-resize.html: Removed.
  • fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
  • fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.
  • fast/css/bug4860-absolute-inline-child-inherits-alignment.html: Removed.

These tests are no longer valid. They expect an out-of-flow block to align with the
center of their parent. The valid behaviour for an out-of-flow element with a center-align
parent is take the center of the parent as their start position. The expected behaviour is
now covered by center-align-absolute-position.html below.

  • fast/css/center-align-absolute-position-expected.html: Added.
  • fast/css/center-align-absolute-position-inline-block-expected.html: Added.
  • fast/css/center-align-absolute-position-inline-block.html: Added.
  • fast/css/center-align-absolute-position.html: Added.
  • fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html:
  • platform/chromium-linux/fast/inline/absolute-positioned-inline-in-centred-block-expected.png:
  • platform/chromium-linux/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png:

This isn't a very helpful test - but note that the alignment of LTR-RTL centers on an axis. The behaviour
now matches FF.

  • platform/chromium-mac/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
  • platform/chromium-win/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.png:
  • platform/chromium-win/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
  • platform/chromium-win/fast/inline/absolute-positioned-inline-in-centred-block-expected.txt:
  • platform/chromium-win/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.txt:
  • platform/chromium/TestExpectations:
  • platform/chromium/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt:
  • platform/chromium/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/qt/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
  • platform/qt/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.

The rebaselined results on each of these now matches FF.

Location:
trunk
Files:
4 added
10 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126909 r126911  
     12012-08-28  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION (r94492): Unstable layout of static block inside text-align: center 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: Removed.
     9        * fast/css/align-positioned-object-on-resize.html: Removed.
     10        * fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
     11        * fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.
     12        * fast/css/bug4860-absolute-inline-child-inherits-alignment.html: Removed.
     13            These tests are no longer valid. They expect an out-of-flow block to align with the
     14            center of their parent. The valid behaviour for an out-of-flow element with a center-align
     15            parent is take the center of the parent as their start position. The expected behaviour is
     16            now covered by center-align-absolute-position.html below.
     17           
     18        * fast/css/center-align-absolute-position-expected.html: Added.
     19        * fast/css/center-align-absolute-position-inline-block-expected.html: Added.
     20        * fast/css/center-align-absolute-position-inline-block.html: Added.
     21        * fast/css/center-align-absolute-position.html: Added.
     22           
     23        * fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html:
     24        * platform/chromium-linux/fast/inline/absolute-positioned-inline-in-centred-block-expected.png:
     25        * platform/chromium-linux/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png:
     26           This isn't a very helpful test - but note that the alignment of LTR-RTL centers on an axis. The behaviour
     27           now matches FF.
     28        * platform/chromium-mac/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
     29        * platform/chromium-win/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.png:
     30        * platform/chromium-win/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
     31        * platform/chromium-win/fast/inline/absolute-positioned-inline-in-centred-block-expected.txt:
     32        * platform/chromium-win/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.txt:
     33        * platform/chromium/TestExpectations:
     34        * platform/chromium/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt:
     35        * platform/chromium/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.
     36        * platform/efl/TestExpectations:
     37        * platform/gtk/TestExpectations:
     38        * platform/mac/TestExpectations:
     39        * platform/qt/TestExpectations:
     40        * platform/qt/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.png: Removed.
     41        * platform/qt/fast/css/bug4860-absolute-inline-child-inherits-alignment-expected.txt: Removed.
     42            The rebaselined results on each of these now matches FF.
     43
    1442012-08-24  Jon Lee  <jonlee@apple.com>
    245
  • trunk/LayoutTests/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html

    r95726 r126911  
    55    https://bugs.webkit.org/show_bug.cgi?id=4860-->
    66</head>
    7 <body>
     7<body style="width: 800px;">
    88
    99<div align="center" style="direction: rtl;">
     
    3636
    3737<div style="direction: ltr;">
    38 <font style="font-size:24px; font-variant:small-caps;letter-spacing:2px; position:absolute; bottom:300px;">LTR-No-Aligned</font>
     38<font style="font-size:24px; font-variant:small-caps;letter-spacing:2px; position:absolute; bottom:350px;">LTR-No-Aligned</font>
    3939</div>
    4040
  • trunk/LayoutTests/platform/chromium-win/fast/inline/absolute-positioned-inline-in-centred-block-expected.txt

    r117903 r126911  
    55    RenderBody {BODY} at (8,8) size 784x584
    66      RenderBlock {DIV} at (0,0) size 784x0
    7 layer at (102,562) size 297x28
    8   RenderBlock (positioned) {FONT} at (101,562) size 298x28
     7layer at (250,562) size 297x28
     8  RenderBlock (positioned) {FONT} at (250,562) size 297x28
    99    RenderText {#text} at (0,0) size 297x27
    1010      text run at (0,0) width 297: "Hello World, And Stuff!"
  • trunk/LayoutTests/platform/chromium-win/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.txt

    r117821 r126911  
    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       RenderBlock {DIV} at (0,0) size 784x0
    7       RenderBlock {DIV} at (0,0) size 784x0
    8       RenderBlock {DIV} at (0,0) size 784x0
    9       RenderBlock {DIV} at (0,0) size 784x0
    10       RenderBlock {DIV} at (0,0) size 784x0
    11       RenderBlock {DIV} at (0,0) size 784x0
    12       RenderBlock {DIV} at (0,0) size 784x0
    13       RenderBlock {DIV} at (0,0) size 784x0
    14 layer at (279,562) size 243x28
    15   RenderBlock (positioned) {FONT} at (278,562) size 244x28
     1layer at (0,0) size 900x585
     2  RenderView at (0,0) size 800x585
     3layer at (0,0) size 800x585
     4  RenderBlock {HTML} at (0,0) size 800x585
     5    RenderBody {BODY} at (8,8) size 800x569
     6      RenderBlock {DIV} at (0,0) size 800x0
     7      RenderBlock {DIV} at (0,0) size 800x0
     8      RenderBlock {DIV} at (0,0) size 800x0
     9      RenderBlock {DIV} at (0,0) size 800x0
     10      RenderBlock {DIV} at (0,0) size 800x0
     11      RenderBlock {DIV} at (0,0) size 800x0
     12      RenderBlock {DIV} at (0,0) size 800x0
     13      RenderBlock {DIV} at (0,0) size 800x0
     14layer at (165,547) size 243x28
     15  RenderBlock (positioned) {FONT} at (165,547) size 243x28
    1616    RenderText {#text} at (0,0) size 243x27
    1717      text run at (0,0) width 243: "RTL-Center-Aligned"
    18 layer at (0,466) size 100x84
    19   RenderBlock (positioned) {FONT} at (0,466) size 100x84
     18layer at (-84,451) size 92x84 backgroundClip at (0,0) size 900x585 clip at (0,0) size 900x585 outlineClip at (0,0) size 900x585
     19  RenderBlock (positioned) {FONT} at (-84,451) size 92x84
    2020    RenderText {#text} at (0,0) size 92x83
    2121      text run at (0,0) width 61: "RTL-"
    2222      text run at (0,28) width 61: "Left-"
    2323      text run at (0,56) width 92: "Aligned"
    24 layer at (565,472) size 227x28
    25   RenderBlock (positioned) {FONT} at (565,472) size 227x28
     24layer at (581,457) size 227x28
     25  RenderBlock (positioned) {FONT} at (581,457) size 227x28
    2626    RenderText {#text} at (0,0) size 227x27
    2727      text run at (0,0) width 227: "RTL-Right-Aligned"
    28 layer at (596,422) size 196x28
    29   RenderBlock (positioned) {FONT} at (596,422) size 196x28
     28layer at (612,407) size 196x28
     29  RenderBlock (positioned) {FONT} at (612,407) size 196x28
    3030    RenderText {#text} at (0,0) size 196x27
    3131      text run at (0,0) width 196: "RTL-No-Aligned"
    32 layer at (279,372) size 243x28
    33   RenderBlock (positioned) {FONT} at (278,372) size 244x28
     32layer at (408,357) size 243x28
     33  RenderBlock (positioned) {FONT} at (408,357) size 243x28
    3434    RenderText {#text} at (0,0) size 243x27
    3535      text run at (0,0) width 243: "LTR-Center-Aligned"
    36 layer at (8,322) size 214x28
    37   RenderBlock (positioned) {FONT} at (8,322) size 214x28
     36layer at (8,307) size 214x28
     37  RenderBlock (positioned) {FONT} at (8,307) size 214x28
    3838    RenderText {#text} at (0,0) size 214x27
    3939      text run at (0,0) width 214: "LTR-Left-Aligned"
    40 layer at (700,216) size 100x84
    41   RenderBlock (positioned) {FONT} at (700,216) size 100x84
    42     RenderText {#text} at (39,0) size 92x83
    43       text run at (39,0) width 61: "LTR-"
    44       text run at (26,28) width 74: "Right-"
    45       text run at (8,56) width 92: "Aligned"
    46 layer at (8,272) size 196x28
    47   RenderBlock (positioned) {FONT} at (8,272) size 196x28
     40layer at (808,201) size 92x84
     41  RenderBlock (positioned) {FONT} at (808,201) size 92x84
     42    RenderText {#text} at (31,0) size 92x83
     43      text run at (31,0) width 61: "LTR-"
     44      text run at (18,28) width 74: "Right-"
     45      text run at (0,56) width 92: "Aligned"
     46layer at (8,207) size 196x28
     47  RenderBlock (positioned) {FONT} at (8,207) size 196x28
    4848    RenderText {#text} at (0,0) size 196x27
    4949      text run at (0,0) width 196: "LTR-No-Aligned"
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r126894 r126911  
    36113611BUGWK95136 WIN LINUX : fast/css/sticky/sticky-writing-mode-vertical-lr.html = IMAGE
    36123612BUGWK95136 : fast/css/sticky/sticky-writing-mode-vertical-rl.html = IMAGE
     3613
     3614// Require rebaseline after https://bugs.webkit.org/show_bug.cgi?id=77754
     3615BUGWK77754 MAC WIN : fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html = IMAGE+TEXT
     3616BUGWK77754 MAC WIN : fast/inline/absolute-positioned-inline-in-centred-block.html = IMAGE+TEXT
     3617BUGWK77754 MAC WIN : fast/css/absolute-child-with-percent-height-inside-relative-parent.html = IMAGE+TEXT
     3618
  • trunk/LayoutTests/platform/chromium/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt

    r117903 r126911  
    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
     1layer at (0,0) size 902x585
     2  RenderView at (0,0) size 800x585
     3layer at (0,0) size 800x585
     4  RenderBlock {HTML} at (0,0) size 800x585
     5    RenderBody {BODY} at (8,8) size 784x569
    66      RenderText {#text} at (0,0) size 0x0
    77layer at (86,8) size 628x230
    88  RenderBlock (relative positioned) {DIV} at (78,0) size 628x230 [bgcolor=#0000FF]
    9 layer at (154,8) size 501x230
    10   RenderBlock (positioned) {DIV} at (67,0) size 503x230 [bgcolor=#FF0000]
     9layer at (400,8) size 501x230
     10  RenderBlock (positioned) {DIV} at (313,0) size 503x230 [bgcolor=#FF0000]
    1111    RenderImage {IMG} at (49,0) size 403x230
    1212    RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/efl/TestExpectations

    r126881 r126911  
    926926BUGWK94880 : fast/forms/search-rtl.html = MISSING
    927927
     928//Require rebaseline after https://bugs.webkit.org/show_bug.cgi?id=77754
     929BUGWK77754 : fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html = TEXT
     930BUGWK77754 : fast/inline/absolute-positioned-inline-in-centred-block.html = TEXT
     931BUGWK77754 : fast/css/absolute-child-with-percent-height-inside-relative-parent.html = TEXT
     932
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r126888 r126911  
    3737//////////////////////////////////////////////////////////////////////////////////////////
    3838
     39BUGWK77754 : fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html = TEXT
     40BUGWK77754 : fast/inline/absolute-positioned-inline-in-centred-block.html = TEXT
     41BUGWK77754 : fast/css/absolute-child-with-percent-height-inside-relative-parent.html = TEXT
    3942
    4043//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/mac/TestExpectations

    r126704 r126911  
    392392BUGWK93560 : fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data-rgba5551.html = PASS TEXT
    393393BUGWK93560 : fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html = PASS TEXT
     394
     395//Require rebaseline after https://bugs.webkit.org/show_bug.cgi?id=77754
     396BUGWK77754 : fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html = TEXT
     397BUGWK77754 : fast/inline/absolute-positioned-inline-in-centred-block.html = TEXT
     398BUGWK77754 : fast/css/absolute-child-with-percent-height-inside-relative-parent.html = TEXT
     399
  • trunk/LayoutTests/platform/qt/TestExpectations

    r126707 r126911  
    197197BUGWK84286 : css2.1/t0805-c5521-brdr-l-01-e.html = TEXT
    198198BUGWK84286 : css2.1/t0805-c5521-ibrdr-l-00-a.html = TEXT
     199
     200//Require rebaseline after https://bugs.webkit.org/show_bug.cgi?id=77754
     201BUGWK77754 : fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html = TEXT
     202BUGWK77754 : fast/inline/absolute-positioned-inline-in-centred-block.html = TEXT
     203BUGWK77754 : fast/css/absolute-child-with-percent-height-inside-relative-parent.html = TEXT
     204
  • trunk/LayoutTests/platform/win/Skipped

    r126785 r126911  
    21342134tables/mozilla_expected_failures/collapsing_borders/bug41262-6.html
    21352135http/tests/security/referrer-policy-https-origin.html
     2136
     2137# Rebaseline after bug 77754
     2138fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html
     2139fast/inline/absolute-positioned-inline-in-centred-block.html
     2140fast/css/absolute-child-with-percent-height-inside-relative-parent.html
     2141
     2142
  • trunk/Source/WebCore/ChangeLog

    r126909 r126911  
     12012-07-10  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION (r94492): Unstable layout of static block inside text-align: center div
     4        https://bugs.webkit.org/show_bug.cgi?id=77754
     5
     6        Reviewed by David Hyatt.
     7
     8        Text-align of 'center' on an out-of-flow element determines its x-position in the line - it
     9        doesn't mean that the element should be centred in the line as though it were a block of text.
     10       
     11        This is a partial revert of http://trac.webkit.org/changeset/113584 and a correction to
     12        http://trac.webkit.org/changeset/94492.
     13
     14        Tests: fast/css/center-align-absolute-position-inline-block.html
     15               fast/css/center-align-absolute-position.html
     16
     17        * rendering/RenderBlock.cpp:
     18        (WebCore::RenderBlock::layoutPositionedObjects): Remove an update to the static position when
     19          it depended on the child's width. Reverts code added in r113584.
     20        * rendering/RenderBlock.h:
     21        (RenderBlock): Remove child parameter from startAlignedOffsetForLine()
     22        * rendering/RenderBlockLineLayout.cpp:
     23        (WebCore::setStaticPositions): ditto
     24        (WebCore::RenderBlock::startAlignedOffsetForLine): No need to account for the child's width when calculating
     25          the offset for the line.
     26
    1272012-08-27  Jon Lee  <jonlee@apple.com>
    228
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r126859 r126911  
    26492649        r->layoutIfNeeded();
    26502650
    2651         // Adjust the static position of a center-aligned inline positioned object with a block child now that the child's width has been computed.
    2652         if (!r->parent()->isRenderView() && r->parent()->isRenderBlock() && r->firstChild() && r->style()->position() == AbsolutePosition
    2653             && r->style()->isOriginalDisplayInlineType() && (r->style()->textAlign() == CENTER || r->style()->textAlign() == WEBKIT_CENTER)) {
    2654             RenderBlock* block = toRenderBlock(r->parent());
    2655             LayoutUnit blockHeight = block->logicalHeight();
    2656             block->setStaticInlinePositionForChild(r, blockHeight, block->startAlignedOffsetForLine(r, blockHeight, false));
    2657         }
    2658 
    26592651        // Lay out again if our estimate was wrong.
    26602652        if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) {
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r126859 r126911  
    201201    }
    202202
    203     LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine);
     203    LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool firstLine);
    204204    LayoutUnit textIndentOffset() const;
    205205
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r126837 r126911  
    922922        // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
    923923        // inline so that we can obtain the value later.
    924         toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(child, blockHeight, false));
     924        toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(blockHeight, false));
    925925        toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight);
    926926    }
    927927
    928928    if (child->style()->isOriginalDisplayInlineType())
    929         block->setStaticInlinePositionForChild(child, blockHeight, block->startAlignedOffsetForLine(child, blockHeight, false));
     929        block->setStaticInlinePositionForChild(child, blockHeight, block->startAlignedOffsetForLine(blockHeight, false));
    930930    else
    931931        block->setStaticInlinePositionForChild(child, blockHeight, block->startOffsetForContent(blockHeight));
     
    28902890}
    28912891
    2892 LayoutUnit RenderBlock::startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine)
     2892LayoutUnit RenderBlock::startAlignedOffsetForLine(LayoutUnit position, bool firstLine)
    28932893{
    28942894    ETextAlign textAlign = style()->textAlign();
     
    28982898
    28992899    // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
    2900     float logicalLeft;
    2901     float availableLogicalWidth;
    2902     logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
    2903     availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft;
    2904     float totalLogicalWidth = logicalWidthForChild(child);
     2900    float totalLogicalWidth = 0;
     2901    float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
     2902    float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft;
    29052903    updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
    29062904
    29072905    if (!style()->isLeftToRightDirection())
    2908         return logicalWidth() - (logicalLeft + totalLogicalWidth);
     2906        return logicalWidth() - logicalLeft;
    29092907    return logicalLeft;
    29102908}
Note: See TracChangeset for help on using the changeset viewer.