| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 double HTMLProgressElement::max() const { | 106 double HTMLProgressElement::max() const { |
| 107 double max = getFloatingPointAttribute(maxAttr); | 107 double max = getFloatingPointAttribute(maxAttr); |
| 108 // Otherwise, if the element has no max attribute, or if it has one but | 108 // Otherwise, if the element has no max attribute, or if it has one but |
| 109 // parsing it resulted in an error, or if the parsed value was less than or | 109 // parsing it resulted in an error, or if the parsed value was less than or |
| 110 // equal to zero, then the maximum value of the progress bar is 1.0. | 110 // equal to zero, then the maximum value of the progress bar is 1.0. |
| 111 return !std::isfinite(max) || max <= 0 ? 1 : max; | 111 return !std::isfinite(max) || max <= 0 ? 1 : max; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void HTMLProgressElement::setMax(double max) { | 114 void HTMLProgressElement::setMax(double max) { |
| 115 // FIXME: The specification says we should ignore the input value if it is inf
erior or equal to 0. | 115 // FIXME: The specification says we should ignore the input value if it is |
| 116 // inferior or equal to 0. |
| 116 setFloatingPointAttribute(maxAttr, max > 0 ? max : 1); | 117 setFloatingPointAttribute(maxAttr, max > 0 ? max : 1); |
| 117 } | 118 } |
| 118 | 119 |
| 119 double HTMLProgressElement::position() const { | 120 double HTMLProgressElement::position() const { |
| 120 if (!isDeterminate()) | 121 if (!isDeterminate()) |
| 121 return HTMLProgressElement::IndeterminatePosition; | 122 return HTMLProgressElement::IndeterminatePosition; |
| 122 return value() / max(); | 123 return value() / max(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 bool HTMLProgressElement::isDeterminate() const { | 126 bool HTMLProgressElement::isDeterminate() const { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 visitor->trace(m_value); | 158 visitor->trace(m_value); |
| 158 LabelableElement::trace(visitor); | 159 LabelableElement::trace(visitor); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void HTMLProgressElement::setValueWidthPercentage(double width) const { | 162 void HTMLProgressElement::setValueWidthPercentage(double width) const { |
| 162 m_value->setInlineStyleProperty(CSSPropertyWidth, width, | 163 m_value->setInlineStyleProperty(CSSPropertyWidth, width, |
| 163 CSSPrimitiveValue::UnitType::Percentage); | 164 CSSPrimitiveValue::UnitType::Percentage); |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |