Changeset 111082 in webkit


Ignore:
Timestamp:
Mar 16, 2012 4:05:34 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Prepare RenderObject for FractionalLayoutUnits
https://bugs.webkit.org/show_bug.cgi?id=81178

Reviewed by Eric Seidel.

This readies RenderObject to deal with FractionalLayoutUnits as a backend for the
LayoutUnit abstraction.

No new tests. No change in behavior.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect): Convenience method to be
used instead of absouluteClippedOverflowRect in platform code. Platform updates will come
in a separate patch.
(WebCore):
(WebCore::RenderObject::repaintAfterLayoutIfNeeded): Borders remain ints when we move to
sub-pixel layout. This adjusts border variables for this, and adds compiler fixes when
using std::max and std::min with mixed int/LayoutUnits.
(WebCore::RenderObject::adjustRectForOutlineAndShadow): Outlines, like borders, remain
ints in the new sub-pixel world. Using variables that reflect that.

  • rendering/RenderObject.h:

(RenderObject):
(WebCore::adjustForAbsoluteZoom): Handles FractionalLayoutUnit values. Flooring is what
JavaScript requires since this is used with values that must return ints.
(WebCore): Adding FractionalLayoutUnit.h to support the new adjusteForAbsoluteZoom method.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r111080 r111082  
     12012-03-16  Levi Weintraub  <leviw@chromium.org>
     2
     3        Prepare RenderObject for FractionalLayoutUnits
     4        https://bugs.webkit.org/show_bug.cgi?id=81178
     5
     6        Reviewed by Eric Seidel.
     7
     8        This readies RenderObject to deal with FractionalLayoutUnits as a backend for the
     9        LayoutUnit abstraction.
     10
     11        No new tests. No change in behavior.
     12
     13        * rendering/RenderObject.cpp:
     14        (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect): Convenience method to be
     15        used instead of absouluteClippedOverflowRect in platform code. Platform updates will come
     16        in a separate patch.
     17        (WebCore):
     18        (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Borders remain ints when we move to
     19        sub-pixel layout. This adjusts border variables for this, and adds compiler fixes when
     20        using std::max and std::min with mixed int/LayoutUnits.
     21        (WebCore::RenderObject::adjustRectForOutlineAndShadow): Outlines, like borders, remain
     22        ints in the new sub-pixel world. Using variables that reflect that.
     23        * rendering/RenderObject.h:
     24        (RenderObject):
     25        (WebCore::adjustForAbsoluteZoom): Handles FractionalLayoutUnit values. Flooring is what
     26        JavaScript requires since this is used with values that must return ints.
     27        (WebCore): Adding FractionalLayoutUnit.h to support the new adjusteForAbsoluteZoom method.
     28
    1292012-03-16  Brady Eidson  <beidson@apple.com>
    230
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r111048 r111082  
    13661366}
    13671367
     1368IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const
     1369{
     1370    return pixelSnappedIntRect(absoluteClippedOverflowRect());
     1371}
     1372
    13681373bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr, const LayoutRect* newOutlineBoxRectPtr)
    13691374{
     
    14391444        style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
    14401445
    1441         LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : zeroLayoutUnit;
     1446        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
    14421447        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
    1443         LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
     1448        LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max<LayoutUnit>(ow, shadowRight);
    14441449        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
    14451450            newOutlineBox.y(),
    14461451            width + borderWidth,
    14471452            max(newOutlineBox.height(), oldOutlineBox.height()));
    1448         LayoutUnit right = min(newBounds.maxX(), oldBounds.maxX());
     1453        LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX());
    14491454        if (rightRect.x() < right) {
    14501455            rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
     
    14581463        style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
    14591464
    1460         LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : zeroLayoutUnit;
     1465        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
    14611466        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
    1462         LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
     1467        LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max<LayoutUnit>(ow, shadowBottom);
    14631468        LayoutRect bottomRect(newOutlineBox.x(),
    14641469            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
     
    27052710void RenderObject::adjustRectForOutlineAndShadow(LayoutRect& rect) const
    27062711{
    2707     LayoutUnit outlineSize = outlineStyleForRepaint()->outlineSize();
     2712    int outlineSize = outlineStyleForRepaint()->outlineSize();
    27082713    if (const ShadowData* boxShadow = style()->boxShadow()) {
    27092714        boxShadow->adjustRectForShadow(rect, outlineSize);
  • trunk/Source/WebCore/rendering/RenderObject.h

    r110732 r111082  
    3030#include "Document.h"
    3131#include "Element.h"
     32#include "FractionalLayoutUnit.h"
    3233#include "FloatQuad.h"
    3334#include "LayoutTypes.h"
     
    718719        return clippedOverflowRectForRepaint(0);
    719720    }
     721    IntRect pixelSnappedAbsoluteClippedOverflowRect() const;
    720722    virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
    721723    virtual LayoutRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const;
     
    11421144}
    11431145
     1146inline int adjustForAbsoluteZoom(FractionalLayoutUnit value, RenderObject* renderer)
     1147{
     1148    return adjustForAbsoluteZoom(value.floor(), renderer->style());
     1149}
     1150
    11441151inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer)
    11451152{
Note: See TracChangeset for help on using the changeset viewer.