Title: [117723] trunk/Source/WebCore
Revision
117723
Author
[email protected]
Date
2012-05-20 19:41:58 -0700 (Sun, 20 May 2012)

Log Message

[Refactoring] Node::shadowHost() and Node::setShadowHost() can be moved to ShadowRoot.
https://bugs.webkit.org/show_bug.cgi?id=86585

Reviewed by Hajime Morita.

Since Node::shadowHost() and Node::setShadowHost() are valid only if Node is ShadowRoot,
they should be moved to ShadowRoot.

However, Node::setParent cannot be called from ShadowRoot, we add Node::setParentOrHostNode
to call it as Node::parentOrHostNode() calls Node::parent(). Node::setParent() is now private.
We also add SVGElementInstance::setParentOrHostNode() to share ContainerNodeAlgorithm.

No new tests, no change in behavior.

* dom/Attr.cpp:
(WebCore::Attr::createTextChild):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::insertBeforeCommon):
(WebCore::ContainerNode::removeBetween):
(WebCore::ContainerNode::removeChildren):
* dom/ContainerNodeAlgorithms.h:
(WebCore::appendChildToContainer):
(WebCore::Private::addChildNodesToDeletionQueue):
* dom/ElementShadow.cpp:
(WebCore::validateShadowRoot):
(WebCore::ElementShadow::addShadowRoot):
(WebCore::ElementShadow::removeAllShadowRoots):
* dom/EventDispatcher.cpp:
(WebCore::eventTargetRespectingSVGTargetRules):
(WebCore::EventDispatcher::ensureEventAncestors):
(WebCore::EventDispatcher::determineDispatchBehavior):
* dom/EventDispatcher.h:
(WebCore):
(EventDispatcher):
* dom/Node.cpp:
(WebCore::Node::parentOrHostElement):
* dom/Node.h:
(Node):
(WebCore::Node::setParentOrHostNode):
(WebCore):
* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::NodeRenderingContext):
* dom/ShadowRoot.h:
(WebCore::ShadowRoot::host):
(WebCore):
(WebCore::ShadowRoot::setHost):
* dom/TreeScope.cpp:
(WebCore::TreeScope::focusedNode):
* html/shadow/ContentSelectorQuery.cpp:
(WebCore::ContentSelectorQuery::matches):
* page/DragController.cpp:
(WebCore::asFileInput):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::instanceAssociatedWithShadowTreeElement):
(WebCore::EventHandler::dispatchMouseEvent):
* page/FocusController.cpp:
(WebCore::FocusScope::owner):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::hasLineIfEmpty):
* svg/SVGElementInstance.h:
(WebCore::SVGElementInstance::setParentOrHostNode):
(SVGElementInstance):
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::title):
* svg/SVGTRefElement.cpp:
(WebCore::SVGShadowText::willRecalcTextStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117722 => 117723)


