| 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 12 matching lines...) Expand all Loading... |
| 23 #include "bindings/core/v8/ExceptionMessages.h" | 23 #include "bindings/core/v8/ExceptionMessages.h" |
| 24 #include "bindings/core/v8/ExceptionState.h" | 24 #include "bindings/core/v8/ExceptionState.h" |
| 25 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 25 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 26 #include "core/HTMLNames.h" | 26 #include "core/HTMLNames.h" |
| 27 #include "core/dom/NodeComputedStyle.h" | 27 #include "core/dom/NodeComputedStyle.h" |
| 28 #include "core/dom/shadow/ShadowRoot.h" | 28 #include "core/dom/shadow/ShadowRoot.h" |
| 29 #include "core/frame/UseCounter.h" | 29 #include "core/frame/UseCounter.h" |
| 30 #include "core/html/HTMLContentElement.h" | 30 #include "core/html/HTMLContentElement.h" |
| 31 #include "core/html/HTMLDivElement.h" | 31 #include "core/html/HTMLDivElement.h" |
| 32 #include "core/html/parser/HTMLParserIdioms.h" | 32 #include "core/html/parser/HTMLParserIdioms.h" |
| 33 #include "core/html/shadow/AppearanceSwitchElement.h" | |
| 34 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
| 35 #include "core/style/ComputedStyle.h" | 34 #include "core/style/ComputedStyle.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 using namespace HTMLNames; | 38 using namespace HTMLNames; |
| 40 | 39 |
| 41 HTMLMeterElement::HTMLMeterElement(Document& document) | 40 HTMLMeterElement::HTMLMeterElement(Document& document) |
| 42 : LabelableElement(meterTag, document) | 41 : LabelableElement(meterTag, document) |
| 43 { | 42 { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 187 |
| 189 void HTMLMeterElement::didElementStateChange() | 188 void HTMLMeterElement::didElementStateChange() |
| 190 { | 189 { |
| 191 updateValueAppearance(valueRatio() * 100); | 190 updateValueAppearance(valueRatio() * 100); |
| 192 } | 191 } |
| 193 | 192 |
| 194 void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 193 void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 195 { | 194 { |
| 196 ASSERT(!m_value); | 195 ASSERT(!m_value); |
| 197 | 196 |
| 198 AppearanceSwitchElement* inner = AppearanceSwitchElement::create(document(),
AppearanceSwitchElement::ShowIfHostHasAppearance); | 197 HTMLDivElement* inner = HTMLDivElement::create(document()); |
| 199 inner->setShadowPseudoId(AtomicString("-webkit-meter-inner-element")); | 198 inner->setShadowPseudoId(AtomicString("-webkit-meter-inner-element")); |
| 200 root.appendChild(inner); | 199 root.appendChild(inner); |
| 201 | 200 |
| 202 HTMLDivElement* bar = HTMLDivElement::create(document()); | 201 HTMLDivElement* bar = HTMLDivElement::create(document()); |
| 203 bar->setShadowPseudoId(AtomicString("-webkit-meter-bar")); | 202 bar->setShadowPseudoId(AtomicString("-webkit-meter-bar")); |
| 204 | 203 |
| 205 m_value = HTMLDivElement::create(document()); | 204 m_value = HTMLDivElement::create(document()); |
| 206 updateValueAppearance(0); | 205 updateValueAppearance(0); |
| 207 bar->appendChild(m_value); | 206 bar->appendChild(m_value); |
| 208 | 207 |
| 209 inner->appendChild(bar); | 208 inner->appendChild(bar); |
| 210 | 209 |
| 211 AppearanceSwitchElement* fallback = AppearanceSwitchElement::create(document
(), AppearanceSwitchElement::ShowIfHostHasNoAppearance); | 210 HTMLDivElement* fallback = HTMLDivElement::create(document()); |
| 212 fallback->appendChild(HTMLContentElement::create(document())); | 211 fallback->appendChild(HTMLContentElement::create(document())); |
| 212 fallback->setShadowPseudoId(AtomicString("-internal-fallback")); |
| 213 root.appendChild(fallback); | 213 root.appendChild(fallback); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void HTMLMeterElement::updateValueAppearance(double percentage) | 216 void HTMLMeterElement::updateValueAppearance(double percentage) |
| 217 { | 217 { |
| 218 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue")); | 218 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue")); |
| 219 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value")); | 219 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value")); |
| 220 DEFINE_STATIC_LOCAL(AtomicString, evenLessGoodPseudoId, ("-webkit-meter-even
-less-good-value")); | 220 DEFINE_STATIC_LOCAL(AtomicString, evenLessGoodPseudoId, ("-webkit-meter-even
-less-good-value")); |
| 221 | 221 |
| 222 m_value->setInlineStyleProperty(CSSPropertyWidth, percentage, CSSPrimitiveVa
lue::UnitType::Percentage); | 222 m_value->setInlineStyleProperty(CSSPropertyWidth, percentage, CSSPrimitiveVa
lue::UnitType::Percentage); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 239 return computedStyle() && !computedStyle()->hasAppearance(); | 239 return computedStyle() && !computedStyle()->hasAppearance(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 DEFINE_TRACE(HTMLMeterElement) | 242 DEFINE_TRACE(HTMLMeterElement) |
| 243 { | 243 { |
| 244 visitor->trace(m_value); | 244 visitor->trace(m_value); |
| 245 LabelableElement::trace(visitor); | 245 LabelableElement::trace(visitor); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace blink | 248 } // namespace blink |
| OLD | NEW |