Changeset 189239 in webkit


Ignore:
Timestamp:
Sep 1, 2015 5:54:43 PM (9 years ago)
Author:
rniwa@webkit.org
Message:

Rename ShadowRoot::hostElement to shadowRoot::host to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=148694

Reviewed by Chris Dumez.

Renamed ShadowRoot::hostElement to ShadowRoot::host to match the latest shadow DOM spec.
This will help us implementing shadow DOM in near future.

  • dom/ContainerNodeAlgorithms.cpp:

(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):

  • dom/Element.cpp:

(WebCore::Element::addShadowRoot):
(WebCore::Element::removeShadowRoot):

  • dom/EventDispatcher.cpp:

(WebCore::EventRelatedNodeResolver::moveToParentOrShadowHost):
(WebCore::EventRelatedNodeResolver::findHostOfTreeScopeInTargetTreeScope):
(WebCore::shouldEventCrossShadowBoundary):
(WebCore::EventPath::EventPath):

  • dom/Node.cpp:

(WebCore::Node::shadowHost):
(WebCore::Node::deprecatedShadowAncestorNode):
(WebCore::Node::parentOrShadowHostElement):

  • dom/NodeRenderingTraversal.cpp:

(WebCore::NodeRenderingTraversal::traverseParent):

  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::setInnerHTML):
(WebCore::ShadowRoot::setResetStyleInheritance):

  • dom/ShadowRoot.h:

(WebCore::Node::parentOrShadowHostNode):

  • dom/Text.cpp:

(WebCore::isSVGShadowText):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::focusedElement):

  • html/shadow/ContentDistributor.cpp:

(WebCore::ContentDistributor::ensureDistribution):

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::insertedInto):
(WebCore::InsertionPoint::removedFrom):

  • page/DragController.cpp:

(WebCore::asFileInput):

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMousePressEvent):

  • page/FocusController.cpp:

(WebCore::FocusNavigationScope::owner):

  • rendering/RenderLayer.cpp:

(WebCore::rendererForScrollbar):

  • style/StyleResolveTree.cpp:

(WebCore::Style::attachShadowRoot):
(WebCore::Style::resolveShadowTree):

  • svg/SVGElement.cpp:

(WebCore::SVGElement::correspondingUseElement):

