Changeset 121917 in webkit


Ignore:
Timestamp:
Jul 5, 2012 11:20:42 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Subpixel layout broken with spans with CSS position other than static
https://bugs.webkit.org/show_bug.cgi?id=90097

Patch by Behdad Esfahbod <behdad@behdad.org> on 2012-07-05
Reviewed by Eric Seidel.

In InlineBox, don't truncate size to integers when returning.

In RenderBlock, don't round-up width to next integer. Round-up to
next LayoutUnit instead.

Test: Added fast/sub-pixel/size-of-span-with-different-positions.html
Adjust expected outputs affected by the rounding changes.

  • platform/FractionalLayoutUnit.h:

(WebCore::FractionalLayoutUnit::fromFloatCeil):
(FractionalLayoutUnit):

  • rendering/InlineBox.h:

(WebCore::InlineBox::size):

  • rendering/RenderBlock.cpp:

(WebCore::updatePreferredWidth):

Location:
trunk
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/platform/chromium-linux/fast/html/details-marker-style-expected.txt

    r117821 r121917  
    1616            RenderText {#text} at (100,79) size 27x92
    1717              text run at (100,79) width 91: "Summary"
    18       RenderBlock {DIV} at (0,257) size 784x47
     18      RenderBlock {DIV} at (0,256) size 784x48
    1919        RenderBlock {DETAILS} at (0,0) size 784x47
    2020          RenderBlock {SUMMARY} at (0,0) size 784x47
     
    2222            RenderText {#text} at (73,19) size 92x27
    2323              text run at (73,19) width 92: "Summary"
    24       RenderBlock {DIV} at (0,304) size 80x131
     24      RenderBlock {DIV} at (0,303) size 80x132
    2525        RenderBlock {DETAILS} at (0,0) size 80x131
    2626          RenderBlock {SUMMARY} at (0,0) size 80x131
  • trunk/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt

    r120403 r121917  
    1616                          text run at (0,0) width 478: "Both sides should have identical size after zooming"
    1717                  RenderTableRow {tr} at (0,67) size 490x24
    18                     RenderTableCell {td} at (1,67) size 244x24 [r=1 c=0 rs=1 cs=1]
    19                       RenderText {#text} at (97,5) size 50x14
    20                         text run at (97,5) width 50: "SVG Image"
    21                     RenderTableCell {td} at (246,67) size 243x24 [r=1 c=1 rs=1 cs=1]
    22                       RenderText {#text} at (95,5) size 53x14
    23                         text run at (95,5) width 53: "PNG Image"
     18                    RenderTableCell {td} at (1,67) size 243x24 [r=1 c=0 rs=1 cs=1]
     19                      RenderText {#text} at (96,5) size 51x14
     20                        text run at (96,5) width 51: "SVG Image"
     21                    RenderTableCell {td} at (245,67) size 244x24 [r=1 c=1 rs=1 cs=1]
     22                      RenderText {#text} at (95,5) size 54x14
     23                        text run at (95,5) width 54: "PNG Image"
    2424                  RenderTableRow {tr} at (0,92) size 490x82
    25                     RenderTableCell {td} at (1,92) size 244x82 [r=2 c=0 rs=1 cs=1]
    26                       RenderEmbeddedObject {object} at (100,4) size 139x70
     25                    RenderTableCell {td} at (1,92) size 243x82 [r=2 c=0 rs=1 cs=1]
     26                      RenderEmbeddedObject {object} at (99,4) size 139x70
    2727                        layer at (0,0) size 139x69
    2828                          RenderView at (0,0) size 139x69
     
    4343                            RenderSVGRect {rect} at (23,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
    4444                      RenderText {#text} at (0,0) size 0x0
    45                     RenderTableCell {td} at (246,92) size 243x82 [r=2 c=1 rs=1 cs=1]
     45                    RenderTableCell {td} at (245,92) size 244x82 [r=2 c=1 rs=1 cs=1]
    4646                      RenderImage {img} at (5,5) size 138x69
    4747                      RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.txt

    r120403 r121917  
    44  RenderBlock {html} at (0,0) size 800x379
    55    RenderBody {body} at (5,5) size 790x368
    6       RenderTable {table} at (41,0) size 706x367
    7         RenderTableSection (anonymous) at (0,0) size 705x367
    8           RenderTableRow {tr} at (0,0) size 705x367
    9             RenderTableCell {td} at (0,0) size 705x367 [r=0 c=0 rs=1 cs=3]
    10               RenderTable {table} at (7,6) size 693x355
    11                 RenderTableSection (anonymous) at (0,0) size 692x355
    12                   RenderTableRow {tr} at (0,1) size 692x65
    13                     RenderTableCell {td} at (1,1) size 690x66 [r=0 c=0 rs=1 cs=2]
    14                       RenderBlock {h1} at (5,19) size 681x27
    15                         RenderText {#text} at (101,0) size 478x25
    16                           text run at (101,0) width 478: "Both sides should have identical size after zooming"
    17                   RenderTableRow {tr} at (0,67) size 692x24
    18                     RenderTableCell {td} at (1,67) size 345x24 [r=1 c=0 rs=1 cs=1]
    19                       RenderText {#text} at (147,5) size 51x14
    20                         text run at (147,5) width 51: "SVG Image"
    21                     RenderTableCell {td} at (347,67) size 344x24 [r=1 c=1 rs=1 cs=1]
     6      RenderTable {table} at (42,0) size 705x367
     7        RenderTableSection (anonymous) at (0,0) size 704x367
     8          RenderTableRow {tr} at (0,0) size 704x367
     9            RenderTableCell {td} at (0,0) size 704x367 [r=0 c=0 rs=1 cs=3]
     10              RenderTable {table} at (7,6) size 692x355
     11                RenderTableSection (anonymous) at (0,0) size 691x355
     12                  RenderTableRow {tr} at (0,1) size 691x65
     13                    RenderTableCell {td} at (1,1) size 689x66 [r=0 c=0 rs=1 cs=2]
     14                      RenderBlock {h1} at (5,19) size 680x27
     15                        RenderText {#text} at (101,0) size 477x25
     16                          text run at (101,0) width 477: "Both sides should have identical size after zooming"
     17                  RenderTableRow {tr} at (0,67) size 691x24
     18                    RenderTableCell {td} at (1,67) size 344x24 [r=1 c=0 rs=1 cs=1]
     19                      RenderText {#text} at (147,5) size 50x14
     20                        text run at (147,5) width 50: "SVG Image"
     21                    RenderTableCell {td} at (346,67) size 344x24 [r=1 c=1 rs=1 cs=1]
    2222                      RenderText {#text} at (145,5) size 54x14
    2323                        text run at (145,5) width 54: "PNG Image"
    24                   RenderTableRow {tr} at (0,92) size 692x262
    25                     RenderTableCell {td} at (1,92) size 345x262 [r=2 c=0 rs=1 cs=1]
    26                       RenderEmbeddedObject {object} at (6,4) size 334x250
     24                  RenderTableRow {tr} at (0,92) size 691x262
     25                    RenderTableCell {td} at (1,92) size 344x262 [r=2 c=0 rs=1 cs=1]
     26                      RenderEmbeddedObject {object} at (5,4) size 334x250
    2727                        layer at (0,0) size 333x250
    2828                          RenderView at (0,0) size 333x250
     
    4343                            RenderSVGRect {rect} at (0,0) size 333x250 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
    4444                      RenderText {#text} at (0,0) size 0x0
    45                     RenderTableCell {td} at (347,92) size 344x262 [r=2 c=1 rs=1 cs=1]
     45                    RenderTableCell {td} at (346,92) size 344x262 [r=2 c=1 rs=1 cs=1]
    4646                      RenderImage {img} at (5,5) size 333x249
    4747                      RenderText {#text} at (0,0) size 0x0
  • trunk/Source/WebCore/ChangeLog

    r121912 r121917  
     12012-07-05  Behdad Esfahbod  <behdad@behdad.org>
     2
     3        Subpixel layout broken with spans with CSS position other than static
     4        https://bugs.webkit.org/show_bug.cgi?id=90097
     5
     6        Reviewed by Eric Seidel.
     7
     8        In InlineBox, don't truncate size to integers when returning.
     9
     10        In RenderBlock, don't round-up width to next integer.  Round-up to
     11        next LayoutUnit instead.
     12
     13        Test: Added fast/sub-pixel/size-of-span-with-different-positions.html
     14        Adjust expected outputs affected by the rounding changes.
     15
     16        * platform/FractionalLayoutUnit.h:
     17        (WebCore::FractionalLayoutUnit::fromFloatCeil):
     18        (FractionalLayoutUnit):
     19        * rendering/InlineBox.h:
     20        (WebCore::InlineBox::size):
     21        * rendering/RenderBlock.cpp:
     22        (WebCore::updatePreferredWidth):
     23
    1242012-07-05  Nate Chapin  <japhet@chromium.org>
    225
  • trunk/Source/WebCore/platform/FractionalLayoutUnit.h

    r121709 r121917  
    8787    FractionalLayoutUnit(const FractionalLayoutUnit& value) { m_value = value.rawValue(); }
    8888
     89    static FractionalLayoutUnit fromFloatCeil(float value)
     90    {
     91      REPORT_OVERFLOW(isInBounds(value));
     92      FractionalLayoutUnit v;
     93      v.m_value = ceilf(value * kFixedPointDenominator);
     94      return v;
     95    }
     96
    8997#if ENABLE(SUBPIXEL_LAYOUT)
    9098    int toInt() const { return m_value / kFixedPointDenominator; }
     
    169177   
    170178private:
    171     bool isInBounds(int value)
     179    static bool isInBounds(int value)
    172180    {
    173181        return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
    174182    }
    175     bool isInBounds(unsigned value)
     183    static bool isInBounds(unsigned value)
    176184    {
    177185        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
    178186    }
    179     bool isInBounds(double value)
     187    static bool isInBounds(double value)
    180188    {
    181189        return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
  • trunk/Source/WebCore/rendering/InlineBox.h

    r121085 r121917  
    208208    float width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
    209209    float height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
    210     FloatSize size() const { return IntSize(width(), height()); }
     210    FloatSize size() const { return FloatSize(width(), height()); }
    211211    float right() const { return left() + width(); }
    212212    float bottom() const { return top() + height(); }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r121789 r121917  
    55215521static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& result)
    55225522{
    5523     LayoutUnit snappedResult = ceilf(result);
     5523    LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result);
    55245524    preferredWidth = max(snappedResult, preferredWidth);
    55255525}
Note: See TracChangeset for help on using the changeset viewer.