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

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

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 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/HTMLQuoteElement.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 21 matching lines...) Expand all
32 #include "core/html/shadow/ProgressShadowElement.h" 32 #include "core/html/shadow/ProgressShadowElement.h"
33 #include "core/rendering/RenderProgress.h" 33 #include "core/rendering/RenderProgress.h"
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 using namespace HTMLNames; 37 using namespace HTMLNames;
38 38
39 const double HTMLProgressElement::IndeterminatePosition = -1; 39 const double HTMLProgressElement::IndeterminatePosition = -1;
40 const double HTMLProgressElement::InvalidPosition = -2; 40 const double HTMLProgressElement::InvalidPosition = -2;
41 41
42 HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document) 42 HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document& document)
43 : LabelableElement(tagName, document) 43 : LabelableElement(tagName, document)
44 , m_value(0) 44 , m_value(0)
45 { 45 {
46 ASSERT(hasTagName(progressTag)); 46 ASSERT(hasTagName(progressTag));
47 ScriptWrappable::init(this); 47 ScriptWrappable::init(this);
48 } 48 }
49 49
50 HTMLProgressElement::~HTMLProgressElement() 50 HTMLProgressElement::~HTMLProgressElement()
51 { 51 {
52 } 52 }
53 53
54 PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document) 54 PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document& document)
55 { 55 {
56 RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagN ame, document)); 56 RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagN ame, document));
57 progress->ensureUserAgentShadowRoot(); 57 progress->ensureUserAgentShadowRoot();
58 return progress.release(); 58 return progress.release();
59 } 59 }
60 60
61 RenderObject* HTMLProgressElement::createRenderer(RenderStyle* style) 61 RenderObject* HTMLProgressElement::createRenderer(RenderStyle* style)
62 { 62 {
63 if (!style->hasAppearance() || hasAuthorShadowRoot()) 63 if (!style->hasAppearance() || hasAuthorShadowRoot())
64 return RenderObject::createObject(this, style); 64 return RenderObject::createObject(this, style);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 render->updateFromElement(); 143 render->updateFromElement();
144 if (wasDeterminate != isDeterminate()) 144 if (wasDeterminate != isDeterminate())
145 didAffectSelector(AffectedSelectorIndeterminate); 145 didAffectSelector(AffectedSelectorIndeterminate);
146 } 146 }
147 } 147 }
148 148
149 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot* root) 149 void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot* root)
150 { 150 {
151 ASSERT(!m_value); 151 ASSERT(!m_value);
152 152
153 RefPtr<ProgressInnerElement> inner = ProgressInnerElement::create(&document( )); 153 RefPtr<ProgressInnerElement> inner = ProgressInnerElement::create(document() );
154 inner->setPart(AtomicString("-webkit-progress-inner-element", AtomicString:: ConstructFromLiteral)); 154 inner->setPart(AtomicString("-webkit-progress-inner-element", AtomicString:: ConstructFromLiteral));
155 root->appendChild(inner); 155 root->appendChild(inner);
156 156
157 RefPtr<ProgressBarElement> bar = ProgressBarElement::create(&document()); 157 RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
158 bar->setPart(AtomicString("-webkit-progress-bar", AtomicString::ConstructFro mLiteral)); 158 bar->setPart(AtomicString("-webkit-progress-bar", AtomicString::ConstructFro mLiteral));
159 RefPtr<ProgressValueElement> value = ProgressValueElement::create(&document( )); 159 RefPtr<ProgressValueElement> value = ProgressValueElement::create(document() );
160 m_value = value.get(); 160 m_value = value.get();
161 m_value->setPart(AtomicString("-webkit-progress-value", AtomicString::Constr uctFromLiteral)); 161 m_value->setPart(AtomicString("-webkit-progress-value", AtomicString::Constr uctFromLiteral));
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 } // namespace 173 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLProgressElement.h ('k') | Source/core/html/HTMLQuoteElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698