⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 124295 in webkit


Ignore:
Timestamp:
Jul 31, 2012, 9:03:52 PM (14 years ago)
Author:
eae@chromium.org
Message:

Float imprecision causes incorrect wrapping in LineLayout with subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=92778

Reviewed by Eric Seidel.

Source/WebCore:

Due to float imprecision an incorrect wrapping decision is made in
certain cases where the values being compare are close but not exactly
the same. This can happen as the size of blocks is represented in layout
units while line layout uses floats.

Test: fast/sub-pixel/inline-block-should-not-wrap.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineWidth::fitsOnLine):
Use LayoutUnit::epsilon when comparing values as that is the maximum
precision we support.

LayoutTests:

Add test ensuring that an inline block isn't wrapped incorrectly.

  • fast/sub-pixel/inline-block-should-not-wrap-expected.html: Added.
  • fast/sub-pixel/inline-block-should-not-wrap.html: Added.
  • platform/mac-lion/Skipped:
  • platform/mac-snowleopard/Skipped:
  • platform/mac-wk2/Skipped:
  • platform/mac/Skipped:
  • platform/qt-4.8/Skipped:
  • platform/qt/Skipped:
  • platform/win-wk2/Skipped:
  • platform/win-xp/Skipped:
  • platform/win/Skipped:
  • platform/wincairo/Skipped:
  • platform/wk2/Skipped:
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r124294 r124295  
     12012-07-31  Emil A Eklund  <eae@chromium.org>
     2
     3        Float imprecision causes incorrect wrapping in LineLayout with subpixel layout
     4        https://bugs.webkit.org/show_bug.cgi?id=92778
     5
     6        Reviewed by Eric Seidel.
     7
     8        Add test ensuring that an inline block isn't wrapped incorrectly.
     9
     10        * fast/sub-pixel/inline-block-should-not-wrap-expected.html: Added.
     11        * fast/sub-pixel/inline-block-should-not-wrap.html: Added.
     12        * platform/mac-lion/Skipped:
     13        * platform/mac-snowleopard/Skipped:
     14        * platform/mac-wk2/Skipped:
     15        * platform/mac/Skipped:
     16        * platform/qt-4.8/Skipped:
     17        * platform/qt/Skipped:
     18        * platform/win-wk2/Skipped:
     19        * platform/win-xp/Skipped:
     20        * platform/win/Skipped:
     21        * platform/wincairo/Skipped:
     22        * platform/wk2/Skipped:
     23
    1242012-08-01  Joone Hur  <joone.hur@intel.com>
    225
  • trunk/LayoutTests/platform/mac-lion/Skipped

    r124221 r124295  
    109109fast/sub-pixel/float-with-right-margin-zoom.html
    110110fast/sub-pixel/float-wrap-with-subpixel-top.html
     111fast/sub-pixel/inline-block-should-not-wrap.html
    111112fast/sub-pixel/inline-block-with-margin.html
    112113fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/mac-snowleopard/Skipped

    r123782 r124295  
    203203fast/sub-pixel/float-with-right-margin-zoom.html
    204204fast/sub-pixel/float-wrap-with-subpixel-top.html
     205fast/sub-pixel/inline-block-should-not-wrap.html
    205206fast/sub-pixel/inline-block-with-margin.html
    206207fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r123782 r124295  
    209209fast/sub-pixel/float-with-right-margin-zoom.html
    210210fast/sub-pixel/float-wrap-with-subpixel-top.html
     211fast/sub-pixel/inline-block-should-not-wrap.html
    211212fast/sub-pixel/inline-block-with-margin.html
    212213fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/mac/Skipped

    r123783 r124295  
    817817fast/sub-pixel/float-with-right-margin-zoom.html
    818818fast/sub-pixel/float-wrap-with-subpixel-top.html
     819fast/sub-pixel/inline-block-should-not-wrap.html
    819820fast/sub-pixel/inline-block-with-margin.html
    820821fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/qt-4.8/Skipped

    r124030 r124295  
    9696fast/sub-pixel/float-with-right-margin-zoom.html
    9797fast/sub-pixel/float-wrap-with-subpixel-top.html
     98fast/sub-pixel/inline-block-should-not-wrap.html
    9899fast/sub-pixel/inline-block-with-margin.html
    99100fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/qt/Skipped

    r124216 r124295  
    270270fast/sub-pixel/float-with-right-margin-zoom.html
    271271fast/sub-pixel/float-wrap-with-subpixel-top.html
     272fast/sub-pixel/inline-block-should-not-wrap.html
    272273fast/sub-pixel/inline-block-with-margin.html
    273274fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/win-wk2/Skipped

    r123782 r124295  
    942942fast/sub-pixel/float-with-right-margin-zoom.html
    943943fast/sub-pixel/float-wrap-with-subpixel-top.html
     944fast/sub-pixel/inline-block-should-not-wrap.html
    944945fast/sub-pixel/inline-block-with-margin.html
    945946fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/win-xp/Skipped

    r123782 r124295  
    4242fast/sub-pixel/float-with-right-margin-zoom.html
    4343fast/sub-pixel/float-wrap-with-subpixel-top.html
     44fast/sub-pixel/inline-block-should-not-wrap.html
    4445fast/sub-pixel/inline-block-with-margin.html
    4546fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/win/Skipped

    r123782 r124295  
    17341734fast/sub-pixel/float-with-right-margin-zoom.html
    17351735fast/sub-pixel/float-wrap-with-subpixel-top.html
     1736fast/sub-pixel/inline-block-should-not-wrap.html
    17361737fast/sub-pixel/inline-block-with-margin.html
    17371738fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/wincairo/Skipped

    r123782 r124295  
    21232123fast/sub-pixel/float-with-right-margin-zoom.html
    21242124fast/sub-pixel/float-wrap-with-subpixel-top.html
     2125fast/sub-pixel/inline-block-should-not-wrap.html
    21252126fast/sub-pixel/inline-block-with-margin.html
    21262127fast/sub-pixel/inline-block-with-padding.html
  • trunk/LayoutTests/platform/wk2/Skipped

    r123782 r124295  
    9292fast/sub-pixel/float-with-right-margin-zoom.html
    9393fast/sub-pixel/float-wrap-with-subpixel-top.html
     94fast/sub-pixel/inline-block-should-not-wrap.html
    9495fast/sub-pixel/inline-block-with-margin.html
    9596fast/sub-pixel/inline-block-with-padding.html
  • trunk/Source/WebCore/ChangeLog

    r124291 r124295  
     12012-07-31  Emil A Eklund  <eae@chromium.org>
     2
     3        Float imprecision causes incorrect wrapping in LineLayout with subpixel layout
     4        https://bugs.webkit.org/show_bug.cgi?id=92778
     5
     6        Reviewed by Eric Seidel.
     7
     8        Due to float imprecision an incorrect wrapping decision is made in
     9        certain cases where the values being compare are close but not exactly
     10        the same. This can happen as the size of blocks is represented in layout
     11        units while line layout uses floats.
     12
     13        Test: fast/sub-pixel/inline-block-should-not-wrap.html
     14
     15        * rendering/RenderBlockLineLayout.cpp:
     16        (WebCore::LineWidth::fitsOnLine):
     17        Use LayoutUnit::epsilon when comparing values as that is the maximum
     18        precision we support.
     19
    1202012-07-31  Hayato Ito  <hayato@chromium.org>
    221
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r121789 r124295  
    7676        updateAvailableWidth();
    7777    }
     78#if ENABLE(SUBPIXEL_LAYOUT)
     79    bool fitsOnLine() const { return currentWidth() <= m_availableWidth + LayoutUnit::epsilon(); }
     80    bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_availableWidth + LayoutUnit::epsilon(); }
     81#else
    7882    bool fitsOnLine() const { return currentWidth() <= m_availableWidth; }
    7983    bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_availableWidth; }
     84#endif
    8085    float currentWidth() const { return m_committedWidth + m_uncommittedWidth; }
    8186
Note: See TracChangeset for help on using the changeset viewer.