--- trunk/Source/WebCore/ChangeLog	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/ChangeLog	2012-05-21 02:41:58 UTC (rev 117723)
@@ -1,3 +1,73 @@
+2012-05-20  Shinya Kawanaka  <[email protected]>
+
+        [Refactoring] Node::shadowHost() and Node::setShadowHost() can be moved to ShadowRoot.
+        https://bugs.webkit.org/show_bug.cgi?id=86585
+
+        Reviewed by Hajime Morita.
+
+        Since Node::shadowHost() and Node::setShadowHost() are valid only if Node is ShadowRoot,
+        they should be moved to ShadowRoot.
+
+        However, Node::setParent cannot be called from ShadowRoot, we add Node::setParentOrHostNode
+        to call it as Node::parentOrHostNode() calls Node::parent(). Node::setParent() is now private.
+        We also add SVGElementInstance::setParentOrHostNode() to share ContainerNodeAlgorithm.
+
+        No new tests, no change in behavior.
+
+        * dom/Attr.cpp:
+        (WebCore::Attr::createTextChild):
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::insertBeforeCommon):
+        (WebCore::ContainerNode::removeBetween):
+        (WebCore::ContainerNode::removeChildren):
+        * dom/ContainerNodeAlgorithms.h:
+        (WebCore::appendChildToContainer):
+        (WebCore::Private::addChildNodesToDeletionQueue):
+        * dom/ElementShadow.cpp:
+        (WebCore::validateShadowRoot):
+        (WebCore::ElementShadow::addShadowRoot):
+        (WebCore::ElementShadow::removeAllShadowRoots):
+        * dom/EventDispatcher.cpp:
+        (WebCore::eventTargetRespectingSVGTargetRules):
+        (WebCore::EventDispatcher::ensureEventAncestors):
+        (WebCore::EventDispatcher::determineDispatchBehavior):
+        * dom/EventDispatcher.h:
+        (WebCore):
+        (EventDispatcher):
+        * dom/Node.cpp:
+        (WebCore::Node::parentOrHostElement):
+        * dom/Node.h:
+        (Node):
+        (WebCore::Node::setParentOrHostNode):
+        (WebCore):
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRenderingContext::NodeRenderingContext):
+        * dom/ShadowRoot.h:
+        (WebCore::ShadowRoot::host):
+        (WebCore):
+        (WebCore::ShadowRoot::setHost):
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::focusedNode):
+        * html/shadow/ContentSelectorQuery.cpp:
+        (WebCore::ContentSelectorQuery::matches):
+        * page/DragController.cpp:
+        (WebCore::asFileInput):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEvent):
+        (WebCore::instanceAssociatedWithShadowTreeElement):
+        (WebCore::EventHandler::dispatchMouseEvent):
+        * page/FocusController.cpp:
+        (WebCore::FocusScope::owner):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::hasLineIfEmpty):
+        * svg/SVGElementInstance.h:
+        (WebCore::SVGElementInstance::setParentOrHostNode):
+        (SVGElementInstance):
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::title):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGShadowText::willRecalcTextStyle):
+
 2012-05-20  Joe Thomas  <[email protected]>
 
         Unsupported commands should have queryCommandValue() = "", not false

Modified: trunk/Source/WebCore/dom/Attr.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/Attr.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/Attr.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -81,7 +81,7 @@
 
         // This does everything appendChild() would do in this situation (assuming m_ignoreChildrenChanged was set),
         // but much more efficiently.
-        textNode->setParent(this);
+        textNode->setParentOrHostNode(this);
         setFirstChild(textNode.get());
         setLastChild(textNode.get());
     }

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -186,6 +186,7 @@
     ASSERT(!newChild->parentNode()); // Use insertBefore if you need to handle reparenting (and want DOM mutation events).
     ASSERT(!newChild->nextSibling());
     ASSERT(!newChild->previousSibling());
+    ASSERT(!newChild->isShadowRoot());
 
     forbidEventDispatch();
     Node* prev = nextChild->previousSibling();
@@ -199,7 +200,7 @@
         ASSERT(m_firstChild == nextChild);
         m_firstChild = newChild;
     }
-    newChild->setParent(this);
+    newChild->setParentOrHostNode(this);
     newChild->setPreviousSibling(prev);
     newChild->setNextSibling(nextChild);
     allowEventDispatch();
@@ -428,7 +429,7 @@
 
     oldChild->setPreviousSibling(0);
     oldChild->setNextSibling(0);
-    oldChild->setParent(0);
+    oldChild->setParentOrHostNode(0);
 
     document()->adoptIfNeeded(oldChild);
 
@@ -481,7 +482,7 @@
         // this discrepancy between removeChild() and its optimized version removeChildren().
         n->setPreviousSibling(0);
         n->setNextSibling(0);
-        n->setParent(0);
+        n->setParentOrHostNode(0);
         document()->adoptIfNeeded(n.get());
 
         m_firstChild = next;

Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h (117722 => 117723)


