Commit 898f06ea authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Move Document code out of Node.cpp

Move Document code out of Node.cpp and into Document.cpp for clarity. There is
no reason (e.g. inlining) requiring that this code be in Node.cpp.

R=adamk@chromium.org, adamk, eseidel

Review URL: https://codereview.chromium.org/178543006

git-svn-id: svn://svn.chromium.org/blink/trunk@168421 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 251f7ace
...@@ -5455,4 +5455,38 @@ void Document::defaultEventHandler(Event* event) ...@@ -5455,4 +5455,38 @@ void Document::defaultEventHandler(Event* event)
Node::defaultEventHandler(event); Node::defaultEventHandler(event);
} }
template<unsigned type>
bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName)
{
if (nodeListCounts[type] && LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
return true;
return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
}
template<>
bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&)
{
return false;
}
bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const
{
if (attrName)
return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName);
for (int type = 0; type < numNodeListInvalidationTypes; type++) {
if (m_nodeListCounts[type])
return true;
}
return false;
}
void Document::invalidateNodeListCaches(const QualifiedName* attrName)
{
HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end();
for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
(*it)->invalidateCache(attrName);
}
} // namespace WebCore } // namespace WebCore
...@@ -814,40 +814,6 @@ unsigned Node::nodeIndex() const ...@@ -814,40 +814,6 @@ unsigned Node::nodeIndex() const
return count; return count;
} }
template<unsigned type>
bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName)
{
if (nodeListCounts[type] && LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
return true;
return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
}
template<>
bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&)
{
return false;
}
bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const
{
if (attrName)
return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName);
for (int type = 0; type < numNodeListInvalidationTypes; type++) {
if (m_nodeListCounts[type])
return true;
}
return false;
}
void Document::invalidateNodeListCaches(const QualifiedName* attrName)
{
HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end();
for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
(*it)->invalidateCache(attrName);
}
void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement) void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement)
{ {
if (hasRareData() && (!attrName || isAttributeNode())) { if (hasRareData() && (!attrName || isAttributeNode())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment