Changeset 90517 in webkit


Ignore:
Timestamp:
Jul 6, 2011 4:55:06 PM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Switch Overflow and FrameRect methods in InlineBox to Layout Units
https://bugs.webkit.org/show_bug.cgi?id=64034

Reviewed by Eric Seidel.

Switching Overflow and FrameRect methods on InlineBox to new Layout Unit abstraction and
cleaning up some compilation errors that crop up when building with floating point layout units.

No new tests, no functionality changes.

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::sizingBox):
  • dom/Document.h:
  • editing/DeleteButtonController.cpp: (WebCore::isDeletableElement):
  • inspector/DOMNodeHighlighter.cpp: (WebCore::DOMNodeHighlighter::drawNodeHighlight):
  • page/animation/AnimationBase.cpp: (WebCore::blendFunc):
  • platform/ScrollView.h: (WebCore::ScrollView::visibleWidth): (WebCore::ScrollView::visibleHeight):
  • platform/ScrollableArea.h: (WebCore::ScrollableArea::visibleHeight): (WebCore::ScrollableArea::visibleWidth):
  • platform/graphics/FloatPoint.h: Adding FloatPoint and FloatSize move[By] functions (WebCore::FloatPoint::move): (WebCore::FloatPoint::moveBy):
  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::computePreferredLogicalWidths): (WebCore::AutoTableLayout::layout):
  • rendering/InlineFlowBox.h: (WebCore::InlineFlowBox::layoutOverflowRect): (WebCore::InlineFlowBox::logicalLeftLayoutOverflow): (WebCore::InlineFlowBox::logicalRightLayoutOverflow): (WebCore::InlineFlowBox::logicalTopLayoutOverflow): (WebCore::InlineFlowBox::logicalBottomLayoutOverflow): (WebCore::InlineFlowBox::logicalLayoutOverflowRect): (WebCore::InlineFlowBox::visualOverflowRect): (WebCore::InlineFlowBox::logicalLeftVisualOverflow): (WebCore::InlineFlowBox::logicalRightVisualOverflow): (WebCore::InlineFlowBox::logicalTopVisualOverflow): (WebCore::InlineFlowBox::logicalBottomVisualOverflow): (WebCore::InlineFlowBox::logicalVisualOverflowRect): (WebCore::InlineFlowBox::frameRectIncludingLineHeight): (WebCore::InlineFlowBox::logicalFrameRectIncludingLineHeight):
  • rendering/RenderBlock.h: (WebCore::RenderBlock::RenderBlockRareData::positiveMarginBeforeDefault): (WebCore::RenderBlock::RenderBlockRareData::negativeMarginBeforeDefault): (WebCore::RenderBlock::RenderBlockRareData::positiveMarginAfterDefault): (WebCore::RenderBlock::RenderBlockRareData::negativeMarginAfterDefault):
Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90515 r90517  
     12011-07-06  Levi Weintraub  <leviw@chromium.org>
     2
     3        Switch Overflow and FrameRect methods in InlineBox to Layout Units
     4        https://bugs.webkit.org/show_bug.cgi?id=64034
     5
     6        Reviewed by Eric Seidel.
     7
     8        Switching Overflow and FrameRect methods on InlineBox to new Layout Unit abstraction and
     9        cleaning up some compilation errors that crop up when building with floating point layout units.
     10
     11        No new tests, no functionality changes.
     12
     13        * css/CSSComputedStyleDeclaration.cpp:
     14        (WebCore::sizingBox):
     15        * dom/Document.h:
     16        * editing/DeleteButtonController.cpp:
     17        (WebCore::isDeletableElement):
     18        * inspector/DOMNodeHighlighter.cpp:
     19        (WebCore::DOMNodeHighlighter::drawNodeHighlight):
     20        * page/animation/AnimationBase.cpp:
     21        (WebCore::blendFunc):
     22        * platform/ScrollView.h:
     23        (WebCore::ScrollView::visibleWidth):
     24        (WebCore::ScrollView::visibleHeight):
     25        * platform/ScrollableArea.h:
     26        (WebCore::ScrollableArea::visibleHeight):
     27        (WebCore::ScrollableArea::visibleWidth):
     28        * platform/graphics/FloatPoint.h: Adding FloatPoint and FloatSize move[By] functions
     29        (WebCore::FloatPoint::move):
     30        (WebCore::FloatPoint::moveBy):
     31        * rendering/AutoTableLayout.cpp:
     32        (WebCore::AutoTableLayout::computePreferredLogicalWidths):
     33        (WebCore::AutoTableLayout::layout):
     34        * rendering/InlineFlowBox.h:
     35        (WebCore::InlineFlowBox::layoutOverflowRect):
     36        (WebCore::InlineFlowBox::logicalLeftLayoutOverflow):
     37        (WebCore::InlineFlowBox::logicalRightLayoutOverflow):
     38        (WebCore::InlineFlowBox::logicalTopLayoutOverflow):
     39        (WebCore::InlineFlowBox::logicalBottomLayoutOverflow):
     40        (WebCore::InlineFlowBox::logicalLayoutOverflowRect):
     41        (WebCore::InlineFlowBox::visualOverflowRect):
     42        (WebCore::InlineFlowBox::logicalLeftVisualOverflow):
     43        (WebCore::InlineFlowBox::logicalRightVisualOverflow):
     44        (WebCore::InlineFlowBox::logicalTopVisualOverflow):
     45        (WebCore::InlineFlowBox::logicalBottomVisualOverflow):
     46        (WebCore::InlineFlowBox::logicalVisualOverflowRect):
     47        (WebCore::InlineFlowBox::frameRectIncludingLineHeight):
     48        (WebCore::InlineFlowBox::logicalFrameRectIncludingLineHeight):
     49        * rendering/RenderBlock.h:
     50        (WebCore::RenderBlock::RenderBlockRareData::positiveMarginBeforeDefault):
     51        (WebCore::RenderBlock::RenderBlockRareData::negativeMarginBeforeDefault):
     52        (WebCore::RenderBlock::RenderBlockRareData::positiveMarginAfterDefault):
     53        (WebCore::RenderBlock::RenderBlockRareData::negativeMarginAfterDefault):
     54
    1552011-07-06  Emil A Eklund  <eae@chromium.org>
    256
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r88526 r90517  
    445445}
    446446
    447 static IntRect sizingBox(RenderObject* renderer)
     447static LayoutRect sizingBox(RenderObject* renderer)
    448448{
    449449    if (!renderer->isBox())
    450         return IntRect();
     450        return LayoutRect();
    451451   
    452452    RenderBox* box = toRenderBox(renderer);
  • trunk/Source/WebCore/dom/Document.h

    r90471 r90517  
    3636#include "IconURL.h"
    3737#include "IntRect.h"
     38#include "LayoutTypes.h"
    3839#include "PageVisibilityState.h"
    3940#include "QualifiedName.h"
     
    13791380    Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue;
    13801381    bool m_isAnimatingFullScreen;
    1381     IntRect m_savedPlaceholderFrameRect;
     1382    LayoutRect m_savedPlaceholderFrameRect;
    13821383    RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
    13831384#endif
  • trunk/Source/WebCore/editing/DeleteButtonController.cpp

    r85864 r90517  
    9191
    9292    RenderBox* box = toRenderBox(renderer);
    93     IntRect borderBoundingBox = box->borderBoundingBox();
     93    LayoutRect borderBoundingBox = box->borderBoundingBox();
    9494    if (borderBoundingBox.width() < minimumWidth || borderBoundingBox.height() < minimumHeight)
    9595        return false;
  • trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp

    r89815 r90517  
    232232        return;
    233233
    234     IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
    235     IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
     234    LayoutSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
     235    LayoutRect boundingBox = renderer->absoluteBoundingBoxRect(true);
    236236
    237237    boundingBox.move(mainFrameOffset);
     
    256256
    257257        // RenderBox returns the "pure" content area box, exclusive of the scrollbars (if present), which also count towards the content area in CSS.
    258         IntRect contentBox = renderBox->contentBoxRect();
     258        LayoutRect contentBox = renderBox->contentBoxRect();
    259259        contentBox.setWidth(contentBox.width() + renderBox->verticalScrollbarWidth());
    260260        contentBox.setHeight(contentBox.height() + renderBox->horizontalScrollbarHeight());
    261261
    262         IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
     262        LayoutRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
    263263                           contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
    264         IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
     264        LayoutRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
    265265                          paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
    266         IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
     266        LayoutRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
    267267                          borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
    268268
  • trunk/Source/WebCore/page/animation/AnimationBase.cpp

    r88804 r90517  
    176176    } else {
    177177        // Convert the TransformOperations into matrices
    178         IntSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : IntSize();
     178        LayoutSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize();
    179179        TransformationMatrix fromT;
    180180        TransformationMatrix toT;
  • trunk/Source/WebCore/platform/ScrollView.h

    r89753 r90517  
    146146    IntRect actualVisibleContentRect() const { return m_actualVisibleContentRect.isEmpty() ? visibleContentRect() : m_actualVisibleContentRect; }
    147147    void setActualVisibleContentRect(const IntRect& actualVisibleContentRect) { m_actualVisibleContentRect = actualVisibleContentRect; }
    148     int visibleWidth() const { return visibleContentRect().width(); }
    149     int visibleHeight() const { return visibleContentRect().height(); }
     148    LayoutUnit visibleWidth() const { return visibleContentRect().width(); }
     149    LayoutUnit visibleHeight() const { return visibleContentRect().height(); }
    150150
    151151    // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r90152 r90517  
    2727#define ScrollableArea_h
    2828
    29 #include "IntRect.h"
     29#include "LayoutTypes.h"
    3030#include "Scrollbar.h"
    3131#include <wtf/Vector.h>
     
    123123    virtual IntPoint maximumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
    124124    virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const { ASSERT_NOT_REACHED(); return IntRect(); }
    125     virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
    126     virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
     125    virtual LayoutUnit visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
     126    virtual LayoutUnit visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
    127127    virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); }
    128128    virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); }
  • trunk/Source/WebCore/platform/graphics/FloatPoint.h

    r90167 r90517  
    9797        m_y += a.height();
    9898    }
     99    void move(const FloatSize& a)
     100    {
     101        m_x += a.width();
     102        m_y += a.height();
     103    }
    99104    void moveBy(const IntPoint& a)
     105    {
     106        m_x += a.x();
     107        m_y += a.y();
     108    }
     109    void moveBy(const FloatPoint& a)
    100110    {
    101111        m_x += a.x();
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r90302 r90517  
    253253        maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
    254254        // 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)));
     255        maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
     256        maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
    257257    }
    258258
     
    265265    Length tableLogicalWidth = m_table->style()->logicalWidth();
    266266    if (tableLogicalWidth.isFixed() && tableLogicalWidth.value() > 0) {
    267         minWidth = max(minWidth, tableLogicalWidth.value());
     267        minWidth = max<LayoutUnit>(minWidth, tableLogicalWidth.value());
    268268        maxWidth = minWidth;
    269269    } else if (!remainingPercent && maxNonPercent) {
     
    552552                    // the lines below might look inconsistent, but that's the way it's handled in mozilla
    553553                    excess -= reduction;
    554                     LayoutUnit newLogicalWidth = max(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
     554                    LayoutUnit newLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
    555555                    available += cellLogicalWidth - newLogicalWidth;
    556556                    m_layoutStruct[i].computedLogicalWidth = newLogicalWidth;
     
    590590            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
    591591            if (logicalWidth.isAuto() && totalAuto && !m_layoutStruct[i].emptyCellsOnly) {
    592                 LayoutUnit cellLogicalWidth = max(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
     592                LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
    593593                available -= cellLogicalWidth;
    594594                totalAuto -= m_layoutStruct[i].effectiveMaxLogicalWidth;
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r90515 r90517  
    197197    // For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right
    198198    // respectively are flipped when compared to their physical counterparts.  For example minX is on the left in vertical-lr, but it is on the right in vertical-rl.
    199     IntRect layoutOverflowRect(int lineTop, int lineBottom) const
     199    LayoutRect layoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
    200200    {
    201201        return m_overflow ? m_overflow->layoutOverflowRect() : enclosingIntRect(frameRectIncludingLineHeight(lineTop, lineBottom));
    202202    }
    203     int logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : logicalLeft(); }
    204     int logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : ceilf(logicalRight()); }
    205     int logicalTopLayoutOverflow(int lineTop) const
     203    LayoutUnit logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : logicalLeft(); }
     204    LayoutUnit logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : ceilf(logicalRight()); }
     205    LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const
    206206    {
    207207        if (m_overflow)
     
    209209        return lineTop;
    210210    }
    211     int logicalBottomLayoutOverflow(int lineBottom) const
     211    LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const
    212212    {
    213213        if (m_overflow)
     
    215215        return lineBottom;
    216216    }
    217     IntRect logicalLayoutOverflowRect(int lineTop, int lineBottom) const
    218     {
    219         IntRect result = layoutOverflowRect(lineTop, lineBottom);
     217    LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
     218    {
     219        LayoutRect result = layoutOverflowRect(lineTop, lineBottom);
    220220        if (!renderer()->isHorizontalWritingMode())
    221221            result = result.transposedRect();
     
    223223    }
    224224
    225     IntRect visualOverflowRect(int lineTop, int lineBottom) const
     225    LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
    226226    {
    227227        return m_overflow ? m_overflow->visualOverflowRect() : enclosingIntRect(frameRectIncludingLineHeight(lineTop, lineBottom));
    228228    }
    229     int logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : logicalLeft(); }
    230     int logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : ceilf(logicalRight()); }
    231     int logicalTopVisualOverflow(int lineTop) const
     229    LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : logicalLeft(); }
     230    LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : ceilf(logicalRight()); }
     231    LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
    232232    {
    233233        if (m_overflow)
     
    235235        return lineTop;
    236236    }
    237     int logicalBottomVisualOverflow(int lineBottom) const
     237    LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const
    238238    {
    239239        if (m_overflow)
     
    241241        return lineBottom;
    242242    }
    243     IntRect logicalVisualOverflowRect(int lineTop, int lineBottom) const
    244     {
    245         IntRect result = visualOverflowRect(lineTop, lineBottom);
     243    LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
     244    {
     245        LayoutRect result = visualOverflowRect(lineTop, lineBottom);
    246246        if (!renderer()->isHorizontalWritingMode())
    247247            result = result.transposedRect();
     
    249249    }
    250250
    251     void setOverflowFromLogicalRects(const IntRect& logicalLayoutOverflow, const IntRect& logicalVisualOverflow, int lineTop, int lineBottom);
    252     void setLayoutOverflow(const IntRect&, int lineTop, int lineBottom);
    253     void setVisualOverflow(const IntRect&, int lineTop, int lineBottom);
    254 
    255     FloatRect frameRectIncludingLineHeight(int lineTop, int lineBottom) const
     251    void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, const IntRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom);
     252    void setLayoutOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lineBottom);
     253    void setVisualOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lineBottom);
     254
     255    FloatRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBottom) const
    256256    {
    257257        if (isHorizontal())
     
    260260    }
    261261   
    262     FloatRect logicalFrameRectIncludingLineHeight(int lineTop, int lineBottom) const
     262    FloatRect logicalFrameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBottom) const
    263263    {
    264264        return FloatRect(logicalLeft(), lineTop, logicalWidth(), lineBottom - lineTop);
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r90515 r90517  
    807807        static int positiveMarginBeforeDefault(const RenderBlock* block)
    808808        {
    809             return std::max(block->marginBefore(), 0);
     809            return std::max<LayoutUnit>(block->marginBefore(), 0);
    810810        }
    811811       
    812812        static int negativeMarginBeforeDefault(const RenderBlock* block)
    813813        {
    814             return std::max(-block->marginBefore(), 0);
     814            return std::max<LayoutUnit>(-block->marginBefore(), 0);
    815815        }
    816816        static int positiveMarginAfterDefault(const RenderBlock* block)
    817817        {
    818             return std::max(block->marginAfter(), 0);
     818            return std::max<LayoutUnit>(block->marginAfter(), 0);
    819819        }
    820820        static int negativeMarginAfterDefault(const RenderBlock* block)
    821821        {
    822             return std::max(-block->marginAfter(), 0);
     822            return std::max<LayoutUnit>(-block->marginAfter(), 0);
    823823        }
    824824       
Note: See TracChangeset for help on using the changeset viewer.