Changeset 90525 in webkit


Ignore:
Timestamp:
Jul 6, 2011 7:32:26 PM (13 years ago)
Author:
eae@chromium.org
Message:

2011-07-06 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Switch offsetFromContainer and related to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63659

Switch offsetFromContainer and related mapping methods to new layout unit
abstraction.

No new tests, no functionality changes.

  • rendering/LayoutTypes.h: (WebCore::enclosingLayoutRect): (WebCore::roundedLayoutPoint): (WebCore::roundedLayoutUnit): Add LayoutUnit versions of enclosingIntRect, roundedIntPoint and lroundf. For now these map to their int counterpart but once we switch to float or fixed point they'll be no-ops and eventually will be removed.
  • rendering/RenderBox.cpp: (WebCore::RenderBox::mapLocalToContainer): (WebCore::RenderBox::mapAbsoluteToLocalPoint): (WebCore::RenderBox::offsetFromContainer):
  • rendering/RenderBox.h:
  • rendering/RenderInline.cpp: (WebCore::RenderInline::linesBoundingBox): (WebCore::RenderInline::offsetFromContainer): (WebCore::RenderInline::mapLocalToContainer): (WebCore::RenderInline::mapAbsoluteToLocalPoint): (WebCore::RenderInline::relativePositionedInlineOffset):
  • rendering/RenderInline.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::offsetFromContainer): (WebCore::RenderObject::offsetFromAncestorContainer):
  • rendering/RenderObject.h:
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::offsetFromContainer):
  • rendering/RenderTableCell.h:
  • rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::convertToPaintingRect):
Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90522 r90525  
     12011-07-06  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch offsetFromContainer and related to to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63659
     7
     8        Switch offsetFromContainer and related mapping methods to new layout unit
     9        abstraction.
     10
     11        No new tests, no functionality changes.
     12
     13        * rendering/LayoutTypes.h:
     14        (WebCore::enclosingLayoutRect):
     15        (WebCore::roundedLayoutPoint):
     16        (WebCore::roundedLayoutUnit):
     17        Add LayoutUnit versions of enclosingIntRect, roundedIntPoint and lroundf.
     18        For now these map to their int counterpart but once we switch to float or
     19        fixed point they'll be no-ops and eventually will be removed.
     20       
     21        * rendering/RenderBox.cpp:
     22        (WebCore::RenderBox::mapLocalToContainer):
     23        (WebCore::RenderBox::mapAbsoluteToLocalPoint):
     24        (WebCore::RenderBox::offsetFromContainer):
     25        * rendering/RenderBox.h:
     26        * rendering/RenderInline.cpp:
     27        (WebCore::RenderInline::linesBoundingBox):
     28        (WebCore::RenderInline::offsetFromContainer):
     29        (WebCore::RenderInline::mapLocalToContainer):
     30        (WebCore::RenderInline::mapAbsoluteToLocalPoint):
     31        (WebCore::RenderInline::relativePositionedInlineOffset):
     32        * rendering/RenderInline.h:
     33        * rendering/RenderObject.cpp:
     34        (WebCore::RenderObject::offsetFromContainer):
     35        (WebCore::RenderObject::offsetFromAncestorContainer):
     36        * rendering/RenderObject.h:
     37        * rendering/RenderTableCell.cpp:
     38        (WebCore::RenderTableCell::offsetFromContainer):
     39        * rendering/RenderTableCell.h:
     40        * rendering/RenderThemeMac.mm:
     41        (WebCore::RenderThemeMac::convertToPaintingRect):
     42
    1432011-07-06  Levi Weintraub  <leviw@chromium.org>
    244
  • trunk/Source/WebCore/rendering/LayoutTypes.h

    r90515 r90525  
    3838
    3939#include "FloatPoint.h"
     40#include "FloatRect.h"
    4041#include "IntRect.h"
    4142
     
    4647typedef IntSize LayoutSize;
    4748typedef IntRect LayoutRect;
     49
     50inline LayoutRect enclosingLayoutRect(const FloatRect& rect)
     51{
     52    return enclosingIntRect(rect);
     53}
    4854
    4955inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r90515 r90525  
    12391239        *wasFixed = fixed;
    12401240   
    1241     IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));
     1241    LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint()));
    12421242   
    12431243    bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
     
    12521252        // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe
    12531253        // to just subtract the delta between the repaintContainer and o.
    1254         IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
     1254        LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
    12551255        transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
    12561256        return;
     
    12801280    o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState);
    12811281
    1282     IntSize containerOffset = offsetFromContainer(o, IntPoint());
     1282    LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
    12831283
    12841284    bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
     
    12911291}
    12921292
    1293 IntSize RenderBox::offsetFromContainer(RenderObject* o, const IntPoint& point) const
     1293LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
    12941294{
    12951295    ASSERT(o == container());
    12961296
    1297     IntSize offset;   
     1297    LayoutSize offset;   
    12981298    if (isRelPositioned())
    12991299        offset += relativePositionOffset();
     
    13021302        if (style()->position() != AbsolutePosition && style()->position() != FixedPosition) {
    13031303            if (o->hasColumns()) {
    1304                 IntRect columnRect(frameRect());
     1304                LayoutRect columnRect(frameRect());
    13051305                toRenderBlock(o)->flipForWritingModeIncludingColumns(columnRect);
    1306                 offset += IntSize(columnRect.location().x(), columnRect.location().y());
     1306                offset += LayoutSize(columnRect.location().x(), columnRect.location().y());
    13071307                columnRect.moveBy(point);
    13081308                o->adjustForColumns(offset, columnRect.location());
  • trunk/Source/WebCore/rendering/RenderBox.h

    r90515 r90525  
    250250    virtual void setOverrideSize(int);
    251251
    252     virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
     252    virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
    253253   
    254254    LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r90515 r90525  
    739739}
    740740
    741 IntRect RenderInline::linesBoundingBox() const
     741LayoutRect RenderInline::linesBoundingBox() const
    742742{
    743743    if (!alwaysCreateLineBoxes()) {
    744744        ASSERT(!firstLineBox());
    745         return enclosingIntRect(culledInlineBoundingBox(this));
    746     }
    747 
    748     IntRect result;
     745        return enclosingLayoutRect(culledInlineBoundingBox(this));
     746    }
     747
     748    LayoutRect result;
    749749   
    750750    // See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero.  We have been
     
    769769        float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLineBox()->logicalBottom() - x;
    770770        float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide;
    771         result = enclosingIntRect(FloatRect(x, y, width, height));
     771        result = enclosingLayoutRect(FloatRect(x, y, width, height));
    772772    }
    773773
     
    10941094}
    10951095
    1096 IntSize RenderInline::offsetFromContainer(RenderObject* container, const IntPoint& point) const
     1096LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const LayoutPoint& point) const
    10971097{
    10981098    ASSERT(container == this->container());
    10991099   
    1100     IntSize offset;   
     1100    LayoutSize offset;   
    11011101    if (isRelPositioned())
    11021102        offset += relativePositionOffset();
     
    11351135        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedIntPoint(transformState.mappedPoint())) - centerPoint);
    11361136
    1137     IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));
     1137    LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint()));
    11381138
    11391139    bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
     
    11671167    o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState);
    11681168
    1169     IntSize containerOffset = offsetFromContainer(o, IntPoint());
     1169    LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
    11701170
    11711171    bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
     
    12861286}
    12871287
    1288 IntSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const
     1288LayoutSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const
    12891289{
    12901290    // FIXME: This function isn't right with mixed writing modes.
     
    12921292    ASSERT(isRelPositioned());
    12931293    if (!isRelPositioned())
    1294         return IntSize();
     1294        return LayoutSize();
    12951295
    12961296    // When we have an enclosing relpositioned inline, we need to add in the offset of the first line
     
    12981298    // relative to the inline itself.
    12991299
    1300     IntSize logicalOffset;
    1301     int inlinePosition;
    1302     int blockPosition;
     1300    LayoutSize logicalOffset;
     1301    LayoutUnit inlinePosition;
     1302    LayoutUnit blockPosition;
    13031303    if (firstLineBox()) {
    1304         inlinePosition = lroundf(firstLineBox()->logicalLeft());
     1304        inlinePosition = roundedLayoutUnit(firstLineBox()->logicalLeft());
    13051305        blockPosition = firstLineBox()->logicalTop();
    13061306    } else {
  • trunk/Source/WebCore/rendering/RenderInline.h

    r90515 r90525  
    5252    virtual void absoluteQuads(Vector<FloatQuad>&);
    5353
    54     virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
     54    virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
    5555
    56     IntRect linesBoundingBox() const;
     56    LayoutRect linesBoundingBox() const;
    5757    IntRect linesVisualOverflowBoundingBox() const;
    5858
     
    7474    virtual void updateDragState(bool dragOn);
    7575   
    76     IntSize relativePositionedInlineOffset(const RenderBox* child) const;
     76    LayoutSize relativePositionedInlineOffset(const RenderBox* child) const;
    7777
    7878    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r90515 r90525  
    19321932}
    19331933
    1934 IntSize RenderObject::offsetFromContainer(RenderObject* o, const IntPoint& point) const
     1934LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
    19351935{
    19361936    ASSERT(o == container());
    19371937
    1938     IntSize offset;
     1938    LayoutSize offset;
    19391939
    19401940    o->adjustForColumns(offset, point);
     
    19461946}
    19471947
    1948 IntSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const
    1949 {
    1950     IntSize offset;
    1951     IntPoint referencePoint;
     1948LayoutSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const
     1949{
     1950    LayoutSize offset;
     1951    LayoutPoint referencePoint;
    19521952    const RenderObject* currContainer = this;
    19531953    do {
     
    19571957            break;
    19581958        ASSERT(!currContainer->hasTransform());
    1959         IntSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint);
     1959        LayoutSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint);
    19601960        offset += currentOffset;
    19611961        referencePoint.move(currentOffset);
  • trunk/Source/WebCore/rendering/RenderObject.h

    r90515 r90525  
    589589    // Return the offset from the container() renderer (excluding transforms). In multi-column layout,
    590590    // different offsets apply at different points, so return the offset that applies to the given point.
    591     virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
     591    virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
    592592    // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
    593     IntSize offsetFromAncestorContainer(RenderObject*) const;
     593    LayoutSize offsetFromAncestorContainer(RenderObject*) const;
    594594   
    595595    virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { }
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r90048 r90525  
    225225}
    226226
    227 IntSize RenderTableCell::offsetFromContainer(RenderObject* o, const IntPoint& point) const
     227LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
    228228{
    229229    ASSERT(o == container());
    230230
    231     IntSize offset = RenderBlock::offsetFromContainer(o, point);
     231    LayoutSize offset = RenderBlock::offsetFromContainer(o, point);
    232232    if (parent())
    233233        offset.expand(-parentBox()->x(), -parentBox()->y());
  • trunk/Source/WebCore/rendering/RenderTableCell.h

    r90048 r90525  
    146146    virtual void paintMask(PaintInfo&, const LayoutPoint&);
    147147
    148     virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
     148    virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
    149149    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
    150150    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r90436 r90525  
    555555    while (renderer && renderer != inputRenderer) {
    556556        RenderObject* containingRenderer = renderer->container();
    557         offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, IntPoint());
     557        offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, LayoutPoint());
    558558        renderer = containingRenderer;
    559559    }
Note: See TracChangeset for help on using the changeset viewer.