| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 CSSParserValue* value = tokens->valueAt(index); | 637 CSSParserValue* value = tokens->valueAt(index); |
| 638 if (value->unit != CSSParserValue::Operator) | 638 if (value->unit != CSSParserValue::Operator) |
| 639 return 0; | 639 return 0; |
| 640 | 640 |
| 641 return value->iValue; | 641 return value->iValue; |
| 642 } | 642 } |
| 643 | 643 |
| 644 bool parseValue(CSSParserValueList* tokens, unsigned* index, Value* result) | 644 bool parseValue(CSSParserValueList* tokens, unsigned* index, Value* result) |
| 645 { | 645 { |
| 646 CSSParserValue* parserValue = tokens->valueAt(*index); | 646 CSSParserValue* parserValue = tokens->valueAt(*index); |
| 647 if (parserValue->unit == CSSParserValue::Operator) | 647 if (parserValue->unit >= CSSParserValue::Operator) |
| 648 return false; | 648 return false; |
| 649 | 649 |
| 650 RefPtrWillBeRawPtr<CSSValue> value = parserValue->createCSSValue(); | 650 CSSPrimitiveValue::UnitType type = static_cast<CSSPrimitiveValue::UnitTy
pe>(parserValue->unit); |
| 651 if (!value || !value->isPrimitiveValue()) | 651 if (unitCategory(type) == CalcOther) |
| 652 return false; | 652 return false; |
| 653 | 653 |
| 654 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 654 if (type == CSSPrimitiveValue::CSS_NUMBER && parserValue->isInt) |
| 655 if (unitCategory(primitiveValue->primitiveType()) == CalcOther) | 655 type = CSSPrimitiveValue::CSS_PARSER_INTEGER; |
| 656 return false; | |
| 657 | 656 |
| 658 result->value = CSSCalcPrimitiveValue::create(primitiveValue, parserValu
e->isInt); | 657 result->value = CSSCalcPrimitiveValue::create( |
| 658 CSSPrimitiveValue::create(parserValue->fValue, type), parserValue->i
sInt); |
| 659 | 659 |
| 660 ++*index; | 660 ++*index; |
| 661 return true; | 661 return true; |
| 662 } | 662 } |
| 663 | 663 |
| 664 bool parseValueTerm(CSSParserValueList* tokens, int depth, unsigned* index,
Value* result) | 664 bool parseValueTerm(CSSParserValueList* tokens, int depth, unsigned* index,
Value* result) |
| 665 { | 665 { |
| 666 if (checkDepthAndIndex(&depth, *index, tokens) != OK) | 666 if (checkDepthAndIndex(&depth, *index, tokens) != OK) |
| 667 return false; | 667 return false; |
| 668 | 668 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 return adoptRefWillBeNoop(new CSSCalcValue(expression, range)); | 775 return adoptRefWillBeNoop(new CSSCalcValue(expression, range)); |
| 776 } | 776 } |
| 777 | 777 |
| 778 void CSSCalcValue::traceAfterDispatch(Visitor* visitor) | 778 void CSSCalcValue::traceAfterDispatch(Visitor* visitor) |
| 779 { | 779 { |
| 780 visitor->trace(m_expression); | 780 visitor->trace(m_expression); |
| 781 CSSValue::traceAfterDispatch(visitor); | 781 CSSValue::traceAfterDispatch(visitor); |
| 782 } | 782 } |
| 783 | 783 |
| 784 } // namespace blink | 784 } // namespace blink |
| OLD | NEW |