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


C++ ShadowRoot::lazyReattachIfAttached方法代码示例

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


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

示例1: appendShadowRoot

ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRootType type)
{
    EventDispatchForbiddenScope assertNoEventDispatch;
    ScriptForbiddenScope forbidScript;

    if (type == ShadowRootType::V0 && m_shadowRoot) {
        DCHECK_EQ(m_shadowRoot->type(), ShadowRootType::V0);
        Deprecation::countDeprecation(shadowHost.document(), UseCounter::ElementCreateShadowRootMultiple);
    }

    if (m_shadowRoot) {
        // TODO(hayato): Is the order, from the youngest to the oldest, important?
        for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShadowRoot())
            root->lazyReattachIfAttached();
    }

    ShadowRoot* shadowRoot = ShadowRoot::create(shadowHost.document(), type);
    shadowRoot->setParentOrShadowHostNode(&shadowHost);
    shadowRoot->setParentTreeScope(shadowHost.treeScope());
    appendShadowRoot(*shadowRoot);
    setNeedsDistributionRecalc();

    shadowRoot->insertedInto(&shadowHost);
    shadowHost.setChildNeedsStyleRecalc();
    shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Shadow));

    InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot);

    return *shadowRoot;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: if

ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRootType type)
{
    EventDispatchForbiddenScope assertNoEventDispatch;
    ScriptForbiddenScope forbidScript;

    if (type == ShadowRootType::V0) {
        if (m_shadowRoots.isEmpty()) {
            shadowHost.willAddFirstAuthorShadowRoot();
        } else if (m_shadowRoots.head()->type() == ShadowRootType::UserAgent) {
            shadowHost.willAddFirstAuthorShadowRoot();
            UseCounter::countDeprecation(shadowHost.document(), UseCounter::ElementCreateShadowRootMultipleWithUserAgentShadowRoot);
        } else {
            UseCounter::countDeprecation(shadowHost.document(), UseCounter::ElementCreateShadowRootMultiple);
        }
    } else if (type == ShadowRootType::Open || type == ShadowRootType::Closed) {
        shadowHost.willAddFirstAuthorShadowRoot();
    }

    for (ShadowRoot* root = m_shadowRoots.head(); root; root = root->olderShadowRoot())
        root->lazyReattachIfAttached();

    RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.document(), type);
    shadowRoot->setParentOrShadowHostNode(&shadowHost);
    shadowRoot->setParentTreeScope(shadowHost.treeScope());
    m_shadowRoots.push(shadowRoot.get());
    setNeedsDistributionRecalc();

    shadowRoot->insertedInto(&shadowHost);
    shadowHost.setChildNeedsStyleRecalc();
    shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Shadow));

    InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());

    return *shadowRoot;
}
开发者ID:mtucker6784,项目名称:chromium,代码行数:35,代码来源:ElementShadow.cpp

示例3: ChildNodeInsertionNotifier

ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::ShadowRootType type)
{
    RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.document(), type);

    for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())
        root->lazyReattachIfAttached();

    shadowRoot->setParentOrShadowHostNode(&shadowHost);
    shadowRoot->setParentTreeScope(shadowHost.treeScope());
    m_shadowRoots.push(shadowRoot.get());
    ChildNodeInsertionNotifier(shadowHost).notify(*shadowRoot);
    setNeedsDistributionRecalc();

    // addShadowRoot() affects apply-author-styles. However, we know that the youngest shadow root has not had any children yet.
    // The youngest shadow root's apply-author-styles is default (false). So we can just set m_applyAuthorStyles false.
    m_applyAuthorStyles = false;

    shadowHost.didAddShadowRoot(*shadowRoot);
    InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());

    ASSERT(m_shadowRoots.head());
    ASSERT(shadowRoot.get() == m_shadowRoots.head());
    return *m_shadowRoots.head();
}
开发者ID:Mihiri,项目名称:blink,代码行数:24,代码来源:ElementShadow.cpp


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