Commit 716bd2ac authored by esprehn@chromium.org's avatar esprehn@chromium.org

Avoid the hash table StyleInvalidator::clearInvalidation in Node::detach when possible

Accessing the hash table in every ::detach call is a lot of overhead since
in the common case the Element is not even in the hash table. We should
check the needsStyleInvalidation() bit first.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@170539 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8352f9b8
......@@ -41,10 +41,10 @@ StyleInvalidator::InvalidationList& StyleInvalidator::ensurePendingInvalidationL
void StyleInvalidator::clearInvalidation(Node& node)
{
if (node.isElementNode() && node.needsStyleInvalidation())
m_pendingInvalidationMap.remove(toElement(&node));
node.clearChildNeedsStyleInvalidation();
node.clearNeedsStyleInvalidation();
if (node.isElementNode())
m_pendingInvalidationMap.remove(toElement(&node));
}
void StyleInvalidator::clearPendingInvalidations()
......
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