From 3006ce7c4a0cefd6ffd7b776f13318fb6b1048d0 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 8 Feb 2012 08:57:08 +0000 Subject: [PATCH] Stop calling Element::ensureShadowRoot() if it is used in construction phase. https://bugs.webkit.org/show_bug.cgi?id=77929 Patch by Shinya Kawanaka 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. * 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@107050 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 26 ++++++++++++++++++++++++++ Source/WebCore/html/HTMLDetailsElement.cpp | 6 ++++-- Source/WebCore/html/HTMLKeygenElement.cpp | 4 +++- Source/WebCore/html/HTMLMeterElement.cpp | 6 +++++- Source/WebCore/html/HTMLProgressElement.cpp | 9 ++++++--- Source/WebCore/html/HTMLSummaryElement.cpp | 7 ++++--- Source/WebCore/html/HTMLTextAreaElement.cpp | 5 +++-- 7 files changed, 51 insertions(+), 12 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 7416db9..a15d667 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,29 @@ +2012-02-08 Shinya Kawanaka + + Stop calling Element::ensureShadowRoot() if it is used in construction phase. + https://bugs.webkit.org/show_bug.cgi?id=77929 + + 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. + + * 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): + 2012-02-08 Nikolas Zimmermann Not reviewed. Add missing results for a new SVG test. diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index 17d86d2..d53a063 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -109,8 +109,10 @@ RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle void HTMLDetailsElement::createShadowSubtree() { ASSERT(!shadowRoot()); - ensureShadowRoot()->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, true); - ensureShadowRoot()->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, true); + + RefPtr root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } Element* HTMLDetailsElement::findMainSummary() const diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index 777ee15..7d07942 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -85,7 +85,9 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume option->appendChild(Text::create(document, keys[i]), ec); } - ensureShadowRoot()->appendChild(select, ec); + ASSERT(!shadowRoot()); + RefPtr root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(select, ec); } PassRefPtr HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) diff --git a/Source/WebCore/html/HTMLMeterElement.cpp b/Source/WebCore/html/HTMLMeterElement.cpp index e230ea6..5925e49 100644 --- a/Source/WebCore/html/HTMLMeterElement.cpp +++ b/Source/WebCore/html/HTMLMeterElement.cpp @@ -234,11 +234,15 @@ void HTMLMeterElement::didElementStateChange() void HTMLMeterElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr bar = MeterBarElement::create(document()); m_value = MeterValueElement::create(document()); ExceptionCode ec = 0; bar->appendChild(m_value, ec); - ensureShadowRoot()->appendChild(bar, ec); + + RefPtr root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(bar, ec); } } // namespace 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::didElementStateChange() void HTMLProgressElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr 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 root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(bar, ASSERT_NO_EXCEPTION); } } // namespace diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp index 758d889..d5f4c15 100644 --- a/Source/WebCore/html/HTMLSummaryElement.cpp +++ b/Source/WebCore/html/HTMLSummaryElement.cpp @@ -73,9 +73,10 @@ RenderObject* HTMLSummaryElement::createRenderer(RenderArena* arena, RenderStyle void HTMLSummaryElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(DetailsMarkerControl::create(document()), ec, true); - ensureShadowRoot()->appendChild(SummaryContentElement::create(document()), ec, true); + ASSERT(!shadowRoot()); + RefPtr root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(DetailsMarkerControl::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(SummaryContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } HTMLDetailsElement* HTMLSummaryElement::detailsElement() const diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index d495dce..6196670 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -84,8 +84,9 @@ PassRefPtr HTMLTextAreaElement::create(const QualifiedName& void HTMLTextAreaElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(TextControlInnerTextElement::create(document()), ec); + ASSERT(!shadowRoot()); + RefPtr root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION); + root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION); } const AtomicString& HTMLTextAreaElement::formControlType() const -- 2.7.4