- Revision
- 89292
- Author
- jer.no...@apple.com
- Date
- 2011-06-20 14:56:15 -0700 (Mon, 20 Jun 2011)
Log Message
Unreviewed build fix; Fix 32-bit build.
Code recently moved from WebKit -> WebCore does not pass WebCore's more strict compiler warnings. Use
CGFloat, and float constants wherever possible, and use narrowPrecisionToFloat() where not.
* WebCore.xcodeproj/project.pbxproj: Add '-Wno-undef' flag for WebVideoFullScreenController.mm
* platform/mac/WebVideoFullscreenController.mm:
(constrainFrameToRatioOfFrame): Use CGFloat instead of Double.
(-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]): Use float constant.
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController updateVolume]): Use float for volume.
(-[WebVideoFullscreenHUDWindowController maxVolume]): Ditto.
(-[WebVideoFullscreenHUDWindowController volumeChanged:]): Ditto.
(-[WebVideoFullscreenHUDWindowController decrementVolume]): Ditto.
(-[WebVideoFullscreenHUDWindowController incrementVolume]): Ditto.
(-[WebVideoFullscreenHUDWindowController volume]): Ditto.
(-[WebVideoFullscreenHUDWindowController setVolume:]): Ditto.
(timeToString): Narrow precision to float when converting to seconds.
* platform/mac/WebWindowAnimation.mm:
(scaledRect): Use CGFloat.
(-[WebWindowScaleAnimation init]): Use float constant.
(-[WebWindowScaleAnimation currentValue]): Ditto.
(-[WebWindowScaleAnimation additionalDurationNeededToReachFinalFrame]): Ditto.
(-[WebWindowFadeAnimation currentAlpha]): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (89291 => 89292)
--- trunk/Source/WebCore/ChangeLog 2011-06-20 21:33:52 UTC (rev 89291)
+++ trunk/Source/WebCore/ChangeLog 2011-06-20 21:56:15 UTC (rev 89292)
@@ -1,3 +1,30 @@
+2011-06-20 Jer Noble <jer.no...@apple.com>
+
+ Unreviewed build fix; Fix 32-bit build.
+
+ Code recently moved from WebKit -> WebCore does not pass WebCore's more strict compiler warnings. Use
+ CGFloat, and float constants wherever possible, and use narrowPrecisionToFloat() where not.
+
+ * WebCore.xcodeproj/project.pbxproj: Add '-Wno-undef' flag for WebVideoFullScreenController.mm
+ * platform/mac/WebVideoFullscreenController.mm:
+ (constrainFrameToRatioOfFrame): Use CGFloat instead of Double.
+ (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]): Use float constant.
+ * platform/mac/WebVideoFullscreenHUDWindowController.mm:
+ (-[WebVideoFullscreenHUDWindowController updateVolume]): Use float for volume.
+ (-[WebVideoFullscreenHUDWindowController maxVolume]): Ditto.
+ (-[WebVideoFullscreenHUDWindowController volumeChanged:]): Ditto.
+ (-[WebVideoFullscreenHUDWindowController decrementVolume]): Ditto.
+ (-[WebVideoFullscreenHUDWindowController incrementVolume]): Ditto.
+ (-[WebVideoFullscreenHUDWindowController volume]): Ditto.
+ (-[WebVideoFullscreenHUDWindowController setVolume:]): Ditto.
+ (timeToString): Narrow precision to float when converting to seconds.
+ * platform/mac/WebWindowAnimation.mm:
+ (scaledRect): Use CGFloat.
+ (-[WebWindowScaleAnimation init]): Use float constant.
+ (-[WebWindowScaleAnimation currentValue]): Ditto.
+ (-[WebWindowScaleAnimation additionalDurationNeededToReachFinalFrame]): Ditto.
+ (-[WebWindowFadeAnimation currentAlpha]): Ditto.
+
2011-06-20 Anders Carlsson <ander...@apple.com>
Reviewed by Darin Adler.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (89291 => 89292)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-06-20 21:33:52 UTC (rev 89291)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-06-20 21:56:15 UTC (rev 89292)
@@ -5339,7 +5339,7 @@
CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; };
CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; };
- CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; };
+ CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef"; }; };
CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203081395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h */; settings = {ATTRIBUTES = (Private, ); }; };
CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; };
CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */; };
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm (89291 => 89292)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2011-06-20 21:33:52 UTC (rev 89291)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2011-06-20 21:56:15 UTC (rev 89292)
@@ -244,16 +244,16 @@
static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame)
{
// Keep a constrained aspect ratio for the destination window
- double originalRatio = frame->size.width / frame->size.height;
- double newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
+ CGFloat originalRatio = frame->size.width / frame->size.height;
+ CGFloat newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
if (newRatio > originalRatio) {
- double newWidth = originalRatio * frameToConstrain->size.height;
- double diff = frameToConstrain->size.width - newWidth;
+ CGFloat newWidth = originalRatio * frameToConstrain->size.height;
+ CGFloat diff = frameToConstrain->size.width - newWidth;
frameToConstrain->size.width = newWidth;
frameToConstrain->origin.x += diff / 2;
} else {
- double newHeight = frameToConstrain->size.width / originalRatio;
- double diff = frameToConstrain->size.height - newHeight;
+ CGFloat newHeight = frameToConstrain->size.width / originalRatio;
+ CGFloat diff = frameToConstrain->size.height - newHeight;
frameToConstrain->size.height = newHeight;
frameToConstrain->origin.y += diff / 2;
}
@@ -554,7 +554,7 @@
if (NSIsEmptyRect(startRect) || NSIsEmptyRect(endRect)) {
// Fakely end the subanimation.
- [subAnimation setCurrentProgress:1.0];
+ [subAnimation setCurrentProgress:1];
// And remove the weak link to the window.
[subAnimation stopAnimation];
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm (89291 => 89292)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm 2011-06-20 21:33:52 UTC (rev 89291)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm 2011-06-20 21:56:15 UTC (rev 89292)
@@ -28,6 +28,7 @@
#import "WebVideoFullscreenHUDWindowController.h"
+#import "FloatConversion.h"
#import "WebCoreSystemInterface.h"
#import <_javascript_Core/RetainPtr.h>
#import <_javascript_Core/UnusedParam.h>
@@ -55,9 +56,9 @@
- (double)duration;
- (void)volumeChanged:(id)sender;
-- (double)maxVolume;
-- (double)volume;
-- (void)setVolume:(double)volume;
+- (float)maxVolume;
+- (float)volume;
+- (void)setVolume:(float)volume;
- (void)decrementVolume;
- (void)incrementVolume;
@@ -416,7 +417,7 @@
- (void)updateVolume
{
- [_volumeSlider setDoubleValue:[self volume]];
+ [_volumeSlider setFloatValue:[self volume]];
}
- (void)updateTime
@@ -471,7 +472,7 @@
return [_delegate mediaElement] ? [_delegate mediaElement]->duration() : 0;
}
-- (double)maxVolume
+- (float)maxVolume
{
// Set the volume slider resolution
return 100;
@@ -480,7 +481,7 @@
- (void)volumeChanged:(id)sender
{
UNUSED_PARAM(sender);
- [self setVolume:[_volumeSlider doubleValue]];
+ [self setVolume:[_volumeSlider floatValue]];
}
- (void)setVolumeToZero:(id)sender
@@ -500,8 +501,8 @@
if (![_delegate mediaElement])
return;
- double volume = [self volume] - 10;
- [self setVolume:max(volume, 0.)];
+ float volume = [self volume] - 10;
+ [self setVolume:MAX(volume, 0)];
}
- (void)incrementVolume
@@ -509,16 +510,16 @@
if (![_delegate mediaElement])
return;
- double volume = [self volume] + 10;
+ float volume = [self volume] + 10;
[self setVolume:min(volume, [self maxVolume])];
}
-- (double)volume
+- (float)volume
{
return [_delegate mediaElement] ? [_delegate mediaElement]->volume() * [self maxVolume] : 0;
}
-- (void)setVolume:(double)volume
+- (void)setVolume:(float)volume
{
if (![_delegate mediaElement])
return;
@@ -583,7 +584,7 @@
if (!isfinite(time))
time = 0;
- int seconds = fabs(time);
+ int seconds = narrowPrecisionToFloat(abs(time));
int hours = seconds / (60 * 60);
int minutes = (seconds / 60) % 60;
seconds %= 60;
Modified: trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm (89291 => 89292)
--- trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm 2011-06-20 21:33:52 UTC (rev 89291)
+++ trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm 2011-06-20 21:56:15 UTC (rev 89292)
@@ -26,18 +26,22 @@
#import "config.h"
#import "WebWindowAnimation.h"
+
+#import "FloatConversion.h"
#import "WebCoreSystemInterface.h"
#import <wtf/Assertions.h>
#import <wtf/UnusedParam.h>
-static const CGFloat slowMotionFactor = 10.;
+using namespace WebCore;
+static const CGFloat slowMotionFactor = 10;
+
static NSTimeInterval WebWindowAnimationDurationFromDuration(NSTimeInterval duration)
{
return ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) ? duration * slowMotionFactor : duration;
}
-static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, double factor)
+static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, CGFloat factor)
{
NSRect currentRect = _initialFrame;
currentRect.origin.x += (NSMinX(_finalFrame) - NSMinX(_initialFrame)) * factor;
@@ -62,7 +66,7 @@
if (!self)
return nil;
[self setAnimationBlockingMode:NSAnimationNonblockingThreaded];
- [self setFrameRate:60.];
+ [self setFrameRate:60];
return self;
}
@@ -97,7 +101,7 @@
- (float)currentValue
{
- return 0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress]));
+ return narrowPrecisionToFloat(0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress])));
}
- (NSRect)currentFrame
@@ -126,8 +130,8 @@
- (NSTimeInterval)additionalDurationNeededToReachFinalFrame
{
- static const CGFloat maxAdditionalDuration = 1.0;
- static const CGFloat speedFactor = 0.0001;
+ static const CGFloat maxAdditionalDuration = 1;
+ static const CGFloat speedFactor = 0.0001f;
CGFloat maxDist = squaredDistance(_initialFrame.origin, _finalFrame.origin);
CGFloat dist;
@@ -196,7 +200,7 @@
- (CGFloat)currentAlpha
{
- return MAX(0.0, MIN(1.0, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));
+ return MAX(0, MIN(1, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));
}
- (void)setCurrentProgress:(NSAnimationProgress)progress