| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 void HTMLMeterElement::didElementStateChange() | 187 void HTMLMeterElement::didElementStateChange() |
| 188 { | 188 { |
| 189 updateValueAppearance(valueRatio() * 100); | 189 updateValueAppearance(valueRatio() * 100); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 192 void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 193 { | 193 { |
| 194 ASSERT(!m_value); | 194 ASSERT(!m_value); |
| 195 | 195 |
| 196 RefPtrWillBeRawPtr<HTMLDivElement> inner = HTMLDivElement::create(document()
); | 196 RefPtrWillBeRawPtr<HTMLDivElement> inner = HTMLDivElement::create(document()
); |
| 197 inner->setShadowPseudoId(AtomicString("-webkit-meter-inner-element", AtomicS
tring::ConstructFromLiteral)); | 197 inner->setShadowPseudoId(AtomicString("-webkit-meter-inner-element")); |
| 198 root.appendChild(inner); | 198 root.appendChild(inner); |
| 199 | 199 |
| 200 RefPtrWillBeRawPtr<HTMLDivElement> bar = HTMLDivElement::create(document()); | 200 RefPtrWillBeRawPtr<HTMLDivElement> bar = HTMLDivElement::create(document()); |
| 201 bar->setShadowPseudoId(AtomicString("-webkit-meter-bar", AtomicString::Const
ructFromLiteral)); | 201 bar->setShadowPseudoId(AtomicString("-webkit-meter-bar")); |
| 202 | 202 |
| 203 m_value = HTMLDivElement::create(document()); | 203 m_value = HTMLDivElement::create(document()); |
| 204 updateValueAppearance(0); | 204 updateValueAppearance(0); |
| 205 bar->appendChild(m_value); | 205 bar->appendChild(m_value); |
| 206 | 206 |
| 207 inner->appendChild(bar); | 207 inner->appendChild(bar); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void HTMLMeterElement::updateValueAppearance(double percentage) | 210 void HTMLMeterElement::updateValueAppearance(double percentage) |
| 211 { | 211 { |
| 212 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue", AtomicString::ConstructFromLiteral)); | 212 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue")); |
| 213 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value", AtomicString::ConstructFromLiteral)); | 213 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value")); |
| 214 DEFINE_STATIC_LOCAL(AtomicString, evenLessGoodPseudoId, ("-webkit-meter-even
-less-good-value", AtomicString::ConstructFromLiteral)); | 214 DEFINE_STATIC_LOCAL(AtomicString, evenLessGoodPseudoId, ("-webkit-meter-even
-less-good-value")); |
| 215 | 215 |
| 216 m_value->setInlineStyleProperty(CSSPropertyWidth, percentage, CSSPrimitiveVa
lue::UnitType::Percentage); | 216 m_value->setInlineStyleProperty(CSSPropertyWidth, percentage, CSSPrimitiveVa
lue::UnitType::Percentage); |
| 217 switch (getGaugeRegion()) { | 217 switch (getGaugeRegion()) { |
| 218 case GaugeRegionOptimum: | 218 case GaugeRegionOptimum: |
| 219 m_value->setShadowPseudoId(optimumPseudoId); | 219 m_value->setShadowPseudoId(optimumPseudoId); |
| 220 break; | 220 break; |
| 221 case GaugeRegionSuboptimal: | 221 case GaugeRegionSuboptimal: |
| 222 m_value->setShadowPseudoId(suboptimumPseudoId); | 222 m_value->setShadowPseudoId(suboptimumPseudoId); |
| 223 break; | 223 break; |
| 224 case GaugeRegionEvenLessGood: | 224 case GaugeRegionEvenLessGood: |
| 225 m_value->setShadowPseudoId(evenLessGoodPseudoId); | 225 m_value->setShadowPseudoId(evenLessGoodPseudoId); |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 DEFINE_TRACE(HTMLMeterElement) | 230 DEFINE_TRACE(HTMLMeterElement) |
| 231 { | 231 { |
| 232 visitor->trace(m_value); | 232 visitor->trace(m_value); |
| 233 LabelableElement::trace(visitor); | 233 LabelableElement::trace(visitor); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |