Get rid of unnecessary reimplementations of CGFloor/Ceiling
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jan 2015 00:25:45 +0000 (00:25 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jan 2015 00:25:45 +0000 (00:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140375

Reviewed by Simon Fraser.

* platform/mac/DragImageMac.mm:
(WebCore::widthWithFont):
(WebCore::drawAtPoint):
(WebCore::webkit_CGCeiling): Deleted.
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController windowDidLoad]):
(webkit_CGFloor): Deleted.
Delete unnecessary code, use the real CGFloor/Ceiling instead.

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
(webkit_CGCeiling): Deleted.
Delete unnecessary code, use the real CGFloor/Ceiling instead.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/DragImageMac.mm
Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebKitNSStringExtras.mm

index 68c0d96..4e1f03e 100644 (file)
@@ -1,5 +1,21 @@
 2015-01-12  Timothy Horton  <timothy_horton@apple.com>
 
+        Get rid of unnecessary reimplementations of CGFloor/Ceiling
+        https://bugs.webkit.org/show_bug.cgi?id=140375
+
+        Reviewed by Simon Fraser.
+
+        * platform/mac/DragImageMac.mm:
+        (WebCore::widthWithFont):
+        (WebCore::drawAtPoint):
+        (WebCore::webkit_CGCeiling): Deleted.
+        * platform/mac/WebVideoFullscreenHUDWindowController.mm:
+        (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
+        (webkit_CGFloor): Deleted.
+        Delete unnecessary code, use the real CGFloor/Ceiling instead.
+
+2015-01-12  Timothy Horton  <timothy_horton@apple.com>
+
         REGRESSION (r177656): Text in find-in-page yellow bouncy rectangle is not crisp
         https://bugs.webkit.org/show_bug.cgi?id=140373
         <rdar://problem/19447156>
index 85dfe89..90843b1 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(DRAG_SUPPORT)
 #import "BitmapImage.h"
+#import "CoreGraphicsSPI.h"
 #import "Font.h"
 #import "FontDescription.h"
 #import "FontSelector.h"
@@ -199,13 +200,6 @@ static float widthWithFont(NSString *string, NSFont *font)
     
     return [string sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]].width;
 }
