Changeset 90069 in webkit


Ignore:
Timestamp:
Jun 29, 2011 4:59:49 PM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-06-29 Levi Weintraub <leviw@chromium.org>

Reviewed by Eric Seidel.

Switch computeWidth and computeHeight functions to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63655

Switch computeWidth and computeHeight functions over to the new layout unit abstraction.

Making a point to mark rounding that should eventually be removed by linking to a new
tracking bug: 63645.

No new tests, no functionality changes.

  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::computePreferredLogicalWidths):
  • rendering/AutoTableLayout.h:
  • rendering/FixedTableLayout.cpp: (WebCore::FixedTableLayout::computePreferredLogicalWidths):
  • rendering/FixedTableLayout.h:
  • rendering/LayoutTypes.h:
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::computePreferredLogicalWidths): (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::computeLogicalWidthUsing): (WebCore::RenderBox::computeLogicalHeight): (WebCore::RenderBox::computeLogicalHeightUsing): (WebCore::RenderBox::computePercentageLogicalHeight): (WebCore::RenderBox::computeReplacedLogicalWidth): (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): (WebCore::RenderBox::computeReplacedLogicalWidthUsing): (WebCore::RenderBox::computeReplacedLogicalHeight): (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight): (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
  • rendering/RenderBox.h:
  • rendering/RenderIFrame.cpp: (WebCore::RenderIFrame::computeLogicalWidth):
  • rendering/RenderImage.cpp: (WebCore::RenderImage::computeReplacedLogicalWidth): (WebCore::RenderImage::computeReplacedLogicalHeight):
  • rendering/RenderImage.h:
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::computePreferredLogicalWidths):
  • rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::computePreferredLogicalWidths):
  • rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::computePreferredLogicalWidths):
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeReplacedLogicalWidth): (WebCore::RenderReplaced::computeReplacedLogicalHeight): (WebCore::RenderReplaced::computePreferredLogicalWidths):
  • rendering/RenderReplaced.h:
  • rendering/RenderSlider.cpp: (WebCore::RenderSlider::computePreferredLogicalWidths):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::computeLogicalWidth):
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::computePreferredLogicalWidths):
  • rendering/RenderVideo.cpp: (WebCore::RenderVideo::computeReplacedLogicalWidth): (WebCore::RenderVideo::computeReplacedLogicalHeight):
  • rendering/RenderVideo.h:
  • rendering/svg/RenderSVGForeignObject.cpp: (WebCore::RenderSVGForeignObject::computeLogicalWidth): (WebCore::RenderSVGForeignObject::computeLogicalHeight):
  • rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computePreferredLogicalWidths): (WebCore::RenderSVGRoot::computeIntrinsicWidth): (WebCore::RenderSVGRoot::computeIntrinsicHeight): (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): (WebCore::RenderSVGRoot::layout):
  • rendering/svg/RenderSVGRoot.h:
