本文整理汇总了C++中ContainerNode::parentNode方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerNode::parentNode方法的具体用法?C++ ContainerNode::parentNode怎么用?C++ ContainerNode::parentNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerNode
的用法示例。
在下文中一共展示了ContainerNode::parentNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findParentTable
HTMLTableElement* HTMLTablePartElement::findParentTable() const
{
ContainerNode* parent = parentNode();
while (parent && !is<HTMLTableElement>(*parent))
parent = parent->parentNode();
return downcast<HTMLTableElement>(parent);
}
示例2: findTraverseRootsAndExecute
void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, typename SelectorQueryTrait::OutputType& output) const
{
// We need to return the matches in document order. To use id lookup while there is possiblity of multiple matches
// we would need to sort the results. For now, just traverse the document in that case.
ASSERT(m_selectors.size() == 1);
bool isRightmostSelector = true;
bool startFromParent = false;
Element* singleMatchingElement = 0;
for (const CSSSelector* selector = &m_selectors[0].selector; selector; selector = selector->tagHistory()) {
if (selector->m_match == CSSSelector::Id && (rootNode.document().getNumberOfElementsWithId(selector->value(), singleMatchingElement) <= 1)) {
ContainerNode* adjustedNode = &rootNode;
if (singleMatchingElement && (isTreeScopeRoot(rootNode) || singleMatchingElement->isDescendantOf(&rootNode)))
adjustedNode = singleMatchingElement;
else if (!singleMatchingElement || isRightmostSelector)
adjustedNode = 0;
if (isRightmostSelector) {
executeForTraverseRoot<SelectorQueryTrait>(m_selectors[0], adjustedNode, MatchesTraverseRoots, rootNode, output);
return;
}
if (startFromParent && adjustedNode)
adjustedNode = adjustedNode->parentNode();
executeForTraverseRoot<SelectorQueryTrait>(m_selectors[0], adjustedNode, DoesNotMatchTraverseRoots, rootNode, output);
return;
}
// If we have both CSSSelector::Id and CSSSelector::Class at the same time, we should use Id
// to find traverse root.
if (!SelectorQueryTrait::shouldOnlyMatchFirstElement && !startFromParent && selector->m_match == CSSSelector::Class) {
if (isRightmostSelector) {
ClassElementList<AllElements> traverseRoots(rootNode, selector->value());
executeForTraverseRoots<SelectorQueryTrait>(m_selectors[0], traverseRoots, MatchesTraverseRoots, rootNode, output);
return;
}
// Since there exists some ancestor element which has the class name, we need to see all children of rootNode.
if (ancestorHasClassName(rootNode, selector->value())) {
executeForTraverseRoot<SelectorQueryTrait>(m_selectors[0], &rootNode, DoesNotMatchTraverseRoots, rootNode, output);
return;
}
ClassElementList<OnlyRoots> traverseRoots(rootNode, selector->value());
executeForTraverseRoots<SelectorQueryTrait>(m_selectors[0], traverseRoots, DoesNotMatchTraverseRoots, rootNode, output);
return;
}
if (selector->relation() == CSSSelector::SubSelector)
continue;
isRightmostSelector = false;
if (selector->relation() == CSSSelector::DirectAdjacent || selector->relation() == CSSSelector::IndirectAdjacent)
startFromParent = true;
else
startFromParent = false;
}
executeForTraverseRoot<SelectorQueryTrait>(m_selectors[0], &rootNode, DoesNotMatchTraverseRoots, rootNode, output);
}
示例3: findFormAncestor
HTMLFormElement* HTMLElement::findFormAncestor() const
{
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
if (isHTMLFormElement(ancestor))
return toHTMLFormElement(ancestor);
}
return 0;
}
示例4: ownerDataListElement
HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
{
for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) {
if (is<HTMLDataListElement>(*parent))
return downcast<HTMLDataListElement>(parent);
}
return nullptr;
}
示例5: ownerDataListElement
HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
{
for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) {
if (parent->hasTagName(datalistTag))
return static_cast<HTMLDataListElement*>(parent);
}
return 0;
}
示例6: recalcSelectOptions
void HTMLOptGroupElement::recalcSelectOptions()
{
ContainerNode* select = parentNode();
while (select && !select->hasTagName(selectTag))
select = select->parentNode();
if (select)
toHTMLSelectElement(select)->setRecalcListItems();
}
示例7: additionalAttributeStyleDecls
// used by table cells to share style decls created by the enclosing table.
void HTMLTableCellElement::additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>& results)
{
ContainerNode* p = parentNode();
while (p && !p->hasTagName(tableTag))
p = p->parentNode();
if (!p)
return;
static_cast<HTMLTableElement*>(p)->addSharedCellDecls(results);
}
示例8: nearestViewportElement
SVGElement* SVGLocatable::nearestViewportElement(const SVGElement* element)
{
ASSERT(element);
for (ContainerNode* n = element->parentNode(); n; n = n->parentNode()) {
if (isViewportElement(n))
return static_cast<SVGElement*>(n);
}
return 0;
}
示例9: farthestViewportElement
SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* element)
{
ASSERT(element);
SVGElement* farthest = 0;
for (ContainerNode* n = element->parentNode(); n; n = n->parentNode()) {
if (isViewportElement(n))
farthest = static_cast<SVGElement*>(n);
}
return farthest;
}
示例10: ownerSelectElement
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
{
ContainerNode* select = parentNode();
while (select && !(select->hasTagName(selectTag) || select->hasTagName(keygenTag)))
select = select->parentNode();
if (!select)
return 0;
return static_cast<HTMLSelectElement*>(select);
}
示例11: ownerSelectElement
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
{
ContainerNode* select = parentNode();
while (select && !is<HTMLSelectElement>(*select))
select = select->parentNode();
if (!select)
return nullptr;
return downcast<HTMLSelectElement>(select);
}
示例12: ownerSelectElement
static inline WMLSelectElement* ownerSelectElement(Element* element)
{
ContainerNode* select = element->parentNode();
while (select && !select->hasTagName(selectTag))
select = select->parentNode();
if (!select)
return 0;
return static_cast<WMLSelectElement*>(select);
}
示例13: attributeChanged
void HTMLEmbedElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
HTMLPlugInImageElement::attributeChanged(attr, preserveDecls);
if ((attr->name() == widthAttr || attr->name() == heightAttr) && !attr->isEmpty()) {
ContainerNode* n = parentNode();
while (n && !n->hasTagName(objectTag))
n = n->parentNode();
if (n)
static_cast<HTMLObjectElement*>(n)->setAttribute(attr->name(), attr->value());
}
}
示例14: updateAncestorDisabledState
void HTMLFormControlElement::updateAncestorDisabledState() const
{
HTMLFieldSetElement* fieldSetAncestor = 0;
ContainerNode* legendAncestor = 0;
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
if (!legendAncestor && ancestor->hasTagName(legendTag))
legendAncestor = ancestor;
if (ancestor->hasTagName(fieldsetTag)) {
fieldSetAncestor = toHTMLFieldSetElement(ancestor);
break;
}
}
m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledFormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled;
}
示例15: recalcWillValidate
bool HTMLFormControlElement::recalcWillValidate() const
{
if (m_dataListAncestorState == Unknown) {
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
if (ancestor->hasTagName(datalistTag)) {
m_dataListAncestorState = InsideDataList;
break;
}
}
if (m_dataListAncestorState == Unknown)
m_dataListAncestorState = NotInsideDataList;
}
return m_dataListAncestorState == NotInsideDataList && !isDisabledOrReadOnly();
}