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