| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 double HTMLProgressElement::value() const | 95 double HTMLProgressElement::value() const |
| 96 { | 96 { |
| 97 double value = getFloatingPointAttribute(valueAttr); | 97 double value = getFloatingPointAttribute(valueAttr); |
| 98 return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max()); | 98 return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void HTMLProgressElement::setValue(double value, ExceptionState& exceptionState) | 101 void HTMLProgressElement::setValue(double value, ExceptionState& exceptionState) |
| 102 { | 102 { |
| 103 if (!std::isfinite(value)) { | 103 if (!std::isfinite(value)) { |
| 104 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n
otAFiniteNumber(value)); | 104 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(value)
); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 setFloatingPointAttribute(valueAttr, std::max(value, 0.)); | 107 setFloatingPointAttribute(valueAttr, std::max(value, 0.)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 double HTMLProgressElement::max() const | 110 double HTMLProgressElement::max() const |
| 111 { | 111 { |
| 112 double max = getFloatingPointAttribute(maxAttr); | 112 double max = getFloatingPointAttribute(maxAttr); |
| 113 return !std::isfinite(max) || max <= 0 ? 1 : max; | 113 return !std::isfinite(max) || max <= 0 ? 1 : max; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void HTMLProgressElement::setMax(double max, ExceptionState& exceptionState) | 116 void HTMLProgressElement::setMax(double max, ExceptionState& exceptionState) |
| 117 { | 117 { |
| 118 if (!std::isfinite(max)) { | 118 if (!std::isfinite(max)) { |
| 119 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n
otAFiniteNumber(max)); | 119 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(max)); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 // FIXME: The specification says we should ignore the input value if it is i
nferior or equal to 0. | 122 // FIXME: The specification says we should ignore the input value if it is i
nferior or equal to 0. |
| 123 setFloatingPointAttribute(maxAttr, max > 0 ? max : 1); | 123 setFloatingPointAttribute(maxAttr, max > 0 ? max : 1); |
| 124 } | 124 } |
| 125 | 125 |
| 126 double HTMLProgressElement::position() const | 126 double HTMLProgressElement::position() const |
| 127 { | 127 { |
| 128 if (!isDeterminate()) | 128 if (!isDeterminate()) |
| 129 return HTMLProgressElement::IndeterminatePosition; | 129 return HTMLProgressElement::IndeterminatePosition; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 inner->appendChild(bar); | 165 inner->appendChild(bar); |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool HTMLProgressElement::shouldAppearIndeterminate() const | 168 bool HTMLProgressElement::shouldAppearIndeterminate() const |
| 169 { | 169 { |
| 170 return !isDeterminate(); | 170 return !isDeterminate(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace | 173 } // namespace |
| OLD | NEW |