Changeset 86395 in webkit


Ignore:
Timestamp:
May 12, 2011 4:30:09 PM (13 years ago)
Author:
eae@chromium.org
Message:

2011-05-12 Emil A Eklund <eae@chromium.org>

Reviewed by Darin Adler.

Convert RenderBox::setLocation, setLogicalLocation and setLogicalSize to IntPoint/IntSize
https://bugs.webkit.org/show_bug.cgi?id=60585

Refactoring, covered by existing tests.

  • rendering/RenderBox.cpp: (WebCore::RenderBox::positionLineBox):
  • rendering/RenderBox.h: (WebCore::RenderBox::setLogicalLocation): (WebCore::RenderBox::setLogicalSize): (WebCore::RenderBox::setLocation):
  • rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::positionFrames): (WebCore::RenderFrameSet::positionFramesWithFlattening):
  • rendering/RenderMedia.cpp: (WebCore::RenderMedia::layout):
  • rendering/RenderScrollbarPart.cpp: (WebCore::RenderScrollbarPart::paintIntoRect):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::adjustLogicalHeightForCaption): (WebCore::RenderTable::layout):
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::layoutRows):
  • rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::layout):
  • rendering/svg/SVGRootInlineBox.cpp: (WebCore::SVGRootInlineBox::layoutRootBox):
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86394 r86395  
     12011-05-12  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Convert RenderBox::setLocation, setLogicalLocation and setLogicalSize to IntPoint/IntSize
     6        https://bugs.webkit.org/show_bug.cgi?id=60585
     7
     8        Refactoring, covered by existing tests.
     9
     10        * rendering/RenderBox.cpp:
     11        (WebCore::RenderBox::positionLineBox):
     12        * rendering/RenderBox.h:
     13        (WebCore::RenderBox::setLogicalLocation):
     14        (WebCore::RenderBox::setLogicalSize):
     15        (WebCore::RenderBox::setLocation):
     16        * rendering/RenderFrameSet.cpp:
     17        (WebCore::RenderFrameSet::positionFrames):
     18        (WebCore::RenderFrameSet::positionFramesWithFlattening):
     19        * rendering/RenderMedia.cpp:
     20        (WebCore::RenderMedia::layout):
     21        * rendering/RenderScrollbarPart.cpp:
     22        (WebCore::RenderScrollbarPart::paintIntoRect):
     23        * rendering/RenderTable.cpp:
     24        (WebCore::RenderTable::adjustLogicalHeightForCaption):
     25        (WebCore::RenderTable::layout):
     26        * rendering/RenderTableSection.cpp:
     27        (WebCore::RenderTableSection::layoutRows):
     28        * rendering/RenderTextControlSingleLine.cpp:
     29        (WebCore::RenderTextControlSingleLine::layout):
     30        * rendering/svg/SVGRootInlineBox.cpp:
     31        (WebCore::SVGRootInlineBox::layoutRootBox):
     32
    1332011-05-12  Adrienne Walker  <enne@google.com>
    234
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r86385 r86395  
    13701370        box->destroy(renderArena());
    13711371    } else if (isReplaced()) {
    1372         setLocation(lroundf(box->x()), lroundf(box->y()));
     1372        setLocation(roundedIntPoint(FloatPoint(box->x(), box->y())));
    13731373        m_inlineBoxWrapper = box;
    13741374    }
  • trunk/Source/WebCore/rendering/RenderBox.h

    r86385 r86395  
    7676            setX(top);
    7777    }
     78    void setLogicalLocation(const IntPoint& location)
     79    {
     80        if (style()->isHorizontalWritingMode())
     81            setLocation(location);
     82        else
     83            setLocation(location.transposedPoint());
     84    }
    7885    void setLogicalWidth(int size)
    7986    {
     
    9097            setWidth(size);
    9198    }
    92     void setLogicalLocation(int left, int top)
     99    void setLogicalSize(const IntSize& size)
    93100    {
    94101        if (style()->isHorizontalWritingMode())
    95             setLocation(left, top);
     102            setSize(size);
    96103        else
    97             setLocation(top, left);
     104            setSize(size.transposedSize());
    98105    }
    99106
     
    103110
    104111    void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); }
    105     void setLocation(int x, int y) { setLocation(IntPoint(x, y)); }
    106112   
    107113    void setSize(const IntSize& size) { m_frameRect.setSize(size); }
  • trunk/Source/WebCore/rendering/RenderFrameSet.cpp

    r86390 r86395  
    519519        int height = m_rows.m_sizes[r];
    520520        for (int c = 0; c < cols; c++) {
    521             child->setLocation(xPos, yPos);
     521            child->setLocation(IntPoint(xPos, yPos));
    522522            int width = m_cols.m_sizes[c];
    523523
     
    616616            IntRect oldRect = child->frameRect();
    617617
    618             child->setLocation(xPos, yPos);
     618            child->setLocation(IntPoint(xPos, yPos));
    619619            child->setHeight(m_rows.m_sizes[r]);
    620620            child->setWidth(m_cols.m_sizes[c]);
  • trunk/Source/WebCore/rendering/RenderMedia.cpp

    r83397 r86395  
    7575    LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
    7676
    77     controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop());
     77    controlsRenderer->setLocation(IntPoint(borderLeft(), borderTop()) + IntSize(paddingLeft(), paddingTop()));
    7878    controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
    7979    controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
  • trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp

    r86197 r86395  
    163163{
    164164    // Make sure our dimensions match the rect.
    165     setLocation(rect.x() - tx, rect.y() - ty);
     165    setLocation(rect.location() - IntSize(tx, ty));
    166166    setWidth(rect.width());
    167167    setHeight(rect.height());
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r86384 r86395  
    258258    IntRect captionRect(m_caption->x(), m_caption->y(), m_caption->width(), m_caption->height());
    259259
    260     m_caption->setLogicalLocation(m_caption->marginStart(), logicalHeight());
     260    m_caption->setLogicalLocation(IntPoint(m_caption->marginStart(), logicalHeight()));
    261261    if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
    262262        m_caption->repaintDuringLayoutIfMoved(captionRect);
     
    375375            movedSectionLogicalTop = min(logicalHeight(), section->logicalTop()) + (style()->isHorizontalWritingMode() ? section->minYVisualOverflow() : section->minXVisualOverflow());
    376376        }
    377         section->setLogicalLocation(sectionLogicalLeft, logicalHeight());
     377        section->setLogicalLocation(IntPoint(sectionLogicalLeft, logicalHeight()));
    378378
    379379        setLogicalHeight(logicalHeight() + section->logicalHeight());
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r83255 r86395  
    494494        // Set the row's x/y position and width/height.
    495495        if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
    496             rowRenderer->setLocation(0, m_rowPos[r]);
     496            rowRenderer->setLocation(IntPoint(0, m_rowPos[r]));
    497497            rowRenderer->setLogicalWidth(logicalWidth());
    498498            rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
     
    608608            IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
    609609
     610            IntPoint cellLocation(0, m_rowPos[rindx]);
    610611            if (!style()->isLeftToRightDirection())
    611                 cell->setLogicalLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
     612                cellLocation.setX(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing);
    612613            else
    613                 cell->setLogicalLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
     614                cellLocation.setX(table()->columnPositions()[c] + hspacing);
     615            cell->setLogicalLocation(cellLocation);
    614616            view()->addLayoutDelta(IntSize(oldCellRect.x() - cell->x(), oldCellRect.y() - cell->y()));
    615617
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r86385 r86395  
    292292    // Ignores the paddings for the inner spin button.
    293293    if (RenderBox* spinBox = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0) {
    294         spinBox->setLocation(spinBox->x() + paddingRight(), borderTop());
     294        spinBox->setLocation(IntPoint(spinBox->x() + paddingRight(), borderTop()));
    295295        spinBox->setHeight(height() - borderTop() - borderBottom());
    296296    }
     
    303303            int x = width() - borderAndPaddingWidth() - button->width() - button->borderAndPaddingWidth();
    304304            int y = (height() - button->height()) / 2;
    305             button->setLocation(x, y);
     305            button->setLocation(IntPoint(x, y));
    306306        } else {
    307307            int x = width() - borderRight() - paddingRight() - button->width();
     
    315315                innerTextRenderer->setX(paddingLeft() + borderLeft() + (spinBox ? spinBox->width() : 0));
    316316            int y = (height() - button->height()) / 2;
    317             button->setLocation(x, y);
     317            button->setLocation(IntPoint(x, y));
    318318        }
    319319    }
     
    329329        int y = (diff / 2) + (diff % 2);
    330330        int x = width() - borderRight() - paddingRight() - spinBox->width();
    331         spinBox->setLocation(x, y);
     331        spinBox->setLocation(IntPoint(x, y));
    332332    }
    333333}
  • trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp

    r84504 r86395  
    177177    }
    178178
    179     int xBlock = childRect.x();
    180     int yBlock = childRect.y();
    181179    int widthBlock = childRect.width();
    182180    int heightBlock = childRect.height();
    183181
    184182    // Finally, assign the root block position, now that all content is laid out.
    185     parentBlock->setLocation(xBlock, yBlock);
    186     parentBlock->setWidth(widthBlock);
    187     parentBlock->setHeight(heightBlock);
     183    parentBlock->setLocation(childRect.location());
     184    parentBlock->setSize(childRect.size());
    188185
    189186    // Position all children relative to the parent block.
     
    192189        if (!child->renderer()->node())
    193190            continue;
    194         child->adjustPosition(-xBlock, -yBlock);
     191        child->adjustPosition(-childRect.x(), -childRect.y());
    195192    }
    196193
Note: See TracChangeset for help on using the changeset viewer.