| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return value() / max(); | 128 return value() / max(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool HTMLProgressElement::isDeterminate() const | 131 bool HTMLProgressElement::isDeterminate() const |
| 132 { | 132 { |
| 133 return fastHasAttribute(valueAttr); | 133 return fastHasAttribute(valueAttr); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void HTMLProgressElement::didElementStateChange() | 136 void HTMLProgressElement::didElementStateChange() |
| 137 { | 137 { |
| 138 m_value->setWidthPercentage(position() * 100); | 138 setValueWidthPercentage(position() * 100); |
| 139 if (LayoutProgressItem layoutItem = LayoutProgressItem(layoutProgress())) | 139 if (LayoutProgressItem layoutItem = LayoutProgressItem(layoutProgress())) |
| 140 layoutItem.updateFromElement(); | 140 layoutItem.updateFromElement(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 143 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 144 { | 144 { |
| 145 ASSERT(!m_value); | 145 ASSERT(!m_value); |
| 146 | 146 |
| 147 ProgressInnerElement* inner = ProgressInnerElement::create(document()); | 147 ProgressShadowElement* inner = ProgressShadowElement::create(document()); |
| 148 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element")); | 148 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element")); |
| 149 root.appendChild(inner); | 149 root.appendChild(inner); |
| 150 | 150 |
| 151 ProgressBarElement* bar = ProgressBarElement::create(document()); | 151 ProgressShadowElement* bar = ProgressShadowElement::create(document()); |
| 152 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar")); | 152 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar")); |
| 153 ProgressValueElement* value = ProgressValueElement::create(document()); | 153 m_value = ProgressShadowElement::create(document()); |
| 154 m_value = value; | |
| 155 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value")); | 154 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value")); |
| 156 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100
); | 155 setValueWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100); |
| 157 bar->appendChild(m_value); | 156 bar->appendChild(m_value); |
| 158 | 157 |
| 159 inner->appendChild(bar); | 158 inner->appendChild(bar); |
| 160 } | 159 } |
| 161 | 160 |
| 162 bool HTMLProgressElement::shouldAppearIndeterminate() const | 161 bool HTMLProgressElement::shouldAppearIndeterminate() const |
| 163 { | 162 { |
| 164 return !isDeterminate(); | 163 return !isDeterminate(); |
| 165 } | 164 } |
| 166 | 165 |
| 167 DEFINE_TRACE(HTMLProgressElement) | 166 DEFINE_TRACE(HTMLProgressElement) |
| 168 { | 167 { |
| 169 visitor->trace(m_value); | 168 visitor->trace(m_value); |
| 170 LabelableElement::trace(visitor); | 169 LabelableElement::trace(visitor); |
| 171 } | 170 } |
| 172 | 171 |
| 172 void HTMLProgressElement::setValueWidthPercentage(double width) const |
| 173 { |
| 174 m_value->setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::
UnitType::Percentage); |
| 175 } |
| 176 |
| 173 } // namespace blink | 177 } // namespace blink |
| OLD | NEW |