Location:
trunk/Source/WebCore
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90068 r90069  
     12011-06-29  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch computeWidth and computeHeight functions to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63655
     7
     8        Switch computeWidth and computeHeight functions over to the new layout unit abstraction.
     9
     10        Making a point to mark rounding that should eventually be removed by linking to a new
     11        tracking bug: 63645.
     12
     13        No new tests, no functionality changes.
     14
     15        * rendering/AutoTableLayout.cpp:
     16        (WebCore::AutoTableLayout::computePreferredLogicalWidths):
     17        * rendering/AutoTableLayout.h:
     18        * rendering/FixedTableLayout.cpp:
     19        (WebCore::FixedTableLayout::computePreferredLogicalWidths):
     20        * rendering/FixedTableLayout.h:
     21        * rendering/LayoutTypes.h:
     22        * rendering/RenderBlock.cpp:
     23        (WebCore::RenderBlock::computePreferredLogicalWidths):
     24        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
     25        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
     26        * rendering/RenderBox.cpp:
     27        (WebCore::RenderBox::computeLogicalWidthUsing):
     28        (WebCore::RenderBox::computeLogicalHeight):
     29        (WebCore::RenderBox::computeLogicalHeightUsing):
     30        (WebCore::RenderBox::computePercentageLogicalHeight):
     31        (WebCore::RenderBox::computeReplacedLogicalWidth):
     32        (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth):
     33        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
     34        (WebCore::RenderBox::computeReplacedLogicalHeight):
     35        (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
     36        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
     37        * rendering/RenderBox.h:
     38        * rendering/RenderIFrame.cpp:
     39        (WebCore::RenderIFrame::computeLogicalWidth):
     40        * rendering/RenderImage.cpp:
     41        (WebCore::RenderImage::computeReplacedLogicalWidth):
     42        (WebCore::RenderImage::computeReplacedLogicalHeight):
     43        * rendering/RenderImage.h:
     44        * rendering/RenderListBox.cpp:
     45        (WebCore::RenderListBox::computePreferredLogicalWidths):
     46        * rendering/RenderListMarker.cpp:
     47        (WebCore::RenderListMarker::computePreferredLogicalWidths):
     48        * rendering/RenderMenuList.cpp:
     49        (WebCore::RenderMenuList::computePreferredLogicalWidths):
     50        * rendering/RenderReplaced.cpp:
     51        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
     52        (WebCore::RenderReplaced::computeReplacedLogicalHeight):
     53        (WebCore::RenderReplaced::computePreferredLogicalWidths):
     54        * rendering/RenderReplaced.h:
     55        * rendering/RenderSlider.cpp:
     56        (WebCore::RenderSlider::computePreferredLogicalWidths):
     57        * rendering/RenderTable.cpp:
     58        (WebCore::RenderTable::computeLogicalWidth):
     59        * rendering/RenderTextControl.cpp:
     60        (WebCore::RenderTextControl::computePreferredLogicalWidths):
     61        * rendering/RenderVideo.cpp:
     62        (WebCore::RenderVideo::computeReplacedLogicalWidth):
     63        (WebCore::RenderVideo::computeReplacedLogicalHeight):
     64        * rendering/RenderVideo.h:
     65        * rendering/svg/RenderSVGForeignObject.cpp:
     66        (WebCore::RenderSVGForeignObject::computeLogicalWidth):
     67        (WebCore::RenderSVGForeignObject::computeLogicalHeight):
     68        * rendering/svg/RenderSVGRoot.cpp:
     69        (WebCore::RenderSVGRoot::computePreferredLogicalWidths):
     70        (WebCore::RenderSVGRoot::computeIntrinsicWidth):
     71        (WebCore::RenderSVGRoot::computeIntrinsicHeight):
     72        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
     73        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
     74        (WebCore::RenderSVGRoot::layout):
     75        * rendering/svg/RenderSVGRoot.h:
     76
    1772011-06-23  Abhishek Arya  <inferno@chromium.org>
    278
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r84755 r90069  
    220220}
    221221
    222 void AutoTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth)
     222void AutoTableLayout::computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth)
    223223{
    224224    fullRecalc();
    225225
    226     int spanMaxLogicalWidth = calcEffectiveLogicalWidth();
     226    LayoutUnit spanMaxLogicalWidth = calcEffectiveLogicalWidth();
    227227    minWidth = 0;
    228228    maxWidth = 0;
     
    252252    if (scaleColumns) {
    253253        maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
    254         maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, INT_MAX / 2.0f)));
    255         maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, INT_MAX / 2.0f)));
     254        // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
     255        maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
     256        maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
    256257    }
    257258
    258259    maxWidth = max(maxWidth, spanMaxLogicalWidth);
    259260
    260     int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
     261    LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
    261262    minWidth += bordersPaddingAndSpacing;
    262263    maxWidth += bordersPaddingAndSpacing;
  • trunk/Source/WebCore/rendering/AutoTableLayout.h

    r71262 r90069  
    2222#define AutoTableLayout_h
    2323
     24#include "LayoutTypes.h"
    2425#include "Length.h"
    2526#include "TableLayout.h"
     
    3637    ~AutoTableLayout();
    3738
    38     virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth);
     39    virtual void computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth);
    3940    virtual void layout();
    4041
  • trunk/Source/WebCore/rendering/FixedTableLayout.cpp

    r81625 r90069  
    190190#define TABLE_MAX_WIDTH 15000
    191191
    192 void FixedTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth)
     192void FixedTableLayout::computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth)
    193193{
    194194    // FIXME: This entire calculation is incorrect for both minwidth and maxwidth.
     
    201201    //
    202202    // The maximum width is max(minWidth, tableWidth).
    203     int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
    204 
    205     int tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;
    206     int mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;
     203    LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
     204
     205    LayoutUnit tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;
     206    LayoutUnit mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;
    207207
    208208    minWidth = max(mw, tableLogicalWidth);
  • trunk/Source/WebCore/rendering/FixedTableLayout.h

    r71262 r90069  
    2222#define FixedTableLayout_h
    2323
     24#include "LayoutTypes.h"
    2425#include "Length.h"
    2526#include "TableLayout.h"
     
    3435    FixedTableLayout(RenderTable*);
    3536
    36     virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth);
     37    virtual void computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth);
    3738    virtual void layout();
    3839
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r90068 r90069  
    46404640    }
    46414641
    4642     int borderAndPadding = borderAndPaddingLogicalWidth();
     4642    LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
    46434643    m_minPreferredLogicalWidth += borderAndPadding;
    46444644    m_maxPreferredLogicalWidth += borderAndPadding;
     
    47564756    float inlineMin = 0;
    47574757
    4758     int cw = containingBlock()->contentLogicalWidth();
     4758    LayoutUnit cw = containingBlock()->contentLogicalWidth();
    47594759
    47604760    // If we are at the start of a line, we want to ignore all white-space.
     
    48744874
    48754875                // Add in text-indent.  This is added in only once.
    4876                 int ti = 0;
     4876                LayoutUnit ti = 0;
    48774877                if (!addedTextIndent) {
    48784878                    addedTextIndent = true;
     
    49454945
    49464946                // Add in text-indent.  This is added in only once.
    4947                 int ti = 0;
     4947                LayoutUnit ti = 0;
    49484948                if (!addedTextIndent) {
    49494949                    addedTextIndent = true;
     
    50215021
    50225022    RenderObject *child = firstChild();
    5023     int floatLeftWidth = 0, floatRightWidth = 0;
     5023    LayoutUnit floatLeftWidth = 0, floatRightWidth = 0;
    50245024    while (child) {
    50255025        // Positioned children don't affect the min/max width
     
    50305030
    50315031        if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
    5032             int floatTotalWidth = floatLeftWidth + floatRightWidth;
     5032            LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth;
    50335033            if (child->style()->clear() & CLEFT) {
    50345034                m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth);
     
    50465046        Length startMarginLength = child->style()->marginStart();
    50475047        Length endMarginLength = child->style()->marginEnd();
    5048         int margin = 0;
    5049         int marginStart = 0;
    5050         int marginEnd = 0;
     5048        LayoutUnit margin = 0;
     5049        LayoutUnit marginStart = 0;
     5050        LayoutUnit marginEnd = 0;
    50515051        if (startMarginLength.isFixed())
    50525052            marginStart += startMarginLength.value();
     
    50555055        margin = marginStart + marginEnd;
    50565056
    5057         int w = child->minPreferredLogicalWidth() + margin;
     5057        LayoutUnit w = child->minPreferredLogicalWidth() + margin;
    50585058        m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
    50595059       
     
    50705070                // is smaller than the float width.
    50715071                bool ltr = containingBlock()->style()->isLeftToRightDirection();
    5072                 int marginLogicalLeft = ltr ? marginStart : marginEnd;
    5073                 int marginLogicalRight = ltr ? marginEnd : marginStart;
    5074                 int maxLeft = marginLogicalLeft > 0 ? max(floatLeftWidth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft;
    5075                 int maxRight = marginLogicalRight > 0 ? max(floatRightWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight;
     5072                LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd;
     5073                LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart;
     5074                LayoutUnit maxLeft = marginLogicalLeft > 0 ? max(floatLeftWidth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft;
     5075                LayoutUnit maxRight = marginLogicalRight > 0 ? max(floatRightWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight;
    50765076                w = child->maxPreferredLogicalWidth() + maxLeft + maxRight;
    50775077                w = max(w, floatLeftWidth + floatRightWidth);
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r90059 r90069  
    16211621}
    16221622
    1623 int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availableLogicalWidth)
    1624 {
    1625     int logicalWidthResult = logicalWidth();
     1623LayoutUnit RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, LayoutUnit availableLogicalWidth)
     1624{
     1625    LayoutUnit logicalWidthResult = logicalWidth();
    16261626    Length logicalWidth;
    16271627    if (widthType == LogicalWidth)
     
    16331633
    16341634    if (logicalWidth.isIntrinsicOrAuto()) {
    1635         int marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
    1636         int marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
     1635        LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
     1636        LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
    16371637        if (availableLogicalWidth)
    16381638            logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
     
    17821782        }
    17831783
    1784         int heightResult;
     1784        LayoutUnit heightResult;
    17851785        if (checkMinMaxHeight) {
    17861786            heightResult = computeLogicalHeightUsing(style()->logicalHeight());
    17871787            if (heightResult == -1)
    17881788                heightResult = logicalHeight();
    1789             int minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
    1790             int maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight());
     1789            LayoutUnit minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
     1790            LayoutUnit maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight());
    17911791            if (maxH == -1)
    17921792                maxH = heightResult;
     
    18161816        // FIXME: Finish accounting for block flow here.
    18171817        // https://bugs.webkit.org/show_bug.cgi?id=46603
    1818         int margins = collapsedMarginBefore() + collapsedMarginAfter();
    1819         int visHeight;
     1818        LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
     1819        LayoutUnit visHeight;
    18201820        if (document()->printing())
    1821             visHeight = static_cast<int>(view()->pageLogicalHeight());
     1821            visHeight = static_cast<LayoutUnit>(view()->pageLogicalHeight());
    18221822        else  {
    18231823            if (isHorizontalWritingMode())
     
    18291829            setLogicalHeight(max(logicalHeight(), visHeight - margins));
    18301830        else {
    1831             int marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();
     1831            LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();
    18321832            setLogicalHeight(max(logicalHeight(), visHeight - marginsBordersPadding));
    18331833        }
     
    18351835}
    18361836
    1837 int RenderBox::computeLogicalHeightUsing(const Length& h)
    1838 {
    1839     int logicalHeight = -1;
     1837LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& h)
     1838{
     1839    LayoutUnit logicalHeight = -1;
    18401840    if (!h.isAuto()) {
    18411841        if (h.isFixed())
     
    18511851}
    18521852
    1853 int RenderBox::computePercentageLogicalHeight(const Length& height)
    1854 {
    1855     int result = -1;
     1853LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height)
     1854{
     1855    LayoutUnit result = -1;
    18561856   
    18571857    // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
     
    19121912        // Don't allow this to affect the block' height() member variable, since this
    19131913        // can get called while the block is still laying out its kids.
    1914         int oldHeight = cb->logicalHeight();
     1914        LayoutUnit oldHeight = cb->logicalHeight();
    19151915        cb->computeLogicalHeight();
    19161916        result = cb->contentLogicalHeight();
     
    19341934}
    19351935
    1936 int RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const
     1936LayoutUnit RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const
    19371937{
    19381938    return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style()->logicalWidth()), includeMaxWidth);
    19391939}
    19401940
    1941 int RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(int logicalWidth, bool includeMaxWidth) const
    1942 {
    1943     int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
    1944     int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
     1941LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth) const
     1942{
     1943    LayoutUnit minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
     1944    LayoutUnit maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
    19451945    return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
    19461946}
    19471947
    1948 int RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
     1948LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
    19491949{
    19501950    switch (logicalWidth.type()) {
     
    19551955            // containing block's block-flow.
    19561956            // https://bugs.webkit.org/show_bug.cgi?id=46496
    1957             const int cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
     1957            const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
    19581958            if (cw > 0)
    19591959                return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
     
    19651965}
    19661966
    1967 int RenderBox::computeReplacedLogicalHeight() const
     1967LayoutUnit RenderBox::computeReplacedLogicalHeight() const
    19681968{
    19691969    return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight()));
    19701970}
    19711971
    1972 int RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(int logicalHeight) const
    1973 {
    1974     int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
    1975     int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
     1972LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const
     1973{
     1974    LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
     1975    LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
    19761976    return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
    19771977}
    19781978
    1979 int RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
     1979LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
    19801980{
    19811981    switch (logicalHeight.type()) {
     
    19951995                ASSERT(cb->isRenderBlock());
    19961996                RenderBlock* block = toRenderBlock(cb);
    1997                 int oldHeight = block->height();
     1997                LayoutUnit oldHeight = block->height();
    19981998                block->computeLogicalHeight();
    1999                 int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
     1999                LayoutUnit newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
    20002000                block->setHeight(oldHeight);
    20012001                return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight));
     
    20052005            // containing block's block-flow.
    20062006            // https://bugs.webkit.org/show_bug.cgi?id=46496
    2007             int availableHeight;
     2007            LayoutUnit availableHeight;
    20082008            if (isPositioned())
    20092009                availableHeight = containingBlockLogicalHeightForPositioned(toRenderBoxModelObject(cb));
  • trunk/Source/WebCore/rendering/RenderBox.h

    r90049 r90069  
    306306    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; }
    307307
    308     int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);
    309     int computeLogicalHeightUsing(const Length& height);
    310     int computeReplacedLogicalWidthUsing(Length width) const;
    311     int computeReplacedLogicalWidthRespectingMinMaxWidth(int logicalWidth, bool includeMaxWidth = true) const;
    312     int computeReplacedLogicalHeightUsing(Length height) const;
    313     int computeReplacedLogicalHeightRespectingMinMaxHeight(int logicalHeight) const;
    314 
    315     virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
    316     virtual int computeReplacedLogicalHeight() const;
    317 
    318     int computePercentageLogicalHeight(const Length& height);
     308    LayoutUnit computeLogicalWidthUsing(LogicalWidthType, LayoutUnit availableLogicalWidth);
     309    LayoutUnit computeLogicalHeightUsing(const Length& height);
     310    LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
     311    LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const;
     312    LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
     313    LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
     314
     315    virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     316    virtual LayoutUnit computeReplacedLogicalHeight() const;
     317
     318    LayoutUnit computePercentageLogicalHeight(const Length& height);
    319319
    320320    // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
  • trunk/Source/WebCore/rendering/RenderIFrame.cpp

    r88011 r90069  
    7575        if (!view)
    7676            return;
    77         int border = borderLeft() + borderRight();
     77        LayoutUnit border = borderLeft() + borderRight();
    7878        setWidth(max(width(), view->contentsWidth() + border));
    7979    }
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r90048 r90069  
    461461}
    462462
    463 int RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
     463LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
    464464{
    465465    if (m_imageResource->imageHasRelativeWidth())
    466466        if (RenderObject* cb = isPositioned() ? container() : containingBlock()) {
    467467            if (cb->isBox())
    468                 m_imageResource->setImageContainerSize(IntSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight()));
     468                m_imageResource->setImageContainerSize(LayoutSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight()));
    469469        }
    470470
    471     int logicalWidth;
     471    LayoutUnit logicalWidth;
    472472    if (isLogicalWidthSpecified())
    473473        logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
    474474    else if (m_imageResource->usesImageContainerSize()) {
    475         IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
     475        LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom());
    476476        logicalWidth = style()->isHorizontalWritingMode() ? size.width() : size.height();
    477477    } else if (m_imageResource->imageHasRelativeWidth())
     
    483483}
    484484
    485 int RenderImage::computeReplacedLogicalHeight() const
    486 {
    487     int logicalHeight;
     485LayoutUnit RenderImage::computeReplacedLogicalHeight() const
     486{
     487    LayoutUnit logicalHeight;
    488488    if (isLogicalHeightSpecified())
    489489        logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
    490490    else if (m_imageResource->usesImageContainerSize()) {
    491         IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
     491        LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom());
    492492        logicalHeight = style()->isHorizontalWritingMode() ? size.height() : size.width();
    493493    } else if (m_imageResource->imageHasRelativeHeight())
  • trunk/Source/WebCore/rendering/RenderImage.h

    r90048 r90069  
    8484    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
    8585
    86     virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
    87     virtual int computeReplacedLogicalHeight() const;
     86    virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     87    virtual LayoutUnit computeReplacedLogicalHeight() const;
    8888
    8989    IntSize imageSizeForError(CachedImage*) const;
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r89984 r90069  
    200200    }
    201201
    202     int toAdd = borderAndPaddingWidth();
     202    LayoutUnit toAdd = borderAndPaddingWidth();
    203203    m_minPreferredLogicalWidth += toAdd;
    204204    m_maxPreferredLogicalWidth += toAdd;
  • trunk/Source/WebCore/rendering/RenderListMarker.cpp

    r90048 r90069  
    13491349        // FIXME: This is a somewhat arbitrary width.  Generated images for markers really won't become particularly useful
    13501350        // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
    1351         int bulletWidth = fontMetrics.ascent() / 2;
    1352         m_image->setImageContainerSize(IntSize(bulletWidth, bulletWidth));
    1353         IntSize imageSize = m_image->imageSize(this, style()->effectiveZoom());
     1351        LayoutUnit bulletWidth = fontMetrics.ascent() / 2;
     1352        m_image->setImageContainerSize(LayoutSize(bulletWidth, bulletWidth));
     1353        LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom());
    13541354        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHorizontalWritingMode() ? imageSize.width() : imageSize.height();
    13551355        setPreferredLogicalWidthsDirty(false);
     
    13581358    }
    13591359
    1360     int logicalWidth = 0;
     1360    LayoutUnit logicalWidth = 0;
    13611361    EListStyleType type = style()->listStyleType();
    13621362    switch (type) {
     
    14531453                logicalWidth = 0;
    14541454            else {
    1455                 int itemWidth = font.width(m_text);
     1455                LayoutUnit itemWidth = font.width(m_text);
    14561456                UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
    1457                 int suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));
     1457                LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));
    14581458                logicalWidth = itemWidth + suffixSpaceWidth;
    14591459            }
  • trunk/Source/WebCore/rendering/RenderMenuList.cpp

    r88952 r90069  
    277277    }
    278278
    279     int toAdd = borderAndPaddingWidth();
     279    LayoutUnit toAdd = borderAndPaddingWidth();
    280280    m_minPreferredLogicalWidth += toAdd;
    281281    m_maxPreferredLogicalWidth += toAdd;
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r90068 r90069  
    253253                if (heightIsAuto) {
    254254                    if (contentRenderer) {
    255                         int logicalHeight = contentRenderer->computeReplacedLogicalHeightUsing(contentRenderStyle->logicalHeight());
     255                        LayoutUnit logicalHeight = contentRenderer->computeReplacedLogicalHeightUsing(contentRenderStyle->logicalHeight());
     256                        // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    256257                        return contentRenderer->computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height())));
    257258                    }
    258259                } else {
    259                     int logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
     260                    LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
     261                    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    260262                    return computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height())));
    261263                }
     
    282284               
    283285                // This solves above equation for 'width' (== logicalWidth).
    284                 int logicalWidth = foundExplicitWidth ? computeIntrinsicLogicalWidth(containingBlock, false) : containingBlock->availableLogicalWidth();
    285                 int marginStart = style()->marginStart().calcMinValue(logicalWidth);
    286                 int marginEnd = style()->marginEnd().calcMinValue(logicalWidth);
     286                LayoutUnit logicalWidth = foundExplicitWidth ? computeIntrinsicLogicalWidth(containingBlock, false) : containingBlock->availableLogicalWidth();
     287                LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth);
     288                LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth);
    287289                logicalWidth = max(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth())));
    288290                if (isPercentageIntrinsicSize)
     291                    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    289292                    logicalWidth = static_cast<int>(ceilf(logicalWidth * intrinsicRatio.width() / 100));
    290293                return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth);
     
    342345        // (used width) / (intrinsic ratio)
    343346        if (!intrinsicRatio.isEmpty() && !isPercentageIntrinsicSize)
     347            // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    344348            return computeReplacedLogicalHeightRespectingMinMaxHeight(static_cast<int>(ceilf(availableLogicalWidth() * intrinsicRatio.height() / intrinsicRatio.width())));
    345349
     
    376380    ASSERT(preferredLogicalWidthsDirty());
    377381
    378     int borderAndPadding = borderAndPaddingWidth();
     382    LayoutUnit borderAndPadding = borderAndPaddingWidth();
    379383    m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding;
    380384
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r90068 r90069  
    3535    virtual void destroy();
    3636
    37     virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
    38     virtual int computeReplacedLogicalHeight() const;
     37    virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     38    virtual LayoutUnit computeReplacedLogicalHeight() const;
    3939
    4040protected:
  • trunk/Source/WebCore/rendering/RenderSlider.cpp

    r88901 r90069  
    8989    }
    9090
    91     int toAdd = borderAndPaddingWidth();
     91    LayoutUnit toAdd = borderAndPaddingWidth();
    9292    m_minPreferredLogicalWidth += toAdd;
    9393    m_maxPreferredLogicalWidth += toAdd;
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r90048 r90069  
    216216    RenderBlock* cb = containingBlock();
    217217
    218     int availableLogicalWidth = containingBlockLogicalWidthForContent();
     218    LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent();
    219219    bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode();
    220     int containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;
     220    LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;
    221221
    222222    LengthType logicalWidthType = style()->logicalWidth().type();
     
    227227    } else {
    228228        // Subtract out any fixed margins from our available width for auto width tables.
    229         int marginTotal = 0;
     229        LayoutUnit marginTotal = 0;
    230230        if (!style()->marginStart().isAuto())
    231231            marginTotal += style()->marginStart().calcValue(availableLogicalWidth);
     
    234234           
    235235        // Subtract out our margins to get the available content width.
    236         int availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal);
     236        LayoutUnit availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal);
    237237       
    238238        // Ensure we aren't bigger than our max width or smaller than our min width.
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r89983 r90069  
    566566    }
    567567
    568     int toAdd = borderAndPaddingWidth();
     568    LayoutUnit toAdd = borderAndPaddingWidth();
    569569
    570570    m_minPreferredLogicalWidth += toAdd;
  • trunk/Source/WebCore/rendering/RenderVideo.cpp

    r89983 r90069  
    254254}
    255255
    256 int RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const
     256LayoutUnit RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const
    257257{
    258258    return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
    259259}
    260260
    261 int RenderVideo::computeReplacedLogicalHeight() const
     261LayoutUnit RenderVideo::computeReplacedLogicalHeight() const
    262262{
    263263    return RenderReplaced::computeReplacedLogicalHeight();
  • trunk/Source/WebCore/rendering/RenderVideo.h

    r89983 r90069  
    7171    virtual void layout();
    7272
    73     virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
    74     virtual int computeReplacedLogicalHeight() const;
     73    virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     74    virtual LayoutUnit computeReplacedLogicalHeight() const;
    7575    virtual int minimumReplacedHeight() const;
    7676
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r89754 r90069  
    8787{
    8888    // FIXME: Investigate in size rounding issues
     89    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    8990    setWidth(static_cast<int>(roundf(m_viewport.width())));
    9091}
     
    9394{
    9495    // FIXME: Investigate in size rounding issues
     96    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    9597    setHeight(static_cast<int>(roundf(m_viewport.height())));
    9698}
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r90048 r90069  
    9999    ASSERT(preferredLogicalWidthsDirty());
    100100
    101     int borderAndPadding = borderAndPaddingWidth();
    102     int width = computeReplacedLogicalWidth(false) + borderAndPadding;
     101    LayoutUnit borderAndPadding = borderAndPaddingWidth();
     102    LayoutUnit width = computeReplacedLogicalWidth(false) + borderAndPadding;
    103103
    104104    if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
     
    114114}
    115115
    116 int RenderSVGRoot::computeIntrinsicWidth(int replacedWidth) const
     116LayoutUnit RenderSVGRoot::computeIntrinsicWidth(LayoutUnit replacedWidth) const
    117117{
    118118    if (!style()->width().isPercent())
    119119        return replacedWidth;
     120    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    120121    return static_cast<int>(ceilf(replacedWidth * style()->effectiveZoom()));
    121122}
    122123
    123 int RenderSVGRoot::computeIntrinsicHeight(int replacedHeight) const
     124LayoutUnit RenderSVGRoot::computeIntrinsicHeight(LayoutUnit replacedHeight) const
    124125{
    125126    if (!style()->height().isPercent())
    126127        return replacedHeight;
     128    // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
    127129    return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom()));
    128130}
     
    149151}
    150152
    151 int RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
    152 {
    153     int replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);
     153LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
     154{
     155    LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);
    154156    Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
    155157    if (!frame)
     
    190192}
    191193
    192 int RenderSVGRoot::computeReplacedLogicalHeight() const
    193 {
    194     int replacedHeight = RenderBox::computeReplacedLogicalHeight();
     194LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const
     195{
     196    LayoutUnit replacedHeight = RenderBox::computeReplacedLogicalHeight();
    195197
    196198    Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
     
    229231    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout);
    230232
    231     IntSize oldSize(width(), height());
     233    LayoutSize oldSize(width(), height());
    232234    negotiateSizeWithHostDocumentIfNeeded();
    233235    computeLogicalWidth();
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h

    r90048 r90069  
    4949
    5050private:
    51     int computeIntrinsicWidth(int replacedWidth) const;
    52     int computeIntrinsicHeight(int replacedHeight) const;
     51    LayoutUnit computeIntrinsicWidth(LayoutUnit replacedWidth) const;
     52    LayoutUnit computeIntrinsicHeight(LayoutUnit replacedHeight) const;
    5353    void negotiateSizeWithHostDocumentIfNeeded();
    5454
     
    6060
    6161    virtual void computePreferredLogicalWidths();
    62     virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
    63     virtual int computeReplacedLogicalHeight() const;
     62    virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     63    virtual LayoutUnit computeReplacedLogicalHeight() const;
    6464    virtual void layout();
    6565    virtual void paint(PaintInfo&, const LayoutPoint&);
Note: See TracChangeset for help on using the changeset viewer.