| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (RenderProgress* render = renderProgress()) | 90 if (RenderProgress* render = renderProgress()) |
| 91 render->updateFromElement(); | 91 render->updateFromElement(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 double HTMLProgressElement::value() const | 94 double HTMLProgressElement::value() const |
| 95 { | 95 { |
| 96 double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); | 96 double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); |
| 97 return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max()); | 97 return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void HTMLProgressElement::setValue(double value, ExceptionState& es) | 100 void HTMLProgressElement::setValue(double value, ExceptionState& exceptionState) |
| 101 { | 101 { |
| 102 if (!std::isfinite(value)) { | 102 if (!std::isfinite(value)) { |
| 103 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 103 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 setAttribute(valueAttr, String::number(value >= 0 ? value : 0)); | 106 setAttribute(valueAttr, String::number(value >= 0 ? value : 0)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 double HTMLProgressElement::max() const | 109 double HTMLProgressElement::max() const |
| 110 { | 110 { |
| 111 double max = parseToDoubleForNumberType(getAttribute(maxAttr)); | 111 double max = parseToDoubleForNumberType(getAttribute(maxAttr)); |
| 112 return !std::isfinite(max) || max <= 0 ? 1 : max; | 112 return !std::isfinite(max) || max <= 0 ? 1 : max; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void HTMLProgressElement::setMax(double max, ExceptionState& es) | 115 void HTMLProgressElement::setMax(double max, ExceptionState& exceptionState) |
| 116 { | 116 { |
| 117 if (!std::isfinite(max)) { | 117 if (!std::isfinite(max)) { |
| 118 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 118 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 setAttribute(maxAttr, String::number(max > 0 ? max : 1)); | 121 setAttribute(maxAttr, String::number(max > 0 ? max : 1)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 double HTMLProgressElement::position() const | 124 double HTMLProgressElement::position() const |
| 125 { | 125 { |
| 126 if (!isDeterminate()) | 126 if (!isDeterminate()) |
| 127 return HTMLProgressElement::IndeterminatePosition; | 127 return HTMLProgressElement::IndeterminatePosition; |
| 128 return value() / max(); | 128 return value() / max(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 inner->appendChild(bar); | 163 inner->appendChild(bar); |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool HTMLProgressElement::shouldAppearIndeterminate() const | 166 bool HTMLProgressElement::shouldAppearIndeterminate() const |
| 167 { | 167 { |
| 168 return !isDeterminate(); | 168 return !isDeterminate(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| OLD | NEW |