Stop calling Element::ensureShadowRoot() if it is used in construction phase.
https://bugs.webkit.org/show_bug.cgi?id=77929
Patch by Shinya Kawanaka <shinyak@google.com> on 2012-02-08
Reviewed by Hajime Morita.
ShadowRoot's life cycle can be consufing If Element::ensureShadowRoot() is used.
So we want to remove Element::ensureShadowRoot().
This patch replaces Element::ensureShadowRoot() if it is used in object construction phase.
No new tests, no change in behavior.
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::create):
Initialize exception code before calling appendChild.
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::createShadowSubtree):
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::createShadowSubtree):
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::createShadowSubtree):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::createShadowSubtree):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::createShadowSubtree):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp
index ba4a883..1b2461c 100644
--- a/Source/WebCore/html/HTMLProgressElement.cpp
+++ b/Source/WebCore/html/HTMLProgressElement.cpp
@@ -153,11 +153,14 @@
void HTMLProgressElement::createShadowSubtree()
{
+ ASSERT(!shadowRoot());
+
RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
m_value = ProgressValueElement::create(document());
- ExceptionCode ec = 0;
- bar->appendChild(m_value, ec);
- ensureShadowRoot()->appendChild(bar, ec);
+ bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
+
+ RefPtr<ShadowRoot> root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION);
+ root->appendChild(bar, ASSERT_NO_EXCEPTION);
}
} // namespace