| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 return compareCSSValuePtr(m_value, static_cast<const CSSCalcPrimitiveVal
ue&>(other).m_value); | 253 return compareCSSValuePtr(m_value, static_cast<const CSSCalcPrimitiveVal
ue&>(other).m_value); |
| 254 } | 254 } |
| 255 | 255 |
| 256 Type getType() const override { return CssCalcPrimitiveValue; } | 256 Type getType() const override { return CssCalcPrimitiveValue; } |
| 257 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override | 257 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override |
| 258 { | 258 { |
| 259 return m_value->typeWithCalcResolved(); | 259 return m_value->typeWithCalcResolved(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 const CSSCalcExpressionNode* getLHS() const |
| 263 { |
| 264 return nullptr; |
| 265 } |
| 266 |
| 267 const CSSCalcExpressionNode* getRHS() const |
| 268 { |
| 269 return nullptr; |
| 270 } |
| 271 |
| 272 CalcOperator op() const |
| 273 { |
| 274 return CalcAdd; |
| 275 } |
| 262 | 276 |
| 263 DEFINE_INLINE_VIRTUAL_TRACE() | 277 DEFINE_INLINE_VIRTUAL_TRACE() |
| 264 { | 278 { |
| 265 visitor->trace(m_value); | 279 visitor->trace(m_value); |
| 266 CSSCalcExpressionNode::trace(visitor); | 280 CSSCalcExpressionNode::trace(visitor); |
| 267 } | 281 } |
| 268 | 282 |
| 269 private: | 283 private: |
| 270 CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) | 284 CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) |
| 271 : CSSCalcExpressionNode(unitCategory(value->typeWithCalcResolved()), isI
nteger) | 285 : CSSCalcExpressionNode(unitCategory(value->typeWithCalcResolved()), isI
nteger) |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 return false; | 501 return false; |
| 488 | 502 |
| 489 const CSSCalcBinaryOperation& other = static_cast<const CSSCalcBinaryOpe
ration&>(exp); | 503 const CSSCalcBinaryOperation& other = static_cast<const CSSCalcBinaryOpe
ration&>(exp); |
| 490 return compareCSSValuePtr(m_leftSide, other.m_leftSide) | 504 return compareCSSValuePtr(m_leftSide, other.m_leftSide) |
| 491 && compareCSSValuePtr(m_rightSide, other.m_rightSide) | 505 && compareCSSValuePtr(m_rightSide, other.m_rightSide) |
| 492 && m_operator == other.m_operator; | 506 && m_operator == other.m_operator; |
| 493 } | 507 } |
| 494 | 508 |
| 495 Type getType() const override { return CssCalcBinaryOperation; } | 509 Type getType() const override { return CssCalcBinaryOperation; } |
| 496 | 510 |
| 511 const CSSCalcExpressionNode* getLHS() const |
| 512 { |
| 513 return m_leftSide; |
| 514 } |
| 515 |
| 516 const CSSCalcExpressionNode* getRHS() const |
| 517 { |
| 518 return m_rightSide; |
| 519 } |
| 520 |
| 521 CalcOperator op() const |
| 522 { |
| 523 return m_operator; |
| 524 } |
| 525 |
| 497 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override | 526 CSSPrimitiveValue::UnitType typeWithCalcResolved() const override |
| 498 { | 527 { |
| 499 switch (m_category) { | 528 switch (m_category) { |
| 500 case CalcNumber: | 529 case CalcNumber: |
| 501 ASSERT(m_leftSide->category() == CalcNumber && m_rightSide->category
() == CalcNumber); | 530 ASSERT(m_leftSide->category() == CalcNumber && m_rightSide->category
() == CalcNumber); |
| 502 return CSSPrimitiveValue::UnitType::Number; | 531 return CSSPrimitiveValue::UnitType::Number; |
| 503 case CalcLength: | 532 case CalcLength: |
| 504 case CalcPercent: { | 533 case CalcPercent: { |
| 505 if (m_leftSide->category() == CalcNumber) | 534 if (m_leftSide->category() == CalcNumber) |
| 506 return m_rightSide->typeWithCalcResolved(); | 535 return m_rightSide->typeWithCalcResolved(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 | 763 |
| 735 return expression ? new CSSCalcValue(expression, range) : nullptr; | 764 return expression ? new CSSCalcValue(expression, range) : nullptr; |
| 736 } | 765 } |
| 737 | 766 |
| 738 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, ValueRange
range) | 767 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, ValueRange
range) |
| 739 { | 768 { |
| 740 return new CSSCalcValue(expression, range); | 769 return new CSSCalcValue(expression, range); |
| 741 } | 770 } |
| 742 | 771 |
| 743 } // namespace blink | 772 } // namespace blink |
| OLD | NEW |