|
Lines 623-638
void Node::setNodeValue(const String& /*
Source/WebCore/dom/Node.cpp_sec1
|
| 623 |
|
623 |
|
| 624 |
PassRefPtr<NodeList> Node::childNodes() |
624 |
PassRefPtr<NodeList> Node::childNodes() |
| 625 |
{ |
625 |
{ |
| 626 |
NodeRareData* data = ensureRareData(); |
626 |
NodeListsNodeData* nodeLists = ensureRareData()->ensureNodeLists(this); |
| 627 |
if (!data->nodeLists()) { |
627 |
if (!nodeLists->m_childNodeListCaches) |
| 628 |
data->setNodeLists(NodeListsNodeData::create()); |
628 |
nodeLists->m_childNodeListCaches = DynamicNodeList::Caches::create(); |
| 629 |
if (treeScope()) |
629 |
return ChildNodeList::create(this, nodeLists->m_childNodeListCaches.get()); |
| 630 |
treeScope()->addNodeListCache(); |
|
|
| 631 |
} |
| 632 |
|
| 633 |
if (!data->nodeLists()->m_childNodeListCaches) |
| 634 |
data->nodeLists()->m_childNodeListCaches = DynamicNodeList::Caches::create(); |
| 635 |
return ChildNodeList::create(this, data->nodeLists()->m_childNodeListCaches.get()); |
| 636 |
} |
630 |
} |
| 637 |
|
631 |
|
| 638 |
Node *Node::lastDescendant() const |
632 |
Node *Node::lastDescendant() const |
|
Lines 1005-1020
unsigned Node::nodeIndex() const
Source/WebCore/dom/Node.cpp_sec2
|
| 1005 |
void Node::registerDynamicNodeList(DynamicNodeList* list) |
999 |
void Node::registerDynamicNodeList(DynamicNodeList* list) |
| 1006 |
{ |
1000 |
{ |
| 1007 |
NodeRareData* data = ensureRareData(); |
1001 |
NodeRareData* data = ensureRareData(); |
| 1008 |
if (!data->nodeLists()) { |
1002 |
// We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. |
| 1009 |
data->setNodeLists(NodeListsNodeData::create()); |
1003 |
if (data->nodeLists() && (!treeScope() || !treeScope()->hasNodeListCaches())) |
| 1010 |
treeScope()->addNodeListCache(); |
|
|
| 1011 |
} else if (!treeScope() || !treeScope()->hasNodeListCaches()) { |
| 1012 |
// We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. |
| 1013 |
data->nodeLists()->invalidateCaches(); |
1004 |
data->nodeLists()->invalidateCaches(); |
| 1014 |
} |
|
|
| 1015 |
|
1005 |
|
| 1016 |
if (list->hasOwnCaches()) |
1006 |
if (list->hasOwnCaches()) |
| 1017 |
data->nodeLists()->m_listsWithCaches.add(list); |
1007 |
data->ensureNodeLists(this)->m_listsWithCaches.add(list); |
| 1018 |
} |
1008 |
} |
| 1019 |
|
1009 |
|
| 1020 |
void Node::unregisterDynamicNodeList(DynamicNodeList* list) |
1010 |
void Node::unregisterDynamicNodeList(DynamicNodeList* list) |
|
Lines 1667-1685
PassRefPtr<NodeList> Node::getElementsBy
Source/WebCore/dom/Node.cpp_sec3
|
| 1667 |
if (localName.isNull()) |
1657 |
if (localName.isNull()) |
| 1668 |
return 0; |
1658 |
return 0; |
| 1669 |
|
1659 |
|
| 1670 |
NodeRareData* data = ensureRareData(); |
|
|
| 1671 |
if (!data->nodeLists()) { |
| 1672 |
data->setNodeLists(NodeListsNodeData::create()); |
| 1673 |
treeScope()->addNodeListCache(); |
| 1674 |
} |
| 1675 |
|
| 1676 |
String name = localName; |
1660 |
String name = localName; |
| 1677 |
if (document()->isHTMLDocument()) |
1661 |
if (document()->isHTMLDocument()) |
| 1678 |
name = localName.lower(); |
1662 |
name = localName.lower(); |
| 1679 |
|
1663 |
|
| 1680 |
AtomicString localNameAtom = name; |
1664 |
AtomicString localNameAtom = name; |
| 1681 |
|
1665 |
|
| 1682 |
pair<NodeListsNodeData::TagNodeListCache::iterator, bool> result = data->nodeLists()->m_tagNodeListCache.add(localNameAtom, 0); |
1666 |
pair<NodeListsNodeData::TagNodeListCache::iterator, bool> result = ensureRareData()->ensureNodeLists(this)->m_tagNodeListCache.add(localNameAtom, 0); |
| 1683 |
if (!result.second) |
1667 |
if (!result.second) |
| 1684 |
return PassRefPtr<TagNodeList>(result.first->second); |
1668 |
return PassRefPtr<TagNodeList>(result.first->second); |
| 1685 |
|
1669 |
|
|
Lines 1696-1714
PassRefPtr<NodeList> Node::getElementsBy
Source/WebCore/dom/Node.cpp_sec4
|
| 1696 |
if (namespaceURI == starAtom) |
1680 |
if (namespaceURI == starAtom) |
| 1697 |
return getElementsByTagName(localName); |
1681 |
return getElementsByTagName(localName); |
| 1698 |
|
1682 |
|
| 1699 |
NodeRareData* data = ensureRareData(); |
|
|
| 1700 |
if (!data->nodeLists()) { |
| 1701 |
data->setNodeLists(NodeListsNodeData::create()); |
| 1702 |
treeScope()->addNodeListCache(); |
| 1703 |
} |
| 1704 |
|
| 1705 |
String name = localName; |
1683 |
String name = localName; |
| 1706 |
if (document()->isHTMLDocument()) |
1684 |
if (document()->isHTMLDocument()) |
| 1707 |
name = localName.lower(); |
1685 |
name = localName.lower(); |
| 1708 |
|
1686 |
|
| 1709 |
AtomicString localNameAtom = name; |
1687 |
AtomicString localNameAtom = name; |
| 1710 |
|
1688 |
|
| 1711 |
pair<NodeListsNodeData::TagNodeListCacheNS::iterator, bool> result = data->nodeLists()->m_tagNodeListCacheNS.add(QualifiedName(nullAtom, localNameAtom, namespaceURI).impl(), 0); |
1689 |
pair<NodeListsNodeData::TagNodeListCacheNS::iterator, bool> result |
|
|
1690 |
= ensureRareData()->ensureNodeLists(this)->m_tagNodeListCacheNS.add(QualifiedName(nullAtom, localNameAtom, namespaceURI).impl(), 0); |
| 1712 |
if (!result.second) |
1691 |
if (!result.second) |
| 1713 |
return PassRefPtr<TagNodeList>(result.first->second); |
1692 |
return PassRefPtr<TagNodeList>(result.first->second); |
| 1714 |
|
1693 |
|
|
Lines 1719-1731
PassRefPtr<NodeList> Node::getElementsBy
Source/WebCore/dom/Node.cpp_sec5
|
| 1719 |
|
1698 |
|
| 1720 |
PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) |
1699 |
PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) |
| 1721 |
{ |
1700 |
{ |
| 1722 |
NodeRareData* data = ensureRareData(); |
1701 |
pair<NodeListsNodeData::NameNodeListCache::iterator, bool> result = ensureRareData()->ensureNodeLists(this)->m_nameNodeListCache.add(elementName, 0); |
| 1723 |
if (!data->nodeLists()) { |
|
|
| 1724 |
data->setNodeLists(NodeListsNodeData::create()); |
| 1725 |
treeScope()->addNodeListCache(); |
| 1726 |
} |
| 1727 |
|
| 1728 |
pair<NodeListsNodeData::NameNodeListCache::iterator, bool> result = data->nodeLists()->m_nameNodeListCache.add(elementName, 0); |
| 1729 |
if (!result.second) |
1702 |
if (!result.second) |
| 1730 |
return PassRefPtr<NodeList>(result.first->second); |
1703 |
return PassRefPtr<NodeList>(result.first->second); |
| 1731 |
|
1704 |
|
|
Lines 1736-1748
PassRefPtr<NodeList> Node::getElementsBy
Source/WebCore/dom/Node.cpp_sec6
|
| 1736 |
|
1709 |
|
| 1737 |
PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) |
1710 |
PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) |
| 1738 |
{ |
1711 |
{ |
| 1739 |
NodeRareData* data = ensureRareData(); |
1712 |
pair<NodeListsNodeData::ClassNodeListCache::iterator, bool> result |
| 1740 |
if (!data->nodeLists()) { |
1713 |
= ensureRareData()->ensureNodeLists(this)->m_classNodeListCache.add(classNames, 0); |
| 1741 |
data->setNodeLists(NodeListsNodeData::create()); |
|
|
| 1742 |
treeScope()->addNodeListCache(); |
| 1743 |
} |
| 1744 |
|
| 1745 |
pair<NodeListsNodeData::ClassNodeListCache::iterator, bool> result = data->nodeLists()->m_classNodeListCache.add(classNames, 0); |
| 1746 |
if (!result.second) |
1714 |
if (!result.second) |
| 1747 |
return PassRefPtr<NodeList>(result.first->second); |
1715 |
return PassRefPtr<NodeList>(result.first->second); |
| 1748 |
|
1716 |
|