-
-static inline CGFloat webkit_CGCeiling(CGFloat value)
-{
-    if (sizeof(value) == sizeof(float))
-        return ceilf(value);
-    return static_cast<CGFloat>(ceil(value));
-}
     
 static void drawAtPoint(NSString *string, NSPoint point, NSFont *font, NSColor *textColor)
 {
@@ -219,7 +213,7 @@ static void drawAtPoint(NSString *string, NSPoint point, NSFont *font, NSColor *
         // It's probably incorrect for high DPI.
         // If you change this, be sure to test all the text drawn this way in Safari, including
         // the status bar, bookmarks bar, tab bar, and activity window.
-        point.y = webkit_CGCeiling(point.y);
+        point.y = CGCeiling(point.y);
         
         NSGraphicsContext *nsContext = [NSGraphicsContext currentContext];
         CGContextRef cgContext = static_cast<CGContextRef>([nsContext graphicsPort]);
index c79af42..a9c6351 100644 (file)
 
 #import "ExceptionCodePlaceholder.h"
 #import "FloatConversion.h"
+#import <WebCore/CoreGraphicsSPI.h>
 #import <WebCore/HTMLVideoElement.h>
 #import <WebCoreSystemInterface.h>
 #import <wtf/RetainPtr.h>
 
 using namespace WebCore;
 
-static inline CGFloat webkit_CGFloor(CGFloat value)
-{
-    if (sizeof(value) == sizeof(float))
-        return floorf(value);
-    return floor(value);
-}
-
 @interface WebVideoFullscreenHUDWindowController (Private) <NSWindowDelegate>
 
 - (void)updateTime;
@@ -330,7 +324,7 @@ static NSTextField *createTimeTextField(NSRect frame)
 
     NSView *contentView = [window contentView];
 
-    CGFloat center = webkit_CGFloor((windowWidth - playButtonWidth) / 2);
+    CGFloat center = CGFloor((windowWidth - playButtonWidth) / 2);
     _playButton = (NSButton *)createControlWithMediaUIControlType(wkMediaUIControlPlayPauseButton, NSMakeRect(center, windowHeight - playButtonTopMargin - playButtonHeight, playButtonWidth, playButtonHeight));
     ASSERT([_playButton isKindOfClass:[NSButton class]]);
     [_playButton setTarget:self];
@@ -353,7 +347,7 @@ static NSTextField *createTimeTextField(NSRect frame)
     [volumeDownButton release];
 
     left += volumeButtonWidth;
-    _volumeSlider = createControlWithMediaUIControlType(wkMediaUIControlSlider, NSMakeRect(left, volumeControlsBottom + webkit_CGFloor((volumeButtonHeight - volumeSliderHeight) / 2), volumeSliderWidth, volumeSliderHeight));
+    _volumeSlider = createControlWithMediaUIControlType(wkMediaUIControlSlider, NSMakeRect(left, volumeControlsBottom + CGFloor((volumeButtonHeight - volumeSliderHeight) / 2), volumeSliderWidth, volumeSliderHeight));
     [_volumeSlider setValue:[NSNumber numberWithDouble:[self maxVolume]] forKey:@"maxValue"];
     [_volumeSlider setTarget:self];
     [_volumeSlider setAction:@selector(volumeChanged:)];
@@ -370,7 +364,7 @@ static NSTextField *createTimeTextField(NSRect frame)
 
     [_timeline setTarget:self];
     [_timeline setAction:@selector(timelinePositionChanged:)];
-    [_timeline setFrame:NSMakeRect(webkit_CGFloor((windowWidth - timelineWidth) / 2), timelineBottomMargin, timelineWidth, timelineHeight)];
+    [_timeline setFrame:NSMakeRect(CGFloor((windowWidth - timelineWidth) / 2), timelineBottomMargin, timelineWidth, timelineHeight)];
     [contentView addSubview:_timeline];
 
     _elapsedTimeText = createTimeTextField(NSMakeRect(timeTextFieldHorizontalMargin, timelineBottomMargin, timeTextFieldWidth, timeTextFieldHeight));
index 1579a44..60c0407 100644 (file)
@@ -1,3 +1,15 @@
+2015-01-12  Timothy Horton  <timothy_horton@apple.com>
+
+        Get rid of unnecessary reimplementations of CGFloor/Ceiling
+        https://bugs.webkit.org/show_bug.cgi?id=140375
+
+        Reviewed by Simon Fraser.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
+        (webkit_CGCeiling): Deleted.
+        Delete unnecessary code, use the real CGFloor/Ceiling instead.
+
 2015-01-12  Anders Carlsson  <andersca@apple.com>
 
         Make delegates conform to formal delegate protocols
index d748dae..7000ae5 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "WebKitNSStringExtras.h"
 
+#import <WebCore/CoreGraphicsSPI.h>
 #import <WebCore/Font.h>
 #import <WebCore/GraphicsContext.h>
 #import <WebCore/TextRun.h>
 
 NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
 
-#if !PLATFORM(IOS)
-static inline CGFloat webkit_CGCeiling(CGFloat value)
-{
-    if (sizeof(value) == sizeof(float))
-        return ceilf(value);
-    return ceil(value);
-}
-#endif
-
 using namespace WebCore;
 
 @implementation NSString (WebKitExtras)
@@ -89,7 +81,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
         // It's probably incorrect for high DPI.
         // If you change this, be sure to test all the text drawn this way in Safari, including
         // the status bar, bookmarks bar, tab bar, and activity window.
-        point.y = webkit_CGCeiling(point.y);
+        point.y = CGCeiling(point.y);
 
         NSGraphicsContext *nsContext = [NSGraphicsContext currentContext];
         CGContextRef cgContext = static_cast<CGContextRef>([nsContext graphicsPort]);