Changeset 89292 in webkit
- Timestamp:
- Jun 20, 2011 2:56:15 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89285 r89292 1 2011-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 1 28 2011-06-20 Anders Carlsson <andersca@apple.com> 2 29 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r89271 r89292 5340 5340 CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; }; 5341 5341 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"; }; }; 5343 5343 CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203081395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5344 5344 CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; }; -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
r89271 r89292 245 245 { 246 246 // Keep a constrained aspect ratio for the destination window 247 doubleoriginalRatio = frame->size.width / frame->size.height;248 doublenewRatio = frameToConstrain->size.width / frameToConstrain->size.height;247 CGFloat originalRatio = frame->size.width / frame->size.height; 248 CGFloat newRatio = frameToConstrain->size.width / frameToConstrain->size.height; 249 249 if (newRatio > originalRatio) { 250 doublenewWidth = originalRatio * frameToConstrain->size.height;251 doublediff = frameToConstrain->size.width - newWidth;250 CGFloat newWidth = originalRatio * frameToConstrain->size.height; 251 CGFloat diff = frameToConstrain->size.width - newWidth; 252 252 frameToConstrain->size.width = newWidth; 253 253 frameToConstrain->origin.x += diff / 2; 254 254 } else { 255 doublenewHeight = frameToConstrain->size.width / originalRatio;256 doublediff = frameToConstrain->size.height - newHeight;255 CGFloat newHeight = frameToConstrain->size.width / originalRatio; 256 CGFloat diff = frameToConstrain->size.height - newHeight; 257 257 frameToConstrain->size.height = newHeight; 258 258 frameToConstrain->origin.y += diff / 2; … … 555 555 if (NSIsEmptyRect(startRect) || NSIsEmptyRect(endRect)) { 556 556 // Fakely end the subanimation. 557 [subAnimation setCurrentProgress:1 .0];557 [subAnimation setCurrentProgress:1]; 558 558 // And remove the weak link to the window. 559 559 [subAnimation stopAnimation]; -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm
r89271 r89292 29 29 #import "WebVideoFullscreenHUDWindowController.h" 30 30 31 #import "FloatConversion.h" 31 32 #import "WebCoreSystemInterface.h" 32 33 #import <JavaScriptCore/RetainPtr.h> … … 56 57 57 58 - (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; 61 62 - (void)decrementVolume; 62 63 - (void)incrementVolume; … … 417 418 - (void)updateVolume 418 419 { 419 [_volumeSlider set DoubleValue:[self volume]];420 [_volumeSlider setFloatValue:[self volume]]; 420 421 } 421 422 … … 472 473 } 473 474 474 - ( double)maxVolume475 - (float)maxVolume 475 476 { 476 477 // Set the volume slider resolution … … 481 482 { 482 483 UNUSED_PARAM(sender); 483 [self setVolume:[_volumeSlider doubleValue]];484 [self setVolume:[_volumeSlider floatValue]]; 484 485 } 485 486 … … 501 502 return; 502 503 503 doublevolume = [self volume] - 10;504 [self setVolume: max(volume, 0.)];504 float volume = [self volume] - 10; 505 [self setVolume:MAX(volume, 0)]; 505 506 } 506 507 … … 510 511 return; 511 512 512 doublevolume = [self volume] + 10;513 float volume = [self volume] + 10; 513 514 [self setVolume:min(volume, [self maxVolume])]; 514 515 } 515 516 516 - ( double)volume517 - (float)volume 517 518 { 518 519 return [_delegate mediaElement] ? [_delegate mediaElement]->volume() * [self maxVolume] : 0; 519 520 } 520 521 521 - (void)setVolume:( double)volume522 - (void)setVolume:(float)volume 522 523 { 523 524 if (![_delegate mediaElement]) … … 584 585 time = 0; 585 586 586 int seconds = fabs(time);587 int seconds = narrowPrecisionToFloat(abs(time)); 587 588 int hours = seconds / (60 * 60); 588 589 int minutes = (seconds / 60) % 60; -
trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm
r89271 r89292 27 27 28 28 #import "WebWindowAnimation.h" 29 30 #import "FloatConversion.h" 29 31 #import "WebCoreSystemInterface.h" 30 32 #import <wtf/Assertions.h> 31 33 #import <wtf/UnusedParam.h> 32 34 33 static const CGFloat slowMotionFactor = 10.; 35 using namespace WebCore; 36 37 static const CGFloat slowMotionFactor = 10; 34 38 35 39 static NSTimeInterval WebWindowAnimationDurationFromDuration(NSTimeInterval duration) … … 38 42 } 39 43 40 static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, doublefactor)44 static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, CGFloat factor) 41 45 { 42 46 NSRect currentRect = _initialFrame; … … 63 67 return nil; 64 68 [self setAnimationBlockingMode:NSAnimationNonblockingThreaded]; 65 [self setFrameRate:60 .];69 [self setFrameRate:60]; 66 70 return self; 67 71 } … … 98 102 - (float)currentValue 99 103 { 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]))); 101 105 } 102 106 … … 127 131 - (NSTimeInterval)additionalDurationNeededToReachFinalFrame 128 132 { 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; 131 135 132 136 CGFloat maxDist = squaredDistance(_initialFrame.origin, _finalFrame.origin); … … 197 201 - (CGFloat)currentAlpha 198 202 { 199 return MAX(0 .0, MIN(1.0, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));203 return MAX(0, MIN(1, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha))); 200 204 } 201 205
Note: See TracChangeset
for help on using the changeset viewer.