CSS3 calc: embed calc expressions in CSSPrimitiveValue
authormikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Feb 2012 09:46:48 +0000 (09:46 +0000)
committermikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Feb 2012 09:46:48 +0000 (09:46 +0000)
commit01d3ebe42f6dbf9fe5cbcb18af1dc4d06fc61814
treea29e917247d6e1f7e7ab79b016b1c69d92e0ab88
parenta8e52eff171ff3f6220a057a7c7b43d2d089248c
CSS3 calc: embed calc expressions in CSSPrimitiveValue
https://bugs.webkit.org/show_bug.cgi?id=78446

Source/WebCore:

Reviewed by Ojan Vafai.

Adds calc expressions to CSSPrimitiveValue. This enables simple (ie no mixing of
percents with numbers/lengths) expressions to be evaluated on most properties.

Tests: css3/calc/block-mask-overlay-image-outset-expected.html
       css3/calc/css3-radial-gradients-expected.html
       css3/calc/gradient-color-stops-expected.html

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::computeLengthPx):
(WebCore):
(WebCore::CSSCalcPrimitiveValue::doubleValue):
(CSSCalcPrimitiveValue):
(WebCore::CSSCalcPrimitiveValue::computeLengthPx):
(CSSCalcBinaryOperation):
(WebCore::CSSCalcBinaryOperation::computeLengthPx):
* css/CSSCalculationValue.h:
(CSSCalcExpressionNode):
(CSSCalcValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::createPrimitiveNumericValue):
(WebCore::CSSParser::parseValidPrimitive):
* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::CSSPrimitiveValue::primitiveType):
(WebCore::CSSPrimitiveValue::init):
(WebCore):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::computeLengthDouble):
(WebCore::CSSPrimitiveValue::getDoubleValue):
(WebCore::CSSPrimitiveValue::getDoubleValueInternal):
(WebCore::CSSPrimitiveValue::customCssText):
* css/CSSPrimitiveValue.h:
(WebCore):
(WebCore::CSSPrimitiveValue::isLength):
(WebCore::CSSPrimitiveValue::isNumber):
(WebCore::CSSPrimitiveValue::isPercentage):
(WebCore::CSSPrimitiveValue::isPx):
(WebCore::CSSPrimitiveValue::isCalculated):
(WebCore::CSSPrimitiveValue::isCalculatedPercentageNumber):
(WebCore::CSSPrimitiveValue::isCalculatedPercentageLength):
(CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::getValue):
(WebCore::CSSPrimitiveValue::cssCalcValue):
* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyBorderRadius::applyValue):

LayoutTests:

Reviewed by Ojan Vafai.

* css3/calc/block-mask-overlay-image-outset-expected.html: Renamed from LayoutTests/css3/calc/block-mask-overlay-image-outset-expected-mismatch.html.
* css3/calc/border-expected.txt:
* css3/calc/calc-errors-expected.txt:
* css3/calc/css3-radial-gradients-expected.html: Renamed from LayoutTests/css3/calc/css3-radial-gradients-expected-mismatch.html.
* css3/calc/font-expected.txt:
* css3/calc/font-monospace-expected.txt:
* css3/calc/font-size-expected.txt:
* css3/calc/font-size-fractional-expected.txt:
* css3/calc/getComputedStyle-margin-percentage-expected.txt:
* css3/calc/gradient-color-stops-expected.html: Renamed from LayoutTests/css3/calc/gradient-color-stops-expected-mismatch.html.
* css3/calc/line-height-expected.txt:
* css3/calc/margin-expected.txt:
* css3/calc/padding-expected.txt:
* css3/calc/simple-calcs-expected.txt:
* css3/calc/table-border-spacing-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/calc/block-mask-overlay-image-outset-expected.html [moved from LayoutTests/css3/calc/block-mask-overlay-image-outset-expected-mismatch.html with 100% similarity]
LayoutTests/css3/calc/border-expected.txt
LayoutTests/css3/calc/calc-errors-expected.txt
LayoutTests/css3/calc/css3-radial-gradients-expected.html [moved from LayoutTests/css3/calc/css3-radial-gradients-expected-mismatch.html with 100% similarity]
LayoutTests/css3/calc/font-expected.txt
LayoutTests/css3/calc/font-monospace-expected.txt
LayoutTests/css3/calc/font-size-expected.txt
LayoutTests/css3/calc/font-size-fractional-expected.txt
LayoutTests/css3/calc/getComputedStyle-margin-percentage-expected.txt
LayoutTests/css3/calc/gradient-color-stops-expected.html [moved from LayoutTests/css3/calc/gradient-color-stops-expected-mismatch.html with 100% similarity]
LayoutTests/css3/calc/line-height-expected.txt
LayoutTests/css3/calc/margin-expected.txt
LayoutTests/css3/calc/padding-expected.txt
LayoutTests/css3/calc/simple-calcs-expected.txt
LayoutTests/css3/calc/table-border-spacing-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSStyleApplyProperty.cpp