| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 String SVGIntegerOptionalInteger::valueAsString() const | 70 String SVGIntegerOptionalInteger::valueAsString() const |
| 71 { | 71 { |
| 72 if (m_firstInteger->value() == m_secondInteger->value()) { | 72 if (m_firstInteger->value() == m_secondInteger->value()) { |
| 73 return String::number(m_firstInteger->value()); | 73 return String::number(m_firstInteger->value()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 return String::number(m_firstInteger->value()) + " " + String::number(m_seco
ndInteger->value()); | 76 return String::number(m_firstInteger->value()) + " " + String::number(m_seco
ndInteger->value()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void SVGIntegerOptionalInteger::setValueAsString(const String& value, ExceptionS
tate& exceptionState) | 79 SVGParsingError SVGIntegerOptionalInteger::setValueAsString(const String& value) |
| 80 { | 80 { |
| 81 float x, y; | 81 float x, y; |
| 82 SVGParsingError parseStatus = NoError; |
| 82 if (!parseNumberOptionalNumber(value, x, y)) { | 83 if (!parseNumberOptionalNumber(value, x, y)) { |
| 83 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid."); | 84 parseStatus = ParsingAttributeFailedError; |
| 84 x = y = 0; | 85 x = y = 0; |
| 85 } | 86 } |
| 86 | 87 |
| 87 m_firstInteger->setValue(x); | 88 m_firstInteger->setValue(x); |
| 88 m_secondInteger->setValue(y); | 89 m_secondInteger->setValue(y); |
| 90 return parseStatus; |
| 89 } | 91 } |
| 90 | 92 |
| 91 void SVGIntegerOptionalInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> othe
r, SVGElement*) | 93 void SVGIntegerOptionalInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> othe
r, SVGElement*) |
| 92 { | 94 { |
| 93 RefPtrWillBeRawPtr<SVGIntegerOptionalInteger> otherIntegerOptionalInteger =
toSVGIntegerOptionalInteger(other); | 95 RefPtrWillBeRawPtr<SVGIntegerOptionalInteger> otherIntegerOptionalInteger =
toSVGIntegerOptionalInteger(other); |
| 94 | 96 |
| 95 m_firstInteger->setValue(m_firstInteger->value() + otherIntegerOptionalInteg
er->m_firstInteger->value()); | 97 m_firstInteger->setValue(m_firstInteger->value() + otherIntegerOptionalInteg
er->m_firstInteger->value()); |
| 96 m_secondInteger->setValue(m_secondInteger->value() + otherIntegerOptionalInt
eger->m_secondInteger->value()); | 98 m_secondInteger->setValue(m_secondInteger->value() + otherIntegerOptionalInt
eger->m_secondInteger->value()); |
| 97 } | 99 } |
| 98 | 100 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 112 m_secondInteger->setValue(static_cast<int>(roundf(y))); | 114 m_secondInteger->setValue(static_cast<int>(roundf(y))); |
| 113 } | 115 } |
| 114 | 116 |
| 115 float SVGIntegerOptionalInteger::calculateDistance(PassRefPtrWillBeRawPtr<SVGPro
pertyBase> other, SVGElement*) | 117 float SVGIntegerOptionalInteger::calculateDistance(PassRefPtrWillBeRawPtr<SVGPro
pertyBase> other, SVGElement*) |
| 116 { | 118 { |
| 117 // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger
right now. We need the distance for every single value. | 119 // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger
right now. We need the distance for every single value. |
| 118 return -1; | 120 return -1; |
| 119 } | 121 } |
| 120 | 122 |
| 121 } | 123 } |
| OLD | NEW |