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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 didElementStateChange(); | 99 didElementStateChange(); |
100 else if (attribute.name() == maxAttr) | 100 else if (attribute.name() == maxAttr) |
101 didElementStateChange(); | 101 didElementStateChange(); |
102 else | 102 else |
103 LabelableElement::parseAttribute(attribute); | 103 LabelableElement::parseAttribute(attribute); |
104 } | 104 } |
105 | 105 |
106 void HTMLProgressElement::attach() | 106 void HTMLProgressElement::attach() |
107 { | 107 { |
108 LabelableElement::attach(); | 108 LabelableElement::attach(); |
109 didElementStateChange(); | 109 if (RenderProgress* render = renderProgress()) |
| 110 render->updateFromElement(); |
110 } | 111 } |
111 | 112 |
112 double HTMLProgressElement::value() const | 113 double HTMLProgressElement::value() const |
113 { | 114 { |
114 double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); | 115 double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); |
115 return !isfinite(value) || value < 0 ? 0 : std::min(value, max()); | 116 return !isfinite(value) || value < 0 ? 0 : std::min(value, max()); |
116 } | 117 } |
117 | 118 |
118 void HTMLProgressElement::setValue(double value, ExceptionCode& ec) | 119 void HTMLProgressElement::setValue(double value, ExceptionCode& ec) |
119 { | 120 { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ASSERT(!m_value); | 169 ASSERT(!m_value); |
169 | 170 |
170 RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::UserAgentShad
owRoot, ASSERT_NO_EXCEPTION); | 171 RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::UserAgentShad
owRoot, ASSERT_NO_EXCEPTION); |
171 | 172 |
172 RefPtr<ProgressInnerElement> inner = ProgressInnerElement::create(document()
); | 173 RefPtr<ProgressInnerElement> inner = ProgressInnerElement::create(document()
); |
173 root->appendChild(inner); | 174 root->appendChild(inner); |
174 | 175 |
175 RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); | 176 RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); |
176 RefPtr<ProgressValueElement> value = ProgressValueElement::create(document()
); | 177 RefPtr<ProgressValueElement> value = ProgressValueElement::create(document()
); |
177 m_value = value.get(); | 178 m_value = value.get(); |
| 179 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100
); |
178 bar->appendChild(m_value, ASSERT_NO_EXCEPTION); | 180 bar->appendChild(m_value, ASSERT_NO_EXCEPTION); |
179 | 181 |
180 inner->appendChild(bar, ASSERT_NO_EXCEPTION); | 182 inner->appendChild(bar, ASSERT_NO_EXCEPTION); |
181 } | 183 } |
182 | 184 |
183 } // namespace | 185 } // namespace |
184 #endif | 186 #endif |
OLD | NEW |