Changeset 98929 in webkit


Ignore:
Timestamp:
Oct 31, 2011 6:01:57 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=71243

Reviewed by Eric Seidel.

Replacing remaining integer uses with LayoutUnits in the aforementioned classes.

No new tests -- no change in behavior.

  • rendering/RenderApplet.cpp:

(WebCore::RenderApplet::intrinsicSize):
(WebCore::RenderApplet::createWidgetIfNecessary):

  • rendering/RenderApplet.h:
  • rendering/RenderButton.cpp:

(WebCore::RenderButton::controlClipRect):

  • rendering/RenderButton.h:
  • rendering/RenderDeprecatedFlexibleBox.cpp:

(WebCore::marginWidthForChild):
(WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths):
(WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):

  • rendering/RenderDeprecatedFlexibleBox.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98926 r98929  
     12011-10-31  Levi Weintraub  <leviw@chromium.org>
     2
     3        Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox
     4        https://bugs.webkit.org/show_bug.cgi?id=71243
     5
     6        Reviewed by Eric Seidel.
     7
     8        Replacing remaining integer uses with LayoutUnits in the aforementioned classes.
     9
     10        No new tests -- no change in behavior.
     11
     12        * rendering/RenderApplet.cpp:
     13        (WebCore::RenderApplet::intrinsicSize):
     14        (WebCore::RenderApplet::createWidgetIfNecessary):
     15        * rendering/RenderApplet.h:
     16        * rendering/RenderButton.cpp:
     17        (WebCore::RenderButton::controlClipRect):
     18        * rendering/RenderButton.h:
     19        * rendering/RenderDeprecatedFlexibleBox.cpp:
     20        (WebCore::marginWidthForChild):
     21        (WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths):
     22        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
     23        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
     24        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
     25        * rendering/RenderDeprecatedFlexibleBox.h:
     26
    1272011-10-31  Tommy Widenflycht  <tommyw@google.com>
    228
  • trunk/Source/WebCore/rendering/RenderApplet.cpp

    r71536 r98929  
    4545}
    4646
    47 IntSize RenderApplet::intrinsicSize() const
     47LayoutSize RenderApplet::intrinsicSize() const
    4848{
    4949    // FIXME: This doesn't make sense. We can't just start returning
     
    5151    // layout and sizing to be correct. We should remove this and
    5252    // pass the appropriate intrinsic size in the constructor.
    53     return widget() ? IntSize(50, 50) : IntSize(150, 150);
     53    return widget() ? LayoutSize(50, 50) : LayoutSize(150, 150);
    5454}
    5555
     
    6464    // use fixed widths/heights from the style system when we can, since the widget might
    6565    // not have an accurate m_width/m_height.
    66     int contentWidth = style()->width().isFixed() ? style()->width().value() :
     66    LayoutUnit contentWidth = style()->width().isFixed() ? LayoutUnit(style()->width().value()) :
    6767        width() - borderAndPaddingWidth();
    68     int contentHeight = style()->height().isFixed() ? style()->height().value() :
     68    LayoutUnit contentHeight = style()->height().isFixed() ? LayoutUnit(style()->height().value()) :
    6969        height() - borderAndPaddingHeight();
    7070    for (Node* child = element->firstChild(); child; child = child->nextSibling()) {
     
    7878    Frame* frame = this->frame();
    7979    ASSERT(frame);
    80     setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args));
     80    setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(LayoutSize(contentWidth, contentHeight), element, m_args));
    8181}
    8282
  • trunk/Source/WebCore/rendering/RenderApplet.h

    r71536 r98929  
    4747
    4848    virtual void layout();
    49     virtual IntSize intrinsicSize() const;
     49    virtual LayoutSize intrinsicSize() const;
    5050
    5151#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/rendering/RenderButton.cpp

    r93820 r98929  
    158158}
    159159
    160 IntRect RenderButton::controlClipRect(const IntPoint& additionalOffset) const
     160LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) const
    161161{
    162162    // Clip to the padding box to at least give content the extra padding space.
    163     return IntRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
     163    return LayoutRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
    164164}
    165165
  • trunk/Source/WebCore/rendering/RenderButton.h

    r98883 r98929  
    5252
    5353    virtual bool hasControlClip() const { return true; }
    54     virtual LayoutRect controlClipRect(const IntPoint&) const;
     54    virtual LayoutRect controlClipRect(const LayoutPoint&) const;
    5555
    5656    void setText(const String&);
  • trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

    r98033 r98929  
    130130}
    131131
    132 static int marginWidthForChild(RenderBox* child)
     132static LayoutUnit marginWidthForChild(RenderBox* child)
    133133{
    134134    // A margin basically has three types: fixed, percentage, and auto (variable).
     
    137137    Length marginLeft = child->style()->marginLeft();
    138138    Length marginRight = child->style()->marginRight();
    139     int margin = 0;
     139    LayoutUnit margin = 0;
    140140    if (marginLeft.isFixed())
    141141        margin += marginLeft.value();
     
    197197    if (hasOverflowClip() && style()->overflowY() == OSCROLL) {
    198198        layer()->setHasVerticalScrollbar(true);
    199         int scrollbarWidth = verticalScrollbarWidth();
     199        LayoutUnit scrollbarWidth = verticalScrollbarWidth();
    200200        m_maxPreferredLogicalWidth += scrollbarWidth;
    201201        m_minPreferredLogicalWidth += scrollbarWidth;
     
    219219}
    220220
    221 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, int pageLogicalHeight, BlockLayoutPass layoutPass)
     221void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass)
    222222{
    223223    ASSERT(needsLayout());
     
    227227
    228228    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
    229     LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
     229    LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
    230230
    231231    LayoutSize previousSize = size();
     
    276276        // twice when we collapse with our previous vertically adjacent and
    277277        // following vertically adjacent blocks.
    278         int pos = maxPositiveMarginBefore();
    279         int neg = maxNegativeMarginBefore();
     278        LayoutUnit pos = maxPositiveMarginBefore();
     279        LayoutUnit neg = maxNegativeMarginBefore();
    280280        if (maxPositiveMarginAfter() > pos)
    281281            pos = maxPositiveMarginAfter();
     
    456456                    break;
    457457                case BBASELINE: {
    458                     int ascent = child->firstLineBoxBaseline();
     458                    LayoutUnit ascent = child->firstLineBoxBaseline();
    459459                    if (ascent == -1)
    460460                        ascent = child->height() + child->marginBottom();
     
    471471            }
    472472
    473             placeChild(child, IntPoint(xPos, childY));
     473            placeChild(child, LayoutPoint(xPos, childY));
    474474
    475475            xPos += child->width() + child->marginRight();
     
    510510                        LayoutUnit allowedFlex = allowedChildFlex(child, expanding, i);
    511511                        if (allowedFlex) {
    512                             LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / child->style()->boxFlex()));
     512                            LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()->boxFlex()));
    513513                            spaceAvailableThisPass = expanding ? min(spaceAvailableThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex);
    514514                        }
     
    528528
    529529                        if (allowedChildFlex(child, expanding, i)) {
    530                             LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
     530                            LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
    531531                            if (spaceAdd) {
    532532                                child->setOverrideWidth(child->overrideWidth() + spaceAdd);
     
    907907            continue;
    908908
    909         int newHeight = blockChild->heightForLineCount(numVisibleLines);
     909        LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines);
    910910        if (newHeight == child->height())
    911911            continue;
     
    937937
    938938        // Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
    939         int totalWidth;
     939        LayoutUnit totalWidth;
    940940        InlineBox* anchorBox = lastLine->lastChild();
    941941        if (anchorBox && anchorBox->renderer()->style()->isLink())
     
    958958            continue;
    959959
    960         int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
    961         int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
    962 
    963         int blockEdge = leftToRight ? blockRightEdge : blockLeftEdge;
     960        LayoutUnit blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
     961        LayoutUnit blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
     962
     963        LayoutUnit blockEdge = leftToRight ? blockRightEdge : blockLeftEdge;
    964964        if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockEdge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth))
    965965            continue;
  • trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h

    r92638 r98929  
    4141    void calcVerticalPrefWidths();
    4242
    43     virtual void layoutBlock(bool relayoutChildren, int pageHeight = 0, BlockLayoutPass = NormalLayoutPass);
     43    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0, BlockLayoutPass = NormalLayoutPass);
    4444    void layoutHorizontalBox(bool relayoutChildren);
    4545    void layoutVerticalBox(bool relayoutChildren);
Note: See TracChangeset for help on using the changeset viewer.