Changeset 139037 in webkit


Ignore:
Timestamp:
Jan 7, 2013 11:46:58 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Use toSize() to convert from Int/FloatPoint to Int/FloatSize
https://bugs.webkit.org/show_bug.cgi?id=105992

Patch by Steve Block <steveblock@chromium.org> on 2013-01-07
Reviewed by Kentaro Hara.

Source/WebCore:

Refactoring only, no change in behavior.

  • html/HTMLAreaElement.cpp:

(WebCore::HTMLAreaElement::computePath):

  • platform/ScrollView.h:

(WebCore::ScrollView::scrollOffset):

  • platform/graphics/FloatPoint.h:

(WebCore::toFloatSize):
Add 'inline FloatSize toFloatSize(const FloatPoint&)' to match IntPoint.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

Source/WebKit/chromium:

  • src/LinkHighlight.cpp:

(WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::minimumScrollOffset):
(WebKit::WebFrameImpl::maximumScrollOffset):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r139036 r139037  
     12013-01-07  Steve Block  <steveblock@chromium.org>
     2
     3        Use toSize() to convert from Int/FloatPoint to Int/FloatSize
     4        https://bugs.webkit.org/show_bug.cgi?id=105992
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Refactoring only, no change in behavior.
     9
     10        * html/HTMLAreaElement.cpp:
     11        (WebCore::HTMLAreaElement::computePath):
     12        * platform/ScrollView.h:
     13        (WebCore::ScrollView::scrollOffset):
     14        * platform/graphics/FloatPoint.h:
     15        (WebCore::toFloatSize):
     16        Add 'inline FloatSize toFloatSize(const FloatPoint&)' to match IntPoint.
     17        * rendering/RenderLayerBacking.cpp:
     18        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     19
    1202013-01-07  Kunihiko Sakamoto  <ksakamoto@chromium.org>
    221
  • trunk/Source/WebCore/html/HTMLAreaElement.cpp

    r135069 r139037  
    116116    }
    117117
    118     p.translate(absPos - FloatPoint());
     118    p.translate(toFloatSize(absPos));
    119119    return p;
    120120}
  • trunk/Source/WebCore/platform/ScrollView.h

    r135029 r139037  
    171171    // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
    172172    virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect().location(); }
    173     IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
     173    IntSize scrollOffset() const { return toSize(visibleContentRect().location()); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
    174174    virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum position we can be scrolled to.
    175175    virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum position we can be scrolled to.
  • trunk/Source/WebCore/platform/graphics/FloatPoint.h

    r138800 r139037  
    264264}
    265265
     266inline FloatSize toFloatSize(const FloatPoint& a)
     267{
     268    return FloatSize(a.x(), a.y());
     269}
     270
    266271float findSlope(const FloatPoint& p1, const FloatPoint& p2, float& c);
    267272
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r139032 r139037  
    636636
    637637    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
    638     m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - IntPoint());
     638    m_graphicsLayer->setOffsetFromRenderer(toSize(localCompositingBounds.location()));
    639639   
    640640    FloatSize oldSize = m_graphicsLayer->size();
     
    655655        clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
    656656        clipLayer->setSize(clippingBox.size());
    657         clipLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
     657        clipLayer->setOffsetFromRenderer(toSize(clippingBox.location()));
    658658    }
    659659   
     
    710710            // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
    711711            foregroundSize = FloatSize(clippingBox.size());
    712             foregroundOffset = clippingBox.location() - IntPoint();
     712            foregroundOffset = toSize(clippingBox.location());
    713713        }
    714714
     
    744744
    745745        IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
    746         m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location());
     746        m_scrollingLayer->setOffsetFromRenderer(-toSize(paddingBox.location()));
    747747
    748748        bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
     
    752752            m_scrollingContentsLayer->setNeedsDisplay();
    753753
    754         IntSize scrollingContentsOffset = paddingBox.location() - IntPoint() - scrollOffset;
     754        IntSize scrollingContentsOffset = toSize(paddingBox.location() - scrollOffset);
    755755        if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
    756756            compositor()->scrollingLayerDidChange(m_owningLayer);
  • trunk/Source/WebKit/chromium/ChangeLog

    r139028 r139037  
     12013-01-07  Steve Block  <steveblock@chromium.org>
     2
     3        Use toSize() to convert from Int/FloatPoint to Int/FloatSize
     4        https://bugs.webkit.org/show_bug.cgi?id=105992
     5
     6        Reviewed by Kentaro Hara.
     7
     8        * src/LinkHighlight.cpp:
     9        (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
     10        * src/WebFrameImpl.cpp:
     11        (WebKit::WebFrameImpl::minimumScrollOffset):
     12        (WebKit::WebFrameImpl::maximumScrollOffset):
     13
    1142013-01-07  Xianzhu Wang  <wangxianzhu@chromium.org>
    215
  • trunk/Source/WebKit/chromium/src/LinkHighlight.cpp

    r137847 r139037  
    215215
    216216    FloatRect boundingRect = newPath.boundingRect();
    217     newPath.translate(FloatPoint() - boundingRect.location());
     217    newPath.translate(-toFloatSize(boundingRect.location()));
    218218
    219219    bool pathHasChanged = !m_path.platformPath() || !(*newPath.platformPath() == *m_path.platformPath());
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r138893 r139037  
    603603    if (!view)
    604604        return WebSize();
    605     return view->minimumScrollPosition() - IntPoint();
     605    return toSize(view->minimumScrollPosition());
    606606}
    607607
     
    611611    if (!view)
    612612        return WebSize();
    613     return view->maximumScrollPosition() - IntPoint();
     613    return toSize(view->maximumScrollPosition());
    614614}
    615615
Note: See TracChangeset for help on using the changeset viewer.