Changeset 116009 in webkit


Ignore:
Timestamp:
May 3, 2012 2:07:32 PM (12 years ago)
Author:
leviw@chromium.org
Message:

[meta] Switch away from integers representing pixels for layout/event handling/rendering
https://bugs.webkit.org/show_bug.cgi?id=60318

Source/WebCore:

Patch by Levi Weintraub <leviw@chromium.org> and Emil A Eklund <eae@chromium.org> on 2012-04-23
Reviewed by Eric Seidel.

Swapping the LayoutUnit backend to FractionalLayoutUnit from int.

FractionalLayoutUnit is a new type that uses an integer to represent a fraction of a pixel.
We're also adding a feature flag -- ENABLE_SUBPIXEL_LAYOUT -- that toggles this fraction
between 1/1 and 1/60. Initially, all platforms will default to subpixel layout being off,
so FractionalLayoutUnits will effectively continue to act as integers.

With ENABLE_SUBPIXEL_LAYOUT turned on, FractionalLayoutUnits accumulate error from sub-pixel
CSS values and applied zooming, and painting uses pixel-snapping to align these values
to pixels. See http://trac.webkit.org/wiki/LayoutUnit for details.

In a number of previous patches, LayoutUnits were plumbed throughout the rendering tree
to prepare for this change. This included a number of functions in LayoutTypes.h and
the IntRect/Point/Size classes that were effectively no-ops while LayoutUnits were
integers. Subsequent patches will remove unnecessary versions of these functions; see
http://webkit.org/b/84616 for tracking these changes.

Tests: fast/sub-pixel/client-width-height-snapping.html

fast/sub-pixel/layout-boxes-with-zoom.html
fast/sub-pixel/size-of-box-with-zoom.html

  • WebCore.exp.in: Updating function signatures that expose FractionalLayoutUnits.
  • WebCore.xcodeproj/project.pbxproj: Adding missing FractionalLayoutPoint.h header.
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::zoomAdjustedPixelValue): Using adjustFloatForAbsoluteZoom instead of int
to make use of extra precision before returning the pixel value.

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::computeLength): No longer rounds for imprecise conversion
when sub-pixel layout is enabled.
(WebCore::CSSPrimitiveValue::customCssText): Returning integer values for pixels.

  • dom/Element.cpp:

(WebCore::adjustForLocalZoom): Using rounding instead of incrementing the value before
adjusting to account for truncation when sub-pixel layout is enabled.

  • page/SpatialNavigation.cpp:

(WebCore::distanceDataForNode): Using FractionalLayoutUnit::abs instead of std::abs.

  • platform/FractionalLayoutUnit.h: Adding some missing operators and a flag around the

constant denominator to switch it between 1/1 and 1/60 depending on the feature flag.

  • platform/Length.h: Changing the default type for value to float, and adding intValue

since this more closely matches usage in a sub-pixel layout world.

  • platform/win/PopupMenuWin.cpp:

(WebCore::PopupMenuWin::paint): Using minimumIntValueForLength in this platform code
instead of LayoutUnits.

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::placeBoxesInBlockDirection):

  • rendering/LayoutTypes.h: This file contains the actual switch for changing LayoutUnits

to be FractionalLayoutUnits. Also updating stub methods with their proper implementations.

  • rendering/PaintInfo.h:

(WebCore::PaintInfo::infiniteRect): Ensuring the infiniteRect doesn't overflow the
FractionalLayoutUnit bounds.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::checkPaginationAndFloatsAtEndLine): Switch to
FractionalLayoutUnit's abs function instead of std::abs.

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Add rounding for
setting the phase of the background geometry before applying modulo from the tile size.

  • rendering/RenderDeprecatedFlexibleBox.cpp:

(WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): Stop applying flex when
we have less than a pixel to distribute.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::backgroundClipRect): Replace PaintInfo::infiniteRect with the
LayoutRect equivalent.

  • rendering/RenderLineBoxList.cpp:

(WebCore::RenderLineBoxList::rangeIntersectsRect): Using FractionalLayoutUnit::abs
instead of std::abs.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::repaintAfterLayoutIfNeeded): Ditto.

  • rendering/RenderObject.h:

(WebCore): Removing unnecessary adjustForAbsoluteZoom function.
(WebCore::RenderObject::outlineSize): Outlines remain ints.

  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::styleOrColLogicalWidth): Build fix. Using floats because
colWidthSum is a Length which uses floats.

  • rendering/RenderThemeChromiumSkia.cpp:

(WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton): Explicit templatization
for max.

  • rendering/RenderTreeAsText.cpp: Adding code to minimize test expectation churn. It

may be worth outputting float values in test expectations, but this isn't done with
the inline box tree yet, either.

  • rendering/RenderTreeAsText.h:

(WebCore): Adding a FractionalLayoutPoint operator.

  • rendering/RenderWidget.cpp:

(WebCore::RenderWidget::updateWidgetGeometry): Adding missing pixel snapping, and switching
absoluteContentBox to an IntRect, as this is what boundingBox returns.

  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::writePositionAndStyle): Adding an enclosingIntRect for consistency with old results.

LayoutTests:

Reviewed by Eric Seidel.

  • fast/sub-pixel: Added.
  • fast/sub-pixel/client-width-height-snapping-expected.txt: Added.
  • fast/sub-pixel/client-width-height-snapping.html: Added.
  • fast/sub-pixel/size-of-box-with-zoom-expected.html: Added.
  • fast/sub-pixel/size-of-box-with-zoom.html: Added.
  • fast/sub-pixel/layout-boxes-with-zoom-expected.html: Added.
  • fast/sub-pixel/layout-boxes-with-zoom.html: Added.
