CSS3 calc(): handle non-negative values
authormikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 09:33:28 +0000 (09:33 +0000)
committermikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 09:33:28 +0000 (09:33 +0000)
commit3b7958787e9f892c238146573af4a6250338dbfa
treea8a010421e52e7a56426af6529e979fd6939e392
parent054c37984f6064596831cf73de8e2ce626f8c7da
CSS3 calc(): handle non-negative values
https://bugs.webkit.org/show_bug.cgi?id=79188

Reviewed by Daniel Bates.

Source/WebCore:

Some CSS properties (e.g. padding) are required to be non-negative. These
are now restricted to the correct range.

Tests: css3/calc/negative-padding-expected.html
       css3/calc/negative-padding.html

* css/CSSCalculationValue.cpp:
(WebCore):
(WebCore::CSSCalcValue::clampToPermittedRange): Added
(WebCore::CSSCalcValue::doubleValue):
(WebCore::CSSCalcValue::isNegative): Added
(WebCore::CSSCalcValue::computeLengthPx):
(WebCore::CSSCalcValue::create):
* css/CSSCalculationValue.h:
(CSSCalcValue):
(WebCore::CSSCalcValue::CSSCalcValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::validCalculationUnit):
(WebCore::CSSParser::parseCalculation):
* css/CSSParser.h:
* platform/CalculationValue.h:

LayoutTests:

* css3/calc/negative-padding-expected.html: Added.
* css3/calc/negative-padding.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/css3/calc/negative-padding-expected.html [new file with mode: 0644]
LayoutTests/css3/calc/negative-padding.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/platform/CalculationValue.h