Changeset 96546 in webkit


Ignore:
Timestamp:
Oct 3, 2011 3:00:25 PM (13 years ago)
Author:
ojan@chromium.org
Message:

remove dead code in flipForWritingMode
https://bugs.webkit.org/show_bug.cgi?id=68948

Reviewed by Hajime Morita.

ChildToParentFlippingAdjustment is never used, so the third argument
to flipForWritingMode always has the same value.

In addition, renamed to flipForWritingModeForChild to be more clear
that it's operating on the child and renamed flipFloatForWritingMode to match.

No new tests. This is just a code cleanup. No functional changes.

  • rendering/InlineBox.cpp:

(WebCore::InlineBox::paint):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::flipFloatForWritingModeForChild):
(WebCore::RenderBlock::paintFloats):
(WebCore::RenderBlock::hitTestFloats):
(WebCore::RenderBlock::hitTestContents):

  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp:

(WebCore::RenderBox::flipForWritingModeForChild):
(WebCore::RenderBox::topLeftLocation):

  • rendering/RenderBox.h:
  • rendering/RenderTable.cpp:

(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::nodeAtPoint):

  • rendering/RenderTableRow.cpp:

(WebCore::RenderTableRow::nodeAtPoint):

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::paintCell):
(WebCore::RenderTableSection::nodeAtPoint):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96545 r96546  
     12011-09-27  Ojan Vafai  <ojan@chromium.org>
     2
     3        remove dead code in flipForWritingMode
     4        https://bugs.webkit.org/show_bug.cgi?id=68948
     5
     6        Reviewed by Hajime Morita.
     7
     8        ChildToParentFlippingAdjustment is never used, so the third argument
     9        to flipForWritingMode always has the same value.
     10
     11        In addition, renamed to flipForWritingModeForChild to be more clear
     12        that it's operating on the child and renamed flipFloatForWritingMode to match.
     13
     14        No new tests. This is just a code cleanup. No functional changes.
     15
     16        * rendering/InlineBox.cpp:
     17        (WebCore::InlineBox::paint):
     18        * rendering/RenderBlock.cpp:
     19        (WebCore::RenderBlock::paintChildren):
     20        (WebCore::RenderBlock::flipFloatForWritingModeForChild):
     21        (WebCore::RenderBlock::paintFloats):
     22        (WebCore::RenderBlock::hitTestFloats):
     23        (WebCore::RenderBlock::hitTestContents):
     24        * rendering/RenderBlock.h:
     25        * rendering/RenderBox.cpp:
     26        (WebCore::RenderBox::flipForWritingModeForChild):
     27        (WebCore::RenderBox::topLeftLocation):
     28        * rendering/RenderBox.h:
     29        * rendering/RenderTable.cpp:
     30        (WebCore::RenderTable::paintObject):
     31        (WebCore::RenderTable::nodeAtPoint):
     32        * rendering/RenderTableRow.cpp:
     33        (WebCore::RenderTableRow::nodeAtPoint):
     34        * rendering/RenderTableSection.cpp:
     35        (WebCore::RenderTableSection::paintCell):
     36        (WebCore::RenderTableSection::nodeAtPoint):
     37
    1382011-10-03  Jer Noble  <jer.noble@apple.com>
    239
  • trunk/Source/WebCore/rendering/InlineBox.cpp

    r96425 r96546  
    199199    LayoutPoint childPoint = paintOffset;
    200200    if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
    201         childPoint = renderer()->containingBlock()->flipForWritingMode(toRenderBox(renderer()), childPoint, RenderBox::ParentToChildFlippingAdjustment);
     201        childPoint = renderer()->containingBlock()->flipForWritingModeForChild(toRenderBox(renderer()), childPoint);
    202202   
    203203    // Paint all phases of replaced elements atomically, as though the replaced element established its
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r96452 r96546  
    24582458        }
    24592459
    2460         LayoutPoint childPoint = flipForWritingMode(child, paintOffset, ParentToChildFlippingAdjustment);
     2460        LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset);
    24612461        if (!child->hasSelfPaintingLayer() && !child->isFloating())
    24622462            child->paint(info, childPoint);
     
    25842584}
    25852585
    2586 LayoutPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const LayoutPoint& point) const
     2586LayoutPoint RenderBlock::flipFloatForWritingModeForChild(const FloatingObject* child, const LayoutPoint& point) const
    25872587{
    25882588    if (!style()->isFlippedBlocksWritingMode())
    25892589        return point;
    25902590   
    2591     // This is similar to the ParentToChildFlippingAdjustment in RenderBox::flipForWritingMode. We have to subtract out our left/top offsets twice, since
    2592     // it's going to get added back in.  We hide this complication here so that the calling code looks normal for the unflipped
     2591    // This is similar to RenderBox::flipForWritingModeForChild. We have to subtract out our left/top offsets twice, since
     2592    // it's going to get added back in. We hide this complication here so that the calling code looks normal for the unflipped
    25932593    // case.
    25942594    if (isHorizontalWritingMode())
     
    26102610            PaintInfo currentPaintInfo(paintInfo);
    26112611            currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
    2612             LayoutPoint childPoint = flipFloatForWritingMode(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
     2612            LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
    26132613            r->m_renderer->paint(currentPaintInfo, childPoint);
    26142614            if (!preservePhase) {
     
    41384138            LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x();
    41394139            LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y();
    4140             LayoutPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
     4140            LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
    41414141            if (floatingObject->m_renderer->hitTest(request, result, pointInContainer, childPoint)) {
    41424142                updateHitTestResult(result, pointInContainer - toLayoutSize(childPoint));
     
    42074207            childHitTest = HitTestChildBlockBackground;
    42084208        for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) {
    4209             LayoutPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment);
     4209            LayoutPoint childPoint = flipForWritingModeForChild(child, accumulatedOffset);
    42104210            if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, pointInContainer, childPoint, childHitTest))
    42114211                return true;
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r96452 r96546  
    508508    };
    509509
    510     LayoutPoint flipFloatForWritingMode(const FloatingObject*, const LayoutPoint&) const;
     510    LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const;
    511511
    512512    LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); }
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r96452 r96546  
    36943694}
    36953695
    3696 LayoutPoint RenderBox::flipForWritingMode(const RenderBox* child, const LayoutPoint& point, FlippingAdjustment adjustment) const
     3696LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const LayoutPoint& point) const
    36973697{
    36983698    if (!style()->isFlippedBlocksWritingMode())
     
    37023702    // the right place.
    37033703    if (isHorizontalWritingMode())
    3704         return LayoutPoint(point.x(), point.y() + height() - child->height() - child->y() - (adjustment == ParentToChildFlippingAdjustment ? child->y() : 0));
    3705     return LayoutPoint(point.x() + width() - child->width() - child->x() - (adjustment == ParentToChildFlippingAdjustment ? child->x() : 0), point.y());
     3704        return LayoutPoint(point.x(), point.y() + height() - child->height() - (2 * child->y()));
     3705    return LayoutPoint(point.x() + width() - child->width() - (2 * child->x()), point.y());
    37063706}
    37073707
     
    37683768    if (!containerBlock || containerBlock == this)
    37693769        return location();
    3770     return containerBlock->flipForWritingMode(this, location(), RenderBox::ParentToChildFlippingAdjustment);
     3770    return containerBlock->flipForWritingModeForChild(this, location());
    37713771}
    37723772
  • trunk/Source/WebCore/rendering/RenderBox.h

    r96408 r96546  
    406406    virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    407407
    408     enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment };
    409     LayoutPoint flipForWritingMode(const RenderBox* child, const LayoutPoint&, FlippingAdjustment) const;
     408    LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutPoint&) const;
    410409    int flipForWritingMode(int position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes).
    411410    IntPoint flipForWritingMode(const IntPoint&) const;
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r96509 r96546  
    523523    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    524524        if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
    525             LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), paintOffset, ParentToChildFlippingAdjustment);
     525            LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), paintOffset);
    526526            child->paint(info, childPoint);
    527527        }
     
    538538            for (RenderObject* child = firstChild(); child; child = child->nextSibling())
    539539                if (child->isTableSection()) {
    540                     LayoutPoint childPoint = flipForWritingMode(toRenderTableSection(child), paintOffset, ParentToChildFlippingAdjustment);
     540                    LayoutPoint childPoint = flipForWritingModeForChild(toRenderTableSection(child), paintOffset);
    541541                    child->paint(info, childPoint);
    542542                }
     
    11991199        for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
    12001200            if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
    1201                 LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), adjustedLocation, ParentToChildFlippingAdjustment);
     1201                LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
    12021202                if (child->nodeAtPoint(request, result, pointInContainer, childPoint, action)) {
    12031203                    updateHitTestResult(result, toLayoutPoint(pointInContainer - childPoint));
  • trunk/Source/WebCore/rendering/RenderTableRow.cpp

    r95852 r96546  
    205205        // then we can remove this check.
    206206        if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer()) {
    207             LayoutPoint cellPoint = flipForWritingMode(toRenderTableCell(child), accumulatedOffset, ParentToChildFlippingAdjustment);
     207            LayoutPoint cellPoint = flipForWritingModeForChild(toRenderTableCell(child), accumulatedOffset);
    208208            if (child->nodeAtPoint(request, result, pointInContainer, cellPoint, action)) {
    209209                updateHitTestResult(result, pointInContainer - toLayoutSize(cellPoint));
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r95852 r96546  
    961961void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    962962{
    963     LayoutPoint cellPoint = flipForWritingMode(cell, paintOffset, ParentToChildFlippingAdjustment);
     963    LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset);
    964964    PaintPhase paintPhase = paintInfo.phase;
    965965    RenderTableRow* row = toRenderTableRow(cell->parent());
     
    12201220            // then we can remove this check.
    12211221            if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer()) {
    1222                 LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), adjustedLocation, ParentToChildFlippingAdjustment);
     1222                LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
    12231223                if (child->nodeAtPoint(request, result, pointInContainer, childPoint, action)) {
    12241224                    updateHitTestResult(result, toLayoutPoint(pointInContainer - childPoint));
     
    12641264    for (int i = current.cells.size() - 1; i >= 0; --i) {
    12651265        RenderTableCell* cell = current.cells[i];
    1266         LayoutPoint cellPoint = flipForWritingMode(cell, adjustedLocation, ParentToChildFlippingAdjustment);
     1266        LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjustedLocation);
    12671267        if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, pointInContainer, cellPoint, action)) {
    12681268            updateHitTestResult(result, toLayoutPoint(pointInContainer - cellPoint));
Note: See TracChangeset for help on using the changeset viewer.