[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
dglazkov at chromium.org
dglazkov at chromium.org
Fri Jan 21 14:44:26 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 78bcf44fec69478812f0c589b2a3e5a466d5bedf
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 28 18:55:42 2010 +0000
2010-12-28 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Eric Seidel.
Combine setShadowRoot and clearShadowRoot into a simpler API
https://bugs.webkit.org/show_bug.cgi?id=50971
No change in behavior, and API is not used yet.
* dom/Element.cpp:
(WebCore::Element::setShadowRoot): Combined clearing and setting of
the shadowRoot, also hooked up with setting and clearing of the
corresponding shadowHost values.
* dom/Element.h: renamed clearShadowRoot to removeShadowRoot and made it
private.
* dom/Node.h: Made shadow host-related functions public so that
Element::setShadowRoot can access setShadowHost. It seems logical
to make shadowHost public as well to keep the defs together.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c81ffd2..f152806 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-12-28 Dimitri Glazkov <dglazkov at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Combine setShadowRoot and clearShadowRoot into a simpler API
+ https://bugs.webkit.org/show_bug.cgi?id=50971
+
+ No change in behavior, and API is not used yet.
+
+ * dom/Element.cpp:
+ (WebCore::Element::setShadowRoot): Combined clearing and setting of
+ the shadowRoot, also hooked up with setting and clearing of the
+ corresponding shadowHost values.
+ * dom/Element.h: renamed clearShadowRoot to removeShadowRoot and made it
+ private.
+ * dom/Node.h: Made shadow host-related functions public so that
+ Element::setShadowRoot can access setShadowHost. It seems logical
+ to make shadowHost public as well to keep the defs together.
+
2010-12-28 Andrey Kosyakov <caseq at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 0707c96..a7cd7ba 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1082,24 +1082,31 @@ Node* Element::shadowRoot()
void Element::setShadowRoot(PassRefPtr<Node> node)
{
- ASSERT(node);
+ // FIXME: Because today this is never called from script directly, we don't have to worry
+ // about compromising DOM tree integrity (eg. node being a parent of this). However,
+ // once we implement XBL2, we will have to add integrity checks here.
+ removeShadowRoot();
+ RefPtr<Node> newRoot = node;
+ if (!newRoot)
+ return;
- // FIXME: Once all instances of shadow DOM are converted to use this code, add setting of shadow host (shadowParent) on node.
- ensureRareData()->m_shadowRoot = node;
+ ensureRareData()->m_shadowRoot = newRoot;
+ newRoot->setShadowHost(this);
}
-void Element::clearShadowRoot()
+void Element::removeShadowRoot()
{
if (!hasRareData())
return;
- RefPtr<Node> shadowRoot = rareData()->m_shadowRoot.release();
- document()->removeFocusedNodeOfSubtree(shadowRoot.get());
- // FIXME: Once all instances of shadow DOM are converted to use this code, add clearing of shadow host (shadowParent).
- if (shadowRoot->inDocument())
- shadowRoot->removedFromDocument();
- else
- shadowRoot->removedFromTree(true);
+ if (RefPtr<Node> oldRoot = rareData()->m_shadowRoot.release()) {
+ document()->removeFocusedNodeOfSubtree(oldRoot.get());
+ oldRoot->setShadowHost(0);
+ if (oldRoot->inDocument())
+ oldRoot->removedFromDocument();
+ else
+ oldRoot->removedFromTree(true);
+ }
}
bool Element::childTypeAllowed(NodeType type)
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 8432f82..4af99e2 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -227,7 +227,6 @@ public:
Node* shadowRoot();
void setShadowRoot(PassRefPtr<Node>);
- void clearShadowRoot();
RenderStyle* computedStyle(PseudoId = NOPSEUDO);
@@ -392,6 +391,7 @@ private:
ElementRareData* ensureRareData();
SpellcheckAttributeState spellcheckAttributeState() const;
+ void removeShadowRoot();
private:
mutable RefPtr<NamedNodeMap> m_attributeMap;
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index 9709688..46b7424 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -216,6 +216,9 @@ public:
// Use when it's guaranteed to that shadowParentNode is 0.
ContainerNode* parentNodeGuaranteedHostFree() const;
+ Element* shadowHost() const;
+ void setShadowHost(Element*);
+
// Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation.
Node* enclosingLinkEventParentOrSelf();
@@ -638,9 +641,6 @@ protected:
NodeRareData* rareData() const;
NodeRareData* ensureRareData();
- Element* shadowHost() const;
- void setShadowHost(Element*);
-
private:
#if USE(JSC)
void markCachedNodeListsSlow(JSC::MarkStack&, JSC::JSGlobalData&);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list