Changeset 114470 in webkit


Ignore:
Timestamp:
Apr 17, 2012 5:30:04 PM (12 years ago)
Author:
leviw@chromium.org
Message:

2012-04-17 Levi Weintraub <leviw@chromium.org>

Clean up outstanding LayoutUnit misuse in WebCore
https://bugs.webkit.org/show_bug.cgi?id=84209

Reviewed by Eric Seidel.

Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
For more details, see https://trac.webkit.org/wiki/LayoutUnit

No new tests. No change in behavior.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
sub-pixel precision, so we should avoid unnecessarily using integers.

  • platform/graphics/FractionalLayoutPoint.h:

(WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
FractionalLayoutSizes. This mirrors a method in IntPoint.

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
which are already pixel-snapped.

  • rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
  • rendering/RenderTable.cpp:

(WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
need to explicitly calculate the width to be integral as well to avoid pushing the next element
over by a pixel that we won't later paint with our own box decorations.

  • rendering/RenderText.h:

(RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
between the header and implementation.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r114468 r114470  
     1 2012-04-17  Levi Weintraub  <leviw@chromium.org>
     2
     3        Clean up outstanding LayoutUnit misuse in WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=84209
     5
     6        Reviewed by Eric Seidel.
     7
     8        Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
     9        For more details, see https://trac.webkit.org/wiki/LayoutUnit
     10
     11        No new tests. No change in behavior.
     12
     13        * css/CSSComputedStyleDeclaration.cpp:
     14        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
     15        sub-pixel precision, so we should avoid unnecessarily using integers.
     16        * platform/graphics/FractionalLayoutPoint.h:
     17        (WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
     18        FractionalLayoutSizes. This mirrors a method in IntPoint.
     19        * rendering/RenderBoxModelObject.cpp:
     20        (WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
     21        which are already pixel-snapped.
     22        * rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
     23        * rendering/RenderTable.cpp:
     24        (WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
     25        need to explicitly calculate the width to be integral as well to avoid pushing the next element
     26        over by a pixel that we won't later paint with our own box decorations.
     27        * rendering/RenderText.h:
     28        (RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
     29        between the header and implementation.
     30        * rendering/style/RenderStyle.cpp:
     31        (WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
     32        rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.
     33
    1342012-04-17  Luke Macpherson  <macpherson@chromium.org>
    235
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r113990 r114470  
    22412241            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    22422242            if (renderer) {
    2243                 IntRect box = sizingBox(renderer);
     2243                LayoutRect box = sizingBox(renderer);
    22442244                RenderView* renderView = m_node->document()->renderView();
    22452245                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutPoint.h

    r108138 r114470  
    4444    FractionalLayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
    4545    explicit FractionalLayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y()) { }
     46    explicit FractionalLayoutPoint(const FractionalLayoutSize& size) : m_x(size.width()), m_y(size.height()) { }
    4647
    4748    static FractionalLayoutPoint zero() { return FractionalLayoutPoint(); }
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r114437 r114470  
    19111911
    19121912            if (haveAllDoubleEdges) {
    1913                 LayoutRect innerThirdRect = outerBorder.rect();
    1914                 LayoutRect outerThirdRect = outerBorder.rect();
     1913                IntRect innerThirdRect = outerBorder.rect();
     1914                IntRect outerThirdRect = outerBorder.rect();
    19151915                for (int side = BSTop; side <= BSLeft; ++side) {
    19161916                    int outerWidth;
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r114437 r114470  
    7373    int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
    7474    int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); }
    75     // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318.
    7675    int pixelSnappedOffsetWidth() const;
    7776    int pixelSnappedOffsetHeight() const;
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r114315 r114470  
    241241
    242242        // Ensure we aren't bigger than our available width.
    243         setLogicalWidth(min(availableContentLogicalWidth, maxPreferredLogicalWidth()));
     243        setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogicalWidth()));
    244244    }
    245245
    246246    // Ensure we aren't smaller than our min preferred width.
    247     setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
     247    setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth()));
    248248
    249249    // Ensure we aren't smaller than our min-width style.
    250250    Length styleMinLogicalWidth = style()->logicalMinWidth();
    251251    if (styleMinLogicalWidth.isSpecified() && styleMinLogicalWidth.isPositive())
    252         setLogicalWidth(max(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
     252        setLogicalWidth(max<int>(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
    253253
    254254    // Finally, with our true width determined, compute our margins for real.
  • trunk/Source/WebCore/rendering/RenderText.h

    r114032 r114470  
    8484                           float& minW, float& maxW, bool& stripFrontSpaces);
    8585
    86     virtual LayoutRect linesBoundingBox() const;
     86    virtual IntRect linesBoundingBox() const;
    8787    LayoutRect linesVisualOverflowBoundingBox() const;
    8888
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r113594 r114470  
    931931    RoundedRect roundedRect(snappedBorderRect);
    932932    if (hasBorderRadius()) {
    933         RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
     933        RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
    934934        radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
    935935        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
Note: See TracChangeset for help on using the changeset viewer.