| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 : LabelableElement(progressTag, document) | 42 : LabelableElement(progressTag, document) |
| 43 , m_value(nullptr) | 43 , m_value(nullptr) |
| 44 { | 44 { |
| 45 UseCounter::count(document, UseCounter::ProgressElement); | 45 UseCounter::count(document, UseCounter::ProgressElement); |
| 46 } | 46 } |
| 47 | 47 |
| 48 HTMLProgressElement::~HTMLProgressElement() | 48 HTMLProgressElement::~HTMLProgressElement() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassRefPtrWillBeRawPtr<HTMLProgressElement> HTMLProgressElement::create(Document
& document) | 52 RawPtr<HTMLProgressElement> HTMLProgressElement::create(Document& document) |
| 53 { | 53 { |
| 54 RefPtrWillBeRawPtr<HTMLProgressElement> progress = adoptRefWillBeNoop(new HT
MLProgressElement(document)); | 54 RawPtr<HTMLProgressElement> progress = (new HTMLProgressElement(document)); |
| 55 progress->ensureUserAgentShadowRoot(); | 55 progress->ensureUserAgentShadowRoot(); |
| 56 return progress.release(); | 56 return progress.release(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 LayoutObject* HTMLProgressElement::createLayoutObject(const ComputedStyle& style
) | 59 LayoutObject* HTMLProgressElement::createLayoutObject(const ComputedStyle& style
) |
| 60 { | 60 { |
| 61 if (!style.hasAppearance() || openShadowRoot()) | 61 if (!style.hasAppearance() || openShadowRoot()) |
| 62 return LayoutObject::createObject(this, style); | 62 return LayoutObject::createObject(this, style); |
| 63 return new LayoutProgress(this); | 63 return new LayoutProgress(this); |
| 64 } | 64 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 layoutObject->updateFromElement(); | 141 layoutObject->updateFromElement(); |
| 142 if (wasDeterminate != isDeterminate()) | 142 if (wasDeterminate != isDeterminate()) |
| 143 pseudoStateChanged(CSSSelector::PseudoIndeterminate); | 143 pseudoStateChanged(CSSSelector::PseudoIndeterminate); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 147 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 148 { | 148 { |
| 149 ASSERT(!m_value); | 149 ASSERT(!m_value); |
| 150 | 150 |
| 151 RefPtrWillBeRawPtr<ProgressInnerElement> inner = ProgressInnerElement::creat
e(document()); | 151 RawPtr<ProgressInnerElement> inner = ProgressInnerElement::create(document()
); |
| 152 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element", Atom
icString::ConstructFromLiteral)); | 152 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element", Atom
icString::ConstructFromLiteral)); |
| 153 root.appendChild(inner); | 153 root.appendChild(inner); |
| 154 | 154 |
| 155 RefPtrWillBeRawPtr<ProgressBarElement> bar = ProgressBarElement::create(docu
ment()); | 155 RawPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); |
| 156 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar", AtomicString::Co
nstructFromLiteral)); | 156 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar", AtomicString::Co
nstructFromLiteral)); |
| 157 RefPtrWillBeRawPtr<ProgressValueElement> value = ProgressValueElement::creat
e(document()); | 157 RawPtr<ProgressValueElement> value = ProgressValueElement::create(document()
); |
| 158 m_value = value.get(); | 158 m_value = value.get(); |
| 159 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value", AtomicStri
ng::ConstructFromLiteral)); | 159 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value", AtomicStri
ng::ConstructFromLiteral)); |
| 160 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100
); | 160 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100
); |
| 161 bar->appendChild(m_value); | 161 bar->appendChild(m_value); |
| 162 | 162 |
| 163 inner->appendChild(bar); | 163 inner->appendChild(bar); |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool HTMLProgressElement::shouldAppearIndeterminate() const | 166 bool HTMLProgressElement::shouldAppearIndeterminate() const |
| 167 { | 167 { |
| 168 return !isDeterminate(); | 168 return !isDeterminate(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void HTMLProgressElement::willAddFirstAuthorShadowRoot() | 171 void HTMLProgressElement::willAddFirstAuthorShadowRoot() |
| 172 { | 172 { |
| 173 ASSERT(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()); | 173 ASSERT(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()); |
| 174 lazyReattachIfAttached(); | 174 lazyReattachIfAttached(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 DEFINE_TRACE(HTMLProgressElement) | 177 DEFINE_TRACE(HTMLProgressElement) |
| 178 { | 178 { |
| 179 visitor->trace(m_value); | 179 visitor->trace(m_value); |
| 180 LabelableElement::trace(visitor); | 180 LabelableElement::trace(visitor); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |