Changeset 119073 in webkit


Ignore:
Timestamp:
May 31, 2012, 1:28:29 AM (13 years ago)
Author:
yosin@chromium.org
Message:

[Platform] Introduce Decimal class for Number/Range input type.
https://bugs.webkit.org/show_bug.cgi?id=87360

Reviewed by Kent Tamura.

Source/WebCore:

This patch added new class Decimal for decimal arithmatic in two
files: platform/Decimal.cpp and Decimal.h with unit test.

Test: WebKit/chromium/tests/DecimalTest.cpp

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/Decimal.cpp: Added.

(WebCore):
(DecimalPrivate):
(SpecialValueHandler):
(WebCore::DecimalPrivate::SpecialValueHandler::SpecialValueHandler):
(WebCore::DecimalPrivate::SpecialValueHandler::handle):
(WebCore::DecimalPrivate::SpecialValueHandler::value):
(UInt128):
(WebCore::DecimalPrivate::UInt128::UInt128):
(WebCore::DecimalPrivate::UInt128::high):
(WebCore::DecimalPrivate::UInt128::low):
(WebCore::DecimalPrivate::UInt128::multiply):
(WebCore::DecimalPrivate::UInt128::highUInt32):
(WebCore::DecimalPrivate::UInt128::lowUInt32):
(WebCore::DecimalPrivate::UInt128::isZero):
(WebCore::DecimalPrivate::UInt128::makeUInt64):
(WebCore::DecimalPrivate::UInt128::operator/=):
(WebCore::DecimalPrivate::UInt128::multiplyHigh):
(WebCore::DecimalPrivate::countDigits):
(WebCore::DecimalPrivate::scaleDown):
(WebCore::DecimalPrivate::scaleUp):
(WebCore::Decimal::EncodedData::EncodedData):
(WebCore::Decimal::EncodedData::operator==):
(WebCore::Decimal::Decimal):
(WebCore::Decimal::operator=):
(WebCore::Decimal::operator+=):
(WebCore::Decimal::operator-=):
(WebCore::Decimal::operator*=):
(WebCore::Decimal::operator/=):
(WebCore::Decimal::operator-):
(WebCore::Decimal::operator+):
(WebCore::Decimal::operator*):
(WebCore::Decimal::operator/):
(WebCore::Decimal::operator==):
(WebCore::Decimal::operator!=):
(WebCore::Decimal::operator<):
(WebCore::Decimal::operator<=):
(WebCore::Decimal::operator>):
(WebCore::Decimal::operator>=):
(WebCore::Decimal::abs):
(WebCore::Decimal::alignOperands):
(WebCore::Decimal::ceiling):
(WebCore::Decimal::compareTo):
(WebCore::Decimal::floor):
(WebCore::Decimal::fromString):
(WebCore::Decimal::infinity):
(WebCore::Decimal::nan):
(WebCore::Decimal::remainder):
(WebCore::Decimal::round):
(WebCore::Decimal::toString):
(WebCore::Decimal::zero):

  • platform/Decimal.h: Added.

(WebCore):
(DecimalPrivate):
(Decimal):
(EncodedData):
(WebCore::Decimal::EncodedData::operator!=):
(WebCore::Decimal::EncodedData::coefficient):
(WebCore::Decimal::EncodedData::exponent):
(WebCore::Decimal::EncodedData::isFinite):
(WebCore::Decimal::EncodedData::isNaN):
(WebCore::Decimal::EncodedData::isSpecial):
(WebCore::Decimal::EncodedData::isZero):
(WebCore::Decimal::EncodedData::sign):
(WebCore::Decimal::EncodedData::setSign):
(WebCore::Decimal::EncodedData::formatClass):
(WebCore::Decimal::isFinite):
(WebCore::Decimal::isNaN):
(WebCore::Decimal::isNegative):
(WebCore::Decimal::isPositive):
(WebCore::Decimal::isSpecial):
(WebCore::Decimal::isZero):
(WebCore::Decimal::value):
(AlignedOperands):
(WebCore::Decimal::invertSign):
(WebCore::Decimal::exponent):
(WebCore::Decimal::sign):

Source/WebKit/chromium:

This patch added unit test for Decimal class.

  • WebKit.gypi:
  • tests/DecimalTest.cpp: Added.

(WebCore):
(WebCore::operator<<): Output Decimal for unit test debugging
(DecimalStepRange):
(DecimalStepRange::DecimalStepRange):
(DecimalStepRange::clampValue):
(DecimalTest):
(DecimalTest::encode):
(DecimalTest::fromString):
(DecimalTest::stepDown):
(DecimalTest::stepUp):
(TEST_F):

