• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TreeScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ASSERT

void TreeScope::setParentTreeScope(TreeScope& newParentScope)
{
    // A document node cannot be re-parented.
    ASSERT(!rootNode().isDocumentNode());

    newParentScope.guardRef();
    if (m_parentTreeScope)
        m_parentTreeScope->guardDeref();
    m_parentTreeScope = &newParentScope;
    setDocument(newParentScope.document());
}
开发者ID:kublaj,项目名称:blink,代码行数:11,代码来源:TreeScope.cpp


示例2: m_relatedNode

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

    if (&currentTreeScope->documentScope() != &targetTreeScope.documentScope()) {
        m_hasDifferentTreeRoot = true;
        m_retargetedRelatedNode = nullptr;
        return;
    }
    if (relatedNode.inDocument() != target.inDocument()) {
        m_hasDifferentTreeRoot = true;
        m_retargetedRelatedNode = moveOutOfAllShadowRoots(relatedNode);
        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;
    }

    bool lowestCommonAncestorIsDocumentScope = i + 1 == m_ancestorTreeScopes.size();
    if (lowestCommonAncestorIsDocumentScope && !relatedNode.inDocument() && !target.inDocument()) {
        Node& targetAncestorInDocumentScope = i ? *downcast<ShadowRoot>(m_ancestorTreeScopes[i - 1]->rootNode()).shadowHost() : target;
        Node& relatedNodeAncestorInDocumentScope = j ? *downcast<ShadowRoot>(targetTreeScopeAncestors[j - 1]->rootNode()).shadowHost() : relatedNode;
        if (targetAncestorInDocumentScope.rootNode() != relatedNodeAncestorInDocumentScope.rootNode()) {
            m_hasDifferentTreeRoot = true;
            m_retargetedRelatedNode = moveOutOfAllShadowRoots(relatedNode);
            return;
        }
    }

    m_lowestCommonAncestorIndex = i;
    m_retargetedRelatedNode = nodeInLowestCommonAncestor();
}
开发者ID:,项目名称:,代码行数:52,代码来源:


示例3: updateLabel

