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

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

Issue 942583002: Move rendering/RenderProgress to layout/LayoutProgress (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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 13 matching lines...) Expand all
24 24
25 #include "bindings/core/v8/ExceptionMessages.h" 25 #include "bindings/core/v8/ExceptionMessages.h"
26 #include "bindings/core/v8/ExceptionState.h" 26 #include "bindings/core/v8/ExceptionState.h"
27 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 27 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/ExceptionCode.h" 29 #include "core/dom/ExceptionCode.h"
30 #include "core/dom/shadow/ShadowRoot.h" 30 #include "core/dom/shadow/ShadowRoot.h"
31 #include "core/frame/UseCounter.h" 31 #include "core/frame/UseCounter.h"
32 #include "core/html/parser/HTMLParserIdioms.h" 32 #include "core/html/parser/HTMLParserIdioms.h"
33 #include "core/html/shadow/ProgressShadowElement.h" 33 #include "core/html/shadow/ProgressShadowElement.h"
34 #include "core/rendering/RenderProgress.h" 34 #include "core/layout/LayoutProgress.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 using namespace HTMLNames; 38 using namespace HTMLNames;
39 39
40 const double HTMLProgressElement::IndeterminatePosition = -1; 40 const double HTMLProgressElement::IndeterminatePosition = -1;
41 const double HTMLProgressElement::InvalidPosition = -2; 41 const double HTMLProgressElement::InvalidPosition = -2;
42 42
43 HTMLProgressElement::HTMLProgressElement(Document& document) 43 HTMLProgressElement::HTMLProgressElement(Document& document)
44 : LabelableElement(progressTag, document) 44 : LabelableElement(progressTag, document)
(...skipping 10 matching lines...) Expand all
55 { 55 {
56 RefPtrWillBeRawPtr<HTMLProgressElement> progress = adoptRefWillBeNoop(new HT MLProgressElement(document)); 56 RefPtrWillBeRawPtr<HTMLProgressElement> progress = adoptRefWillBeNoop(new HT MLProgressElement(document));
57 progress->ensureClosedShadowRoot(); 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() || hasOpenShadowRoot()) 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 LayoutProgress(this);
66 } 66 }
67 67
68 RenderProgress* HTMLProgressElement::renderProgress() const 68 LayoutProgress* HTMLProgressElement::layoutProgress() const
69 { 69 {
70 if (renderer() && renderer()->isProgress()) 70 if (renderer() && renderer()->isProgress())
71 return toRenderProgress(renderer()); 71 return toLayoutProgress(renderer());
72 72
73 LayoutObject* layoutObject = closedShadowRoot()->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 toLayoutProgress(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();
84 else 84 else
85 LabelableElement::parseAttribute(name, value); 85 LabelableElement::parseAttribute(name, value);
86 } 86 }
87 87
88 void HTMLProgressElement::attach(const AttachContext& context) 88 void HTMLProgressElement::attach(const AttachContext& context)
89 { 89 {
90 LabelableElement::attach(context); 90 LabelableElement::attach(context);
91 if (RenderProgress* render = renderProgress()) 91 if (LayoutProgress* render = layoutProgress())
92 render->updateFromElement(); 92 render->updateFromElement();
93 } 93 }
94 94
95 double HTMLProgressElement::value() const 95 double HTMLProgressElement::value() const
96 { 96 {
97 double value = getFloatingPointAttribute(valueAttr); 97 double value = getFloatingPointAttribute(valueAttr);
98 // Otherwise, if the parsed value was greater than or equal to the maximum 98 // Otherwise, if the parsed value was greater than or equal to the maximum
99 // value, then the current value of the progress bar is the maximum value 99 // value, then the current value of the progress bar is the maximum value
100 // of the progress bar. Otherwise, if parsing the value attribute's value 100 // of the progress bar. Otherwise, if parsing the value attribute's value
101 // resulted in an error, or a number less than or equal to zero, then the 101 // resulted in an error, or a number less than or equal to zero, then the
(...skipping 29 matching lines...) Expand all
131 } 131 }
132 132
133 bool HTMLProgressElement::isDeterminate() const 133 bool HTMLProgressElement::isDeterminate() const
134 { 134 {
135 return fastHasAttribute(valueAttr); 135 return fastHasAttribute(valueAttr);
136 } 136 }
137 137
138 void HTMLProgressElement::didElementStateChange() 138 void HTMLProgressElement::didElementStateChange()
139 { 139 {
140 m_value->setWidthPercentage(position() * 100); 140 m_value->setWidthPercentage(position() * 100);
141 if (RenderProgress* render = renderProgress()) { 141 if (LayoutProgress* render = layoutProgress()) {
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::didAddClosedShadowRoot(ShadowRoot& root) 149 void HTMLProgressElement::didAddClosedShadowRoot(ShadowRoot& root)
150 { 150 {
151 ASSERT(!m_value); 151 ASSERT(!m_value);
(...skipping 24 matching lines...) Expand all
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/shadow/ProgressShadowElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698