diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/html/HTMLDetailsElement.cpp | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/html/HTMLDetailsElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLDetailsElement.cpp | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index 464733c3d..ba529d90c 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -22,7 +22,6 @@ #include "HTMLDetailsElement.h" #if ENABLE(DETAILS_ELEMENT) -#include "ElementShadow.h" #include "HTMLContentElement.h" #include "HTMLNames.h" #include "HTMLSummaryElement.h" @@ -43,15 +42,22 @@ static const AtomicString& summaryQuerySelector() return selector; }; -class DetailsContentElement : public HTMLContentElement { +class DetailsContentElement : public InsertionPoint { public: static PassRefPtr<DetailsContentElement> create(Document*); private: DetailsContentElement(Document* document) - : HTMLContentElement(HTMLNames::webkitShadowContentTag, document) + : InsertionPoint(HTMLNames::webkitShadowContentTag, document) { } + + virtual MatchType matchTypeFor(Node* node) const OVERRIDE + { + if (node->isElementNode() && node == node->parentNode()->querySelector(summaryQuerySelector(), ASSERT_NO_EXCEPTION)) + return NeverMatches; + return AlwaysMatches; + } }; PassRefPtr<DetailsContentElement> DetailsContentElement::create(Document* document) @@ -59,7 +65,7 @@ PassRefPtr<DetailsContentElement> DetailsContentElement::create(Document* docume return adoptRef(new DetailsContentElement(document)); } -class DetailsSummaryElement : public HTMLContentElement { +class DetailsSummaryElement : public InsertionPoint { public: static PassRefPtr<DetailsSummaryElement> create(Document*); @@ -71,28 +77,32 @@ public: private: DetailsSummaryElement(Document* document) - : HTMLContentElement(HTMLNames::webkitShadowContentTag, document) + : InsertionPoint(HTMLNames::webkitShadowContentTag, document) + { } + + virtual MatchType matchTypeFor(Node* node) const OVERRIDE { - setSelect(summaryQuerySelector()); + if (node->isElementNode() && node == node->parentNode()->querySelector(summaryQuerySelector(), ASSERT_NO_EXCEPTION)) + return AlwaysMatches; + return NeverMatches; } }; PassRefPtr<DetailsSummaryElement> DetailsSummaryElement::create(Document* document) { - RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document); - defaultSummary->appendChild(Text::create(document, defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION); + RefPtr<HTMLSummaryElement> summary = HTMLSummaryElement::create(summaryTag, document); + summary->appendChild(Text::create(document, defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION); - RefPtr<DetailsSummaryElement> elem = adoptRef(new DetailsSummaryElement(document)); - elem->appendChild(defaultSummary); - return elem.release(); + RefPtr<DetailsSummaryElement> detailsSummary = adoptRef(new DetailsSummaryElement(document)); + detailsSummary->appendChild(summary); + return detailsSummary.release(); } PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& tagName, Document* document) { - RefPtr<HTMLDetailsElement> elem = adoptRef(new HTMLDetailsElement(tagName, document)); - elem->createShadowSubtree(); - - return elem.release(); + RefPtr<HTMLDetailsElement> details = adoptRef(new HTMLDetailsElement(tagName, document)); + details->ensureUserAgentShadowRoot(); + return details.release(); } HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document* document) @@ -107,13 +117,10 @@ RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle return new (arena) RenderBlock(this); } -void HTMLDetailsElement::createShadowSubtree() +void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot* root) { - ASSERT(!shadow()); - - RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); - root->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, true); - root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, AttachLazily); + root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, AttachLazily); } Element* HTMLDetailsElement::findMainSummary() const @@ -139,6 +146,9 @@ void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicS bool HTMLDetailsElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const { + if (childContext.node()->isPseudoElement()) + return HTMLElement::childShouldCreateRenderer(childContext); + if (!childContext.isOnEncapsulationBoundary()) return false; |