void HTMLLabelElement::updateLabel(TreeScope& scope, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue)
{
    if (!inDocument())
        return;

    if (oldForAttributeValue == newForAttributeValue)
        return;

    if (!oldForAttributeValue.isEmpty())
        scope.removeLabel(oldForAttributeValue, this);
    if (!newForAttributeValue.isEmpty())
        scope.addLabel(newForAttributeValue, this);
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:13,代码来源:HTMLLabelElement.cpp


示例4: ASSERT_WITH_SECURITY_IMPLICATION

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: collectTreeScopes

void RelatedNodeRetargeter::moveToNewTreeScope(TreeScope* previousTreeScope, TreeScope& newTreeScope)
{
    if (m_hasDifferentTreeRoot)
        return;

    auto& currentRelatedNodeScope = m_retargetedRelatedNode->treeScope();
    if (previousTreeScope != &currentRelatedNodeScope) {
        // currentRelatedNode is still outside our shadow tree. New tree scope may contain currentRelatedNode
        // but there is no need to re-target it. Moving into a slot (thereby a deeper shadow tree) doesn't matter.
        return;
    }

    bool enteredSlot = newTreeScope.parentTreeScope() == previousTreeScope;
    if (enteredSlot) {
        if (m_lowestCommonAncestorIndex) {
            if (m_ancestorTreeScopes.isEmpty())
                collectTreeScopes();
            bool relatedNodeIsInSlot = m_ancestorTreeScopes[m_lowestCommonAncestorIndex - 1] == &newTreeScope;
            if (relatedNodeIsInSlot) {
                m_lowestCommonAncestorIndex--;
                m_retargetedRelatedNode = nodeInLowestCommonAncestor();
                ASSERT(&newTreeScope == &m_retargetedRelatedNode->treeScope());
            }
        } else
            ASSERT(m_retargetedRelatedNode == &m_relatedNode);
    } else {
        ASSERT(previousTreeScope->parentTreeScope() == &newTreeScope);
        m_lowestCommonAncestorIndex++;
        ASSERT_WITH_SECURITY_IMPLICATION(m_ancestorTreeScopes.isEmpty() || m_lowestCommonAncestorIndex < m_ancestorTreeScopes.size());
        m_retargetedRelatedNode = downcast<ShadowRoot>(currentRelatedNodeScope.rootNode()).host();
        ASSERT(&newTreeScope == &m_retargetedRelatedNode->treeScope());
    }
}
开发者ID:,项目名称:,代码行数:33,代码来源:


示例6: ASSERT

void RelatedNodeRetargeter::collectTreeScopes()
{
    ASSERT(m_ancestorTreeScopes.isEmpty());
    for (TreeScope* currentTreeScope = &m_relatedNode.treeScope(); currentTreeScope; currentTreeScope = currentTreeScope->parentTreeScope())
        m_ancestorTreeScopes.append(currentTreeScope);
    ASSERT_WITH_SECURITY_IMPLICATION(!m_ancestorTreeScopes.isEmpty());
}
开发者ID:,项目名称:,代码行数:7,代码来源:


示例7: DCHECK

void TreeScope::setParentTreeScope(TreeScope& newParentScope) {
  // A document node cannot be re-parented.
  DCHECK(!rootNode().isDocumentNode());

  m_parentTreeScope = &newParentScope;
  setDocument(newParentScope.document());
}
开发者ID:ollie314,项目名称:chromium,代码行数:7,代码来源:TreeScope.cpp


示例8: UNUSED_PARAM

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


示例9: 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


示例10:

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


示例11: fragmentIdentifierFromIRIString

AtomicString SVGURIReference::fragmentIdentifierFromIRIString(
    const String& urlString,
    const TreeScope& treeScope) {
  SVGURLReferenceResolver resolver(urlString, treeScope.document());
  if (!resolver.isLocal())
    return emptyAtom;
  return resolver.fragmentIdentifier();
}
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:SVGURIReference.cpp


示例12: treeScope

void InsertionPoint::attach()
{
    TreeScope* scope = treeScope();
    if (scope->isShadowRoot()) {
        ShadowRoot* root = toShadowRoot(scope);
        if (doesSelectFromHostChildren()) {
            distributeHostChildren(root->tree());
            attachDistributedNode();
        } else if (!root->olderShadowRoot()->assignedTo()) {
            ASSERT(!root->olderShadowRoot()->attached());
            assignShadowRoot(root->olderShadowRoot());
            root->olderShadowRoot()->attach();
        }
    }

    HTMLElement::attach();
}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例13: ASSERT

EventTarget* EventPath::findRelatedNode(TreeScope& scope, RelatedTargetMap& relatedTargetMap)
{
    WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 32> parentTreeScopes;
    EventTarget* relatedNode = 0;
    for (TreeScope* current = &scope; current; current = current->olderShadowRootOrParentTreeScope()) {
        parentTreeScopes.append(current);
        RelatedTargetMap::const_iterator iter = relatedTargetMap.find(current);
        if (iter != relatedTargetMap.end() && iter->value) {
            relatedNode = iter->value;
            break;
        }
    }
    ASSERT(relatedNode);
    for (WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 32>::iterator iter = parentTreeScopes.begin(); iter < parentTreeScopes.end(); ++iter)
        relatedTargetMap.add(*iter, relatedNode);
    return relatedNode;
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:17,代码来源:EventPath.cpp


示例14: ASSERT

void TreeScope::setParentTreeScope(TreeScope& newParentScope)
{
    // A document node cannot be re-parented.
    ASSERT(!m_rootNode.isDocumentNode());

    m_parentTreeScope = &newParentScope;
    setDocumentScope(newParentScope.documentScope());
}
开发者ID:eocanha,项目名称:webkit,代码行数:8,代码来源:TreeScope.cpp


示例15: focusedFrameOwnerElement

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


示例16: rootNode

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


示例17: 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


示例18: fragmentIdentifierFromIRIString

AtomicString SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const TreeScope& treeScope)
{
    size_t start = url.find('#');
    if (start == kNotFound)
        return emptyAtom;

    const Document& document = treeScope.document();
    KURL base = start ? KURL(document.baseURI(), url.substring(0, start)) : document.baseURI();
    if (equalIgnoringFragmentIdentifier(base, document.url()))
        return AtomicString(url.substring(start + 1));

    return emptyAtom;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:13,代码来源:SVGURIReference.cpp


示例19: ASSERT

void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
{
    ASSERT(isMaster());
    ASSERT(!document().inStyleRecalc());

    if (!document().isActive())
        return;

    if (shouldUpdateDocumentStyleSheetCollection(updateMode))
        documentStyleSheetCollection()->updateActiveStyleSheets(this, updateMode);

    if (shouldUpdateShadowTreeStyleSheetCollection(updateMode)) {
        TreeScopeSet treeScopes = updateMode == FullStyleUpdate ? m_activeTreeScopes : m_dirtyTreeScopes;
        HashSet<TreeScope*> treeScopesRemoved;

        for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
            TreeScope* treeScope = *it;
            ASSERT(treeScope != m_document);
            ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
            ASSERT(collection);
            collection->updateActiveStyleSheets(this, updateMode);
            if (!collection->hasStyleSheetCandidateNodes()) {
                treeScopesRemoved.add(treeScope);
                // When removing TreeScope from ActiveTreeScopes,
                // its resolver should be destroyed by invoking resetAuthorStyle.
                ASSERT(!treeScope->scopedStyleResolver());
            }
        }
        m_activeTreeScopes.removeAll(treeScopesRemoved);
    }

    InspectorInstrumentation::activeStyleSheetsUpdated(m_document);
    m_usesRemUnits = documentStyleSheetCollection()->usesRemUnits();

    m_dirtyTreeScopes.clear();
    m_documentScopeDirty = false;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:37,代码来源:StyleEngine.cpp


示例20: moveToParentOrShadowHost

    Node* moveToParentOrShadowHost(Node& newTarget)
    {
        TreeScope& newTreeScope = newTarget.treeScope();
        if (&newTreeScope == m_currentTreeScope)
            return m_relatedNodeInCurrentTreeScope;

        if (m_currentTreeScope) {
            ASSERT(is<ShadowRoot>(m_currentTreeScope->rootNode()));
            ASSERT(&newTarget == downcast<ShadowRoot>(m_currentTreeScope->rootNode()).host());
            ASSERT(m_currentTreeScope->parentTreeScope() == &newTreeScope);
        }

        if (&newTreeScope == &m_relatedNodeTreeScope)
            m_relatedNodeInCurrentTreeScope = &m_relatedNode;
        else if (m_relatedNodeInCurrentTreeScope) {
            ASSERT(m_currentTreeScope);
            m_relatedNodeInCurrentTreeScope = &newTarget;
        } else {
            if (!m_currentTreeScope) {
                TreeScope* newTreeScopeAncestor = &newTreeScope;
                do {
                    m_relatedNodeInCurrentTreeScope = findHostOfTreeScopeInTargetTreeScope(m_relatedNodeTreeScope, *newTreeScopeAncestor);
                    newTreeScopeAncestor = newTreeScopeAncestor->parentTreeScope();
                    if (newTreeScopeAncestor == &m_relatedNodeTreeScope) {
                        m_relatedNodeInCurrentTreeScope = &m_relatedNode;
                        break;
                    }
                } while (newTreeScopeAncestor && !m_relatedNodeInCurrentTreeScope);
            }
            ASSERT(m_relatedNodeInCurrentTreeScope || findHostOfTreeScopeInTargetTreeScope(newTreeScope, m_relatedNodeTreeScope)
                || &newTreeScope.documentScope() != &m_relatedNodeTreeScope.documentScope());
        }

        m_currentTreeScope = &newTreeScope;

        return m_relatedNodeInCurrentTreeScope;
    }
开发者ID:sailei1,项目名称:webkit,代码行数:37,代码来源:EventDispatcher.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TreeServer类代码示例发布时间:2022-05-31
下一篇:
C++ TreePlanting类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap