Changeset 121789 in webkit


Ignore:
Timestamp:
Jul 3, 2012 10:41:35 AM (12 years ago)
Author:
robert@webkit.org
Message:

CSS 2.1 failure: floats-wrap-top-below-inline-* fail
https://bugs.webkit.org/show_bug.cgi?id=88171

Reviewed by Eric Seidel.

Source/WebCore:

When shifting a line or element left or right to avoid a float use the height
of the line or element to determine whether the float is inside the element or
if it overlaps the bottom of the element.

Do this by passing the height of the element to the interval tree used to detect
the overlap with it's containing block's floats. The height is zero by default so
callers to logical[Left|Right]OffsetForLine will need to pass the height if they
want to use it to detect floats to avoid.

Tests: css2.1/20110323/floats-wrap-top-below-bfc-001l.htm

css2.1/20110323/floats-wrap-top-below-bfc-001r.htm
css2.1/20110323/floats-wrap-top-below-bfc-002l.htm
css2.1/20110323/floats-wrap-top-below-bfc-002r.htm
css2.1/20110323/floats-wrap-top-below-bfc-003l.htm
css2.1/20110323/floats-wrap-top-below-bfc-003r.htm
css2.1/20110323/floats-wrap-top-below-inline-001l.htm
css2.1/20110323/floats-wrap-top-below-inline-001r.htm
css2.1/20110323/floats-wrap-top-below-inline-002l.htm
css2.1/20110323/floats-wrap-top-below-inline-002r.htm
css2.1/20110323/floats-wrap-top-below-inline-003l.htm
css2.1/20110323/floats-wrap-top-below-inline-003r.htm
css2.1/20110323/floats-zero-height-wrap-001.htm
css2.1/20110323/floats-zero-height-wrap-002.htm
fast/block/float/floats-wrap-inside-inline-001.htm
fast/block/float/floats-wrap-inside-inline-002.htm
fast/block/float/floats-wrap-inside-inline-003.htm
fast/block/float/floats-wrap-inside-inline-004.htm
fast/block/float/floats-wrap-inside-inline-005.htm

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeStartPositionDeltaForChildAvoidingFloats):
(WebCore::::collectIfNeeded):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):
(WebCore::RenderBlock::getClearDelta):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::availableLogicalWidthForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::startOffsetForLine):
(WebCore::RenderBlock::endOffsetForLine):
(WebCore::RenderBlock::pixelSnappedLogicalLeftOffsetForLine):
(WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
(RenderBlock):
(WebCore::RenderBlock::FloatIntervalSearchAdapter::FloatIntervalSearchAdapter):
(WebCore::RenderBlock::FloatIntervalSearchAdapter::lowValue):
(WebCore::RenderBlock::FloatIntervalSearchAdapter::highValue):
(FloatIntervalSearchAdapter):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::logicalBottomForLine):
(WebCore):
(WebCore::LineWidth::updateAvailableWidth):
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::containingBlockAvailableLineWidthInRegion):

LayoutTests:

  • css2.1/20110323/floats-wrap-top-below-001l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-001r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-002l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-002r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-003l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-003r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-001l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-001l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-001r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-001r.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-002l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-002l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-002r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-002r.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-003l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-003l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-003r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-bfc-003r.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-001l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-001l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-001r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-001r.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-002l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-002l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-002r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-002r.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-003l-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-003l.htm: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-003r-expected.html: Added.
  • css2.1/20110323/floats-wrap-top-below-inline-003r.htm: Added.
  • css2.1/20110323/floats-zero-height-wrap-001-expected.html: Added.
  • css2.1/20110323/floats-zero-height-wrap-001.htm: Added.
  • css2.1/20110323/floats-zero-height-wrap-002.htm: Added.
  • css2.1/20110323/floats-zero-height-wrap-002-expected.html: Added.

All of these are taken from the CSS test suite, including the expected.html files which have been renamed
from *-ref.html so that new-run-webkit-tests will parse use them.

  • fast/block/float/floats-wrap-inside-inline-001-expected.html: Added.
  • fast/block/float/floats-wrap-inside-inline-001.htm: Added.

The span should avoid a float even when its top and bottom does not overlap with the top of the span.
In this test the float starts and ends inside the span's first linebox.

  • fast/block/float/floats-wrap-inside-inline-002-expected.html: Added.
  • fast/block/float/floats-wrap-inside-inline-002.htm: Added.

The span should avoid a float even when its top and bottom does not overlap with the top of the span.
In this test the float overlaps the bottom of the span, but is below the span's first linebox.

  • fast/block/float/floats-wrap-inside-inline-003-expected.html: Added.
  • fast/block/float/floats-wrap-inside-inline-003.htm: Added.

An inline span should avoid a float even when its top and bottom does not overlap with the top of the span.
In this test the float starts and ends inside the span's first linebox.

  • fast/block/float/floats-wrap-inside-inline-004-expected.html: Added.
  • fast/block/float/floats-wrap-inside-inline-004.htm: Added.

The span should avoid a float even when its top and bottom does not overlap with the top of the span.
In this test the float overlaps inside the span and the span has height set by its style.

  • fast/block/float/floats-wrap-inside-inline-005-expected.html: Added.
  • fast/block/float/floats-wrap-inside-inline-005.htm: Added.

In this test the float starts and ends inside the span's second linebox, so only the second linebox should avoid the float.

  • platform/chromium-win/css1/formatting_model/floating_elements-expected.txt:

This is a progression due to lineboxes now avoiding floats they overlap.

