Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: Source/core/html/HTMLProgressElement.cpp

Issue 935283002: Rename {Author,UserAgent}ShadowRoot to {Open,Closed}ShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix inspector tests Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLProgressElement.h ('k') | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 UseCounter::count(document, UseCounter::ProgressElement); 47 UseCounter::count(document, UseCounter::ProgressElement);
48 } 48 }
49 49
50 HTMLProgressElement::~HTMLProgressElement() 50 HTMLProgressElement::~HTMLProgressElement()
51 { 51 {
52 } 52 }
53 53
54 PassRefPtrWillBeRawPtr<HTMLProgressElement> HTMLProgressElement::create(Document & document) 54 PassRefPtrWillBeRawPtr<HTMLProgressElement> HTMLProgressElement::create(Document & document)
55 { 55 {
56 RefPtrWillBeRawPtr<HTMLProgressElement> progress = adoptRefWillBeNoop(new HT MLProgressElement(document)); 56 RefPtrWillBeRawPtr<HTMLProgressElement> progress = adoptRefWillBeNoop(new HT MLProgressElement(document));
57 progress->ensureUserAgentShadowRoot(); 57 progress->ensureClosedShadowRoot();
58 return progress.release(); 58 return progress.release();
59 } 59 }
60 60
61 LayoutObject* HTMLProgressElement::createRenderer(const LayoutStyle& style) 61 LayoutObject* HTMLProgressElement::createRenderer(const LayoutStyle& style)
62 { 62 {
63 if (!style.hasAppearance() || hasAuthorShadowRoot()) 63 if (!style.hasAppearance() || hasOpenShadowRoot())
64 return LayoutObject::createObject(this, style); 64 return LayoutObject::createObject(this, style);
65 return new RenderProgress(this); 65 return new RenderProgress(this);
66 } 66 }
67 67
68 RenderProgress* HTMLProgressElement::renderProgress() const 68 RenderProgress* HTMLProgressElement::renderProgress() const
69 { 69 {
70 if (renderer() && renderer()->isProgress()) 70 if (renderer() && renderer()->isProgress())
71 return toRenderProgress(renderer()); 71 return toRenderProgress(renderer());
72 72
73 LayoutObject* layoutObject = userAgentShadowRoot()->firstChild()->renderer() ; 73 LayoutObject* layoutObject = closedShadowRoot()->firstChild()->renderer();
74 ASSERT_WITH_SECURITY_IMPLICATION(!layoutObject || layoutObject->isProgress() ); 74 ASSERT_WITH_SECURITY_IMPLICATION(!layoutObject || layoutObject->isProgress() );
75 return toRenderProgress(layoutObject); 75 return toRenderProgress(layoutObject);
76 } 76 }
77 77
78 void HTMLProgressElement::parseAttribute(const QualifiedName& name, const Atomic String& value) 78 void HTMLProgressElement::parseAttribute(const QualifiedName& name, const Atomic String& value)
79 { 79 {
80 if (name == valueAttr) 80 if (name == valueAttr)
81 didElementStateChange(); 81 didElementStateChange();
82 else if (name == maxAttr) 82 else if (name == maxAttr)
83 didElementStateChange(); 83 didElementStateChange();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { 139 {
140 m_value->setWidthPercentage(position() * 100); 140 m_value->setWidthPercentage(position() * 100);
141 if (RenderProgress* render = renderProgress()) { 141 if (RenderProgress* render = renderProgress()) {
142 bool wasDeterminate = render->isDeterminate(); 142 bool wasDeterminate = render->isDeterminate();
143 render->updateFromElement(); 143 render->updateFromElement();
144 if (wasDeterminate != isDeterminate()) 144 if (wasDeterminate != isDeterminate())
145 pseudoStateChanged(CSSSelector::PseudoIndeterminate); 145 pseudoStateChanged(CSSSelector::PseudoIndeterminate);
146 } 146 }
147 } 147 }
148 148
149 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root) 149 void HTMLProgressElement::didAddClosedShadowRoot(ShadowRoot& root)
150 { 150 {
151 ASSERT(!m_value); 151 ASSERT(!m_value);
152 152
153 RefPtrWillBeRawPtr<ProgressInnerElement> inner = ProgressInnerElement::creat e(document()); 153 RefPtrWillBeRawPtr<ProgressInnerElement> inner = ProgressInnerElement::creat e(document());
154 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element", Atom icString::ConstructFromLiteral)); 154 inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element", Atom icString::ConstructFromLiteral));
155 root.appendChild(inner); 155 root.appendChild(inner);
156 156
157 RefPtrWillBeRawPtr<ProgressBarElement> bar = ProgressBarElement::create(docu ment()); 157 RefPtrWillBeRawPtr<ProgressBarElement> bar = ProgressBarElement::create(docu ment());
158 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar", AtomicString::Co nstructFromLiteral)); 158 bar->setShadowPseudoId(AtomicString("-webkit-progress-bar", AtomicString::Co nstructFromLiteral));
159 RefPtrWillBeRawPtr<ProgressValueElement> value = ProgressValueElement::creat e(document()); 159 RefPtrWillBeRawPtr<ProgressValueElement> value = ProgressValueElement::creat e(document());
160 m_value = value.get(); 160 m_value = value.get();
161 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value", AtomicStri ng::ConstructFromLiteral)); 161 m_value->setShadowPseudoId(AtomicString("-webkit-progress-value", AtomicStri ng::ConstructFromLiteral));
162 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100 ); 162 m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100 );
163 bar->appendChild(m_value); 163 bar->appendChild(m_value);
164 164
165 inner->appendChild(bar); 165 inner->appendChild(bar);
166 } 166 }
167 167
168 bool HTMLProgressElement::shouldAppearIndeterminate() const 168 bool HTMLProgressElement::shouldAppearIndeterminate() const
169 { 169 {
170 return !isDeterminate(); 170 return !isDeterminate();
171 } 171 }
172 172
173 void HTMLProgressElement::willAddFirstAuthorShadowRoot() 173 void HTMLProgressElement::willAddFirstOpenShadowRoot()
174 { 174 {
175 ASSERT(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()); 175 ASSERT(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled());
176 lazyReattachIfAttached(); 176 lazyReattachIfAttached();
177 } 177 }
178 178
179 DEFINE_TRACE(HTMLProgressElement) 179 DEFINE_TRACE(HTMLProgressElement)
180 { 180 {
181 visitor->trace(m_value); 181 visitor->trace(m_value);
182 LabelableElement::trace(visitor); 182 LabelableElement::trace(visitor);
183 } 183 }
184 184
185 } // namespace 185 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLProgressElement.h ('k') | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698