--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h	2012-05-21 02:41:58 UTC (rev 117723)
@@ -105,7 +105,7 @@
 template<class GenericNode, class GenericNodeContainer>
 inline void appendChildToContainer(GenericNode* child, GenericNodeContainer* container)
 {
-    child->setParent(container);
+    child->setParentOrHostNode(container);
 
     GenericNode* lastChild = container->lastChild();
     if (lastChild) {
@@ -161,7 +161,7 @@
             next = n->nextSibling();
             n->setPreviousSibling(0);
             n->setNextSibling(0);
-            n->setParent(0);
+            n->setParentOrHostNode(0);
 
             if (!n->refCount()) {
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/dom/ElementShadow.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/ElementShadow.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/ElementShadow.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -53,7 +53,7 @@
     if (!shadowRoot)
         return true;
 
-    if (shadowRoot->shadowHost()) {
+    if (shadowRoot->host()) {
         ec = HIERARCHY_REQUEST_ERR;
         return false;
     }
@@ -74,7 +74,7 @@
     if (!validateShadowRoot(shadowHost->document(), shadowRoot.get(), ec))
         return;
 
-    shadowRoot->setShadowHost(shadowHost);
+    shadowRoot->setHost(shadowHost);
     ChildNodeInsertionNotifier(shadowHost).notify(shadowRoot.get());
 
     if (shadowHost->attached()) {
@@ -99,7 +99,7 @@
         if (oldRoot->attached())
             oldRoot->detach();
 
-        oldRoot->setShadowHost(0);
+        oldRoot->setHost(0);
         oldRoot->setPrev(0);
         oldRoot->setNext(0);
         shadowHost->document()->adoptIfNeeded(oldRoot.get());

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -36,6 +36,7 @@
 #include "InspectorInstrumentation.h"
 #include "MouseEvent.h"
 #include "ScopedEventQueue.h"
+#include "ShadowRoot.h"
 #include "WindowEventContext.h"
 #include <wtf/RefPtr.h>
 #include <wtf/UnusedParam.h>
@@ -125,7 +126,7 @@
 
     // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
     // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects
-    Element* shadowHostElement = referenceNode->treeScope()->rootNode()->shadowHost();
+    Element* shadowHostElement = toShadowRoot(referenceNode->treeScope()->rootNode())->host();
     // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do
     // have should be a use. The assert and following test is here to catch future shadow DOM changes
     // that do enable SVG in a shadow tree.
@@ -176,7 +177,6 @@
     gNodesDispatchingSimulatedClicks->remove(node);
 }
 
-
 void EventDispatcher::adjustRelatedTarget(Event* event, PassRefPtr<EventTarget> prpRelatedTarget)
 {
     if (!prpRelatedTarget)
@@ -216,7 +216,7 @@
     targetStack.append(originalTarget);
     while (true) {
         if (ancestorWalker.get()->isShadowRoot()) {
-            if (determineDispatchBehavior(event, ancestorWalker.get()) == StayInsideShadowDOM)
+            if (determineDispatchBehavior(event, toShadowRoot(ancestorWalker.get())) == StayInsideShadowDOM)
                 return;
             ancestorWalker.parentIncludingInsertionPointAndShadowRoot();
             if (!ancestorWalker.get())
@@ -347,7 +347,7 @@
     return m_ancestors.isEmpty() ? 0 : &m_ancestors.last();
 }
 
-EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, Node* shadowRoot)
+EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot)
 {
 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO)
     // Video-only full screen is a mode where we use the shadow DOM as an implementation
@@ -355,7 +355,7 @@
     if (Element* element = m_node->document()->webkitCurrentFullScreenElement()) {
         // FIXME: We assume that if the full screen element is a media element that it's
         // the video-only full screen. Both here and elsewhere. But that is probably wrong.
-        if (element->isMediaElement() && shadowRoot && shadowRoot->shadowHost() == element)
+        if (element->isMediaElement() && shadowRoot && shadowRoot->host() == element)
             return StayInsideShadowDOM;
     }
 #else

Modified: trunk/Source/WebCore/dom/EventDispatcher.h (117722 => 117723)


--- trunk/Source/WebCore/dom/EventDispatcher.h	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/EventDispatcher.h	2012-05-21 02:41:58 UTC (rev 117723)
@@ -40,7 +40,7 @@
 class Node;
 class PlatformKeyboardEvent;
 class PlatformMouseEvent;
-class PlatformWheelEvent;
+class ShadowRoot;
 class TreeScope;
 
 enum EventDispatchBehavior {
@@ -75,7 +75,8 @@
 private:
     EventDispatcher(Node*);
 
-    EventDispatchBehavior determineDispatchBehavior(Event*, Node* shadowRoot);
+    EventDispatchBehavior determineDispatchBehavior(Event*, ShadowRoot*);
+
     void ensureEventAncestors(Event*);
     const EventContext* topEventContext();
 

Modified: trunk/Source/WebCore/dom/Node.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/Node.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -497,17 +497,6 @@
     clearFlag(HasRareDataFlag);
 }
 
-Element* Node::shadowHost() const
-{
-    return toElement(isShadowRoot() ? parent() : 0);
-}
-
-void Node::setShadowHost(Element* host)
-{
-    ASSERT(!parentNode() && isShadowRoot());
-    setParent(host);
-}
-
 Node* Node::toNode()
 {
     return this;
@@ -1552,7 +1541,7 @@
         return 0;
 
     if (parent->isShadowRoot())
-        return parent->shadowHost();
+        return toShadowRoot(parent)->host();
 
     if (!parent->isElementNode())
         return 0;

Modified: trunk/Source/WebCore/dom/Node.h (117722 => 117723)


--- trunk/Source/WebCore/dom/Node.h	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/Node.h	2012-05-21 02:41:58 UTC (rev 117723)
@@ -229,6 +229,7 @@
     // Node's parent, shadow tree host.
     ContainerNode* parentOrHostNode() const;
     Element* parentOrHostElement() const;
+    void setParentOrHostNode(ContainerNode*);
     Node* highestAncestor() const;
 
     // Use when it's guaranteed to that shadowHost is 0.
@@ -236,9 +237,6 @@
     // Returns the parent node, but 0 if the parent node is a ShadowRoot.
     ContainerNode* nonShadowBoundaryParentNode() const;
 
-    Element* shadowHost() const;
-    void setShadowHost(Element*);
-
     bool selfOrAncestorHasDirAutoAttribute() const { return getFlag(SelfOrAncestorHasDirAutoFlag); }
     void setSelfOrAncestorHasDirAutoAttribute(bool flag) { setFlag(flag, SelfOrAncestorHasDirAutoFlag); }
 
@@ -776,6 +774,7 @@
     // This method is made private to ensure a compiler error on call sites that
     // don't follow this rule.
     using TreeShared<ContainerNode>::parent;
+    using TreeShared<ContainerNode>::setParent;
 
     void trackForDebugging();
 
@@ -833,6 +832,11 @@
     return getFlag(IsShadowRootFlag) ? 0 : parent();
 }
 
+inline void Node::setParentOrHostNode(ContainerNode* parent)
+{
+    setParent(parent);
+}
+
 inline ContainerNode* Node::parentOrHostNode() const
 {
     return parent();

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -66,7 +66,7 @@
 
     if (parent->isShadowRoot() && toShadowRoot(parent)->isYoungest()) {
         m_phase = AttachingShadowChild;
-        m_parentNodeForRenderingAndStyle = parent->shadowHost();
+        m_parentNodeForRenderingAndStyle = toShadowRoot(parent)->host();
         return;
     }
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (117722 => 117723)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2012-05-21 02:41:58 UTC (rev 117723)
@@ -27,6 +27,7 @@
 #ifndef ShadowRoot_h
 #define ShadowRoot_h
 
+#include "ContainerNode.h"
 #include "Document.h"
 #include "DocumentFragment.h"
 #include "Element.h"
@@ -68,7 +69,8 @@
     virtual bool applyAuthorStyles() const OVERRIDE;
     void setApplyAuthorStyles(bool);
 
-    Element* host() const { return shadowHost(); }
+    Element* host() const;
+    void setHost(Element*);
     ElementShadow* owner() const;
 
     String innerHTML() const;
@@ -104,6 +106,16 @@
     InsertionPoint* m_insertionPointAssignedTo;
 };
 
+inline Element* ShadowRoot::host() const
+{
+    return toElement(parentOrHostNode());
+}
+
+inline void ShadowRoot::setHost(Element* host)
+{
+    setParentOrHostNode(host);
+}
+
 inline InsertionPoint* ShadowRoot::assignedTo() const
 {
     return m_insertionPointAssignedTo;

Modified: trunk/Source/WebCore/dom/TreeScope.cpp (117722 => 117723)


--- trunk/Source/WebCore/dom/TreeScope.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/dom/TreeScope.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -39,6 +39,7 @@
 #include "HTMLNames.h"
 #include "Page.h"
 #include "RuntimeEnabledFeatures.h"
+#include "ShadowRoot.h"
 #include "TreeScopeAdopter.h"
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/CString.h>
@@ -221,7 +222,7 @@
     TreeScope* treeScope = node->treeScope();
 
     while (treeScope != this && treeScope != document) {
-        node = treeScope->rootNode()->shadowHost();
+        node = toShadowRoot(treeScope->rootNode())->host();
         treeScope = node->treeScope();
     }
     if (this != treeScope)

Modified: trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp (117722 => 117723)


--- trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -64,7 +64,7 @@
     if (!node)
         return false;
 
-    ASSERT(node->parentNode() == m_insertionPoint->shadowRoot()->shadowHost());
+    ASSERT(node->parentNode() == m_insertionPoint->shadowRoot()->host());
 
     if (m_insertionPoint->select().isNull() || m_insertionPoint->select().isEmpty())
         return true;

Modified: trunk/Source/WebCore/page/DragController.cpp (117722 => 117723)


--- trunk/Source/WebCore/page/DragController.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/page/DragController.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -63,6 +63,7 @@
 #include "ResourceRequest.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
+#include "ShadowRoot.h"
 #include "StylePropertySet.h"
 #include "Text.h"
 #include "TextEvent.h"
@@ -276,7 +277,7 @@
 
     // If this is a button inside of the a file input, move up to the file input.
     if (inputElement && inputElement->isTextButton() && inputElement->treeScope()->rootNode()->isShadowRoot())
-        inputElement = inputElement->treeScope()->rootNode()->shadowHost()->toInputElement();
+        inputElement = toShadowRoot(inputElement->treeScope()->rootNode())->host()->toInputElement();
 
     return inputElement && inputElement->isFileUpload() ? inputElement : 0;
 }

Modified: trunk/Source/WebCore/page/EventHandler.cpp (117722 => 117723)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -1599,7 +1599,7 @@
         // If a mouse event handler changes the input element type to one that has a widget associated,
         // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
         // event target node can't still be the shadow node.
-        if (targetNode(mev)->isShadowRoot() && targetNode(mev)->shadowHost()->hasTagName(inputTag)) {
+        if (targetNode(mev)->isShadowRoot() && toShadowRoot(targetNode(mev))->host()->hasTagName(inputTag)) {
             HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
             mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
         }
@@ -2092,11 +2092,11 @@
     if (!referenceNode || !referenceNode->isSVGElement())
         return 0;
 
-    Node* shadowTreeElement = referenceNode->shadowRoot();
-    if (!shadowTreeElement)
+    ShadowRoot* shadowRoot = referenceNode->shadowRoot();
+    if (!shadowRoot)
         return 0;
 
-    Element* shadowTreeParentElement = shadowTreeElement->shadowHost();
+    Element* shadowTreeParentElement = shadowRoot->host();
     if (!shadowTreeParentElement)
         return 0;
 
@@ -2250,7 +2250,7 @@
                 // focused if the user does a mouseup over it, however, because the mouseup
                 // will set a selection inside it, which will call setFocuseNodeIfNeeded.
                 ExceptionCode ec = 0;
-                Node* n = node->isShadowRoot() ? node->shadowHost() : node;
+                Node* n = node->isShadowRoot() ? toShadowRoot(node)->host() : node;
                 if (m_frame->selection()->isRange()
                     && m_frame->selection()->toNormalizedRange()->compareNode(n, ec) == Range::NODE_INSIDE
                     && n->isDescendantOf(m_frame->document()->focusedNode()))

Modified: trunk/Source/WebCore/page/FocusController.cpp (117722 => 117723)


--- trunk/Source/WebCore/page/FocusController.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/page/FocusController.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -110,7 +110,7 @@
 {
     Node* root = rootNode();
     if (root->isShadowRoot())
-        return root->shadowHost();
+        return toShadowRoot(root)->host();
     if (Frame* frame = root->document()->frame())
         return frame->ownerElement();
     return 0;

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (117722 => 117723)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -58,6 +58,7 @@
 #include "RenderView.h"
 #include "Settings.h"
 #include "SVGTextRunRenderingContext.h"
+#include "ShadowRoot.h"
 #include "TransformState.h"
 #include <wtf/StdLibExtras.h>
 
@@ -5773,7 +5774,7 @@
     if (node()->isRootEditableElement())
         return true;
     
-    if (node()->isShadowRoot() && (node()->shadowHost()->hasTagName(inputTag)))
+    if (node()->isShadowRoot() && toShadowRoot(node())->host()->hasTagName(inputTag))
         return true;
     
     return false;

Modified: trunk/Source/WebCore/svg/SVGElementInstance.h (117722 => 117723)


--- trunk/Source/WebCore/svg/SVGElementInstance.h	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/svg/SVGElementInstance.h	2012-05-21 02:41:58 UTC (rev 117723)
@@ -48,6 +48,8 @@
 
     virtual ~SVGElementInstance();
 
+    void setParentOrHostNode(SVGElementInstance* instance) { setParent(instance); }
+
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const;
 
@@ -143,6 +145,8 @@
 
 private:
     friend class SVGUseElement;
+    using TreeShared<SVGElementInstance>::parent;
+    using TreeShared<SVGElementInstance>::setParent;
 
     SVGElementInstance(SVGUseElement*, SVGUseElement*, PassRefPtr<SVGElement> originalElement);
 

Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (117722 => 117723)


--- trunk/Source/WebCore/svg/SVGStyledElement.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -42,6 +42,7 @@
 #include "SVGRenderSupport.h"
 #include "SVGSVGElement.h"
 #include "SVGUseElement.h"
+#include "ShadowRoot.h"
 #include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
 #include <wtf/StdLibExtras.h>
@@ -90,7 +91,7 @@
 
     // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title.
     if (isInShadowTree()) {
-        Element* shadowHostElement = treeScope()->rootNode()->shadowHost();
+        Element* shadowHostElement = toShadowRoot(treeScope()->rootNode())->host();
         // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do
         // have should be a use. The assert and following test is here to catch future shadow DOM changes
         // that do enable SVG in a shadow tree.

Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (117722 => 117723)


--- trunk/Source/WebCore/svg/SVGTRefElement.cpp	2012-05-21 02:25:55 UTC (rev 117722)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp	2012-05-21 02:41:58 UTC (rev 117723)
@@ -142,9 +142,9 @@
 
 void SVGShadowText::willRecalcTextStyle(StyleChange change)
 {
-    if (change != NoChange && parentNode()->shadowHost()) {
+    if (change != NoChange && parentNode()->isShadowRoot()) {
         if (renderer())
-            renderer()->setStyle(parentNode()->shadowHost()->renderer()->style());
+            renderer()->setStyle(toShadowRoot(parentNode())->host()->renderer()->style());
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to