| Index: Source/core/css/parser/SizesCalcParser.cpp
|
| diff --git a/Source/core/css/parser/SizesCalcParser.cpp b/Source/core/css/parser/SizesCalcParser.cpp
|
| index f99688bb609de3bfc86a010742aa83edb0604c60..bd846909d4df4a8cd1c1d63e751d1c12fd90ad00 100644
|
| --- a/Source/core/css/parser/SizesCalcParser.cpp
|
| +++ b/Source/core/css/parser/SizesCalcParser.cpp
|
| @@ -10,12 +10,20 @@
|
|
|
| namespace WebCore {
|
|
|
| -bool SizesCalcParser::parse(MediaQueryTokenIterator start, MediaQueryTokenIterator end, PassRefPtr<MediaValues> mediaValues, unsigned& result)
|
| +SizesCalcParser::SizesCalcParser(MediaQueryTokenIterator start, MediaQueryTokenIterator end, PassRefPtr<MediaValues> mediaValues)
|
| + : m_mediaValues(mediaValues)
|
| + , m_viewportDependant(false)
|
| + , m_result(0)
|
| {
|
| - SizesCalcParser parser(mediaValues);
|
| - if (!parser.calcToReversePolishNotation(start, end))
|
| - return false;
|
| - return parser.calculate(result);
|
| + m_isValid = calcToReversePolishNotation(start, end);
|
| + if (m_isValid)
|
| + m_isValid = calculate();
|
| +}
|
| +
|
| +unsigned SizesCalcParser::result()
|
| +{
|
| + ASSERT(m_isValid);
|
| + return m_result;
|
| }
|
|
|
| static bool operatorPriority(UChar cc, bool& highPriority)
|
| @@ -93,6 +101,7 @@ bool SizesCalcParser::calcToReversePolishNotation(MediaQueryTokenIterator start,
|
| appendNumber(*it);
|
| break;
|
| case DimensionToken:
|
| + m_viewportDependant = m_viewportDependant || CSSPrimitiveValue::isViewportPercentageLength(it->unitType());
|
| if (!CSSPrimitiveValue::isLength(it->unitType()) || !appendLength(*it))
|
| return false;
|
| break;
|
| @@ -193,7 +202,7 @@ static bool operateOnStack(Vector<SizesCalcValue>& stack, UChar operation)
|
| return true;
|
| }
|
|
|
| -bool SizesCalcParser::calculate(unsigned& result)
|
| +bool SizesCalcParser::calculate()
|
| {
|
| Vector<SizesCalcValue> stack;
|
| for (Vector<SizesCalcValue>::iterator it = m_valueList.begin(); it != m_valueList.end(); ++it) {
|
| @@ -205,7 +214,7 @@ bool SizesCalcParser::calculate(unsigned& result)
|
| }
|
| }
|
| if (stack.size() == 1 && stack.last().isLength) {
|
| - result = clampTo<unsigned>(stack.last().value);
|
| + m_result = clampTo<unsigned>(stack.last().value);
|
| return true;
|
| }
|
| return false;
|
|
|