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


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

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


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

示例1: findHostChildWithSameSlotName

bool HTMLSlotElement::findHostChildWithSameSlotName() const {
  ShadowRoot* root = containingShadowRoot();
  DCHECK(root);
  DCHECK(root->isV1());
  SlotAssignment& assignment = root->ensureSlotAssignment();
  return assignment.findHostChildBySlotName(name());
}
开发者ID:ollie314,项目名称:chromium,代码行数:7,代码来源:HTMLSlotElement.cpp

示例2: removedFrom

void HTMLSlotElement::removedFrom(ContainerNode* insertionPoint) {
  // `removedFrom` is called after the node is removed from the tree.
  // That means:
  // 1. If this slot is still in a tree scope, it means the slot has been in a
  // shadow tree. An inclusive shadow-including ancestor of the shadow host was
  // originally removed from its parent.
  // 2. Or (this slot is now not in a tree scope), this slot's inclusive
  // ancestor was orginally removed from its parent (== insertion point). This
  // slot and the originally removed node was in the same tree.

  ShadowRoot* root = containingShadowRootBeforeRemoved(*this, *insertionPoint);
  if (root) {
    if (ElementShadow* rootOwner = root->owner())
      rootOwner->setNeedsDistributionRecalc();
  }

  // Since this insertion point is no longer visible from the shadow subtree, it
  // need to clean itself up.
  clearDistribution();

  if (root && root->isV1() && root == insertionPoint->treeScope().rootNode()) {
    // This slot was in a shadow tree and got disconnected from the shadow root.
    root->ensureSlotAssignment().slotRemoved(*this);
  }

  HTMLElement::removedFrom(insertionPoint);
}
开发者ID:ollie314,项目名称:chromium,代码行数:27,代码来源:HTMLSlotElement.cpp

示例3: hasAssignedNodesSlow

bool HTMLSlotElement::hasAssignedNodesSlow() const {
  ShadowRoot* root = containingShadowRoot();
  DCHECK(root);
  DCHECK(root->isV1());
  SlotAssignment& assignment = root->ensureSlotAssignment();
  if (assignment.findSlotByName(name()) != this)
    return false;
  return assignment.findHostChildBySlotName(name());
}
开发者ID:ollie314,项目名称:chromium,代码行数:9,代码来源:HTMLSlotElement.cpp

示例4: insertedInto

Node::InsertionNotificationRequest HTMLSlotElement::insertedInto(
    ContainerNode* insertionPoint) {
  HTMLElement::insertedInto(insertionPoint);
  ShadowRoot* root = containingShadowRoot();
  if (root) {
    DCHECK(root->owner());
    root->owner()->setNeedsDistributionRecalc();
    // Relevant DOM Standard: https://dom.spec.whatwg.org/#concept-node-insert
    // - 6.4:  Run assign slotables for a tree with node's tree and a set
    // containing each inclusive descendant of node that is a slot.
    if (root->isV1() && !wasInShadowTreeBeforeInserted(*this, *insertionPoint))
      root->ensureSlotAssignment().slotAdded(*this);
  }

  // We could have been distributed into in a detached subtree, make sure to
  // clear the distribution when inserted again to avoid cycles.
  clearDistribution();

  return InsertionDone;
}
开发者ID:ollie314,项目名称:chromium,代码行数:20,代码来源:HTMLSlotElement.cpp


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