Location:
trunk
Files:
7 added
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116007 r116009  
     12012-04-23  Levi Weintraub  <leviw@chromium.org>
     2
     3        [meta] Switch away from integers representing pixels for layout/event handling/rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=60318
     5
     6        Reviewed by Eric Seidel.
     7
     8        * fast/sub-pixel: Added.
     9        * fast/sub-pixel/client-width-height-snapping-expected.txt: Added.
     10        * fast/sub-pixel/client-width-height-snapping.html: Added.
     11        * fast/sub-pixel/size-of-box-with-zoom-expected.html: Added.
     12        * fast/sub-pixel/size-of-box-with-zoom.html: Added.
     13        * fast/sub-pixel/layout-boxes-with-zoom-expected.html: Added.
     14        * fast/sub-pixel/layout-boxes-with-zoom.html: Added.
     15
     16<<<<<<< .mine
     172012-05-03  Levi Weintraub  <leviw@chromium.org>
     18
     19        [meta] Switch away from integers representing pixels for layout/event handling/rendering
     20        https://bugs.webkit.org/show_bug.cgi?id=60318
     21
     22        Reviewed by Eric Seidel.
     23
     24        * fast/sub-pixel: Added.
     25        * fast/sub-pixel/client-width-height-snapping-expected.txt: Added.
     26        * fast/sub-pixel/client-width-height-snapping.html: Added.
     27        * fast/sub-pixel/layout-boxes-with-zoom-expected.html: Added.
     28        * fast/sub-pixel/layout-boxes-with-zoom.html: Added.
     29        * fast/sub-pixel/size-of-box-with-zoom-expected.html: Added.
     30        * fast/sub-pixel/size-of-box-with-zoom.html: Added.
     31        * platform/efl/Skipped: Skipping sub-pixel tests until platforms enabled the
     32        SUBPIXEL_LAYOUT feature flag.
     33        * platform/gtk-wk2/Skipped: Ditto.
     34        * platform/mac-lion/Skipped: Ditto.
     35        * platform/mac-snowleopard/Skipped: Ditto.
     36        * platform/mac-wk2/Skipped: Ditto.
     37        * platform/mac/Skipped: Ditto.
     38        * platform/qt-4.8/Skipped: Ditto.
     39        * platform/qt-5.0-wk1/Skipped: Ditto.
     40        * platform/qt-5.0-wk2/Skipped: Ditto.
     41        * platform/qt-5.0/Skipped: Ditto.
     42        * platform/qt-arm/Skipped: Ditto.
     43        * platform/qt-mac/Skipped: Ditto.
     44        * platform/qt/Skipped: Ditto.
     45        * platform/win-wk2/Skipped: Ditto.
     46        * platform/win-xp/Skipped: Ditto.
     47        * platform/win/Skipped: Ditto.
     48        * platform/wincairo/Skipped: Ditto.
     49        * platform/wk2/Skipped: Ditto.
     50
     51=======
    1522012-05-03  Raphael Kubo da Costa  <rakuco@webkit.org>
    253
     
    85136        * fast/writing-mode/flipped-blocks-inline-map-local-to-container.html:
    86137
     138>>>>>>> .r116007
    871392012-05-03  Andreas Kling  <kling@webkit.org>
    88140
  • trunk/LayoutTests/platform/efl/Skipped

    r116001 r116009  
    20492049fast/frames/transparent-scrollbar.html
    20502050
     2051# Fail until SUBPIXEL_LAYOUT is enabled
     2052# https://bugs.webkit.org/show_bug.cgi?id=85532
     2053fast/sub-pixel/client-width-height-snapping.html
     2054fast/sub-pixel/layout-boxes-with-zoom.html
     2055fast/sub-pixel/size-of-box-with-zoom.html
     2056
    20512057# This should only be a layer change.
    20522058# http://webkit.org/b/82129
  • trunk/LayoutTests/platform/gtk-wk2/Skipped

    r110939 r116009  
    347347editing/text-iterator/findString-selection-disabled.html
    348348
     349# Fail until SUBPIXEL_LAYOUT is enabled
     350# https://bugs.webkit.org/show_bug.cgi?id=85532
     351fast/sub-pixel/client-width-height-snapping.html
     352fast/sub-pixel/layout-boxes-with-zoom.html
     353fast/sub-pixel/size-of-box-with-zoom.html
     354
    349355###############################################################################
    350356# TESTS FAILING
  • trunk/LayoutTests/platform/mac-lion/Skipped

    r115700 r116009  
    127127# Most if not all Java tests fail when run in WebKit1.
    128128java/
     129
     130# Fail until SUBPIXEL_LAYOUT is enabled
     131# https://bugs.webkit.org/show_bug.cgi?id=85532
     132fast/sub-pixel/client-width-height-snapping.html
     133fast/sub-pixel/layout-boxes-with-zoom.html
     134fast/sub-pixel/size-of-box-with-zoom.html
  • trunk/LayoutTests/platform/mac-snowleopard/Skipped

    r106463 r116009  
    195195fast/hidpi
    196196
     197# Fail until SUBPIXEL_LAYOUT is enabled
     198# https://bugs.webkit.org/show_bug.cgi?id=85532
     199fast/sub-pixel/client-width-height-snapping.html
     200fast/sub-pixel/layout-boxes-with-zoom.html
     201fast/sub-pixel/size-of-box-with-zoom.html
     202
    197203# Frame::findString does nothing on pages that prevent selection
    198204# https://bugs.webkit.org/show_bug.cgi?id=40361
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r115572 r116009  
    208208editing/spelling/spelling-marker-description.html
    209209
     210# Fail until SUBPIXEL_LAYOUT is enabled
     211# https://bugs.webkit.org/show_bug.cgi?id=85532
     212fast/sub-pixel/client-width-height-snapping.html
     213fast/sub-pixel/layout-boxes-with-zoom.html
     214fast/sub-pixel/size-of-box-with-zoom.html
     215
    210216# fast/events/pagehide-timeout.html, pageshow-pagehide-on-back-cached-with-frames.html, and
    211217# pageshow-pagehide-on-back-cached.html flakey on Lion Intel Debug WebKit testers.
  • trunk/LayoutTests/platform/mac/Skipped

    r116004 r116009  
    806806scrollbars/scrollbar-miss-mousemove-disabled.html
    807807
     808# Fail until SUBPIXEL_LAYOUT is enabled
     809# https://bugs.webkit.org/show_bug.cgi?id=85532
     810fast/sub-pixel/client-width-height-snapping.html
     811fast/sub-pixel/layout-boxes-with-zoom.html
     812fast/sub-pixel/size-of-box-with-zoom.html
     813
    808814# media/audio-repaint.html sometimes fails on Lion Debug (Tests)
    809815# https://bugs.webkit.org/show_bug.cgi?id=84357
  • trunk/LayoutTests/platform/qt-4.8/Skipped

    r113235 r116009  
    7979fast/events/page-visibility-transition-test.html
    8080
     81# Fail until SUBPIXEL_LAYOUT is enabled
     82# https://bugs.webkit.org/show_bug.cgi?id=85532
     83fast/sub-pixel/client-width-height-snapping.html
     84fast/sub-pixel/layout-boxes-with-zoom.html
     85fast/sub-pixel/size-of-box-with-zoom.html
  • trunk/LayoutTests/platform/qt-5.0-wk1/Skipped

    r113235 r116009  
    3030fast/events/page-visibility-transition-test.html
    3131
     32# Fail until SUBPIXEL_LAYOUT is enabled
     33# https://bugs.webkit.org/show_bug.cgi?id=85532
     34fast/sub-pixel/client-width-height-snapping.html
     35fast/sub-pixel/layout-boxes-with-zoom.html
     36fast/sub-pixel/size-of-box-with-zoom.html
  • trunk/LayoutTests/platform/qt-5.0-wk2/Skipped

    r115572 r116009  
    594594# https://bugs.webkit.org/show_bug.cgi?id=84434
    595595fast/events/touch/basic-single-touch-events.html
     596
     597# Fail until SUBPIXEL_LAYOUT is enabled
     598# https://bugs.webkit.org/show_bug.cgi?id=85532
     599fast/sub-pixel/client-width-height-snapping.html
     600fast/sub-pixel/layout-boxes-with-zoom.html
     601fast/sub-pixel/size-of-box-with-zoom.html
  • trunk/LayoutTests/platform/qt-5.0/Skipped

    r115941 r116009  
    118118svg/hixie/error/dumpAsText/005.xml
    119119
     120# Fail until SUBPIXEL_LAYOUT is enabled
     121# https://bugs.webkit.org/show_bug.cgi?id=85532
     122fast/sub-pixel/client-width-height-snapping.html
     123fast/sub-pixel/layout-boxes-with-zoom.html
     124fast/sub-pixel/size-of-box-with-zoom.html
     125
    120126# REGRESSION(r114899) - https://bugs.webkit.org/show_bug.cgi?id=84595
    121127editing/selection/5354455-1.html
  • trunk/LayoutTests/platform/qt-arm/Skipped

    r115927 r116009  
    205205fast/events/media-focus-in-standalone-media-document.html
    206206
     207# Fail until SUBPIXEL_LAYOUT is enabled
     208# https://bugs.webkit.org/show_bug.cgi?id=85532
     209fast/sub-pixel/client-width-height-snapping.html
     210fast/sub-pixel/layout-boxes-with-zoom.html
     211fast/sub-pixel/size-of-box-with-zoom.html
     212
    207213# missing layoutTestController.setPageVisibility()
    208214fast/events/page-visibility-iframe-delete-test.html
  • trunk/LayoutTests/platform/qt-mac/Skipped

    r115818 r116009  
    56135613ietestcenter/css3/text/textshadow-010.htm
    56145614
     5615# Fail until SUBPIXEL_LAYOUT is enabled
     5616# https://bugs.webkit.org/show_bug.cgi?id=85532
     5617fast/sub-pixel/client-width-height-snapping.html
     5618fast/sub-pixel/layout-boxes-with-zoom.html
     5619fast/sub-pixel/size-of-box-with-zoom.html
     5620
    56155621# new failing tests
    56165622fast/ruby/floating-ruby-text.html
  • trunk/LayoutTests/platform/qt/Skipped

    r116001 r116009  
    207207fast/dom/shadow/shadow-ul-li.html
    208208fast/dom/shadow/tab-order-iframe-and-shadow.html
     209
     210# Fail until SUBPIXEL_LAYOUT is enabled
     211# https://bugs.webkit.org/show_bug.cgi?id=85532
     212fast/sub-pixel/client-width-height-snapping.html
     213fast/sub-pixel/layout-boxes-with-zoom.html
     214fast/sub-pixel/size-of-box-with-zoom.html
    209215
    210216# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/LayoutTests/platform/win-wk2/Skipped

    r113127 r116009  
    934934inspector/extensions/extensions-resources.html
    935935
     936# Fail until SUBPIXEL_LAYOUT is enabled
     937# https://bugs.webkit.org/show_bug.cgi?id=85532
     938fast/sub-pixel/client-width-height-snapping.html
     939fast/sub-pixel/layout-boxes-with-zoom.html
     940fast/sub-pixel/size-of-box-with-zoom.html
     941
    936942# HiDPI tests require test infrastructure enhancements
    937943fast/hidpi
  • trunk/LayoutTests/platform/win-xp/Skipped

    r85479 r116009  
    3434fast/images/embed-image.html
    3535
     36# Fail until SUBPIXEL_LAYOUT is enabled
     37# https://bugs.webkit.org/show_bug.cgi?id=85532
     38fast/sub-pixel/client-width-height-snapping.html
     39fast/sub-pixel/layout-boxes-with-zoom.html
     40fast/sub-pixel/size-of-box-with-zoom.html
     41
    3642# REGRESSION (r83928 or before): Some tests failing assertions in MarkStack::internalAppend / MarkStack::drain
    3743# https://bugs.webkit.org/show_bug.cgi?id=58657
  • trunk/LayoutTests/platform/win/Skipped

    r115927 r116009  
    17251725fast/block/lineboxcontain/font.html
    17261726
     1727# Fail until SUBPIXEL_LAYOUT is enabled
     1728# https://bugs.webkit.org/show_bug.cgi?id=85532
     1729fast/sub-pixel/client-width-height-snapping.html
     1730fast/sub-pixel/layout-boxes-with-zoom.html
     1731fast/sub-pixel/size-of-box-with-zoom.html
     1732
    17271733# http://webkit.org/b/82886
    17281734inspector/styles/override-screen-size.html
  • trunk/LayoutTests/platform/wincairo/Skipped

    r115927 r116009  
    20802080fast/dom/navigator-vibration.html
    20812081
     2082# Fail until SUBPIXEL_LAYOUT is enabled
     2083# https://bugs.webkit.org/show_bug.cgi?id=85532
     2084fast/sub-pixel/client-width-height-snapping.html
     2085fast/sub-pixel/layout-boxes-with-zoom.html
     2086fast/sub-pixel/size-of-box-with-zoom.html
     2087
    20822088#Battery Status API is not implemented.
    20832089batterystatus
  • trunk/LayoutTests/platform/wk2/Skipped

    r115790 r116009  
    8383# Needs rebaseline
    8484fast/js/constructor-length.html
     85
     86# Fail until SUBPIXEL_LAYOUT is enabled
     87# https://bugs.webkit.org/show_bug.cgi?id=85532
     88fast/sub-pixel/client-width-height-snapping.html
     89fast/sub-pixel/layout-boxes-with-zoom.html
     90fast/sub-pixel/size-of-box-with-zoom.html
    8591
    8692# CONSOLE MESSAGE: line 0: SVG animation pause API missing!
  • trunk/Source/WebCore/ChangeLog

    r116005 r116009  
     12012-04-23  Levi Weintraub  <leviw@chromium.org> and Emil A Eklund <eae@chromium.org>
     2
     3        [meta] Switch away from integers representing pixels for layout/event handling/rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=60318
     5
     6        Reviewed by Eric Seidel.
     7
     8        Swapping the LayoutUnit backend to FractionalLayoutUnit from int.
     9       
     10        FractionalLayoutUnit is a new type that uses an integer to represent a fraction of a pixel.
     11        We're also adding a feature flag -- ENABLE_SUBPIXEL_LAYOUT -- that toggles this fraction
     12        between 1/1 and 1/60. Initially, all platforms will default to subpixel layout being off,
     13        so FractionalLayoutUnits will effectively continue to act as integers.
     14       
     15        With ENABLE_SUBPIXEL_LAYOUT turned on, FractionalLayoutUnits accumulate error from sub-pixel
     16        CSS values and applied zooming, and painting uses pixel-snapping to align these values
     17        to pixels. See http://trac.webkit.org/wiki/LayoutUnit for details.
     18
     19        In a number of previous patches, LayoutUnits were plumbed throughout the rendering tree
     20        to prepare for this change. This included a number of functions in LayoutTypes.h and
     21        the IntRect/Point/Size classes that were effectively no-ops while LayoutUnits were
     22        integers. Subsequent patches will remove unnecessary versions of these functions; see
     23        http://webkit.org/b/84616 for tracking these changes.
     24
     25        Tests: fast/sub-pixel/client-width-height-snapping.html
     26               fast/sub-pixel/layout-boxes-with-zoom.html
     27               fast/sub-pixel/size-of-box-with-zoom.html
     28
     29        * WebCore.exp.in: Updating function signatures that expose FractionalLayoutUnits.
     30        * WebCore.xcodeproj/project.pbxproj: Adding missing FractionalLayoutPoint.h header.
     31        * css/CSSComputedStyleDeclaration.cpp:
     32        (WebCore::zoomAdjustedPixelValue): Using adjustFloatForAbsoluteZoom instead of int
     33        to make use of extra precision before returning the pixel value.
     34        * css/CSSPrimitiveValue.cpp:
     35        (WebCore::CSSPrimitiveValue::computeLength): No longer rounds for imprecise conversion
     36        when sub-pixel layout is enabled.
     37        (WebCore::CSSPrimitiveValue::customCssText): Returning integer values for pixels.
     38        * dom/Element.cpp:
     39        (WebCore::adjustForLocalZoom): Using rounding instead of incrementing the value before
     40        adjusting to account for truncation when sub-pixel layout is enabled.
     41        * page/SpatialNavigation.cpp:
     42        (WebCore::distanceDataForNode): Using FractionalLayoutUnit::abs instead of std::abs.
     43        * platform/FractionalLayoutUnit.h: Adding some missing operators and a flag around the
     44        constant denominator to switch it between 1/1 and 1/60 depending on the feature flag.
     45        * platform/Length.h: Changing the default type for value to float, and adding intValue
     46        since this more closely matches usage in a sub-pixel layout world.
     47        * platform/win/PopupMenuWin.cpp:
     48        (WebCore::PopupMenuWin::paint): Using minimumIntValueForLength in this platform code
     49        instead of LayoutUnits.
     50        * rendering/InlineFlowBox.cpp:
     51        (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
     52        * rendering/LayoutTypes.h: This file contains the actual switch for changing LayoutUnits
     53        to be FractionalLayoutUnits. Also updating stub methods with their proper implementations.
     54        * rendering/PaintInfo.h:
     55        (WebCore::PaintInfo::infiniteRect): Ensuring the infiniteRect doesn't overflow the
     56        FractionalLayoutUnit bounds.
     57        * rendering/RenderBlockLineLayout.cpp:
     58        (WebCore::RenderBlock::checkPaginationAndFloatsAtEndLine): Switch to
     59        FractionalLayoutUnit's abs function instead of std::abs.
     60        * rendering/RenderBoxModelObject.cpp:
     61        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Add rounding for
     62        setting the phase of the background geometry before applying modulo from the tile size.
     63        * rendering/RenderDeprecatedFlexibleBox.cpp:
     64        (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): Stop applying flex when
     65        we have less than a pixel to distribute.
     66        * rendering/RenderLayer.cpp:
     67        (WebCore::RenderLayer::backgroundClipRect): Replace PaintInfo::infiniteRect with the
     68        LayoutRect equivalent.
     69        * rendering/RenderLineBoxList.cpp:
     70        (WebCore::RenderLineBoxList::rangeIntersectsRect): Using FractionalLayoutUnit::abs
     71        instead of std::abs.
     72        * rendering/RenderObject.cpp:
     73        (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Ditto.
     74        * rendering/RenderObject.h:
     75        (WebCore): Removing unnecessary adjustForAbsoluteZoom function.
     76        (WebCore::RenderObject::outlineSize): Outlines remain ints.
     77        * rendering/RenderTableCell.cpp:
     78        (WebCore::RenderTableCell::styleOrColLogicalWidth): Build fix. Using floats because
     79        colWidthSum is a Length which uses floats.
     80        * rendering/RenderThemeChromiumSkia.cpp:
     81        (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton): Explicit templatization
     82        for max.
     83        * rendering/RenderTreeAsText.cpp: Adding code to minimize test expectation churn. It
     84        may be worth outputting float values in test expectations, but this isn't done with
     85        the inline box tree yet, either.
     86        * rendering/RenderTreeAsText.h:
     87        (WebCore): Adding a FractionalLayoutPoint operator.
     88        * rendering/RenderWidget.cpp:
     89        (WebCore::RenderWidget::updateWidgetGeometry): Adding missing pixel snapping, and switching
     90        absoluteContentBox to an IntRect, as this is what boundingBox returns.
     91        * rendering/svg/SVGRenderTreeAsText.cpp:
     92        (WebCore::writePositionAndStyle): Adding an enclosingIntRect for consistency with old results.
     93
     94<<<<<<< .mine
     952012-05-03  Levi Weintraub  <leviw@chromium.org> and Emil A Eklund <eae@chromium.org>
     96
     97        [meta] Switch away from integers representing pixels for layout/event handling/rendering
     98        https://bugs.webkit.org/show_bug.cgi?id=60318
     99
     100        Reviewed by Eric Seidel.
     101
     102        Swapping the LayoutUnit backend to FractionalLayoutUnit from int.
     103       
     104        FractionalLayoutUnit is a new type that uses an integer that can represent a fraction of a
     105        pixel. The ENABLE_SUBPIXEL_LAYOUT feature flags toggles this fraction between 1/1 and 1/60.
     106        Initially, all platforms will default to subpixel layout being off, so FractionalLayoutUnits
     107        will effectively continue to act as integers.
     108       
     109        With ENABLE_SUBPIXEL_LAYOUT turned on, FractionalLayoutUnits accumulate error from sub-pixel
     110        CSS values and applied zooming, and painting uses pixel-snapping to align these values
     111        to pixels and prevent unwanted anti-aliasing. See http://trac.webkit.org/wiki/LayoutUnit for
     112        details.
     113
     114        In a number of previous patches, LayoutUnits were plumbed throughout the rendering tree to
     115        prepare for this change. This included a number of functions in LayoutTypes.h and the
     116        IntRect/Point/Size classes that were effectively no-ops while LayoutUnits were integers. See
     117        http://webkit.org/b/60318 for the exhaustive list of changes that were done in preparation
     118        for this. Subsequent patches will remove unnecessary versions of these functions.
     119        http://webkit.org/b/84616 tracks these changes.
     120
     121        Tests: fast/sub-pixel/client-width-height-snapping.html
     122               fast/sub-pixel/layout-boxes-with-zoom.html
     123               fast/sub-pixel/size-of-box-with-zoom.html
     124
     125        * WebCore.exp.in: Updating function signatures that expose FractionalLayoutUnits.
     126        * WebCore.order: Ditto.
     127        * WebCore.xcodeproj/project.pbxproj: Adding missing FractionalLayoutPoint.h header.
     128        * css/CSSPrimitiveValue.cpp:
     129        (WebCore::CSSPrimitiveValue::computeLength): No longer rounds for imprecise conversion
     130        when sub-pixel layout is enabled.
     131        * dom/Element.cpp:
     132        (WebCore::adjustForLocalZoom): Using rounding instead of incrementing the value before
     133        adjusting to account for truncation when sub-pixel layout is enabled.
     134        * rendering/mathml/RenderMathMLBlock.cpp:
     135        (WebCore): Fixing a static initializer build error by moving an integer constant to be
     136        an int.
     137        * rendering/LayoutTypes.h: This file contains the actual switch for changing LayoutUnits
     138        to be FractionalLayoutUnits. Also updating stub methods with their proper implementations.
     139        * rendering/PaintInfo.h:
     140        (WebCore::PaintInfo::infiniteRect): Ensuring the infiniteRect doesn't overflow the
     141        FractionalLayoutUnit bounds. LayoutRect::infiniteRect() is the largest rectangle that can
     142        be represented using LayoutUnits.
     143        * rendering/RenderLayer.h:
     144        (WebCore::ClipRect::operator!=): Add overload of != to fix complaining compilers when
     145        * rendering/RenderTreeAsText.cpp: Adding code to minimize test expectation churn. It
     146        may be worth outputting float values in test expectations, but this isn't done with
     147        the inline box tree yet, either.
     148        * rendering/RenderTreeAsText.h:
     149        (WebCore): Adding a FractionalLayoutPoint operator.
     150        * rendering/svg/SVGRenderTreeAsText.cpp:
     151        (WebCore::writePositionAndStyle):
     152        (WebCore): Adding a FractionalLayoutPoint operator.
     153
     154=======
    11552012-05-03  Anders Carlsson  <andersca@apple.com>
    2156
     
    139293        * rendering/RenderLayerCompositor.h:
    140294
     295>>>>>>> .r116007
    1412962012-05-03  Andreas Kling  <kling@webkit.org>
    142297
  • trunk/Source/WebCore/WebCore.exp.in

    r115943 r116009  
    221221__ZN7WebCore11MemoryCache19getOriginsWithCacheERN3WTF7HashSetINS1_6RefPtrINS_14SecurityOriginEEENS_18SecurityOriginHashENS1_10HashTraitsIS5_EEEE
    222222__ZN7WebCore11MemoryCache25removeResourcesWithOriginEPNS_14SecurityOriginE
    223 __ZN7WebCore12RenderObject19scrollRectToVisibleERKNS_7IntRectERKNS_15ScrollAlignmentES6_
     223__ZN7WebCore11RenderLayer19scrollRectToVisibleERKNS_20FractionalLayoutRectERKNS_15ScrollAlignmentES6_
    224224__ZN7WebCore11URLWithDataEP6NSDataP5NSURL
    225225__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
     
    239239__ZN7WebCore12EventHandler16handleWheelEventERKNS_18PlatformWheelEventE
    240240__ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE
    241 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEjRKNS_7IntSizeE
     241__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_21FractionalLayoutPointEbbNS_17HitTestScrollbarsEjRKNS_20FractionalLayoutSizeE
    242242__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
    243243__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
     
    269269__ZN7WebCore12PrintContextC1EPNS_5FrameE
    270270__ZN7WebCore12PrintContextD1Ev
    271 __ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb
     271__ZN7WebCore12RenderObject16repaintRectangleERKNS_20FractionalLayoutRectEb
     272__ZN7WebCore12RenderObject19scrollRectToVisibleERKNS_20FractionalLayoutRectERKNS_15ScrollAlignmentES6_
    272273__ZN7WebCore12RenderWidget28resumeWidgetHierarchyUpdatesEv
    273274__ZN7WebCore12RenderWidget29suspendWidgetHierarchyUpdatesEv
     
    528529__ZN7WebCore16enclosingIntRectERK7_NSRect
    529530__ZN7WebCore16enclosingIntRectERKNS_9FloatRectE
     531__ZN7WebCore16enclosingIntRectERKNS_20FractionalLayoutRectE
    530532__ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
    531533__ZN7WebCore16isUserVisibleURLEP8NSString
     
    606608__ZN7WebCore19TextResourceDecoderD1Ev
    607609__ZN7WebCore19applicationIsSafariEv
     610__ZN7WebCore19pixelSnappedIntRectERKNS_20FractionalLayoutRectE
    608611__ZN7WebCore20DictationAlternativeC1Ejjy
    609612__ZN7WebCore20DictationAlternativeC1Ev
     
    838841__ZN7WebCore5Frame17setPageZoomFactorEf
    839842__ZN7WebCore5Frame17setTextZoomFactorEf
     843__ZN7WebCore5Frame24searchForLabelsAboveCellEPNS_17RegularExpressionEPNS_20HTMLTableCellElementEPm
    840844__ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
    841 __ZN7WebCore5Frame24searchForLabelsAboveCellEPNS_17RegularExpressionEPNS_20HTMLTableCellElementEPm
    842845__ZN7WebCore5Frame25setPageAndTextZoomFactorsEff
    843846__ZN7WebCore5Frame27resizePageRectsKeepingRatioERKNS_9FloatSizeES3_
     
    854857__ZN7WebCore5Range6setEndEN3WTF10PassRefPtrINS_4NodeEEEiRi
    855858__ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi
    856 __ZN7WebCore5Range9textRectsERN3WTF6VectorINS_7IntRectELm0EEEbPNS0_20RangeInFixedPositionE
    857859__ZN7WebCore5RangeD1Ev
    858860__ZN7WebCore6Chrome16setStatusbarTextEPNS_5FrameERKN3WTF6StringE
     
    10621064__ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
    10631065__ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
    1064 __ZN7WebCore9FloatRectC1ERK6CGRect
    10651066__ZN7WebCore9FloatRectC1ERK7_NSRect
     1067__ZN7WebCore9FloatRectC1ERKNS_20FractionalLayoutRectE
    10661068__ZN7WebCore9FloatRectC1ERKNS_7IntRectE
    10671069__ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE
     1070__ZN7WebCore9FloatSizeC1ERKNS_20FractionalLayoutSizeE
    10681071__ZN7WebCore9FontCache13fontDataCountEv
    10691072__ZN7WebCore9FontCache21inactiveFontDataCountEv
     
    10761079__ZN7WebCore9FrameView12setMediaTypeERKN3WTF6StringE
    10771080__ZN7WebCore9FrameView14adjustViewSizeEv
    1078 __ZN7WebCore9FrameView14setMarginWidthEi
    10791081__ZN7WebCore9FrameView14setNeedsLayoutEv
    10801082__ZN7WebCore9FrameView14setTransparentEb
    1081 __ZN7WebCore9FrameView15setMarginHeightEi
    10821083__ZN7WebCore9FrameView16setPaintBehaviorEj
    10831084__ZN7WebCore9FrameView17addScrollableAreaEPNS_14ScrollableAreaE
     
    15121513__ZNK7WebCore8Position8upstreamENS_27EditingBoundaryCrossingRuleE
    15131514__ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv
     1515__ZNK7WebCore5Range9textQuadsERN3WTF6VectorINS_9FloatQuadELm0EEEbPNS0_20RangeInFixedPositionE
     1516__ZNK7WebCore9FloatSize6isZeroEv
    15141517__ZNK7WebCore9FloatQuad11boundingBoxEv
    15151518__ZNK7WebCore9FloatRect10intersectsERKS0_
  • trunk/Source/WebCore/WebCore.order

    r115248 r116009  
    35093509__ZN7WebCore17RenderLineBoxList13removeLineBoxEPNS_13InlineFlowBoxE
    35103510__ZNK7WebCore11RenderBlock20adjustRectForColumnsERNS_7IntRectE
    3511 __ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb
    35123511__ZNK7WebCore22HTMLFormControlElement11isFocusableEv
    35133512__ZNK7WebCore22HTMLFormControlElement13supportsFocusEv
     
    62496248__ZN7WebCore14RenderMenuList11removeChildEPNS_12RenderObjectE
    62506249__ZN7WebCore14RenderMenuListD0Ev
    6251 __ZN7WebCore13HitTestResultC1ERKNS_8IntPointE
    62526250__ZN7WebCore11RenderLayer7hitTestERKNS_14HitTestRequestERNS_13HitTestResultE
    62536251__ZN7WebCore11RenderLayer12hitTestLayerEPS0_S1_RKNS_14HitTestRequestERNS_13HitTestResultERKNS_7IntRectERKNS_8IntPointEbPKNS_24HitTestingTransformStateEPd
     
    62556253__ZN7WebCore11RenderLayer35update3DTransformedDescendantStatusEv
    62566254__ZN7WebCore11RenderLayer11hitTestListEPN3WTF6VectorIPS0_Lm0EEES3_RKNS_14HitTestRequestERNS_13HitTestResultERKNS_7IntRectERKNS_8IntPointEPKNS_24HitTestingTransformStateEPdSK_SJ_b
    6257 __ZN7WebCore13HitTestResultC1ERKNS_8IntPointEjjjj
    62586255__ZNK7WebCore11RenderLayer15hitTestContentsERKNS_14HitTestRequestERNS_13HitTestResultERKNS_7IntRectERKNS_8IntPointENS_13HitTestFilterE
    62596256__ZN7WebCore12RenderObject7hitTestERKNS_14HitTestRequestERNS_13HitTestResultERKNS_8IntPointEiiNS_13HitTestFilterE
     
    1436114358__ZN3WTF9HashTableIPKvSt4pairIS2_N7WebCore7IntSizeEENS_18PairFirstExtractorIS6_EENS_7PtrHashIS2_EENS_14PairHashTraitsINS_10HashTraitsIS2_EENSC_IS5_EEEESD_E6rehashEi
    1436214359__ZN3WTF9HashTableIPKvSt4pairIS2_N7WebCore7IntSizeEENS_18PairFirstExtractorIS6_EENS_7PtrHashIS2_EENS_14PairHashTraitsINS_10HashTraitsIS2_EENSC_IS5_EEEESD_EaSERKSG_
    14363 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEjRKNS_7IntSizeE
    1436414360__ZNK7WebCore13HitTestResult10isSelectedEv
    1436514361__ZN3WTF9HashTableIN7WebCore7IntSizeESt4pairIS2_jENS_18PairFirstExtractorIS4_EENS_7IntHashIS2_EENS_14PairHashTraitsINS_10HashTraitsIS2_EENSA_IjEEEESB_E16lookupForWritingIS2_NS_22IdentityHashTranslatorIS2_S4_S8_EEEES3_IPS4_bERKT_
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r115943 r116009  
    51375137                B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */; };
    51385138                B8DBDB4E130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */; };
     5139                BAB1C06A14FC3679004233FC /* FractionalLayoutPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 144FCE5414EC79E7000D17A3 /* FractionalLayoutPoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
    51395140                BACF290113B2A0D500781F90 /* LayoutTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BACF290013B2A0D500781F90 /* LayoutTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
    51405141                BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; };
     
    2283522836                                41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */,
    2283622837                                935C476D09AC4D6300A6AAB4 /* FoundationExtras.h in Headers */,
     22838                                BAB1C06A14FC3679004233FC /* FractionalLayoutPoint.h in Headers */,
    2283722839                                144FCFE114EF2509000D17A3 /* FractionalLayoutRect.h in Headers */,
    2283822840                                144FCE5D14EC79E7000D17A3 /* FractionalLayoutSize.h in Headers */,
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r115573 r116009  
    432432template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
    433433{
     434#if ENABLE(SUBPIXEL_LAYOUT)
     435    return Length(static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
     436#else
    434437    return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
     438#endif
    435439}
    436440
  • trunk/Source/WebCore/dom/Element.cpp

    r115645 r116009  
    354354    if (zoomFactor == 1)
    355355        return value;
     356#if ENABLE(SUBPIXEL_LAYOUT)
     357    return lroundf(value / zoomFactor);
     358#else
    356359    // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
    357360    if (zoomFactor > 1)
    358361        value++;
    359362    return static_cast<int>(value / zoomFactor);
     363#endif
    360364}
    361365
  • trunk/Source/WebCore/rendering/LayoutTypes.h

    r115691 r116009  
    3838
    3939#include "FloatRect.h"
     40#include "FractionalLayoutRect.h"
     41#include "FractionalLayoutUnit.h"
    4042#include "IntRect.h"
    41 #include <wtf/UnusedParam.h>
     43
     44#include <wtf/MathExtras.h>
    4245
    4346namespace WebCore {
    4447
    45 typedef int LayoutUnit;
    46 typedef IntPoint LayoutPoint;
    47 typedef IntSize LayoutSize;
    48 typedef IntRect LayoutRect;
     48typedef FractionalLayoutUnit LayoutUnit;
     49typedef FractionalLayoutPoint LayoutPoint;
     50typedef FractionalLayoutSize LayoutSize;
     51typedef FractionalLayoutRect LayoutRect;
    4952
    50 #define MAX_LAYOUT_UNIT INT_MAX
    51 #define MIN_LAYOUT_UNIT INT_MIN
    52 #define ZERO_LAYOUT_UNIT 0
     53#define MAX_LAYOUT_UNIT LayoutUnit::max()
     54#define MIN_LAYOUT_UNIT LayoutUnit::min()
     55#define ZERO_LAYOUT_UNIT LayoutUnit(0)
    5356
    54 inline LayoutRect enclosingLayoutRect(const FloatRect& rect)
     57inline FractionalLayoutRect enclosingLayoutRect(const FloatRect& rect)
    5558{
    5659    return enclosingIntRect(rect);
    5760}
    5861
    59 inline IntRect pixelSnappedIntRect(const LayoutRect& rect)
     62inline LayoutSize roundedLayoutSize(const FloatSize& s)
    6063{
    61     return rect;
     64#if ENABLE(SUBPIXEL_LAYOUT)
     65    return FractionalLayoutSize(s);
     66#else
     67    return roundedIntSize(s);
     68#endif
    6269}
    6370
    6471inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit width, LayoutUnit height)
    6572{
    66     return IntRect(left, top, width, height);
    67 }
    68 
    69 inline IntRect pixelSnappedIntRect(const LayoutPoint& location, const LayoutSize& size)
    70 {
    71     return IntRect(location, size);
     73    return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snapSizeToPixel(height, top));
    7274}
    7375
    7476inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom)
    7577{
    76     return IntRect(left, top, right - left, bottom - top);
    77 }
    78 
    79 inline int snapSizeToPixel(LayoutUnit size, LayoutUnit location)
    80 {
    81     UNUSED_PARAM(location);
    82     return size;
    83 }
    84 
    85 inline IntSize pixelSnappedIntSize(LayoutSize size, LayoutPoint location)
    86 {
    87     UNUSED_PARAM(location);
    88     return size;
    89 }
    90 
    91 inline IntSize roundedIntSize(const LayoutSize& s)
    92 {
    93     return s;
    94 }
    95 
    96 inline LayoutSize roundedLayoutSize(const FloatSize& s)
    97 {
    98     return roundedIntSize(s);
    99 }
    100 
    101 inline IntPoint roundedIntPoint(const LayoutPoint& p)
    102 {
    103     return p;
     78    return IntRect(left.round(), top.round(), snapSizeToPixel(right - left, left), snapSizeToPixel(bottom - top, top));
    10479}
    10580
    10681inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
    10782{
     83#if ENABLE(SUBPIXEL_LAYOUT)
     84    return FractionalLayoutPoint(p);
     85#else
    10886    return roundedIntPoint(p);
     87#endif
    10988}
    11089
    11190inline LayoutPoint flooredLayoutPoint(const FloatPoint& p)
    11291{
    113     return flooredIntPoint(p);
     92    return LayoutPoint(p.x(), p.y());
    11493}
    11594
    11695inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
    11796{
    118     return flooredIntPoint(s);
     97    return LayoutPoint(s.width(), s.height());
    11998}
    12099
    121100inline LayoutSize flooredLayoutSize(const FloatPoint& p)
    122101{
    123     return LayoutSize(static_cast<int>(p.x()), static_cast<int>(p.y()));
     102    return LayoutSize(p.x(), p.y());
    124103}
    125104
    126105inline int roundToInt(LayoutUnit value)
    127106{
    128     return value;
     107    return value.round();
    129108}
    130109
    131110inline int floorToInt(LayoutUnit value)
    132111{
    133     return value;
     112    return value.toInt();
    134113}
    135114
    136115inline LayoutUnit roundedLayoutUnit(float value)
    137116{
    138     return lroundf(value);
     117#if ENABLE(SUBPIXEL_LAYOUT)
     118    return FractionalLayoutUnit(value);
     119#else
     120    return static_cast<int>(lroundf(value));
     121#endif
    139122}
    140123
    141124inline LayoutUnit ceiledLayoutUnit(float value)
    142125{
     126#if ENABLE(SUBPIXEL_LAYOUT)
     127    return FractionalLayoutUnit(value);
     128#else
    143129    return ceilf(value);
     130#endif
    144131}
    145132
    146133inline LayoutUnit absoluteValue(const LayoutUnit& value)
    147134{
    148     return abs(value);
     135    return value.abs();
    149136}
    150137
     
    161148inline LayoutUnit layoutMod(const LayoutUnit& numerator, const LayoutUnit& denominator)
    162149{
    163     return numerator % denominator;
     150    return numerator.toInt() % denominator.toInt();
    164151}
    165152
    166153inline LayoutUnit clampToLayoutUnit(double value)
    167154{
    168     return clampToInteger(value);
     155    return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max());
    169156}
    170157
    171 inline bool isIntegerValue(const LayoutUnit)
     158inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size)
    172159{
    173     return true;
     160    return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location));
    174161}
    175162
    176 inline LayoutUnit boundedMultiply(const LayoutUnit& a, const LayoutUnit& b)
     163inline bool isIntegerValue(const LayoutUnit value)
    177164{
    178     return a * b;
     165    return value.floor() == value;
    179166}
    180167
  • trunk/Source/WebCore/rendering/PaintInfo.h

    r96408 r116009  
    3333#include "GraphicsContext.h"
    3434#include "IntRect.h"
     35#include "LayoutTypes.h"
    3536#include "PaintPhase.h"
     37#include <limits>
    3638#include <wtf/HashMap.h>
    3739#include <wtf/ListHashSet.h>
     
    9799#endif
    98100
    99     static IntRect infiniteRect() { return IntRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX); }
     101    static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); }
    100102
    101103    // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/.
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r115913 r116009  
    102102    bool operator==(const ClipRect& other) const { return rect() == other.rect() && hasRadius() == other.hasRadius(); }
    103103    bool operator!=(const ClipRect& other) const { return rect() != other.rect() || hasRadius() != other.hasRadius(); }
     104    bool operator!=(const LayoutRect& otherRect) const { return rect() != otherRect; }
    104105
    105106    void intersect(const LayoutRect& other) { m_rect.intersect(other); }
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r115913 r116009  
    7878using namespace HTMLNames;
    7979
    80 static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal);
     80static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const LayoutRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    8181
    8282static inline bool hasFractions(double val)
     
    103103{
    104104    return ts << "(" << p.x() << "," << p.y() << ")";
     105}
     106
     107TextStream& operator<<(TextStream& ts, const FractionalLayoutPoint& p)
     108{
     109    // FIXME: These should be printed as floats. Keeping them ints for consistency with pervious test expectations.
     110    return ts << "(" << p.x().toInt() << "," << p.y().toInt() << ")";
    105111}
    106112
     
    243249    bool adjustForTableCells = cb ? cb->isTableCell() : false;
    244250
    245     IntRect r;
     251    LayoutRect r;
    246252    if (o.isText()) {
    247253        // FIXME: Would be better to dump the bounding box x and y rather than the first run's x and y, but that would involve updating
     
    262268        // captured by the results.
    263269        const RenderTableCell& cell = *toRenderTableCell(&o);
    264         r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingBefore(), cell.width(), cell.height() - cell.intrinsicPaddingBefore() - cell.intrinsicPaddingAfter());
     270        r = LayoutRect(cell.x(), cell.y() + cell.intrinsicPaddingBefore(), cell.width(), cell.height() - cell.intrinsicPaddingBefore() - cell.intrinsicPaddingAfter());
    265271    } else if (o.isBox())
    266272        r = toRenderBox(&o)->frameRect();
     
    269275    if (adjustForTableCells)
    270276        r.move(0, -toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore());
     277
     278    // FIXME: Convert layout test results to report sub-pixel values, in the meantime using enclosingIntRect
     279    // for consistency with old results.
     280    r = enclosingIntRect(r);
     281
    271282
    272283    ts << " " << r;
     
    592603
    593604static void write(TextStream& ts, RenderLayer& l,
    594                   const IntRect& layerBounds, const IntRect& backgroundClipRect, const IntRect& clipRect, const IntRect& outlineClipRect,
     605                  const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect, const LayoutRect& outlineClipRect,
    595606                  LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
    596607{
     608    IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
     609    IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect);
     610    IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
     611    IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect);
     612
    597613    writeIndent(ts, indent);
    598614
     
    602618        ts << static_cast<const void*>(&l) << " ";
    603619     
    604     ts << layerBounds;
    605 
    606     if (!layerBounds.isEmpty()) {
    607         if (!backgroundClipRect.contains(layerBounds))
    608             ts << " backgroundClip " << backgroundClipRect;
    609         if (!clipRect.contains(layerBounds))
    610             ts << " clip " << clipRect;
    611         if (!outlineClipRect.contains(layerBounds))
    612             ts << " outlineClip " << outlineClipRect;
     620    ts << adjustedLayoutBounds;
     621
     622    if (!adjustedLayoutBounds.isEmpty()) {
     623        if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds))
     624            ts << " backgroundClip " << adjustedBackgroundClipRect;
     625        if (!adjustedClipRect.contains(adjustedLayoutBounds))
     626            ts << " clip " << adjustedClipRect;
     627        if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds))
     628            ts << " outlineClip " << adjustedOutlineClipRect;
    613629    }
    614630
     
    645661
    646662static void writeRenderNamedFlowThreads(TextStream& ts, RenderView* renderView, const RenderLayer* rootLayer,
    647                         const IntRect& paintRect, int indent, RenderAsTextBehavior behavior)
     663                        const LayoutRect& paintRect, int indent, RenderAsTextBehavior behavior)
    648664{
    649665    if (!renderView->hasRenderNamedFlowThreads())
     
    693709
    694710static void writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* l,
    695                         const IntRect& paintRect, int indent, RenderAsTextBehavior behavior)
     711                        const LayoutRect& paintRect, int indent, RenderAsTextBehavior behavior)
    696712{
    697713    // FIXME: Apply overflow to the root layer to not break every test.  Complete hack.  Sigh.
    698     IntRect paintDirtyRect(paintRect);
     714    LayoutRect paintDirtyRect(paintRect);
    699715    if (rootLayer == l) {
    700         paintDirtyRect.setWidth(max(paintDirtyRect.width(), rootLayer->renderBox()->maxXLayoutOverflow()));
    701         paintDirtyRect.setHeight(max(paintDirtyRect.height(), rootLayer->renderBox()->maxYLayoutOverflow()));
    702         l->setSize(l->size().expandedTo(l->renderBox()->maxLayoutOverflow()));
     716        paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLayer->renderBox()->maxXLayoutOverflow()));
     717        paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLayer->renderBox()->maxYLayoutOverflow()));
     718        l->setSize(l->size().expandedTo(pixelSnappedIntSize(l->renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0))));
    703719    }
    704720   
    705721    // Calculate the clip rects we should use.
    706     IntRect layerBounds;
     722    LayoutRect layerBounds;
    707723    ClipRect damageRect, clipRectToApply, outlineRect;
    708724    l->calculateRects(rootLayer, 0, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, true);
  • trunk/Source/WebCore/rendering/RenderTreeAsText.h

    r101342 r116009  
    3434
    3535class Element;
     36class FractionalLayoutPoint;
    3637class FloatPoint;
    3738class FloatSize;
     
    7172TextStream& operator<<(TextStream&, const IntPoint&);
    7273TextStream& operator<<(TextStream&, const IntRect&);
     74TextStream& operator<<(TextStream&, const FractionalLayoutPoint&);
    7375TextStream& operator<<(TextStream&, const FloatPoint&);
    7476TextStream& operator<<(TextStream&, const FloatSize&);
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp

    r115895 r116009  
    158158
    159159// An arbitrary large value, like RenderBlock.cpp BLOCK_MAX_WIDTH or FixedTableLayout.cpp TABLE_MAX_WIDTH.
    160 static const LayoutUnit cLargeLogicalWidth = 15000;
     160static const int cLargeLogicalWidth = 15000;
    161161
    162162void RenderMathMLBlock::computeChildrenPreferredLogicalHeights()
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r115560 r116009  
    327327static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& object)
    328328{
    329     ts << " " << const_cast<RenderObject&>(object).absoluteClippedOverflowRect();
     329    ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClippedOverflowRect());
    330330    writeStyle(ts, object);
    331331    return ts;
Note: See TracChangeset for help on using the changeset viewer.