当前位置: 首页>>代码示例>>C++>>正文


C++ TreeScope::rootNode方法代码示例

本文整理汇总了C++中TreeScope::rootNode方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeScope::rootNode方法的具体用法?C++ TreeScope::rootNode怎么用?C++ TreeScope::rootNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeScope的用法示例。


在下文中一共展示了TreeScope::rootNode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doesSelectFromHostChildren

bool HTMLShadowElement::doesSelectFromHostChildren() const
{
    TreeScope* scope = treeScope();

    if (scope->rootNode()->isShadowRoot())
        return toShadowRoot(scope->rootNode())->isOldest();
    return false;
}
开发者ID:conioh,项目名称:os-design,代码行数:8,代码来源:HTMLShadowElement.cpp

示例2: add

void DocumentOrderedMap::add(const AtomicStringImpl& key, Element& element, const TreeScope& treeScope)
{
    UNUSED_PARAM(treeScope);
    ASSERT_WITH_SECURITY_IMPLICATION(element.isInTreeScope());
    ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode().containsIncludingShadowDOM(&element));

    if (!element.isInTreeScope())
        return;
    Map::AddResult addResult = m_map.ensure(&key, [&element] {
        return MapEntry(&element);
    });
    MapEntry& entry = addResult.iterator->value;

#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
    ASSERT_WITH_SECURITY_IMPLICATION(!entry.registeredElements.contains(&element));
    entry.registeredElements.add(&element);
#endif

    if (addResult.isNewEntry)
        return;

    ASSERT_WITH_SECURITY_IMPLICATION(entry.count);
    entry.element = nullptr;
    entry.count++;
    entry.orderedList.clear();
}
开发者ID:eocanha,项目名称:webkit,代码行数:26,代码来源:DocumentOrderedMap.cpp

示例3:

TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope)
    : m_treeScope(treeScope)
    , m_rootNode(treeScope.rootNode())
    , m_containingClosedShadowTree(nullptr)
    , m_preOrder(-1)
    , m_postOrder(-1)
{
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:8,代码来源:TreeScopeEventContext.cpp

示例4: add

void DocumentOrderedMap::add(const AtomicStringImpl& key, Element& element, const TreeScope& treeScope)
{
    ASSERT_WITH_SECURITY_IMPLICATION(element.isInTreeScope());
    ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode()->containsIncludingShadowDOM(&element));
    if (!element.isInTreeScope() || &element.document() != treeScope.documentScope())
        return;
    Map::AddResult addResult = m_map.add(&key, MapEntry(&element));
    if (addResult.isNewEntry)
        return;

    MapEntry& entry = addResult.iterator->value;
    ASSERT_WITH_SECURITY_IMPLICATION(entry.count);
    entry.element = 0;
    entry.count++;
    entry.orderedList.clear();
}
开发者ID:ewmailing,项目名称:webkit,代码行数:16,代码来源:DocumentOrderedMap.cpp

示例5: adjustPositionForStart

static Position adjustPositionForStart(const Position& currentPosition, Node* endContainerNode)
{
    TreeScope* treeScope = endContainerNode->treeScope();

    ASSERT(currentPosition.containerNode()->treeScope() != treeScope);
    
    if (Node* ancestor = treeScope->ancestorInThisScope(currentPosition.containerNode())) {
        if (ancestor->contains(endContainerNode))
            return positionBeforeNode(ancestor);
        return positionAfterNode(ancestor);
    }

    if (Node* firstChild = treeScope->rootNode()->firstChild())
        return positionBeforeNode(firstChild);

    return Position();
}
开发者ID:dog-god,项目名称:iptv,代码行数:17,代码来源:VisibleSelection.cpp

示例6: focusedElement

Element* TreeScope::focusedElement()
{
    Document& document = m_rootNode.document();
    Element* element = document.focusedElement();

    if (!element && document.page())
        element = focusedFrameOwnerElement(document.page()->focusController().focusedFrame(), document.frame());
    if (!element)
        return nullptr;
    TreeScope* treeScope = &element->treeScope();
    while (treeScope != this && treeScope != &document) {
        element = downcast<ShadowRoot>(treeScope->rootNode()).host();
        treeScope = &element->treeScope();
    }
    if (this != treeScope)
        return nullptr;
    return element;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:18,代码来源:TreeScope.cpp

示例7: focusedElement

Element* TreeScope::focusedElement()
{
    Document* document = rootNode()->document();
    Element* element = document->focusedElement();

    if (!element && document->page())
        element = focusedFrameOwnerElement(document->page()->focusController().focusedFrame(), document->frame());
    if (!element)
        return 0;
    TreeScope* treeScope = element->treeScope();
    while (treeScope != this && treeScope != document) {
        element = toShadowRoot(treeScope->rootNode())->hostElement();
        treeScope = element->treeScope();
    }
    if (this != treeScope)
        return 0;
    return element;
}
开发者ID:emandino,项目名称:webkit,代码行数:18,代码来源:TreeScope.cpp

示例8: RelatedNodeRetargeter

    RelatedNodeRetargeter(Node& relatedNode, TreeScope& targetTreeScope)
        : m_relatedNode(relatedNode)
        , m_retargetedRelatedNode(&relatedNode)
    {
        TreeScope* currentTreeScope = &m_relatedNode.treeScope();
        if (LIKELY(currentTreeScope == &targetTreeScope))
            return;

        if (&currentTreeScope->documentScope() != &targetTreeScope.documentScope()) {
            m_hasDifferentTreeRoot = true;
            m_retargetedRelatedNode = nullptr;
            return;
        }
        if (relatedNode.inDocument() != targetTreeScope.rootNode().inDocument()) {
            m_hasDifferentTreeRoot = true;
            while (m_retargetedRelatedNode->isInShadowTree())
                m_retargetedRelatedNode = downcast<ShadowRoot>(m_retargetedRelatedNode->treeScope().rootNode()).host();
            return;
        }

        collectTreeScopes();

        // FIXME: We should collect this while constructing the event path.
        Vector<TreeScope*, 8> targetTreeScopeAncestors;
        for (TreeScope* currentTreeScope = &targetTreeScope; currentTreeScope; currentTreeScope = currentTreeScope->parentTreeScope())
            targetTreeScopeAncestors.append(currentTreeScope);
        ASSERT_WITH_SECURITY_IMPLICATION(!targetTreeScopeAncestors.isEmpty());

        unsigned i = m_ancestorTreeScopes.size();
        unsigned j = targetTreeScopeAncestors.size();
        ASSERT_WITH_SECURITY_IMPLICATION(m_ancestorTreeScopes.last() == targetTreeScopeAncestors.last());
        while (m_ancestorTreeScopes[i - 1] == targetTreeScopeAncestors[j - 1]) {
            i--;
            j--;
            if (!i || !j)
                break;
        }

        m_lowestCommonAncestorIndex = i;
        m_retargetedRelatedNode = nodeInLowestCommonAncestor();
    }
开发者ID:sailei1,项目名称:webkit,代码行数:41,代码来源:EventDispatcher.cpp

示例9: TreeScopeStyleSheetCollection

DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope)
    : TreeScopeStyleSheetCollection(treeScope)
{
    ASSERT(treeScope.rootNode() == treeScope.rootNode().document());
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:5,代码来源:DocumentStyleSheetCollection.cpp


注:本文中的TreeScope::rootNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。