Title: [139037] trunk/Source
Revision
139037
Author
[email protected]
Date
2013-01-07 23:46:58 -0800 (Mon, 07 Jan 2013)

Log Message

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

Patch by Steve Block <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139036 => 139037)


--- trunk/Source/WebCore/ChangeLog	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebCore/ChangeLog	2013-01-08 07:46:58 UTC (rev 139037)
@@ -1,3 +1,22 @@
+2013-01-07  Steve Block  <[email protected]>
+
+        Use toSize() to convert from Int/FloatPoint to Int/FloatSize
+        https://bugs.webkit.org/show_bug.cgi?id=105992
+
+        Reviewed by Kentaro Hara.
+
+        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):
+
 2013-01-07  Kunihiko Sakamoto  <[email protected]>
 
         INPUT_MULTIPLE_FIELDS_UI: Step-up/-down of month/day field should respect min/max attributes

Modified: trunk/Source/WebCore/html/HTMLAreaElement.cpp (139036 => 139037)


--- trunk/Source/WebCore/html/HTMLAreaElement.cpp	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebCore/html/HTMLAreaElement.cpp	2013-01-08 07:46:58 UTC (rev 139037)
@@ -115,7 +115,7 @@
         p.transform(zoomTransform);
     }
 
-    p.translate(absPos - FloatPoint());
+    p.translate(toFloatSize(absPos));
     return p;
 }
     

Modified: trunk/Source/WebCore/platform/ScrollView.h (139036 => 139037)


--- trunk/Source/WebCore/platform/ScrollView.h	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebCore/platform/ScrollView.h	2013-01-08 07:46:58 UTC (rev 139037)
@@ -170,7 +170,7 @@
 
     // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
     virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect().location(); }
-    IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
+    IntSize scrollOffset() const { return toSize(visibleContentRect().location()); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
     virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum position we can be scrolled to.
     virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum position we can be scrolled to.
     // Adjust the passed in scroll position to keep it between the minimum and maximum positions.

Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.h (139036 => 139037)


--- trunk/Source/WebCore/platform/graphics/FloatPoint.h	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.h	2013-01-08 07:46:58 UTC (rev 139037)
@@ -263,6 +263,11 @@
     return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
 }
 
+inline FloatSize toFloatSize(const FloatPoint& a)
+{
+    return FloatSize(a.x(), a.y());
+}
+
 float findSlope(const FloatPoint& p1, const FloatPoint& p2, float& c);
 
 // Find point where lines through the two pairs of points intersect. Returns false if the lines don't intersect.

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (139036 => 139037)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-01-08 07:46:58 UTC (rev 139037)
@@ -635,7 +635,7 @@
     }
 
     m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
-    m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - IntPoint());
+    m_graphicsLayer->setOffsetFromRenderer(toSize(localCompositingBounds.location()));
     
     FloatSize oldSize = m_graphicsLayer->size();
     FloatSize newSize = relativeCompositingBounds.size();
@@ -654,7 +654,7 @@
         clippingBox = clipBox(toRenderBox(renderer()));
         clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
         clipLayer->setSize(clippingBox.size());
-        clipLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
+        clipLayer->setOffsetFromRenderer(toSize(clippingBox.location()));
     }
     
     if (m_maskLayer) {
@@ -709,7 +709,7 @@
             // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
             // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
             foregroundSize = FloatSize(clippingBox.size());
-            foregroundOffset = clippingBox.location() - IntPoint();
+            foregroundOffset = toSize(clippingBox.location());
         }
 
         m_foregroundLayer->setPosition(foregroundPosition);
@@ -743,7 +743,7 @@
         m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
 
         IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
-        m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location());
+        m_scrollingLayer->setOffsetFromRenderer(-toSize(paddingBox.location()));
 
         bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
 
@@ -751,7 +751,7 @@
         if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
             m_scrollingContentsLayer->setNeedsDisplay();
 
-        IntSize scrollingContentsOffset = paddingBox.location() - IntPoint() - scrollOffset;
+        IntSize scrollingContentsOffset = toSize(paddingBox.location() - scrollOffset);
         if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
             compositor()->scrollingLayerDidChange(m_owningLayer);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (139036 => 139037)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-08 07:46:58 UTC (rev 139037)
@@ -1,3 +1,16 @@
+2013-01-07  Steve Block  <[email protected]>
+
+        Use toSize() to convert from Int/FloatPoint to Int/FloatSize
+        https://bugs.webkit.org/show_bug.cgi?id=105992
+
+        Reviewed by Kentaro Hara.
+
+        * src/LinkHighlight.cpp:
+        (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::minimumScrollOffset):
+        (WebKit::WebFrameImpl::maximumScrollOffset):
+
 2013-01-07  Xianzhu Wang  <[email protected]>
 
         [Chromium] Expose compositedScrollingForFramesEnabled setting in WebKit API

Modified: trunk/Source/WebKit/chromium/src/LinkHighlight.cpp (139036 => 139037)


--- trunk/Source/WebKit/chromium/src/LinkHighlight.cpp	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebKit/chromium/src/LinkHighlight.cpp	2013-01-08 07:46:58 UTC (rev 139037)
@@ -214,7 +214,7 @@
     }
 
     FloatRect boundingRect = newPath.boundingRect();
-    newPath.translate(FloatPoint() - boundingRect.location());
+    newPath.translate(-toFloatSize(boundingRect.location()));
 
     bool pathHasChanged = !m_path.platformPath() || !(*newPath.platformPath() == *m_path.platformPath());
     if (pathHasChanged) {

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (139036 => 139037)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2013-01-08 07:19:15 UTC (rev 139036)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2013-01-08 07:46:58 UTC (rev 139037)
@@ -602,7 +602,7 @@
     FrameView* view = frameView();
     if (!view)
         return WebSize();
-    return view->minimumScrollPosition() - IntPoint();
+    return toSize(view->minimumScrollPosition());
 }
 
 WebSize WebFrameImpl::maximumScrollOffset() const
@@ -610,7 +610,7 @@
     FrameView* view = frameView();
     if (!view)
         return WebSize();
-    return view->maximumScrollPosition() - IntPoint();
+    return toSize(view->maximumScrollPosition());
 }
 
 void WebFrameImpl::setScrollOffset(const WebSize& offset)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to