Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Support a rational time class for use by media elements.
https://bugs.webkit.org/show_bug.cgi?id=88787 Source/JavaScriptCore: Re-export WTF::MediaTime from JavaScriptCore. Reviewed by Eric Carlson. * JavaScriptCore.order: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Source/WTF: Reviewed by Eric Carlson. Add a new MediaTime class which implements rational math operations. Add common constructors and assignment operators: * wtf/MediaTime.cpp: Added. (WTF::MediaTime::MediaTime): (WTF::MediaTime::~MediaTime): (WTF::MediaTime::operator=): Add common math operators: * wtf/MediaTime.cpp: (WTF::MediaTime::operator+): (WTF::MediaTime::operator-): (WTF::MediaTime::operator<): (WTF::MediaTime::operator>): (WTF::MediaTime::operator==): (WTF::MediaTime::operator>=): (WTF::MediaTime::operator<=): Add functions to check the MeiaTime time type flags: * wtf/MediaTime.h: (WTF::MediaTime::isValid): (WTF::MediaTime::isInvalid): (WTF::MediaTime::hasBeenRounde): (WTF::MediaTime::isPositiveInfinite): (WTF::MediaTime::isNegativeInfinite): (WTF::MediaTime::isIndefinite): Add constants for commonly used MediaTime values: (WTF::MediaTime::zeroTime): (WTF::MediaTime::invalidTime): (WTF::MediaTime::positiveInfiniteTime): (WTF::MediaTime::negativeInfiniteTime): (WTF::MediaTime::indefiniteTime): Add explicit conversion functions to convert to and from floating point values. * wtf/MediaTime.cpp: (WTF::MediaTime::createWithFloat): (WTF::MediaTime::createWithDouble): (WTF::MediaTime::toFloat): (WTF::MediaTime::toDouble): Add some useful exported functions: * wtf/MediaTime.cpp: (WTF::MediaTime::compare): Master function for the comparison operators above. (WTF::MediaTime::setTimeScale): Rescale the time value to a new time scale. (WTF::abs): Return an absolute value for the current MediaTime. Static utility functions to implement the above: * wtf/MediaTime.cpp: (WTF::greatestCommonDivisor): (WTF::leastCommonMultiple): (WTF::signum): Windows-only implementations of isinf and signbit: * wtf/MediaTime.cpp: (std::isinf): (std::signbit): Add the new class to platform build files: * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: Tools: Add unit tests for the WTF::MediaTime class. Reviewed by Eric Carlson. * TestWebKitAPI/GNUmakefile.am: * TestWebKitAPI/TestWebKitAPI.gypi: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/MediaTime.cpp: Added. * TestWebKitAPI/win/TestWebKitAPI.vcproj: (WTF::operator<<): (TestWebKitAPI): (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/110313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
17 changed files
with
810 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.