2010-12-21 Dominic Cooney <dominicc@google.com>

        Reviewed by Adam Barth.

        Rename Node::isShadowNode to isShadowRoot
        https://bugs.webkit.org/show_bug.cgi?id=51060

        The method gets whether the node is the root of a shadow tree;
        renamed to reflect intent.

        A simple rename--no new tests needed.

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::initForStyleResolve):
        (WebCore::CSSStyleSelector::SelectorChecker::checkSelector):
        * dom/Node.cpp:
        (WebCore::Node::shadowTreeRootNode):
        (WebCore::Node::isInShadowTree):
        (WebCore::eventTargetRespectingSVGTargetRules):
        (WebCore::Node::getEventAncestors):
        * dom/Node.h:
        (WebCore::Node::isShadowRoot):
        * dom/Range.cpp:
        (WebCore::Range::checkNodeBA):
        * page/DragController.cpp:
        (WebCore::asFileInput):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMousePressEvent):
        (WebCore::EventHandler::dispatchMouseEvent):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::hasLineIfEmpty):
        * rendering/TextControlInnerElements.cpp:
        (WebCore::TextControlInnerElement::attachInnerElement):
        * svg/SVGStyledElement.cpp:
        (WebCore::SVGStyledElement::title):
        * svg/SVGUseElement.cpp:
        (WebCore::ShadowTreeUpdateBlocker::while):
        * svg/animation/SVGSMILElement.cpp:
        (WebCore::SVGSMILElement::insertedIntoDocument):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8647d420
