Subpixel layout: Rename FloatPoint/FloatRect device pixel snapping functions.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Aug 2014 03:33:02 +0000 (03:33 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Aug 2014 03:33:02 +0000 (03:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136314

Reviewed by Simon Fraser.

From *edToDevicePixels() to *PointToDevicePixels() (* = floor/round/ceil)

EnclosedIntRect -> enclosingIntRect() changes functionality for InspectorOverlay painting,
but currently untestable.

Source/WebCore:

* WebCore.exp.in:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::showPaintRect):
* platform/graphics/FloatPoint.h:
(WebCore::flooredIntSize):
(WebCore::floorPointToDevicePixels):
(WebCore::ceilPointToDevicePixels):
(WebCore::flooredToDevicePixels): Deleted.
(WebCore::ceiledToDevicePixels): Deleted.
* platform/graphics/FloatRect.cpp:
(WebCore::enclosingRectToDevicePixels):
(WebCore::enclosingRectExtendedToDevicePixels): Deleted. Renamed.
(WebCore::enclosedIntRect): Deleted. Not needed.
* platform/graphics/FloatRect.h:

Source/WebKit2:

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateTapHighlight]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173045 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/platform/graphics/FloatPoint.h
Source/WebCore/platform/graphics/FloatRect.cpp
Source/WebCore/platform/graphics/FloatRect.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index 84e661c..3db91f6 100644 (file)
@@ -1,5 +1,32 @@
 2014-08-27  Zalan Bujtas  <zalan@apple.com>
 
+        Subpixel layout: Rename FloatPoint/FloatRect device pixel snapping functions.
+        https://bugs.webkit.org/show_bug.cgi?id=136314
+
+        Reviewed by Simon Fraser.
+
+        From *edToDevicePixels() to *PointToDevicePixels() (* = floor/round/ceil)
+
+        EnclosedIntRect -> enclosingIntRect() changes functionality for InspectorOverlay painting,
+        but currently untestable.
+
+        * WebCore.exp.in:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::showPaintRect):
+        * platform/graphics/FloatPoint.h:
+        (WebCore::flooredIntSize):
+        (WebCore::floorPointToDevicePixels):
+        (WebCore::ceilPointToDevicePixels):
+        (WebCore::flooredToDevicePixels): Deleted.
+        (WebCore::ceiledToDevicePixels): Deleted.
+        * platform/graphics/FloatRect.cpp:
+        (WebCore::enclosingRectToDevicePixels):
+        (WebCore::enclosingRectExtendedToDevicePixels): Deleted. Renamed.
+        (WebCore::enclosedIntRect): Deleted. Not needed.
+        * platform/graphics/FloatRect.h:
+
+2014-08-27  Zalan Bujtas  <zalan@apple.com>
+
         Subpixel layout: Rename LayoutPoint's device pixel snapping functions.
         https://bugs.webkit.org/show_bug.cgi?id=136306
 
index 916b9db..8639194 100644 (file)
@@ -2686,7 +2686,7 @@ __ZN7WebCore31applicationIsDaijisenDictionaryEv
 __ZN7WebCore31applicationIsMicrosoftMessengerEv
 __ZN7WebCore31enableURLSchemeCanonicalizationEb
 __ZN7WebCore33applicationIsTheEconomistOnIPhoneEv
-__ZN7WebCore35enclosingRectExtendedToDevicePixelsERKNS_9FloatRectEf
+__ZN7WebCore35encloseRectToDevicePixelsERKNS_9FloatRectEf
 __ZN7WebCore35isEndOfEditableOrNonEditableContentERKNS_15VisiblePositionE
 __ZN7WebCore35positionOfNextBoundaryOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
 __ZN7WebCore41initializeHTTPConnectionSettingsOnStartupEv
index d6ba1d1..dcd3819 100644 (file)
@@ -489,7 +489,7 @@ void InspectorOverlay::showPaintRect(const FloatRect& rect)
     if (!m_showingPaintRects)
         return;
 
-    IntRect rootRect = m_page.mainFrame().view()->contentsToRootView(enclosedIntRect(rect));
+    IntRect rootRect = m_page.mainFrame().view()->contentsToRootView(enclosingIntRect(rect));
 
     const std::chrono::milliseconds removeDelay = std::chrono::milliseconds(250);
 
index ce62db1..15c831e 100644 (file)
@@ -210,6 +210,11 @@ inline float operator*(const FloatPoint& a, const FloatPoint& b)
     return a.dot(b);
 }
 
+inline IntSize flooredIntSize(const FloatPoint& p)
+{
+    return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
+}
+
 inline IntPoint roundedIntPoint(const FloatPoint& p)
 {
     return IntPoint(clampToInteger(roundf(p.x())), clampToInteger(roundf(p.y())));
@@ -220,24 +225,19 @@ inline IntPoint flooredIntPoint(const FloatPoint& p)
     return IntPoint(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
 }
 
-inline FloatPoint flooredToDevicePixels(const FloatPoint& p, float deviceScaleFactor)
-{
-    return FloatPoint(floorf(p.x() * deviceScaleFactor)  / deviceScaleFactor, floorf(p.y() * deviceScaleFactor)  / deviceScaleFactor);
-}
-
 inline IntPoint ceiledIntPoint(const FloatPoint& p)
 {
     return IntPoint(clampToInteger(ceilf(p.x())), clampToInteger(ceilf(p.y())));
 }
 
-inline FloatPoint ceiledToDevicePixels(const FloatPoint& p, float deviceScaleFactor)
+inline FloatPoint floorPointToDevicePixels(const FloatPoint& p, float deviceScaleFactor)
 {
-    return FloatPoint(ceilf(p.x() * deviceScaleFactor)  / deviceScaleFactor, ceilf(p.y() * deviceScaleFactor)  / deviceScaleFactor);
+    return FloatPoint(floorf(p.x() * deviceScaleFactor)  / deviceScaleFactor, floorf(p.y() * deviceScaleFactor)  / deviceScaleFactor);
 }
 
-inline IntSize flooredIntSize(const FloatPoint& p)
+inline FloatPoint ceilPointToDevicePixels(const FloatPoint& p, float deviceScaleFactor)
 {
-    return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
+    return FloatPoint(ceilf(p.x() * deviceScaleFactor)  / deviceScaleFactor, ceilf(p.y() * deviceScaleFactor)  / deviceScaleFactor);
 }
 
 inline FloatSize toFloatSize(const FloatPoint& a)
index 3a0c3e7..42feee2 100644 (file)
@@ -206,10 +206,10 @@ void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const Fl
     setLocationAndSizeFromEdges(left, top, right, bottom);
 }
 
-FloatRect enclosingRectExtendedToDevicePixels(const FloatRect& rect, float deviceScaleFactor)
+FloatRect encloseRectToDevicePixels(const FloatRect& rect, float deviceScaleFactor)
 {
-    FloatPoint location = flooredToDevicePixels(rect.minXMinYCorner(), deviceScaleFactor);
-    FloatPoint maxPoint = ceiledToDevicePixels(rect.maxXMaxYCorner(), deviceScaleFactor);
+    FloatPoint location = floorPointToDevicePixels(rect.minXMinYCorner(), deviceScaleFactor);
+    FloatPoint maxPoint = ceilPointToDevicePixels(rect.maxXMaxYCorner(), deviceScaleFactor);
     return FloatRect(location, maxPoint - location);
 }
 
@@ -221,16 +221,6 @@ IntRect enclosingIntRect(const FloatRect& rect)
     return IntRect(location, maxPoint - location);
 }
 
-IntRect enclosedIntRect(const FloatRect& rect)
-{
-    IntPoint location = ceiledIntPoint(rect.minXMinYCorner());
-    IntPoint maxPoint = flooredIntPoint(rect.maxXMaxYCorner());
-    IntSize size = maxPoint - location;
-    size.clampNegativeToZero();
-
-    return IntRect(location, size);
-}
-
 IntRect roundedIntRect(const FloatRect& rect)
 {
     return IntRect(roundedIntPoint(rect.location()), roundedIntSize(rect.size()));
index cc81bde..28a3598 100644 (file)
@@ -246,12 +246,8 @@ inline bool FloatRect::isInfinite() const
     return *this == infiniteRect();
 }
 
-WEBCORE_EXPORT FloatRect enclosingRectExtendedToDevicePixels(const FloatRect&, float deviceScaleFactor);
+WEBCORE_EXPORT FloatRect encloseRectToDevicePixels(const FloatRect&, float deviceScaleFactor);
 WEBCORE_EXPORT IntRect enclosingIntRect(const FloatRect&);
-
-// Returns a valid IntRect contained within the given FloatRect.
-IntRect enclosedIntRect(const FloatRect&);
-
 WEBCORE_EXPORT IntRect roundedIntRect(const FloatRect&);
 
 }
index b5d1973..81b6ee8 100644 (file)
@@ -1,3 +1,18 @@
+2014-08-27  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel layout: Rename FloatPoint/FloatRect device pixel snapping functions.
+        https://bugs.webkit.org/show_bug.cgi?id=136314
+
+        Reviewed by Simon Fraser.
+
+        From *edToDevicePixels() to *PointToDevicePixels() (* = floor/round/ceil)
+
+        EnclosedIntRect -> enclosingIntRect() changes functionality for InspectorOverlay painting,
+        but currently untestable.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _updateTapHighlight]):
+
 2014-08-27  Tim Horton  <timothy_horton@apple.com>
 
         WebKit2 swipe gesture should report the position of the snapshot to the client
index 93a2f03..e569510 100644 (file)
@@ -577,7 +577,7 @@ static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius)
             FloatRect boundingBox = quad.boundingBox();
             boundingBox.scale(selfScale);
             boundingBox.inflate(minimumTapHighlightRadius);
-            CGRect pixelAlignedRect = static_cast<CGRect>(enclosingRectExtendedToDevicePixels(boundingBox, deviceScaleFactor));
+            CGRect pixelAlignedRect = static_cast<CGRect>(encloseRectToDevicePixels(boundingBox, deviceScaleFactor));
             [rects addObject:[NSValue valueWithCGRect:pixelAlignedRect]];
         } else {
             allHighlightRectsAreRectilinear = false;