Changeset 89292 in webkit


Ignore:
Timestamp:
Jun 20, 2011 2:56:15 PM (13 years ago)
Author:
jer.noble@apple.com
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.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89285 r89292  
     12011-06-20  Jer Noble  <jer.noble@apple.com>
     2
     3        Unreviewed build fix; Fix 32-bit build.
     4
     5        Code recently moved from WebKit -> WebCore does not pass WebCore's more strict compiler warnings.  Use
     6        CGFloat, and float constants wherever possible, and use narrowPrecisionToFloat() where not.
     7
     8        * WebCore.xcodeproj/project.pbxproj: Add '-Wno-undef' flag for WebVideoFullScreenController.mm
     9        * platform/mac/WebVideoFullscreenController.mm:
     10        (constrainFrameToRatioOfFrame): Use CGFloat instead of Double.
     11        (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]): Use float constant.
     12        * platform/mac/WebVideoFullscreenHUDWindowController.mm:
     13        (-[WebVideoFullscreenHUDWindowController updateVolume]): Use float for volume.
     14        (-[WebVideoFullscreenHUDWindowController maxVolume]): Ditto.
     15        (-[WebVideoFullscreenHUDWindowController volumeChanged:]): Ditto.
     16        (-[WebVideoFullscreenHUDWindowController decrementVolume]): Ditto.
     17        (-[WebVideoFullscreenHUDWindowController incrementVolume]): Ditto.
     18        (-[WebVideoFullscreenHUDWindowController volume]): Ditto.
     19        (-[WebVideoFullscreenHUDWindowController setVolume:]): Ditto.
     20        (timeToString): Narrow precision to float when converting to seconds.
     21        * platform/mac/WebWindowAnimation.mm:
     22        (scaledRect): Use CGFloat.
     23        (-[WebWindowScaleAnimation init]): Use float constant.
     24        (-[WebWindowScaleAnimation currentValue]): Ditto.
     25        (-[WebWindowScaleAnimation additionalDurationNeededToReachFinalFrame]): Ditto.
     26        (-[WebWindowFadeAnimation currentAlpha]): Ditto.
     27
    1282011-06-20  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r89271 r89292  
    53405340                CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; };
    53415341                CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; };
    5342                 CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; };
     5342                CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef"; }; };
    53435343                CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203081395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h */; settings = {ATTRIBUTES = (Private, ); }; };
    53445344                CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; };
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm

    r89271 r89292  
    245245{
    246246    // Keep a constrained aspect ratio for the destination window
    247     double originalRatio = frame->size.width / frame->size.height;
    248     double newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
     247    CGFloat originalRatio = frame->size.width / frame->size.height;
     248    CGFloat newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
    249249    if (newRatio > originalRatio) {
    250         double newWidth = originalRatio * frameToConstrain->size.height;
    251         double diff = frameToConstrain->size.width - newWidth;
     250        CGFloat newWidth = originalRatio * frameToConstrain->size.height;
     251        CGFloat diff = frameToConstrain->size.width - newWidth;
    252252        frameToConstrain->size.width = newWidth;
    253253        frameToConstrain->origin.x += diff / 2;
    254254    } else {
    255         double newHeight = frameToConstrain->size.width / originalRatio;
    256         double diff = frameToConstrain->size.height - newHeight;
     255        CGFloat newHeight = frameToConstrain->size.width / originalRatio;
     256        CGFloat diff = frameToConstrain->size.height - newHeight;
    257257        frameToConstrain->size.height = newHeight;
    258258        frameToConstrain->origin.y += diff / 2;
     
    555555    if (NSIsEmptyRect(startRect) || NSIsEmptyRect(endRect)) {
    556556        // Fakely end the subanimation.
    557         [subAnimation setCurrentProgress:1.0];
     557        [subAnimation setCurrentProgress:1];
    558558        // And remove the weak link to the window.
    559559        [subAnimation stopAnimation];
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm

    r89271 r89292  
    2929#import "WebVideoFullscreenHUDWindowController.h"
    3030
     31#import "FloatConversion.h"
    3132#import "WebCoreSystemInterface.h"
    3233#import <JavaScriptCore/RetainPtr.h>
     
    5657
    5758- (void)volumeChanged:(id)sender;
    58 - (double)maxVolume;
    59 - (double)volume;
    60 - (void)setVolume:(double)volume;
     59- (float)maxVolume;
     60- (float)volume;
     61- (void)setVolume:(float)volume;
    6162- (void)decrementVolume;
    6263- (void)incrementVolume;
     
    417418- (void)updateVolume
    418419{
    419     [_volumeSlider setDoubleValue:[self volume]];
     420    [_volumeSlider setFloatValue:[self volume]];
    420421}
    421422
     
    472473}
    473474
    474 - (double)maxVolume
     475- (float)maxVolume
    475476{
    476477    // Set the volume slider resolution
     
    481482{
    482483    UNUSED_PARAM(sender);
    483     [self setVolume:[_volumeSlider doubleValue]];
     484    [self setVolume:[_volumeSlider floatValue]];
    484485}
    485486
     
    501502        return;
    502503
    503     double volume = [self volume] - 10;
    504     [self setVolume:max(volume, 0.)];
     504    float volume = [self volume] - 10;
     505    [self setVolume:MAX(volume, 0)];
    505506}
    506507
     
    510511        return;
    511512
    512     double volume = [self volume] + 10;
     513    float volume = [self volume] + 10;
    513514    [self setVolume:min(volume, [self maxVolume])];
    514515}
    515516
    516 - (double)volume
     517- (float)volume
    517518{
    518519    return [_delegate mediaElement] ? [_delegate mediaElement]->volume() * [self maxVolume] : 0;
    519520}
    520521
    521 - (void)setVolume:(double)volume
     522- (void)setVolume:(float)volume
    522523{
    523524    if (![_delegate mediaElement])
     
    584585        time = 0;
    585586
    586     int seconds = fabs(time);
     587    int seconds = narrowPrecisionToFloat(abs(time));
    587588    int hours = seconds / (60 * 60);
    588589    int minutes = (seconds / 60) % 60;
  • trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm

    r89271 r89292  
    2727
    2828#import "WebWindowAnimation.h"
     29
     30#import "FloatConversion.h"
    2931#import "WebCoreSystemInterface.h"
    3032#import <wtf/Assertions.h>
    3133#import <wtf/UnusedParam.h>
    3234
    33 static const CGFloat slowMotionFactor = 10.;
     35using namespace WebCore;
     36
     37static const CGFloat slowMotionFactor = 10;
    3438
    3539static NSTimeInterval WebWindowAnimationDurationFromDuration(NSTimeInterval duration)
     
    3842}
    3943
    40 static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, double factor)
     44static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, CGFloat factor)
    4145{
    4246    NSRect currentRect = _initialFrame;
     
    6367        return nil;
    6468    [self setAnimationBlockingMode:NSAnimationNonblockingThreaded];
    65     [self setFrameRate:60.];
     69    [self setFrameRate:60];
    6670    return self;
    6771}
     
    98102- (float)currentValue
    99103{
    100     return 0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress]));
     104    return narrowPrecisionToFloat(0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress])));
    101105}
    102106
     
    127131- (NSTimeInterval)additionalDurationNeededToReachFinalFrame
    128132{
    129     static const CGFloat maxAdditionalDuration = 1.0;
    130     static const CGFloat speedFactor = 0.0001;
     133    static const CGFloat maxAdditionalDuration = 1;
     134    static const CGFloat speedFactor = 0.0001f;
    131135   
    132136    CGFloat maxDist = squaredDistance(_initialFrame.origin, _finalFrame.origin);
     
    197201- (CGFloat)currentAlpha
    198202{
    199     return MAX(0.0, MIN(1.0, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));
     203    return MAX(0, MIN(1, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));
    200204}
    201205
Note: See TracChangeset for help on using the changeset viewer.