Changeset 89984 in webkit


Ignore:
Timestamp:
Jun 28, 2011 6:28:51 PM (13 years ago)
Author:
eae@chromium.org
Message:

2011-06-28 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Switch RenderLayer position/size to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63578

Switch location and size methods for RenderLayer over to the new layout unit abstraction.

No new tests, no functionality changes.

  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::resize): (WebCore::RenderLayer::visibleHeight): (WebCore::RenderLayer::visibleWidth): (WebCore::RenderLayer::offsetFromResizeCorner):
  • rendering/RenderLayer.h: (WebCore::RenderLayer::location): (WebCore::RenderLayer::setLocation): (WebCore::RenderLayer::size): (WebCore::RenderLayer::setSize): (WebCore::RenderLayer::rect): (WebCore::RenderLayer::renderBoxLocation): (WebCore::RenderLayer::renderBoxX): (WebCore::RenderLayer::renderBoxY):
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::visibleHeight): (WebCore::RenderListBox::visibleWidth):
  • rendering/RenderListBox.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89983 r89984  
     12011-06-28  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch RenderLayer position/size to to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63578
     7
     8        Switch location and size methods for RenderLayer over to the new layout unit abstraction.
     9       
     10        No new tests, no functionality changes.
     11
     12        * rendering/RenderLayer.cpp:
     13        (WebCore::RenderLayer::resize):
     14        (WebCore::RenderLayer::visibleHeight):
     15        (WebCore::RenderLayer::visibleWidth):
     16        (WebCore::RenderLayer::offsetFromResizeCorner):
     17        * rendering/RenderLayer.h:
     18        (WebCore::RenderLayer::location):
     19        (WebCore::RenderLayer::setLocation):
     20        (WebCore::RenderLayer::size):
     21        (WebCore::RenderLayer::setSize):
     22        (WebCore::RenderLayer::rect):
     23        (WebCore::RenderLayer::renderBoxLocation):
     24        (WebCore::RenderLayer::renderBoxX):
     25        (WebCore::RenderLayer::renderBoxY):
     26        * rendering/RenderListBox.cpp:
     27        (WebCore::RenderListBox::visibleHeight):
     28        (WebCore::RenderListBox::visibleWidth):
     29        * rendering/RenderListBox.h:
     30
    1312011-06-28  Levi Weintraub  <leviw@chromium.org>
    232
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r89474 r89984  
    15561556}
    15571557
    1558 void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset)
     1558void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOffset)
    15591559{
    15601560    // FIXME: This should be possible on generated content but is not right now.
     
    15771577    float zoomFactor = renderer->style()->effectiveZoom();
    15781578
    1579     IntSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));
     1579    LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));
    15801580    newOffset.setWidth(newOffset.width() / zoomFactor);
    15811581    newOffset.setHeight(newOffset.height() / zoomFactor);
    15821582   
    1583     IntSize currentSize = IntSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
    1584     IntSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
     1583    LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
     1584    LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
    15851585    element->setMinimumSizeForResizing(minimumSize);
    15861586   
    1587     IntSize adjustedOldOffset = IntSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
    1588    
    1589     IntSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
     1587    LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
     1588   
     1589    LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
    15901590
    15911591    CSSStyleDeclaration* style = element->style();
     
    16001600            style->setProperty(CSSPropertyMarginRight, String::number(renderer->marginRight() / zoomFactor) + "px", false, ec);
    16011601        }
    1602         int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());
     1602        LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());
    16031603        baseWidth = baseWidth / zoomFactor;
    16041604        style->setProperty(CSSPropertyWidth, String::number(baseWidth + difference.width()) + "px", false, ec);
     
    16111611            style->setProperty(CSSPropertyMarginBottom, String::number(renderer->marginBottom() / zoomFactor) + "px", false, ec);
    16121612        }
    1613         int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());
     1613        LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());
    16141614        baseHeight = baseHeight / zoomFactor;
    16151615        style->setProperty(CSSPropertyHeight, String::number(baseHeight + difference.height()) + "px", false, ec);
     
    18001800}
    18011801
    1802 int RenderLayer::visibleHeight() const
     1802LayoutUnit RenderLayer::visibleHeight() const
    18031803{
    18041804    return m_layerSize.height();
    18051805}
    18061806
    1807 int RenderLayer::visibleWidth() const
     1807LayoutUnit RenderLayer::visibleWidth() const
    18081808{
    18091809    return m_layerSize.width();
     
    20042004}
    20052005
    2006 IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& absolutePoint) const
     2006LayoutSize RenderLayer::offsetFromResizeCorner(const LayoutPoint& absolutePoint) const
    20072007{
    20082008    // Currently the resize corner is always the bottom right corner
    20092009    // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
    2010     IntPoint bottomRight = toPoint(size());
    2011     IntPoint localPoint = absoluteToContents(absolutePoint);
     2010    LayoutPoint bottomRight = toPoint(size());
     2011    LayoutPoint localPoint = absoluteToContents(absolutePoint);
    20122012    return localPoint - bottomRight;
    20132013}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r89316 r89984  
    212212    }
    213213   
    214     const IntPoint& location() const { return m_topLeft; }
    215     void setLocation(int x, int y) { m_topLeft = IntPoint(x, y); }
    216 
    217     const IntSize& size() const { return m_layerSize; }
    218     void setSize(const IntSize& size) { m_layerSize = size; }
    219 
    220     IntRect rect() const { return IntRect(location(), size()); }
     214    const LayoutPoint& location() const { return m_topLeft; }
     215    void setLocation(LayoutUnit x, LayoutUnit y) { m_topLeft = LayoutPoint(x, y); }
     216
     217    const LayoutSize& size() const { return m_layerSize; }
     218    void setSize(const LayoutSize& size) { m_layerSize = size; }
     219
     220    LayoutRect rect() const { return LayoutRect(location(), size()); }
    221221
    222222    int scrollWidth();
     
    262262    bool isPointInResizeControl(const IntPoint& absolutePoint) const;
    263263    bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
    264     IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
     264    LayoutSize offsetFromResizeCorner(const LayoutPoint& absolutePoint) const;
    265265
    266266    void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect& damageRect, bool paintingOverlayControls = false);
     
    273273    void autoscroll();
    274274
    275     void resize(const PlatformMouseEvent&, const IntSize&);
     275    void resize(const PlatformMouseEvent&, const LayoutSize&);
    276276    bool inResizeMode() const { return m_inResizeMode; }
    277277    void setInResizeMode(bool b) { m_inResizeMode = b; }
     
    463463    void setLastChild(RenderLayer* last) { m_last = last; }
    464464
    465     IntPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : IntPoint(); }
    466     int renderBoxX() const { return renderBoxLocation().x(); }
    467     int renderBoxY() const { return renderBoxLocation().y(); }
     465    LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : LayoutPoint(); }
     466    LayoutUnit renderBoxX() const { return renderBoxLocation().x(); }
     467    LayoutUnit renderBoxY() const { return renderBoxLocation().y(); }
    468468
    469469    void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
     
    541541    virtual IntPoint maximumScrollPosition() const;
    542542    virtual IntRect visibleContentRect(bool includeScrollbars) const;
    543     virtual int visibleHeight() const;
    544     virtual int visibleWidth() const;
     543    virtual LayoutUnit visibleHeight() const;
     544    virtual LayoutUnit visibleWidth() const;
    545545    virtual IntSize contentsSize() const;
    546546    virtual IntSize overhangAmount() const;
     
    636636
    637637    // Our (x,y) coordinates are in our parent layer's coordinate space.
    638     IntPoint m_topLeft;
     638    LayoutPoint m_topLeft;
    639639
    640640    // The layer's width/height
    641     IntSize m_layerSize;
     641    LayoutSize m_layerSize;
    642642
    643643    // Our scroll offsets if the view is scrolled.
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r89983 r89984  
    778778}
    779779
    780 int RenderListBox::visibleHeight() const
     780LayoutUnit RenderListBox::visibleHeight() const
    781781{
    782782    return height();
    783783}
    784784
    785 int RenderListBox::visibleWidth() const
     785LayoutUnit RenderListBox::visibleWidth() const
    786786{
    787787    return width();
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r89983 r89984  
    114114    virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); }
    115115    virtual IntSize contentsSize() const;
    116     virtual int visibleHeight() const;
    117     virtual int visibleWidth() const;
     116    virtual LayoutUnit visibleHeight() const;
     117    virtual LayoutUnit visibleWidth() const;
    118118    virtual IntPoint currentMousePosition() const;
    119119    virtual bool shouldSuspendScrollAnimations() const;
Note: See TracChangeset for help on using the changeset viewer.