Location:
trunk/Source/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r189230 r189239  
     12015-09-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Rename ShadowRoot::hostElement to shadowRoot::host to match the latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=148694
     5
     6        Reviewed by Chris Dumez.
     7
     8        Renamed ShadowRoot::hostElement to ShadowRoot::host to match the latest shadow DOM spec.
     9        This will help us implementing shadow DOM in near future.
     10
     11        * dom/ContainerNodeAlgorithms.cpp:
     12        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
     13        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):
     14        * dom/Element.cpp:
     15        (WebCore::Element::addShadowRoot):
     16        (WebCore::Element::removeShadowRoot):
     17        * dom/EventDispatcher.cpp:
     18        (WebCore::EventRelatedNodeResolver::moveToParentOrShadowHost):
     19        (WebCore::EventRelatedNodeResolver::findHostOfTreeScopeInTargetTreeScope):
     20        (WebCore::shouldEventCrossShadowBoundary):
     21        (WebCore::EventPath::EventPath):
     22        * dom/Node.cpp:
     23        (WebCore::Node::shadowHost):
     24        (WebCore::Node::deprecatedShadowAncestorNode):
     25        (WebCore::Node::parentOrShadowHostElement):
     26        * dom/NodeRenderingTraversal.cpp:
     27        (WebCore::NodeRenderingTraversal::traverseParent):
     28        * dom/ShadowRoot.cpp:
     29        (WebCore::ShadowRoot::setInnerHTML):
     30        (WebCore::ShadowRoot::setResetStyleInheritance):
     31        * dom/ShadowRoot.h:
     32        (WebCore::Node::parentOrShadowHostNode):
     33        * dom/Text.cpp:
     34        (WebCore::isSVGShadowText):
     35        * dom/TreeScope.cpp:
     36        (WebCore::TreeScope::focusedElement):
     37        * html/shadow/ContentDistributor.cpp:
     38        (WebCore::ContentDistributor::ensureDistribution):
     39        * html/shadow/InsertionPoint.cpp:
     40        (WebCore::InsertionPoint::insertedInto):
     41        (WebCore::InsertionPoint::removedFrom):
     42        * page/DragController.cpp:
     43        (WebCore::asFileInput):
     44        * page/EventHandler.cpp:
     45        (WebCore::EventHandler::handleMousePressEvent):
     46        * page/FocusController.cpp:
     47        (WebCore::FocusNavigationScope::owner):
     48        * rendering/RenderLayer.cpp:
     49        (WebCore::rendererForScrollbar):
     50        * style/StyleResolveTree.cpp:
     51        (WebCore::Style::attachShadowRoot):
     52        (WebCore::Style::resolveShadowTree):
     53        * svg/SVGElement.cpp:
     54        (WebCore::SVGElement::correspondingUseElement):
     55
    1562015-09-01  Chris Dumez  <cdumez@apple.com>
    257
  • trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp

    r185435 r189239  
    4545
    4646    if (RefPtr<ShadowRoot> root = downcast<Element>(node).shadowRoot()) {
    47         if (node.inDocument() && root->hostElement() == &node)
     47        if (node.inDocument() && root->host() == &node)
    4848            notifyNodeInsertedIntoDocument(*root, postInsertionNotificationTargets);
    4949    }
     
    7979
    8080    if (RefPtr<ShadowRoot> root = downcast<Element>(node).shadowRoot()) {
    81         if (!node.inDocument() && root->hostElement() == &node)
     81        if (!node.inDocument() && root->host() == &node)
    8282            notifyNodeRemovedFromDocument(*root.get());
    8383    }
  • trunk/Source/WebCore/dom/Element.cpp

    r188920 r189239  
    16321632    ensureElementRareData().setShadowRoot(WTF::move(newShadowRoot));
    16331633
    1634     shadowRoot.setHostElement(this);
     1634    shadowRoot.setHost(this);
    16351635    shadowRoot.setParentTreeScope(&treeScope());
    16361636    shadowRoot.distributor().didShadowBoundaryChange(this);
     
    16611661    elementRareData()->clearShadowRoot();
    16621662
    1663     oldRoot->setHostElement(0);
     1663    oldRoot->setHost(0);
    16641664    oldRoot->setParentTreeScope(&document());
    16651665
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r185232 r189239  
    144144        if (m_currentTreeScope) {
    145145            ASSERT(is<ShadowRoot>(m_currentTreeScope->rootNode()));
    146             ASSERT(&newTarget == downcast<ShadowRoot>(m_currentTreeScope->rootNode()).hostElement());
     146            ASSERT(&newTarget == downcast<ShadowRoot>(m_currentTreeScope->rootNode()).host());
    147147            ASSERT(m_currentTreeScope->parentTreeScope() == &newTreeScope);
    148148        }
     
    185185            }
    186186            if (is<ShadowRoot>(scope->rootNode()))
    187                 previousHost = downcast<ShadowRoot>(scope->rootNode()).hostElement();
     187                previousHost = downcast<ShadowRoot>(scope->rootNode()).host();
    188188            else
    189189                ASSERT_WITH_SECURITY_IMPLICATION(!scope->parentTreeScope());
     
    386386            // FIXME: We assume that if the full screen element is a media element that it's
    387387            // the video-only full screen. Both here and elsewhere. But that is probably wrong.
    388             if (element->isMediaElement() && shadowRoot.hostElement() == element)
     388            if (element->isMediaElement() && shadowRoot.host() == element)
    389389                return false;
    390390        }
     
    445445        if (!node || !shouldEventCrossShadowBoundary(event, downcast<ShadowRoot>(*node), *target))
    446446            return;
    447         node = downcast<ShadowRoot>(*node).hostElement();
     447        node = downcast<ShadowRoot>(*node).host();
    448448    }
    449449}
  • trunk/Source/WebCore/dom/Node.cpp

    r188917 r189239  
    10351035{
    10361036    if (ShadowRoot* root = containingShadowRoot())
    1037         return root->hostElement();
     1037        return root->host();
    10381038    return 0;
    10391039}
     
    10421042{
    10431043    if (ShadowRoot* root = containingShadowRoot())
    1044         return root->hostElement();
     1044        return root->host();
    10451045
    10461046    return const_cast<Node*>(this);
     
    10871087
    10881088    if (is<ShadowRoot>(*parent))
    1089         return downcast<ShadowRoot>(*parent).hostElement();
     1089        return downcast<ShadowRoot>(*parent).host();
    10901090
    10911091    if (!is<Element>(*parent))
  • trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp

    r174225 r189239  
    134134
    135135    if (is<ShadowRoot>(*parent))
    136         return shadowRootCrossing == CrossShadowRoot ? downcast<ShadowRoot>(parent)->hostElement() : parent;
     136        return shadowRootCrossing == CrossShadowRoot ? downcast<ShadowRoot>(parent)->host() : parent;
    137137
    138138    if (is<InsertionPoint>(*parent)) {
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r179143 r189239  
    9292    }
    9393
    94     if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, hostElement(), AllowScriptingContent, ec))
     94    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), AllowScriptingContent, ec))
    9595        replaceChildrenWithFragment(*this, fragment.release(), ec);
    9696}
     
    118118    if (value != m_resetStyleInheritance) {
    119119        m_resetStyleInheritance = value;
    120         if (hostElement())
     120        if (host())
    121121            setNeedsStyleRecalc();
    122122    }
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r177751 r189239  
    5454    void setResetStyleInheritance(bool);
    5555
    56     Element* hostElement() const { return m_hostElement; }
    57     void setHostElement(Element* hostElement) { m_hostElement = hostElement; }
     56    Element* host() const { return m_hostElement; }
     57    void setHost(Element* hostElement) { m_hostElement = hostElement; }
    5858
    5959    String innerHTML() const;
     
    6767
    6868    ContentDistributor& distributor() { return m_distributor; }
    69     void invalidateDistribution() { m_distributor.invalidateDistribution(hostElement()); }
     69    void invalidateDistribution() { m_distributor.invalidateDistribution(m_hostElement); }
    7070
    7171    virtual void removeAllEventListeners() override;
     
    8080
    8181    // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=88834
    82     bool isOrphan() const { return !hostElement(); }
     82    bool isOrphan() const { return !m_hostElement; }
    8383
    8484    unsigned m_resetStyleInheritance : 1;
     
    106106    ASSERT(isMainThreadOrGCThread());
    107107    if (is<ShadowRoot>(*this))
    108         return downcast<ShadowRoot>(*this).hostElement();
     108        return downcast<ShadowRoot>(*this).host();
    109109    return parentNode();
    110110}
  • trunk/Source/WebCore/dom/Text.cpp

    r187022 r189239  
    176176    Node* parentNode = text->parentNode();
    177177    ASSERT(parentNode);
    178     return is<ShadowRoot>(*parentNode) && downcast<ShadowRoot>(*parentNode).hostElement()->hasTagName(SVGNames::trefTag);
     178    return is<ShadowRoot>(*parentNode) && downcast<ShadowRoot>(*parentNode).host()->hasTagName(SVGNames::trefTag);
    179179}
    180180
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r185109 r189239  
    314314    TreeScope* treeScope = &element->treeScope();
    315315    while (treeScope != this && treeScope != &document) {
    316         element = downcast<ShadowRoot>(treeScope->rootNode()).hostElement();
     316        element = downcast<ShadowRoot>(treeScope->rootNode()).host();
    317317        treeScope = &element->treeScope();
    318318    }
  • trunk/Source/WebCore/html/shadow/ContentDistributor.cpp

    r174067 r189239  
    127127
    128128    Vector<ShadowRoot*, 8> shadowRoots;
    129     for (Element* current = shadowRoot->hostElement(); current; current = current->shadowHost()) {
     129    for (Element* current = shadowRoot->host(); current; current = current->shadowHost()) {
    130130        ShadowRoot* currentRoot = current->shadowRoot();
    131131        if (!currentRoot->distributor().needsDistribution())
     
    135135
    136136    for (size_t i = shadowRoots.size(); i > 0; --i)
    137         shadowRoots[i - 1]->distributor().distribute(shadowRoots[i - 1]->hostElement());
     137        shadowRoots[i - 1]->distributor().distribute(shadowRoots[i - 1]->host());
    138138}
    139139
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r161205 r189239  
    8686
    8787    if (ShadowRoot* root = containingShadowRoot()) {
    88         root->distributor().didShadowBoundaryChange(root->hostElement());
     88        root->distributor().didShadowBoundaryChange(root->host());
    8989        root->distributor().invalidateInsertionPointList();
    9090    }
     
    9999        root = insertionPoint.containingShadowRoot();
    100100
    101     if (root && root->hostElement()) {
     101    if (root && root->host()) {
    102102        root->invalidateDistribution();
    103103        root->distributor().invalidateInsertionPointList();
  • trunk/Source/WebCore/page/DragController.cpp

    r185231 r189239  
    291291    // If this is a button inside of the a file input, move up to the file input.
    292292    if (inputElement && inputElement->isTextButton() && is<ShadowRoot>(inputElement->treeScope().rootNode()))
    293         inputElement = downcast<ShadowRoot>(inputElement->treeScope().rootNode()).hostElement()->toInputElement();
     293        inputElement = downcast<ShadowRoot>(inputElement->treeScope().rootNode()).host()->toInputElement();
    294294
    295295    return inputElement && inputElement->isFileUpload() ? inputElement : 0;
  • trunk/Source/WebCore/page/EventHandler.cpp

    r188990 r189239  
    18171817        // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
    18181818        // event target node can't still be the shadow node.
    1819         if (is<ShadowRoot>(*mouseEvent.targetNode()) && is<HTMLInputElement>(*downcast<ShadowRoot>(*mouseEvent.targetNode()).hostElement()))
     1819        if (is<ShadowRoot>(*mouseEvent.targetNode()) && is<HTMLInputElement>(*downcast<ShadowRoot>(*mouseEvent.targetNode()).host()))
    18201820            mouseEvent = m_frame.document()->prepareMouseEvent(HitTestRequest(), documentPoint, platformMouseEvent);
    18211821
  • trunk/Source/WebCore/page/FocusController.cpp

    r186256 r189239  
    8484    ContainerNode* root = rootNode();
    8585    if (is<ShadowRoot>(*root))
    86         return downcast<ShadowRoot>(*root).hostElement();
     86        return downcast<ShadowRoot>(*root).host();
    8787    if (Frame* frame = root->document().frame())
    8888        return frame->ownerElement();
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r189144 r189239  
    30643064        if (ShadowRoot* shadowRoot = element->containingShadowRoot()) {
    30653065            if (shadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
    3066                 return shadowRoot->hostElement()->renderer();
     3066                return shadowRoot->host()->renderer();
    30673067        }
    30683068    }
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r187496 r189239  
    386386static void attachShadowRoot(ShadowRoot& shadowRoot)
    387387{
    388     ASSERT(shadowRoot.hostElement());
    389     ASSERT(shadowRoot.hostElement()->renderer());
    390 
    391     auto& renderer = *shadowRoot.hostElement()->renderer();
     388    ASSERT(shadowRoot.host());
     389    ASSERT(shadowRoot.host()->renderer());
     390
     391    auto& renderer = *shadowRoot.host()->renderer();
    392392    RenderTreePosition renderTreePosition(renderer);
    393393    attachChildren(shadowRoot, renderer.style(), renderTreePosition);
     
    679679static void resolveShadowTree(ShadowRoot& shadowRoot, Element& host, Style::Change change)
    680680{
    681     ASSERT(shadowRoot.hostElement() == &host);
     681    ASSERT(shadowRoot.host() == &host);
    682682    ASSERT(host.renderer());
    683683    RenderTreePosition renderTreePosition(*host.renderer());
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r187504 r189239  
    491491    if (root->type() != ShadowRoot::UserAgentShadowRoot)
    492492        return nullptr;
    493     auto* host = root->hostElement();
     493    auto* host = root->host();
    494494    if (!is<SVGUseElement>(host))
    495495        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.