Clamp values in LayoutUnit::operator/ when SATURATED_LAYOUT_ARITHMETIC is enabled
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 19:12:45 +0000 (19:12 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 19:12:45 +0000 (19:12 +0000)
commitbdd60e483d84bf1e9a45fc29782a7f9245462054
tree88d756d6f089450b6778729000d87c60f7faece0
parentc387eb2a9b3dde5806bd8192259dcf93aa91b6ae
Clamp values in LayoutUnit::operator/ when SATURATED_LAYOUT_ARITHMETIC is enabled
https://bugs.webkit.org/show_bug.cgi?id=104955

Reviewed by Julien Chaffraix.

Source/WebCore:

LayoutUnit::operator/ currently does not clamp values and
instead overflows when given a value greater than INT_MAX or
less than INT_MIN.

Test: TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp

* platform/LayoutUnit.h:
(WebCore::operator/):
Clamp value if SATURATED_LAYOUT_ARITHMETIC is enabled.

Tools:

Add tests for LayoutUnit.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/ForwardingHeaders: Added.
* TestWebKitAPI/ForwardingHeaders/WebCore: Added.
* TestWebKitAPI/ForwardingHeaders/WebCore/LayoutUnit.h: Added.
* TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:
* TestWebKitAPI/TestWebKitAPI.gypi:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp: Added.
(TestWebKitAPI):
(TestWebKitAPI::TEST):
* TestWebKitAPI/win/TestWebKitAPI.vcproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/LayoutUnit.h
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt
Tools/TestWebKitAPI/ForwardingHeaders/WebCore/LayoutUnit.h [new file with mode: 0644]
Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp
Tools/TestWebKitAPI/TestWebKitAPI.gypi
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj