diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/html/HTMLProgressElement.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/html/HTMLProgressElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLProgressElement.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index cab0429..710f7e4 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -30,23 +30,33 @@ #include "HTMLFormElement.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" -#include "ProgressBarValueElement.h" +#include "ProgressShadowElement.h" #include "RenderProgress.h" +#include "ShadowRoot.h" #include <wtf/StdLibExtras.h> namespace WebCore { using namespace HTMLNames; +const double HTMLProgressElement::IndeterminatePosition = -1; +const double HTMLProgressElement::InvalidPosition = -2; + HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : HTMLFormControlElement(tagName, document, form) { ASSERT(hasTagName(progressTag)); } +HTMLProgressElement::~HTMLProgressElement() +{ +} + PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return adoptRef(new HTMLProgressElement(tagName, document, form)); + RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document, form)); + progress->createShadowSubtree(); + return progress; } RenderObject* HTMLProgressElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -72,7 +82,6 @@ void HTMLProgressElement::parseMappedAttribute(Attribute* attribute) void HTMLProgressElement::attach() { - createShadowSubtreeIfNeeded(); HTMLFormControlElement::attach(); didElementStateChange(); } @@ -117,21 +126,24 @@ void HTMLProgressElement::setMax(double max, ExceptionCode& ec) double HTMLProgressElement::position() const { if (!hasAttribute(valueAttr)) - return -1; + return HTMLProgressElement::IndeterminatePosition; return value() / max(); } void HTMLProgressElement::didElementStateChange() { + m_value->setWidthPercentage(position()*100); if (renderer()) renderer()->updateFromElement(); } -void HTMLProgressElement::createShadowSubtreeIfNeeded() +void HTMLProgressElement::createShadowSubtree() { - if (shadowRoot()) - return; - setShadowRoot(ProgressBarValueElement::create(document()).get()); + RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); + m_value = ProgressValueElement::create(document()); + ExceptionCode ec = 0; + bar->appendChild(m_value, ec); + ensureShadowRoot()->appendChild(bar, ec); } } // namespace |