Location:
trunk
Files:
43 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121787 r121789  
     12012-07-03  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: floats-wrap-top-below-inline-* fail
     4        https://bugs.webkit.org/show_bug.cgi?id=88171
     5
     6        Reviewed by Eric Seidel.
     7
     8        * css2.1/20110323/floats-wrap-top-below-001l-expected.html: Added.
     9        * css2.1/20110323/floats-wrap-top-below-001r-expected.html: Added.
     10        * css2.1/20110323/floats-wrap-top-below-002l-expected.html: Added.
     11        * css2.1/20110323/floats-wrap-top-below-002r-expected.html: Added.
     12        * css2.1/20110323/floats-wrap-top-below-003l-expected.html: Added.
     13        * css2.1/20110323/floats-wrap-top-below-003r-expected.html: Added.
     14        * css2.1/20110323/floats-wrap-top-below-bfc-001l-expected.html: Added.
     15        * css2.1/20110323/floats-wrap-top-below-bfc-001l.htm: Added.
     16        * css2.1/20110323/floats-wrap-top-below-bfc-001r-expected.html: Added.
     17        * css2.1/20110323/floats-wrap-top-below-bfc-001r.htm: Added.
     18        * css2.1/20110323/floats-wrap-top-below-bfc-002l-expected.html: Added.
     19        * css2.1/20110323/floats-wrap-top-below-bfc-002l.htm: Added.
     20        * css2.1/20110323/floats-wrap-top-below-bfc-002r-expected.html: Added.
     21        * css2.1/20110323/floats-wrap-top-below-bfc-002r.htm: Added.
     22        * css2.1/20110323/floats-wrap-top-below-bfc-003l-expected.html: Added.
     23        * css2.1/20110323/floats-wrap-top-below-bfc-003l.htm: Added.
     24        * css2.1/20110323/floats-wrap-top-below-bfc-003r-expected.html: Added.
     25        * css2.1/20110323/floats-wrap-top-below-bfc-003r.htm: Added.
     26        * css2.1/20110323/floats-wrap-top-below-inline-001l-expected.html: Added.
     27        * css2.1/20110323/floats-wrap-top-below-inline-001l.htm: Added.
     28        * css2.1/20110323/floats-wrap-top-below-inline-001r-expected.html: Added.
     29        * css2.1/20110323/floats-wrap-top-below-inline-001r.htm: Added.
     30        * css2.1/20110323/floats-wrap-top-below-inline-002l-expected.html: Added.
     31        * css2.1/20110323/floats-wrap-top-below-inline-002l.htm: Added.
     32        * css2.1/20110323/floats-wrap-top-below-inline-002r-expected.html: Added.
     33        * css2.1/20110323/floats-wrap-top-below-inline-002r.htm: Added.
     34        * css2.1/20110323/floats-wrap-top-below-inline-003l-expected.html: Added.
     35        * css2.1/20110323/floats-wrap-top-below-inline-003l.htm: Added.
     36        * css2.1/20110323/floats-wrap-top-below-inline-003r-expected.html: Added.
     37        * css2.1/20110323/floats-wrap-top-below-inline-003r.htm: Added.
     38        * css2.1/20110323/floats-zero-height-wrap-001-expected.html: Added.
     39        * css2.1/20110323/floats-zero-height-wrap-001.htm: Added.
     40        * css2.1/20110323/floats-zero-height-wrap-002.htm: Added.
     41        * css2.1/20110323/floats-zero-height-wrap-002-expected.html: Added.
     42        All of these are taken from the CSS test suite, including the expected.html files which have been renamed
     43        from *-ref.html so that new-run-webkit-tests will parse use them.
     44        * fast/block/float/floats-wrap-inside-inline-001-expected.html: Added.
     45        * fast/block/float/floats-wrap-inside-inline-001.htm: Added.
     46        The span should avoid a float even when its top and bottom does not overlap with the top of the span.
     47        In this test the float starts and ends inside the span's first linebox.
     48        * fast/block/float/floats-wrap-inside-inline-002-expected.html: Added.
     49        * fast/block/float/floats-wrap-inside-inline-002.htm: Added.
     50        The span should avoid a float even when its top and bottom does not overlap with the top of the span.
     51        In this test the float overlaps the bottom of the span, but is below the span's first linebox.
     52        * fast/block/float/floats-wrap-inside-inline-003-expected.html: Added.
     53        * fast/block/float/floats-wrap-inside-inline-003.htm: Added.
     54        An inline span should avoid a float even when its top and bottom does not overlap with the top of the span.
     55        In this test the float starts and ends inside the span's first linebox.
     56        * fast/block/float/floats-wrap-inside-inline-004-expected.html: Added.
     57        * fast/block/float/floats-wrap-inside-inline-004.htm: Added.
     58        The span should avoid a float even when its top and bottom does not overlap with the top of the span.
     59        In this test the float overlaps inside the span and the span has height set by its style.
     60        * fast/block/float/floats-wrap-inside-inline-005-expected.html: Added.
     61        * fast/block/float/floats-wrap-inside-inline-005.htm: Added.
     62        In this test the float starts and ends inside the span's second linebox, so only the second linebox should avoid the float.
     63        * platform/chromium-win/css1/formatting_model/floating_elements-expected.txt:
     64        This is a progression due to lineboxes now avoiding floats they overlap.
     65
    1662012-07-03  Emil A Eklund  <eae@chromium.org>
    267
  • trunk/LayoutTests/platform/chromium-win/css1/formatting_model/floating_elements-expected.txt

    r117821 r121789  
    1 layer at (0,0) size 785x6441
     1layer at (0,0) size 785x6501
    22  RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x6441
    4   RenderBlock {HTML} at (0,0) size 785x6441
    5     RenderBody {BODY} at (8,8) size 769x6425 [bgcolor=#CCCCCC]
     3layer at (0,0) size 785x6501
     4  RenderBlock {HTML} at (0,0) size 785x6501
     5    RenderBody {BODY} at (8,8) size 769x6485 [bgcolor=#CCCCCC]
    66      RenderBlock {P} at (0,0) size 769x20
    77        RenderText {#text} at (0,0) size 337x19
     
    106106          text run at (5,185) width 123: "be on the next \"line.\""
    107107      RenderBlock {HR} at (24,992) size 579x2 [border: (1px inset #000000)]
    108       RenderBlock {DIV} at (2,1018) size 314x350 [border: (5px solid #800080)]
     108      RenderBlock {DIV} at (2,1018) size 314x364 [border: (5px solid #800080)]
    109109        RenderBlock (floating) {P} at (5,5) size 194x74 [bgcolor=#C0C0C0] [border: (1px solid #00FF00)]
    110110          RenderText {#text} at (17,17) size 159x39
     
    116116            text run at (17,37) width 127: "paragraph (second in"
    117117            text run at (17,57) width 49: "source)."
    118         RenderText {#text} at (199,5) size 303x339
     118        RenderText {#text} at (199,5) size 303x353
    119119          text run at (199,5) width 103: "This is text within"
    120120          text run at (199,25) width 57: "the DIV. "
    121121          text run at (256,25) width 23: "The"
    122122          text run at (199,45) width 99: "floating elements"
    123           text run at (199,65) width 90: "within this DIV"
    124           text run at (5,85) width 81: "should not go"
    125           text run at (5,105) width 106: "beyond the left or"
    126           text run at (5,125) width 108: "right inner edge of"
    127           text run at (5,145) width 94: "this DIV, which"
    128           text run at (5,165) width 86: "means that the"
    129           text run at (5,185) width 303: "borders of the floating elements should not overlap"
    130           text run at (5,205) width 283: "the top or side borders of the DIV in any way. "
    131           text run at (288,205) width 12: "In"
    132           text run at (5,225) width 302: "addition, they should not overlap each other in any"
    133           text run at (5,245) width 238: "way, nor should the floated elements be"
    134           text run at (5,265) width 174: "overwritten by the DIV text. "
    135           text run at (179,265) width 90: "In addition, the"
    136           text run at (5,285) width 288: "floated elements should not be side-by-side, but"
    137           text run at (5,305) width 271: "instead the first should be floated left, and the"
    138           text run at (5,325) width 249: "second floated to the right below the first."
    139       RenderBlock {HR} at (364,1376) size 41x2 [border: (1px inset #000000)]
    140       RenderBlock {DIV} at (2,1386) size 410x230 [border: (5px solid #800080)]
     123          text run at (5,79) width 90: "within this DIV"
     124          text run at (5,99) width 81: "should not go"
     125          text run at (5,119) width 106: "beyond the left or"
     126          text run at (5,139) width 108: "right inner edge of"
     127          text run at (5,159) width 94: "this DIV, which"
     128          text run at (5,179) width 278: "means that the borders of the floating elements"
     129          text run at (5,199) width 291: "should not overlap the top or side borders of the"
     130          text run at (5,219) width 103: "DIV in any way. "
     131          text run at (108,219) width 163: "In addition, they should not"
     132          text run at (5,239) width 273: "overlap each other in any way, nor should the"
     133          text run at (5,259) width 290: "floated elements be overwritten by the DIV text."
     134          text run at (5,279) width 276: "In addition, the floated elements should not be"
     135          text run at (5,299) width 303: "side-by-side, but instead the first should be floated"
     136          text run at (5,319) width 293: "left, and the second floated to the right below the"
     137          text run at (5,339) width 26: "first."
     138      RenderBlock {HR} at (364,1390) size 41x2 [border: (1px inset #000000)]
     139      RenderBlock {DIV} at (2,1400) size 410x246 [border: (5px solid #800080)]
    141140        RenderImage {IMG} at (5,5) size 256x36 [border: (3px solid #000000)]
    142141        RenderImage {IMG} at (149,41) size 256x36 [border: (3px solid #000000)]
    143         RenderText {#text} at (261,5) size 397x219
     142        RenderText {#text} at (261,5) size 400x235
    144143          text run at (261,5) width 125: "This is text within the"
    145           text run at (261,25) width 35: "DIV. "
    146           text run at (296,25) width 70: "The floating"
    147           text run at (5,45) width 135: "images within this DIV"
    148           text run at (5,65) width 130: "should not go beyond"
    149           text run at (5,85) width 357: "the left or right inner edge of this DIV, which means that the"
    150           text run at (5,105) width 383: "borders of the floating images should not overlap the top or side"
    151           text run at (5,125) width 192: "borders of the DIV in any way. "
    152           text run at (197,125) width 163: "In addition, they should not"
    153           text run at (5,145) width 393: "overlap each other in any way, nor should the floated elements be"
    154           text run at (5,165) width 174: "overwritten by the DIV text. "
    155           text run at (179,165) width 223: "In addition, the floated images should"
    156           text run at (5,185) width 397: "not be side-by-side, but instead the first should be floated left, and"
    157           text run at (5,205) width 271: "the second floated to the right below the first."
    158       RenderBlock {HR} at (24,1640) size 579x2 [border: (1px inset #000000)]
    159       RenderBlock {DIV} at (2,1666) size 765x130 [border: (5px solid #800080)]
     144          text run at (5,41) width 35: "DIV. "
     145          text run at (40,41) width 70: "The floating"
     146          text run at (5,61) width 135: "images within this DIV"
     147          text run at (5,81) width 362: "should not go beyond the left or right inner edge of this DIV,"
     148          text run at (5,101) width 372: "which means that the borders of the floating images should not"
     149          text run at (5,121) width 332: "overlap the top or side borders of the DIV in any way. "
     150          text run at (337,121) width 68: "In addition,"
     151          text run at (5,141) width 368: "they should not overlap each other in any way, nor should the"
     152          text run at (5,161) width 294: "floated elements be overwritten by the DIV text. "
     153          text run at (299,161) width 90: "In addition, the"
     154          text run at (5,181) width 371: "floated images should not be side-by-side, but instead the first"
     155          text run at (5,201) width 400: "should be floated left, and the second floated to the right below the"
     156          text run at (5,221) width 26: "first."
     157      RenderBlock {HR} at (24,1670) size 579x2 [border: (1px inset #000000)]
     158      RenderBlock {DIV} at (2,1696) size 765x130 [border: (5px solid #800080)]
    160159        RenderBlock (floating) {P} at (566,5) size 194x74 [bgcolor=#C0C0C0] [border: (1px solid #00FF00)]
    161160          RenderText {#text} at (17,17) size 159x39
     
    176175          text run at (199,85) width 551: "addition, the top of the left-floating box should not be higher than the top of the right-floating"
    177176          text run at (5,105) width 27: "box."
    178       RenderBlock {HR} at (364,1804) size 41x2 [border: (1px inset #000000)]
    179       RenderBlock {DIV} at (2,1814) size 765x70 [border: (5px solid #800080)]
     177      RenderBlock {HR} at (364,1834) size 41x2 [border: (1px inset #000000)]
     178      RenderBlock {DIV} at (2,1844) size 765x70 [border: (5px solid #800080)]
    180179        RenderImage {IMG} at (5,5) size 15x36 [border: (3px solid #000000)]
    181180        RenderImage {IMG} at (745,5) size 15x36 [border: (3px solid #000000)]
     
    186185          text run at (689,25) width 12: "In"
    187186          text run at (5,45) width 606: "addition, the top of the left-floating image should not be higher than the top of the right-floating image."
    188       RenderBlock {HR} at (24,1908) size 579x2 [border: (1px inset #000000)]
    189       RenderBlock {DIV} at (2,1934) size 765x130 [border: (5px solid #800080)]
     187      RenderBlock {HR} at (24,1938) size 579x2 [border: (1px inset #000000)]
     188      RenderBlock {DIV} at (2,1964) size 765x130 [border: (5px solid #800080)]
    190189        RenderText {#text} at (199,5) size 172x19
    191190          text run at (199,5) width 164: "This is text within the DIV. "
     
    211210          text run at (230,85) width 314: "In order to mark these points clearly, an asterisk has"
    212211          text run at (5,105) width 279: "been inserted just before each floated element."
    213       RenderBlock {HR} at (364,2073) size 41x2 [border: (1px inset #000000)]
    214       RenderBlock {DIV} at (2,2083) size 765x90 [border: (5px solid #800080)]
     212      RenderBlock {HR} at (364,2103) size 41x2 [border: (1px inset #000000)]
     213      RenderBlock {DIV} at (2,2113) size 765x90 [border: (5px solid #800080)]
    215214        RenderText {#text} at (20,5) size 172x19
    216215          text run at (20,5) width 164: "This is text within the DIV. "
     
    227226          text run at (565,45) width 175: "In order to mark these points"
    228227          text run at (5,65) width 407: "clearly, an asterisk has been inserted just before each floated image."
    229       RenderBlock {HR} at (24,2197) size 579x2 [border: (1px inset #000000)]
    230       RenderBlock {DIV} at (2,2223) size 765x230 [border: (5px solid #800080)]
     228      RenderBlock {HR} at (24,2227) size 579x2 [border: (1px inset #000000)]
     229      RenderBlock {DIV} at (2,2253) size 765x230 [border: (5px solid #800080)]
    231230        RenderText {#text} at (199,5) size 172x19
    232231          text run at (199,5) width 164: "This is text within the DIV. "
     
    272271          text run at (199,185) width 517: "float so that its top is aligned with the top of the line-box in which the asterisk appears."
    273272          text run at (199,205) width 380: "Otherwise, its top should align with the top of the next line-box."
    274       RenderBlock {HR} at (364,2462) size 41x2 [border: (1px inset #000000)]
    275       RenderBlock {DIV} at (2,2472) size 765x130 [border: (5px solid #800080)]
     273      RenderBlock {HR} at (364,2492) size 41x2 [border: (1px inset #000000)]
     274      RenderBlock {DIV} at (2,2502) size 765x130 [border: (5px solid #800080)]
    276275        RenderText {#text} at (20,5) size 172x19
    277276          text run at (20,5) width 164: "This is text within the DIV. "
     
    298297          text run at (5,85) width 693: "image, then the image should float so that its top is aligned with the top of the line-box in which the asterisk appears."
    299298          text run at (5,105) width 380: "Otherwise, its top should align with the top of the next line-box."
    300       RenderBlock {HR} at (24,2626) size 579x2 [border: (1px inset #000000)]
    301       RenderBlock {DIV} at (2,2652) size 490x310 [border: (5px solid #800080)]
     299      RenderBlock {HR} at (24,2656) size 579x2 [border: (1px inset #000000)]
     300      RenderBlock {DIV} at (2,2682) size 490x310 [border: (5px solid #800080)]
    302301        RenderText {#text} at (199,5) size 50x19
    303302          text run at (199,5) width 50: "This is *"
     
    330329          text run at (5,265) width 456: "of the floated element to avoid floating elements appearing before text which"
    331330          text run at (5,285) width 213: "precedes it in the source document."
    332       RenderBlock {HR} at (364,2970) size 41x2 [border: (1px inset #000000)]
    333       RenderBlock {DIV} at (2,2980) size 490x230 [border: (5px solid #800080)]
     331      RenderBlock {HR} at (364,3000) size 41x2 [border: (1px inset #000000)]
     332      RenderBlock {DIV} at (2,3010) size 490x230 [border: (5px solid #800080)]
    334333        RenderText {#text} at (20,5) size 50x19
    335334          text run at (20,5) width 50: "This is *"
     
    353352          text run at (5,185) width 479: "insertion point of the floated element to avoid floating elements appearing before"
    354353          text run at (5,205) width 278: "text which precedes it in the source document."
    355       RenderBlock {HR} at (24,3234) size 579x2 [border: (1px inset #000000)]
    356       RenderTable {TABLE} at (0,3260) size 769x3165 [border: (1px outset #808080)]
    357         RenderTableSection {TBODY} at (1,1) size 767x3163
     354      RenderBlock {HR} at (24,3264) size 579x2 [border: (1px inset #000000)]
     355      RenderTable {TABLE} at (0,3290) size 769x3195 [border: (1px outset #808080)]
     356        RenderTableSection {TBODY} at (1,1) size 767x3193
    358357          RenderTableRow {TR} at (0,0) size 767x28
    359358            RenderTableCell {TD} at (0,0) size 767x28 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
     
    361360                RenderText {#text} at (4,4) size 159x19
    362361                  text run at (4,4) width 159: "TABLE Testing Section"
    363           RenderTableRow {TR} at (0,28) size 767x3135
    364             RenderTableCell {TD} at (0,1581) size 12x28 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     362          RenderTableRow {TR} at (0,28) size 767x3165
     363            RenderTableCell {TD} at (0,1596) size 12x28 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    365364              RenderText {#text} at (4,4) size 4x19
    366365                text run at (4,4) width 4: " "
    367             RenderTableCell {TD} at (12,28) size 755x3135 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     366            RenderTableCell {TD} at (12,28) size 755x3165 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    368367              RenderBlock {P} at (4,4) size 747x40
    369368                RenderText {#text} at (0,0) size 731x39
     
    446445                  text run at (5,185) width 123: "be on the next \"line.\""
    447446              RenderBlock {HR} at (28,804) size 563x2 [border: (1px inset #000000)]
    448               RenderBlock {DIV} at (6,830) size 314x350 [border: (5px solid #800080)]
     447              RenderBlock {DIV} at (6,830) size 314x364 [border: (5px solid #800080)]
    449448                RenderBlock (floating) {P} at (5,5) size 194x74 [bgcolor=#C0C0C0] [border: (1px solid #00FF00)]
    450449                  RenderText {#text} at (17,17) size 159x39
     
    456455                    text run at (17,37) width 127: "paragraph (second in"
    457456                    text run at (17,57) width 49: "source)."
    458                 RenderText {#text} at (199,5) size 303x339
     457                RenderText {#text} at (199,5) size 303x353
    459458                  text run at (199,5) width 103: "This is text within"
    460459                  text run at (199,25) width 57: "the DIV. "
    461460                  text run at (256,25) width 23: "The"
    462461                  text run at (199,45) width 99: "floating elements"
    463                   text run at (199,65) width 90: "within this DIV"
    464                   text run at (5,85) width 81: "should not go"
    465                   text run at (5,105) width 106: "beyond the left or"
    466                   text run at (5,125) width 108: "right inner edge of"
    467                   text run at (5,145) width 94: "this DIV, which"
    468                   text run at (5,165) width 86: "means that the"
    469                   text run at (5,185) width 303: "borders of the floating elements should not overlap"
    470                   text run at (5,205) width 283: "the top or side borders of the DIV in any way. "
    471                   text run at (288,205) width 12: "In"
    472                   text run at (5,225) width 302: "addition, they should not overlap each other in any"
    473                   text run at (5,245) width 238: "way, nor should the floated elements be"
    474                   text run at (5,265) width 174: "overwritten by the DIV text. "
    475                   text run at (179,265) width 90: "In addition, the"
    476                   text run at (5,285) width 288: "floated elements should not be side-by-side, but"
    477                   text run at (5,305) width 271: "instead the first should be floated left, and the"
    478                   text run at (5,325) width 249: "second floated to the right below the first."
    479               RenderBlock {HR} at (357,1188) size 41x2 [border: (1px inset #000000)]
    480               RenderBlock {DIV} at (6,1198) size 410x230 [border: (5px solid #800080)]
     462                  text run at (5,79) width 90: "within this DIV"
     463                  text run at (5,99) width 81: "should not go"
     464                  text run at (5,119) width 106: "beyond the left or"
     465                  text run at (5,139) width 108: "right inner edge of"
     466                  text run at (5,159) width 94: "this DIV, which"
     467                  text run at (5,179) width 278: "means that the borders of the floating elements"
     468                  text run at (5,199) width 291: "should not overlap the top or side borders of the"
     469                  text run at (5,219) width 103: "DIV in any way. "
     470                  text run at (108,219) width 163: "In addition, they should not"
     471                  text run at (5,239) width 273: "overlap each other in any way, nor should the"
     472                  text run at (5,259) width 290: "floated elements be overwritten by the DIV text."
     473                  text run at (5,279) width 276: "In addition, the floated elements should not be"
     474                  text run at (5,299) width 303: "side-by-side, but instead the first should be floated"
     475                  text run at (5,319) width 293: "left, and the second floated to the right below the"
     476                  text run at (5,339) width 26: "first."
     477              RenderBlock {HR} at (357,1202) size 41x2 [border: (1px inset #000000)]
     478              RenderBlock {DIV} at (6,1212) size 410x246 [border: (5px solid #800080)]
    481479                RenderImage {IMG} at (5,5) size 256x36 [border: (3px solid #000000)]
    482480                RenderImage {IMG} at (149,41) size 256x36 [border: (3px solid #000000)]
    483                 RenderText {#text} at (261,5) size 397x219
     481                RenderText {#text} at (261,5) size 400x235
    484482                  text run at (261,5) width 125: "This is text within the"
    485                   text run at (261,25) width 35: "DIV. "
    486                   text run at (296,25) width 70: "The floating"
    487                   text run at (5,45) width 135: "images within this DIV"
    488                   text run at (5,65) width 130: "should not go beyond"
    489                   text run at (5,85) width 357: "the left or right inner edge of this DIV, which means that the"
    490                   text run at (5,105) width 383: "borders of the floating images should not overlap the top or side"
    491                   text run at (5,125) width 192: "borders of the DIV in any way. "
    492                   text run at (197,125) width 163: "In addition, they should not"
    493                   text run at (5,145) width 393: "overlap each other in any way, nor should the floated elements be"
    494                   text run at (5,165) width 174: "overwritten by the DIV text. "
    495                   text run at (179,165) width 223: "In addition, the floated images should"
    496                   text run at (5,185) width 397: "not be side-by-side, but instead the first should be floated left, and"
    497                   text run at (5,205) width 271: "the second floated to the right below the first."
    498               RenderBlock {HR} at (28,1452) size 563x2 [border: (1px inset #000000)]
    499               RenderBlock {DIV} at (6,1478) size 743x130 [border: (5px solid #800080)]
     483                  text run at (5,41) width 35: "DIV. "
     484                  text run at (40,41) width 70: "The floating"
     485                  text run at (5,61) width 135: "images within this DIV"
     486                  text run at (5,81) width 362: "should not go beyond the left or right inner edge of this DIV,"
     487                  text run at (5,101) width 372: "which means that the borders of the floating images should not"
     488                  text run at (5,121) width 332: "overlap the top or side borders of the DIV in any way. "
     489                  text run at (337,121) width 68: "In addition,"
     490                  text run at (5,141) width 368: "they should not overlap each other in any way, nor should the"
     491                  text run at (5,161) width 294: "floated elements be overwritten by the DIV text. "
     492                  text run at (299,161) width 90: "In addition, the"
     493                  text run at (5,181) width 371: "floated images should not be side-by-side, but instead the first"
     494                  text run at (5,201) width 400: "should be floated left, and the second floated to the right below the"
     495                  text run at (5,221) width 26: "first."
     496              RenderBlock {HR} at (28,1482) size 563x2 [border: (1px inset #000000)]
     497              RenderBlock {DIV} at (6,1508) size 743x130 [border: (5px solid #800080)]
    500498                RenderBlock (floating) {P} at (544,5) size 194x74 [bgcolor=#C0C0C0] [border: (1px solid #00FF00)]
    501499                  RenderText {#text} at (17,17) size 159x39
     
    516514                  text run at (257,85) width 466: "In addition, the top of the left-floating box should not be higher than the top of"
    517515                  text run at (5,105) width 128: "the right-floating box."
    518               RenderBlock {HR} at (357,1616) size 41x2 [border: (1px inset #000000)]
    519               RenderBlock {DIV} at (6,1626) size 743x70 [border: (5px solid #800080)]
     516              RenderBlock {HR} at (357,1646) size 41x2 [border: (1px inset #000000)]
     517              RenderBlock {DIV} at (6,1656) size 743x70 [border: (5px solid #800080)]
    520518                RenderImage {IMG} at (5,5) size 15x36 [border: (3px solid #000000)]
    521519                RenderImage {IMG} at (723,5) size 15x36 [border: (3px solid #000000)]
     
    526524                  text run at (689,25) width 12: "In"
    527525                  text run at (5,45) width 606: "addition, the top of the left-floating image should not be higher than the top of the right-floating image."
    528               RenderBlock {HR} at (28,1720) size 563x2 [border: (1px inset #000000)]
    529               RenderBlock {DIV} at (6,1746) size 743x130 [border: (5px solid #800080)]
     526              RenderBlock {HR} at (28,1750) size 563x2 [border: (1px inset #000000)]
     527              RenderBlock {DIV} at (6,1776) size 743x130 [border: (5px solid #800080)]
    530528                RenderText {#text} at (199,5) size 172x19
    531529                  text run at (199,5) width 164: "This is text within the DIV. "
     
    551549                  text run at (320,85) width 222: "In order to mark these points clearly,"
    552550                  text run at (5,105) width 371: "an asterisk has been inserted just before each floated element."
    553               RenderBlock {HR} at (357,1885) size 41x2 [border: (1px inset #000000)]
    554               RenderBlock {DIV} at (6,1895) size 743x90 [border: (5px solid #800080)]
     551              RenderBlock {HR} at (357,1915) size 41x2 [border: (1px inset #000000)]
     552              RenderBlock {DIV} at (6,1925) size 743x90 [border: (5px solid #800080)]
    555553                RenderText {#text} at (20,5) size 172x19
    556554                  text run at (20,5) width 164: "This is text within the DIV. "
     
    567565                  text run at (622,45) width 100: "In order to mark"
    568566                  text run at (5,65) width 482: "these points clearly, an asterisk has been inserted just before each floated image."
    569               RenderBlock {HR} at (28,2009) size 563x2 [border: (1px inset #000000)]
    570               RenderBlock {DIV} at (6,2035) size 743x290 [border: (5px solid #800080)]
     567              RenderBlock {HR} at (28,2039) size 563x2 [border: (1px inset #000000)]
     568              RenderBlock {DIV} at (6,2065) size 743x290 [border: (5px solid #800080)]
    571569                RenderText {#text} at (199,5) size 172x19
    572570                  text run at (199,5) width 164: "This is text within the DIV. "
     
    616614                  text run at (5,265) width 167: "which the asterisk appears. "
    617615                  text run at (172,265) width 380: "Otherwise, its top should align with the top of the next line-box."
    618               RenderBlock {HR} at (357,2333) size 41x2 [border: (1px inset #000000)]
    619               RenderBlock {DIV} at (6,2343) size 743x130 [border: (5px solid #800080)]
     616              RenderBlock {HR} at (357,2363) size 41x2 [border: (1px inset #000000)]
     617              RenderBlock {DIV} at (6,2373) size 743x130 [border: (5px solid #800080)]
    620618                RenderText {#text} at (20,5) size 172x19
    621619                  text run at (20,5) width 164: "This is text within the DIV. "
     
    643641                  text run at (5,105) width 56: "appears. "
    644642                  text run at (61,105) width 380: "Otherwise, its top should align with the top of the next line-box."
    645               RenderBlock {HR} at (28,2497) size 563x2 [border: (1px inset #000000)]
    646               RenderBlock {DIV} at (6,2523) size 490x310 [border: (5px solid #800080)]
     643              RenderBlock {HR} at (28,2527) size 563x2 [border: (1px inset #000000)]
     644              RenderBlock {DIV} at (6,2553) size 490x310 [border: (5px solid #800080)]
    647645                RenderText {#text} at (199,5) size 50x19
    648646                  text run at (199,5) width 50: "This is *"
     
    675673                  text run at (5,265) width 456: "of the floated element to avoid floating elements appearing before text which"
    676674                  text run at (5,285) width 213: "precedes it in the source document."
    677               RenderBlock {HR} at (357,2841) size 41x2 [border: (1px inset #000000)]
    678               RenderBlock {DIV} at (6,2851) size 490x230 [border: (5px solid #800080)]
     675              RenderBlock {HR} at (357,2871) size 41x2 [border: (1px inset #000000)]
     676              RenderBlock {DIV} at (6,2881) size 490x230 [border: (5px solid #800080)]
    679677                RenderText {#text} at (20,5) size 50x19
    680678                  text run at (20,5) width 50: "This is *"
     
    698696                  text run at (5,185) width 479: "insertion point of the floated element to avoid floating elements appearing before"
    699697                  text run at (5,205) width 278: "text which precedes it in the source document."
    700               RenderBlock {HR} at (28,3105) size 563x2 [border: (1px inset #000000)]
     698              RenderBlock {HR} at (28,3135) size 563x2 [border: (1px inset #000000)]
  • trunk/Source/WebCore/ChangeLog

    r121778 r121789  
     12012-07-03  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: floats-wrap-top-below-inline-* fail
     4        https://bugs.webkit.org/show_bug.cgi?id=88171
     5
     6        Reviewed by Eric Seidel.
     7
     8        When shifting a line or element left or right to avoid a float use the height
     9        of the line or element to determine whether the float is inside the element or
     10        if it overlaps the bottom of the element.
     11
     12        Do this by passing the height of the element to the interval tree used to detect
     13        the overlap with it's containing block's floats. The height is zero by default so
     14        callers to logical[Left|Right]OffsetForLine will need to pass the height if they
     15        want to use it to detect floats to avoid.
     16
     17        Tests: css2.1/20110323/floats-wrap-top-below-bfc-001l.htm
     18               css2.1/20110323/floats-wrap-top-below-bfc-001r.htm
     19               css2.1/20110323/floats-wrap-top-below-bfc-002l.htm
     20               css2.1/20110323/floats-wrap-top-below-bfc-002r.htm
     21               css2.1/20110323/floats-wrap-top-below-bfc-003l.htm
     22               css2.1/20110323/floats-wrap-top-below-bfc-003r.htm
     23               css2.1/20110323/floats-wrap-top-below-inline-001l.htm
     24               css2.1/20110323/floats-wrap-top-below-inline-001r.htm
     25               css2.1/20110323/floats-wrap-top-below-inline-002l.htm
     26               css2.1/20110323/floats-wrap-top-below-inline-002r.htm
     27               css2.1/20110323/floats-wrap-top-below-inline-003l.htm
     28               css2.1/20110323/floats-wrap-top-below-inline-003r.htm
     29               css2.1/20110323/floats-zero-height-wrap-001.htm
     30               css2.1/20110323/floats-zero-height-wrap-002.htm
     31               fast/block/float/floats-wrap-inside-inline-001.htm
     32               fast/block/float/floats-wrap-inside-inline-002.htm
     33               fast/block/float/floats-wrap-inside-inline-003.htm
     34               fast/block/float/floats-wrap-inside-inline-004.htm
     35               fast/block/float/floats-wrap-inside-inline-005.htm
     36
     37        * rendering/RenderBlock.cpp:
     38        (WebCore::RenderBlock::computeStartPositionDeltaForChildAvoidingFloats):
     39        (WebCore::::collectIfNeeded):
     40        (WebCore::RenderBlock::logicalLeftOffsetForLine):
     41        (WebCore::RenderBlock::logicalRightOffsetForLine):
     42        (WebCore::RenderBlock::getClearDelta):
     43        * rendering/RenderBlock.h:
     44        (WebCore::RenderBlock::availableLogicalWidthForLine):
     45        (WebCore::RenderBlock::logicalRightOffsetForLine):
     46        (WebCore::RenderBlock::logicalLeftOffsetForLine):
     47        (WebCore::RenderBlock::startOffsetForLine):
     48        (WebCore::RenderBlock::endOffsetForLine):
     49        (WebCore::RenderBlock::pixelSnappedLogicalLeftOffsetForLine):
     50        (WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
     51        (RenderBlock):
     52        (WebCore::RenderBlock::FloatIntervalSearchAdapter::FloatIntervalSearchAdapter):
     53        (WebCore::RenderBlock::FloatIntervalSearchAdapter::lowValue):
     54        (WebCore::RenderBlock::FloatIntervalSearchAdapter::highValue):
     55        (FloatIntervalSearchAdapter):
     56        * rendering/RenderBlockLineLayout.cpp:
     57        (WebCore::logicalBottomForLine):
     58        (WebCore):
     59        (WebCore::LineWidth::updateAvailableWidth):
     60        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
     61        * rendering/RenderBox.cpp:
     62        (WebCore::RenderBox::containingBlockAvailableLineWidthInRegion):
     63
    1642012-07-03  Vsevolod Vlasov  <vsevik@chromium.org>
    265
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r121728 r121789  
    21382138        blockOffset = max(blockOffset, blockOffset + (region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage));
    21392139
    2140     LayoutUnit startOff = startOffsetForLine(blockOffset, false, region, offsetFromLogicalTopOfFirstPage);
     2140    LayoutUnit startOff = startOffsetForLine(blockOffset, false, region, offsetFromLogicalTopOfFirstPage, logicalHeightForChild(child));
     2141
    21412142    if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) {
    21422143        if (childMarginStart < 0)
     
    39623963}
    39633964
     3965static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom)
     3966{
     3967    if (objectTop >= floatBottom || objectBottom < floatTop)
     3968        return false;
     3969
     3970    // The top of the object overlaps the float
     3971    if (objectTop >= floatTop)
     3972        return true;
     3973
     3974    // The object encloses the float
     3975    if (objectTop < floatTop && objectBottom > floatBottom)
     3976        return true;
     3977
     3978    // The bottom of the object overlaps the float
     3979    if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= floatBottom)
     3980        return true;
     3981
     3982    return false;
     3983}
     3984
    39643985template <RenderBlock::FloatingObject::Type FloatTypeValue>
    39653986inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) const
    39663987{
    39673988    const FloatingObject* r = interval.data();
    3968     if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < interval.high()) {
    3969         // All the objects returned from the tree should be already placed.
    3970         ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <= m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value);
    3971 
    3972         if (FloatTypeValue == FloatingObject::FloatLeft
    3973             && m_renderer->logicalRightForFloat(r) > m_offset) {
    3974             m_offset = m_renderer->logicalRightForFloat(r);
    3975             if (m_heightRemaining)
    3976                 *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
    3977         }
    3978 
    3979         if (FloatTypeValue == FloatingObject::FloatRight
    3980             && m_renderer->logicalLeftForFloat(r) < m_offset) {
    3981             m_offset = m_renderer->logicalLeftForFloat(r);
    3982             if (m_heightRemaining)
    3983                 *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
    3984         }
     3989    if (r->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue))
     3990        return;
     3991
     3992    // All the objects returned from the tree should be already placed.
     3993    ASSERT(r->isPlaced() && rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(r), m_renderer->pixelSnappedLogicalBottomForFloat(r), m_lowValue, m_highValue));
     3994
     3995    if (FloatTypeValue == FloatingObject::FloatLeft
     3996        && m_renderer->logicalRightForFloat(r) > m_offset) {
     3997        m_offset = m_renderer->logicalRightForFloat(r);
     3998        if (m_heightRemaining)
     3999            *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowValue;
     4000    }
     4001
     4002    if (FloatTypeValue == FloatingObject::FloatRight
     4003        && m_renderer->logicalLeftForFloat(r) < m_offset) {
     4004        m_offset = m_renderer->logicalLeftForFloat(r);
     4005        if (m_heightRemaining)
     4006            *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowValue;
    39854007    }
    39864008}
     
    40164038}
    40174039
    4018 LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const
     4040LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit logicalHeight) const
    40194041{
    40204042    LayoutUnit left = fixedOffset;
     
    40234045            *heightRemaining = 1;
    40244046
    4025         FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), left, heightRemaining);
     4047        FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemaining);
    40264048        m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
    40274049    }
     
    40634085}
    40644086
    4065 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const
     4087LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit logicalHeight) const
    40664088{
    40674089    LayoutUnit right = fixedOffset;
     
    40714093
    40724094        LayoutUnit rightFloatOffset = fixedOffset;
    4073         FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), rightFloatOffset, heightRemaining);
     4095        FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, heightRemaining);
    40744096        m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
    40754097        right = min(right, rightFloatOffset);
     
    45124534        LayoutUnit newLogicalTop = logicalTop;
    45134535        while (true) {
    4514             LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLogicalWidthForLine(newLogicalTop, false);
     4536            LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLogicalWidthForLine(newLogicalTop, false, logicalHeightForChild(child));
    45154537            if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWidthForContent(newLogicalTop))
    45164538                return newLogicalTop - logicalTop;
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r121557 r121789  
    132132    // Versions that can compute line offsets with the region and page offset passed in. Used for speed to avoid having to
    133133    // compute the region all over again when you already know it.
    134     LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    135     {
    136         return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
    137             - logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage));
    138     }
    139     LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    140     {
    141         return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine);
    142     }
    143     LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    144     {
    145         return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine);
    146     }
    147     LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    148     {
    149         return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
    150             : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage);
    151     }
    152     LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    153     {
    154         return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
    155             : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage);
    156     }
    157 
    158     LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine) const
    159     {
    160         return availableLogicalWidthForLine(position, firstLine, regionAtBlockOffset(position), offsetFromLogicalTopOfFirstPage());
    161     }
    162     LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine) const
    163     {
    164         return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0);
    165     }
    166     LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const
    167     {
    168         return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0);
    169     }
    170     LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const
    171     {
    172         return roundToInt(logicalLeftOffsetForLine(position, firstLine));
    173     }
    174     LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine) const
     134    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     135    {
     136        return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
     137            - logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight));
     138    }
     139    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     140    {
     141        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine, 0, logicalHeight);
     142    }
     143    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     144    {
     145        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine, 0, logicalHeight);
     146    }
     147    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     148    {
     149        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
     150            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
     151    }
     152    LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     153    {
     154        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
     155            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
     156    }
     157
     158    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     159    {
     160        return availableLogicalWidthForLine(position, firstLine, regionAtBlockOffset(position), offsetFromLogicalTopOfFirstPage(), logicalHeight);
     161    }
     162    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     163    {
     164        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0, logicalHeight);
     165    }
     166    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     167    {
     168        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0, logicalHeight);
     169    }
     170    LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     171    {
     172        return roundToInt(logicalLeftOffsetForLine(position, firstLine, logicalHeight));
     173    }
     174    LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
    175175    {
    176176        // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
    177177        // by a subpixel value for all but the first column. This can lead to the actual pixel snapped width of the column being off
    178178        // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
    179         return floorToInt(logicalRightOffsetForLine(position, firstLine));
    180     }
    181     LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const
    182     {
    183         return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine)
    184             : logicalWidth() - logicalRightOffsetForLine(position, firstLine);
    185     }
    186     LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine) const
    187     {
    188         return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine)
    189             : logicalWidth() - logicalRightOffsetForLine(position, firstLine);
     179        return floorToInt(logicalRightOffsetForLine(position, firstLine, logicalHeight));
     180    }
     181    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     182    {
     183        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, logicalHeight)
     184            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, logicalHeight);
     185    }
     186    LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
     187    {
     188        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, logicalHeight)
     189            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, logicalHeight);
    190190    }
    191191
     
    416416    virtual void paintObject(PaintInfo&, const LayoutPoint&);
    417417   
    418     LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0) const;
    419     LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0) const;
     418    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const;
     419    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const;
    420420
    421421    virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
     
    10011001        typedef FloatingObjectInterval IntervalType;
    10021002       
    1003         FloatIntervalSearchAdapter(const RenderBlock* renderer, int value, LayoutUnit& offset, LayoutUnit* heightRemaining)
     1003        FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, int highValue, LayoutUnit& offset, LayoutUnit* heightRemaining)
    10041004            : m_renderer(renderer)
    1005             , m_value(value)
     1005            , m_lowValue(lowValue)
     1006            , m_highValue(highValue)
    10061007            , m_offset(offset)
    10071008            , m_heightRemaining(heightRemaining)
     
    10091010        }
    10101011       
    1011         inline int lowValue() const { return m_value; }
    1012         inline int highValue() const { return m_value; }
     1012        inline int lowValue() const { return m_lowValue; }
     1013        inline int highValue() const { return m_highValue; }
    10131014        void collectIfNeeded(const IntervalType&) const;
    10141015
    10151016    private:
    10161017        const RenderBlock* m_renderer;
    1017         int m_value;
     1018        int m_lowValue;
     1019        int m_highValue;
    10181020        LayoutUnit& m_offset;
    10191021        LayoutUnit* m_heightRemaining;
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r121123 r121789  
    113113};
    114114
     115static LayoutUnit logicalHeightForLine(RenderBlock* block)
     116{
     117    InlineFlowBox* lineBox = block->firstRootBox();
     118    LayoutUnit logicalHeight = 0;
     119    if (!lineBox)
     120        return logicalHeight;
     121
     122    if (lineBox->firstChild() && lineBox->firstChild()->renderer() && lineBox->firstChild()->renderer()->isRenderBlock())
     123        logicalHeight = toRenderBlock(lineBox->firstChild()->renderer())->logicalHeight();
     124    else
     125        logicalHeight = lineBox->height();
     126    return logicalHeight;
     127}
     128
    115129inline void LineWidth::updateAvailableWidth()
    116130{
    117131    LayoutUnit height = m_block->logicalHeight();
    118     m_left = m_block->logicalLeftOffsetForLine(height, m_isFirstLine);
    119     m_right = m_block->logicalRightOffsetForLine(height, m_isFirstLine);
     132    LayoutUnit logicalHeight = logicalHeightForLine(m_block);
     133    m_left = m_block->logicalLeftOffsetForLine(height, m_isFirstLine, logicalHeight);
     134    m_right = m_block->logicalRightOffsetForLine(height, m_isFirstLine, logicalHeight);
    120135
    121136    computeAvailableWidthFromLeftAndRight();
     
    752767{
    753768    ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
    754     float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine());
    755     float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()) - logicalLeft;
     769   
     770    LayoutUnit lineLogicalHeight = logicalHeightForLine(this);
     771    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight);
     772    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight) - logicalLeft;
    756773
    757774    bool needsWordSpacing = false;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r121722 r121789  
    12391239        containingBlockRegion = cb->clampToStartAndEndRegions(region);
    12401240    }
    1241     return cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, adjustedPageOffsetForContainingBlock);
     1241    return cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, adjustedPageOffsetForContainingBlock, availableLogicalHeight());
    12421242}
    12431243
Note: See TracChangeset for help on using the changeset viewer.