2010-12-21 Dominic Cooney <dominicc@google.com>
Reviewed by Adam Barth.
Rename Node::isShadowNode to isShadowRoot
https://bugs.webkit.org/show_bug.cgi?id=51060
The method gets whether the node is the root of a shadow tree;
renamed to reflect intent.
A simple rename--no new tests needed.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::initForStyleResolve):
(WebCore::CSSStyleSelector::SelectorChecker::checkSelector):
* dom/Node.cpp:
(WebCore::Node::shadowTreeRootNode):
(WebCore::Node::isInShadowTree):
(WebCore::eventTargetRespectingSVGTargetRules):
(WebCore::Node::getEventAncestors):
* dom/Node.h:
(WebCore::Node::isShadowRoot):
* dom/Range.cpp:
(WebCore::Range::checkNodeBA):
* page/DragController.cpp:
(WebCore::asFileInput):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::dispatchMouseEvent):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::hasLineIfEmpty):
* rendering/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::attachInnerElement):
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::title):
* svg/SVGUseElement.cpp:
(WebCore::ShadowTreeUpdateBlocker::while):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::insertedIntoDocument):
2010-12-20 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
Reviewed by Andreas Kling.
......
......@@ -761,7 +761,7 @@ inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* paren
m_parentNode = e ? e->parentNode() : 0;
#if ENABLE(SVG)
if (!m_parentNode && e && e->isSVGElement() && e->isShadowNode())
if (!m_parentNode && e && e->isSVGElement() && e->isShadowRoot())
m_parentNode = e->shadowParentNode();
#endif
......@@ -1892,7 +1892,7 @@ CSSStyleSelector::SelectorMatch CSSStyleSelector::SelectorChecker::checkSelector
#if ENABLE(SVG)
// Spec: CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree
// because its contents are not part of the formal document structure.
if (e->isSVGElement() && e->isShadowNode())
if (e->isSVGElement() && e->isShadowRoot())
return SelectorFailsCompletely;
#endif
......
......@@ -1457,7 +1457,7 @@ Node* Node::shadowTreeRootNode()
{
Node* root = this;
while (root) {
if (root->isShadowNode())
if (root->isShadowRoot())
return root;
root = root->parentNodeGuaranteedHostFree();
}
......@@ -1467,7 +1467,7 @@ Node* Node::shadowTreeRootNode()
bool Node::isInShadowTree()
{
for (Node* n = this; n; n = n->parentNode())
if (n->isShadowNode())
if (n->isShadowRoot())
return true;
return false;
}
......@@ -2522,7 +2522,7 @@ static inline EventTarget* eventTargetRespectingSVGTargetRules(Node* referenceNo
// 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
for (Node* n = referenceNode; n; n = n->parentNode()) {
if (!n->isShadowNode() || !n->isSVGElement())
if (!n->isShadowRoot() || !n->isSVGElement())
continue;
ContainerNode* shadowTreeParentElement = n->shadowParentNode();
......@@ -2545,7 +2545,7 @@ void Node::getEventAncestors(Vector<EventContext>& ancestors, EventTarget* origi
Node* ancestor = this;
bool shouldSkipNextAncestor = false;
while (true) {
if (ancestor->isShadowNode()) {
if (ancestor->isShadowRoot()) {
if (behavior == StayInsideShadowDOM)
return;
ancestor = ancestor->shadowParentNode();
......@@ -2559,7 +2559,7 @@ void Node::getEventAncestors(Vector<EventContext>& ancestors, EventTarget* origi
#if ENABLE(SVG)
// Skip SVGShadowTreeRootElement.
shouldSkipNextAncestor = ancestor->isSVGElement() && ancestor->isShadowNode();
shouldSkipNextAncestor = ancestor->isSVGElement() && ancestor->isShadowRoot();
if (shouldSkipNextAncestor)
continue;
#endif
......
......@@ -205,7 +205,7 @@ public:
bool isCommentNode() const { return getFlag(IsCommentFlag); }
virtual bool isCharacterDataNode() const { return false; }
bool isDocumentNode() const;
bool isShadowNode() const { return getFlag(IsShadowRootFlag); }
bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
// FIXME: Eliminate all uses, fold into shadowHost.
ContainerNode* shadowParentNode() const;
Node* shadowAncestorNode();
......
......@@ -1188,7 +1188,7 @@ void Range::checkNodeBA(Node* n, ExceptionCode& ec) const
case Node::PROCESSING_INSTRUCTION_NODE:
case Node::TEXT_NODE:
case Node::XPATH_NAMESPACE_NODE:
if (root->isShadowNode())
if (root->isShadowRoot())
break;
ec = RangeException::INVALID_NODE_TYPE_ERR;
return;
......
......@@ -255,7 +255,7 @@ static HTMLInputElement* asFileInput(Node* node)
// The button for a FILE input is a sub element with no set input type
// In order to get around this problem we assume any non-FILE input element
// is this internal button, and try querying the shadow parent node.
if (node->hasTagName(HTMLNames::inputTag) && node->isShadowNode() && !static_cast<HTMLInputElement*>(node)->isFileUpload())
if (node->hasTagName(HTMLNames::inputTag) && node->isShadowRoot() && !static_cast<HTMLInputElement*>(node)->isFileUpload())
node = node->shadowParentNode();
if (!node || !node->hasTagName(HTMLNames::inputTag))
......
......@@ -1383,7 +1383,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
// 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 (mev.targetNode()->isShadowNode() && mev.targetNode()->shadowParentNode()->hasTagName(inputTag)) {
if (mev.targetNode()->isShadowRoot() && mev.targetNode()->shadowParentNode()->hasTagName(inputTag)) {
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
}
......@@ -1913,7 +1913,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
// 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->isShadowNode() ? node->shadowParentNode() : node;
Node* n = node->isShadowRoot() ? node->shadowParentNode() : node;
if (m_frame->selection()->isRange()
&& m_frame->selection()->toNormalizedRange()->compareNode(n, ec) == Range::NODE_INSIDE
&& n->isDescendantOf(m_frame->document()->focusedNode()))
......
......@@ -4901,7 +4901,7 @@ bool RenderBlock::hasLineIfEmpty() const
if (node()->isContentEditable() && node()->rootEditableElement() == node())
return true;
if (node()->isShadowNode() && (node()->shadowParentNode()->hasTagName(inputTag)))
if (node()->isShadowRoot() && (node()->shadowParentNode()->hasTagName(inputTag)))
return true;
return false;
......
......@@ -104,7 +104,7 @@ void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render
setInDocument();
// For elements not yet in shadow DOM, add the node to the DOM normally.
if (!isShadowNode()) {
if (!isShadowRoot()) {
// FIXME: This code seems very wrong. Why are we magically adding |this| to the DOM here?
// We shouldn't be calling parser API methods outside of the parser!
parent->deprecatedParserAddChild(this);
......
......@@ -80,7 +80,7 @@ String SVGStyledElement::title() const
// Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title.
Node* parent = const_cast<SVGStyledElement*>(this);
while (parent) {
if (!parent->isShadowNode()) {
if (!parent->isShadowRoot()) {
parent = parent->parentNodeGuaranteedHostFree();
continue;
}
......
......@@ -493,12 +493,12 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR
// The will be expanded soon anyway - see expandUseElementsInShadowTree().
ContainerNode* parent = parentNode();
while (parent) {
if (parent->isShadowNode())
if (parent->isShadowRoot())
return;
parent = parent->parentNodeGuaranteedHostFree();
}
SVGElement* target = 0;
if (targetElement && targetElement->isSVGElement())
target = static_cast<SVGElement*>(targetElement);
......
......@@ -148,7 +148,7 @@ void SVGSMILElement::insertedIntoDocument()
#ifndef NDEBUG
// Verify we are not in <use> instance tree.
for (ContainerNode* n = this; n; n = n->parentNode())
ASSERT(!n->isShadowNode());
ASSERT(!n->isShadowRoot());
#endif
SVGSVGElement* owner = ownerSVGElement();
if (!owner)
......@@ -961,4 +961,3 @@ void SVGSMILElement::beginByLinkActivation()
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment