本文整理汇总了C++中ShadowRoot::isOldest方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadowRoot::isOldest方法的具体用法?C++ ShadowRoot::isOldest怎么用?C++ ShadowRoot::isOldest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadowRoot
的用法示例。
在下文中一共展示了ShadowRoot::isOldest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculatePath
void EventPath::calculatePath()
{
ASSERT(m_node);
ASSERT(m_nodeEventContexts.isEmpty());
m_node->updateDistribution();
// For performance and memory usage reasons we want to store the
// path using as few bytes as possible and with as few allocations
// as possible which is why we gather the data on the stack before
// storing it in a perfectly sized m_nodeEventContexts Vector.
WillBeHeapVector<RawPtrWillBeMember<Node>, 64> nodesInPath;
Node* current = m_node;
nodesInPath.append(current);
while (current) {
if (m_event && current->keepEventInNode(m_event))
break;
WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);
if (!insertionPoints.isEmpty()) {
for (const auto& insertionPoint : insertionPoints) {
if (insertionPoint->isShadowInsertionPoint()) {
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
ASSERT(containingShadowRoot);
if (!containingShadowRoot->isOldest())
nodesInPath.append(containingShadowRoot->olderShadowRoot());
}
nodesInPath.append(insertionPoint);
}
current = insertionPoints.last();
continue;
}
if (current->isShadowRoot()) {
if (m_event && shouldStopAtShadowRoot(*m_event, *toShadowRoot(current), *m_node))
break;
current = current->shadowHost();
#if !ENABLE(OILPAN)
// TODO(kochi): crbug.com/507413 This check is necessary when some asynchronous event
// is queued while its shadow host is removed and the shadow root gets the event
// immediately after it. When Oilpan is enabled, this situation does not happen.
// Except this case, shadow root's host is assumed to be non-null.
if (current)
nodesInPath.append(current);
#else
nodesInPath.append(current);
#endif
} else {
current = current->parentNode();
if (current)
nodesInPath.append(current);
}
}
m_nodeEventContexts.reserveCapacity(nodesInPath.size());
for (Node* nodeInPath : nodesInPath) {
m_nodeEventContexts.append(NodeEventContext(nodeInPath, eventTargetRespectingTargetRules(*nodeInPath)));
}
}
示例2: distribute
void ElementShadow::distribute()
{
host()->setNeedsStyleRecalc();
Vector<HTMLShadowElement*, 32> shadowInsertionPoints;
DistributionPool pool(*host());
for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
HTMLShadowElement* shadowInsertionPoint = 0;
const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->descendantInsertionPoints();
for (size_t i = 0; i < insertionPoints.size(); ++i) {
InsertionPoint* point = insertionPoints[i].get();
if (!point->isActive())
continue;
if (isHTMLShadowElement(point)) {
if (!shadowInsertionPoint)
shadowInsertionPoint = toHTMLShadowElement(point);
} else {
pool.distributeTo(point, this);
if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*point))
shadow->setNeedsDistributionRecalc();
}
}
if (shadowInsertionPoint) {
shadowInsertionPoints.append(shadowInsertionPoint);
if (shadowInsertionPoint->hasChildNodes())
pool.populateChildren(*shadowInsertionPoint);
} else {
pool.clear();
}
}
for (size_t i = shadowInsertionPoints.size(); i > 0; --i) {
HTMLShadowElement* shadowInsertionPoint = shadowInsertionPoints[i - 1];
ShadowRoot* root = shadowInsertionPoint->containingShadowRoot();
ASSERT(root);
if (root->isOldest()) {
pool.distributeTo(shadowInsertionPoint, this);
} else if (root->olderShadowRoot()->type() == root->type()) {
// Only allow reprojecting older shadow roots between the same type to
// disallow reprojecting UA elements into author shadows.
DistributionPool olderShadowRootPool(*root->olderShadowRoot());
olderShadowRootPool.distributeTo(shadowInsertionPoint, this);
root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot(shadowInsertionPoint);
}
if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInsertionPoint))
shadow->setNeedsDistributionRecalc();
}
}
示例3: pool
void ElementShadowV0::distribute() {
HeapVector<Member<HTMLShadowElement>, 32> shadowInsertionPoints;
DistributionPool pool(m_elementShadow->host());
for (ShadowRoot* root = &youngestShadowRoot(); root;
root = root->olderShadowRoot()) {
HTMLShadowElement* shadowInsertionPoint = 0;
for (const auto& point : root->descendantInsertionPoints()) {
if (!point->isActive())
continue;
if (isHTMLShadowElement(*point)) {
DCHECK(!shadowInsertionPoint);
shadowInsertionPoint = toHTMLShadowElement(point);
shadowInsertionPoints.append(shadowInsertionPoint);
} else {
pool.distributeTo(point, this);
if (ElementShadow* shadow =
shadowWhereNodeCanBeDistributedForV0(*point))
shadow->setNeedsDistributionRecalc();
}
}
}
for (size_t i = shadowInsertionPoints.size(); i > 0; --i) {
HTMLShadowElement* shadowInsertionPoint = shadowInsertionPoints[i - 1];
ShadowRoot* root = shadowInsertionPoint->containingShadowRoot();
DCHECK(root);
if (root->isOldest()) {
pool.distributeTo(shadowInsertionPoint, this);
} else if (root->olderShadowRoot()->type() == root->type()) {
// Only allow reprojecting older shadow roots between the same type to
// disallow reprojecting UA elements into author shadows.
DistributionPool olderShadowRootPool(*root->olderShadowRoot());
olderShadowRootPool.distributeTo(shadowInsertionPoint, this);
root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot(
shadowInsertionPoint);
}
if (ElementShadow* shadow =
shadowWhereNodeCanBeDistributedForV0(*shadowInsertionPoint))
shadow->setNeedsDistributionRecalc();
}
InspectorInstrumentation::didPerformElementShadowDistribution(
&m_elementShadow->host());
}
示例4: pool
void ElementShadow::distributeV0()
{
host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Shadow));
WillBeHeapVector<RawPtrWillBeMember<HTMLShadowElement>, 32> shadowInsertionPoints;
DistributionPool pool(*host());
for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShadowRoot()) {
HTMLShadowElement* shadowInsertionPoint = 0;
const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoints = root->descendantInsertionPoints();
for (size_t i = 0; i < insertionPoints.size(); ++i) {
InsertionPoint* point = insertionPoints[i].get();
if (!point->isActive())
continue;
if (isHTMLShadowElement(*point)) {
ASSERT(!shadowInsertionPoint);
shadowInsertionPoint = toHTMLShadowElement(point);
shadowInsertionPoints.append(shadowInsertionPoint);
} else {
pool.distributeTo(point, this);
if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*point))
shadow->setNeedsDistributionRecalc();
}
}
}
for (size_t i = shadowInsertionPoints.size(); i > 0; --i) {
HTMLShadowElement* shadowInsertionPoint = shadowInsertionPoints[i - 1];
ShadowRoot* root = shadowInsertionPoint->containingShadowRoot();
ASSERT(root);
if (root->isOldest()) {
pool.distributeTo(shadowInsertionPoint, this);
} else if (root->olderShadowRoot()->type() == root->type()) {
// Only allow reprojecting older shadow roots between the same type to
// disallow reprojecting UA elements into author shadows.
DistributionPool olderShadowRootPool(*root->olderShadowRoot());
olderShadowRootPool.distributeTo(shadowInsertionPoint, this);
root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot(shadowInsertionPoint);
}
if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInsertionPoint))
shadow->setNeedsDistributionRecalc();
}
InspectorInstrumentation::didPerformElementShadowDistribution(host());
}
示例5: calculatePath
void EventPath::calculatePath()
{
ASSERT(m_node);
ASSERT(m_nodeEventContexts.isEmpty());
m_node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(m_node.get()));
Node* current = m_node;
addNodeEventContext(*current);
if (!m_node->inDocument())
return;
while (current) {
if (m_event && current->keepEventInNode(m_event))
break;
WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);
if (!insertionPoints.isEmpty()) {
for (const auto& insertionPoint : insertionPoints) {
if (insertionPoint->isShadowInsertionPoint()) {
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
ASSERT(containingShadowRoot);
if (!containingShadowRoot->isOldest())
addNodeEventContext(*containingShadowRoot->olderShadowRoot());
}
addNodeEventContext(*insertionPoint);
}
current = insertionPoints.last();
continue;
}
if (current->isShadowRoot()) {
if (m_event && shouldStopAtShadowRoot(*m_event, *toShadowRoot(current), *m_node))
break;
current = current->shadowHost();
addNodeEventContext(*current);
} else {
current = current->parentNode();
if (current)
addNodeEventContext(*current);
}
}
}
示例6: calculatePath
void EventPath::calculatePath()
{
ASSERT(m_node);
ASSERT(m_nodeEventContexts.isEmpty());
m_node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(m_node));
Node* current = m_node;
addNodeEventContext(current);
if (!m_node->inDocument())
return;
while (current) {
if (current->isShadowRoot() && m_event && determineDispatchBehavior(m_event, toShadowRoot(current), m_node) == StayInsideShadowDOM)
break;
Vector<InsertionPoint*, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);
if (!insertionPoints.isEmpty()) {
for (size_t i = 0; i < insertionPoints.size(); ++i) {
InsertionPoint* insertionPoint = insertionPoints[i];
if (insertionPoint->isShadowInsertionPoint()) {
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
ASSERT(containingShadowRoot);
if (!containingShadowRoot->isOldest())
addNodeEventContext(containingShadowRoot->olderShadowRoot());
}
addNodeEventContext(insertionPoint);
}
current = insertionPoints.last();
continue;
}
if (current->isShadowRoot()) {
current = current->shadowHost();
addNodeEventContext(current);
} else {
current = current->parentNode();
if (current)
addNodeEventContext(current);
}
}
}