Location:
trunk/Source
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r119067 r119073  
    11101110    platform/CrossThreadCopier.cpp
    11111111    platform/DateComponents.cpp
     1112    platform/Decimal.cpp
    11121113    platform/DragData.cpp
    11131114    platform/DragImage.cpp
  • trunk/Source/WebCore/ChangeLog

    r119070 r119073  
     12012-05-31  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Platform] Introduce Decimal class for Number/Range input type.
     4        https://bugs.webkit.org/show_bug.cgi?id=87360
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch added new class Decimal for decimal arithmatic in two
     9        files: platform/Decimal.cpp and Decimal.h with unit test.
     10
     11        Test: WebKit/chromium/tests/DecimalTest.cpp
     12
     13        * CMakeLists.txt:
     14        * GNUmakefile.list.am:
     15        * Target.pri:
     16        * WebCore.gypi:
     17        * WebCore.vcproj/WebCore.vcproj:
     18        * WebCore.xcodeproj/project.pbxproj:
     19        * platform/Decimal.cpp: Added.
     20        (WebCore):
     21        (DecimalPrivate):
     22        (SpecialValueHandler):
     23        (WebCore::DecimalPrivate::SpecialValueHandler::SpecialValueHandler):
     24        (WebCore::DecimalPrivate::SpecialValueHandler::handle):
     25        (WebCore::DecimalPrivate::SpecialValueHandler::value):
     26        (UInt128):
     27        (WebCore::DecimalPrivate::UInt128::UInt128):
     28        (WebCore::DecimalPrivate::UInt128::high):
     29        (WebCore::DecimalPrivate::UInt128::low):
     30        (WebCore::DecimalPrivate::UInt128::multiply):
     31        (WebCore::DecimalPrivate::UInt128::highUInt32):
     32        (WebCore::DecimalPrivate::UInt128::lowUInt32):
     33        (WebCore::DecimalPrivate::UInt128::isZero):
     34        (WebCore::DecimalPrivate::UInt128::makeUInt64):
     35        (WebCore::DecimalPrivate::UInt128::operator/=):
     36        (WebCore::DecimalPrivate::UInt128::multiplyHigh):
     37        (WebCore::DecimalPrivate::countDigits):
     38        (WebCore::DecimalPrivate::scaleDown):
     39        (WebCore::DecimalPrivate::scaleUp):
     40        (WebCore::Decimal::EncodedData::EncodedData):
     41        (WebCore::Decimal::EncodedData::operator==):
     42        (WebCore::Decimal::Decimal):
     43        (WebCore::Decimal::operator=):
     44        (WebCore::Decimal::operator+=):
     45        (WebCore::Decimal::operator-=):
     46        (WebCore::Decimal::operator*=):
     47        (WebCore::Decimal::operator/=):
     48        (WebCore::Decimal::operator-):
     49        (WebCore::Decimal::operator+):
     50        (WebCore::Decimal::operator*):
     51        (WebCore::Decimal::operator/):
     52        (WebCore::Decimal::operator==):
     53        (WebCore::Decimal::operator!=):
     54        (WebCore::Decimal::operator<):
     55        (WebCore::Decimal::operator<=):
     56        (WebCore::Decimal::operator>):
     57        (WebCore::Decimal::operator>=):
     58        (WebCore::Decimal::abs):
     59        (WebCore::Decimal::alignOperands):
     60        (WebCore::Decimal::ceiling):
     61        (WebCore::Decimal::compareTo):
     62        (WebCore::Decimal::floor):
     63        (WebCore::Decimal::fromString):
     64        (WebCore::Decimal::infinity):
     65        (WebCore::Decimal::nan):
     66        (WebCore::Decimal::remainder):
     67        (WebCore::Decimal::round):
     68        (WebCore::Decimal::toString):
     69        (WebCore::Decimal::zero):
     70        * platform/Decimal.h: Added.
     71        (WebCore):
     72        (DecimalPrivate):
     73        (Decimal):
     74        (EncodedData):
     75        (WebCore::Decimal::EncodedData::operator!=):
     76        (WebCore::Decimal::EncodedData::coefficient):
     77        (WebCore::Decimal::EncodedData::exponent):
     78        (WebCore::Decimal::EncodedData::isFinite):
     79        (WebCore::Decimal::EncodedData::isNaN):
     80        (WebCore::Decimal::EncodedData::isSpecial):
     81        (WebCore::Decimal::EncodedData::isZero):
     82        (WebCore::Decimal::EncodedData::sign):
     83        (WebCore::Decimal::EncodedData::setSign):
     84        (WebCore::Decimal::EncodedData::formatClass):
     85        (WebCore::Decimal::isFinite):
     86        (WebCore::Decimal::isNaN):
     87        (WebCore::Decimal::isNegative):
     88        (WebCore::Decimal::isPositive):
     89        (WebCore::Decimal::isSpecial):
     90        (WebCore::Decimal::isZero):
     91        (WebCore::Decimal::value):
     92        (AlignedOperands):
     93        (WebCore::Decimal::invertSign):
     94        (WebCore::Decimal::exponent):
     95        (WebCore::Decimal::sign):
     96
    1972012-05-31  Kentaro Hara  <haraken@chromium.org>
    298
  • trunk/Source/WebCore/GNUmakefile.list.am

    r119067 r119073  
    31183118        Source/WebCore/platform/DateComponents.cpp \
    31193119        Source/WebCore/platform/DateComponents.h \
     3120        Source/WebCore/platform/Decimal.cpp \
     3121        Source/WebCore/platform/Decimal.h \
    31203122        Source/WebCore/platform/DragData.cpp \
    31213123        Source/WebCore/platform/DragData.h \
  • trunk/Source/WebCore/Target.pri

    r119067 r119073  
    10851085    platform/CrossThreadCopier.cpp \
    10861086    platform/DateComponents.cpp \
     1087    platform/Decimal.cpp \
    10871088    platform/DragData.cpp \
    10881089    platform/DragImage.cpp \
     
    22072208    platform/CrossThreadCopier.h \
    22082209    platform/DateComponents.h \
     2210    platform/Decimal.h \
    22092211    platform/DragData.h \
    22102212    platform/DragImage.h \
  • trunk/Source/WebCore/WebCore.gypi

    r119067 r119073  
    273273            'platform/Cursor.h',
    274274            'platform/DateComponents.h',
     275            'platform/Decimal.h',
    275276            'platform/DragData.h',
    276277            'platform/DragImage.h',
     
    31503151            'platform/Cursor.cpp',
    31513152            'platform/DateComponents.cpp',
     3153            'platform/Decimal.cpp',
    31523154            'platform/DragData.cpp',
    31533155            'platform/DragImage.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r119067 r119073  
    2790027900                        </File>
    2790127901                        <File
     27902                                RelativePath="..\platform\Decimal.cpp"
     27903                                >
     27904                        </File>
     27905                        <File
     27906                                RelativePath="..\platform\Decimal.h"
     27907                                >
     27908                        </File>
     27909                        <File
    2790227910                                RelativePath="..\platform\DragData.cpp"
    2790327911                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r119067 r119073  
    11941194                450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 450CEBEF15073BBE002BB149 /* LabelableElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11951195                45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1196                45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
     1197                45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11961198                4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; };
    11971199                46700ED0127B96CB00F5D5D6 /* FileWriterSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */; };
     
    82048206                450CEBEF15073BBE002BB149 /* LabelableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelableElement.h; sourceTree = "<group>"; };
    82058207                45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
     8208                45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
     8209                45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
    82068210                4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
    82078211                46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileWriterSync.cpp; path = Modules/filesystem/FileWriterSync.cpp; sourceTree = "<group>"; };
     
    2034420348                                A5732B08136A161D005C8D7C /* DateComponents.cpp */,
    2034520349                                A5732B09136A161D005C8D7C /* DateComponents.h */,
     20350                                45FEA5CD156DDE8C00654101 /* Decimal.cpp */,
     20351                                45FEA5CE156DDE8C00654101 /* Decimal.h */,
    2034620352                                A79546420B5C4CB4007B438F /* DragData.cpp */,
    2034720353                                A7B6E69D0B291A9600D0529F /* DragData.h */,
     
    2210322109                                F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */,
    2210422110                                F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */,
     22111                                45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */,
    2210522112                                A8C228A111D5722E00D5A7D3 /* DecodedDataDocumentParser.h in Headers */,
    2210622113                                CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */,
     
    2559925606                                F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */,
    2560025607                                F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */,
     25608                                45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */,
    2560125609                                A8C228A211D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp in Sources */,
    2560225610                                4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */,
  • trunk/Source/WebKit/chromium/ChangeLog

    r119068 r119073  
     12012-05-31  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Platform] Introduce Decimal class for Number/Range input type.
     4        https://bugs.webkit.org/show_bug.cgi?id=87360
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch added unit test for Decimal class.
     9
     10        * WebKit.gypi:
     11        * tests/DecimalTest.cpp: Added.
     12        (WebCore):
     13        (WebCore::operator<<): Output Decimal for unit test debugging
     14        (DecimalStepRange):
     15        (DecimalStepRange::DecimalStepRange):
     16        (DecimalStepRange::clampValue):
     17        (DecimalTest):
     18        (DecimalTest::encode):
     19        (DecimalTest::fromString):
     20        (DecimalTest::stepDown):
     21        (DecimalTest::stepUp):
     22        (TEST_F):
     23
    1242012-05-30  Yury Semikhatsky  <yurys@chromium.org>
    225
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r119067 r119073  
    9696            'tests/CompositorFakeGraphicsContext3D.h',
    9797            'tests/CompositorFakeWebGraphicsContext3D.h',
     98            'tests/DecimalTest.cpp',
    9899            'tests/DragImageTest.cpp',
    99100            'tests/DrawingBufferChromiumTest.cpp',
Note: See TracChangeset for help on using the changeset viewer.