Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: Source/core/dom/Document.h

Issue 159503003: Do not cause unnecessary node lists invalidation on id/name attribute change (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | Source/core/dom/Document.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 642
643 // Updates for :target (CSS3 selector). 643 // Updates for :target (CSS3 selector).
644 void setCSSTarget(Element*); 644 void setCSSTarget(Element*);
645 Element* cssTarget() const { return m_cssTarget; } 645 Element* cssTarget() const { return m_cssTarget; }
646 646
647 void scheduleStyleRecalc(); 647 void scheduleStyleRecalc();
648 bool hasPendingForcedStyleRecalc() const; 648 bool hasPendingForcedStyleRecalc() const;
649 649
650 void registerNodeList(LiveNodeListBase*); 650 void registerNodeList(LiveNodeListBase*);
651 void unregisterNodeList(LiveNodeListBase*); 651 void unregisterNodeList(LiveNodeListBase*);
652 void incrementNodeListWithIdNameCacheCount();
653 void decrementNodeListWithIdNameCacheCount();
652 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ; 654 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ;
653 void invalidateNodeListCaches(const QualifiedName* attrName); 655 void invalidateNodeListCaches(const QualifiedName* attrName);
654 656
655 void attachNodeIterator(NodeIterator*); 657 void attachNodeIterator(NodeIterator*);
656 void detachNodeIterator(NodeIterator*); 658 void detachNodeIterator(NodeIterator*);
657 void moveNodeIteratorsToNewDocument(Node&, Document&); 659 void moveNodeIteratorsToNewDocument(Node&, Document&);
658 660
659 void attachRange(Range*); 661 void attachRange(Range*);
660 void detachRange(Range*); 662 void detachRange(Range*);
661 663
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 } 1362 }
1361 1363
1362 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin) 1364 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin)
1363 { 1365 {
1364 // The different (legacy) meta tags have different priorities based on the t ype 1366 // The different (legacy) meta tags have different priorities based on the t ype
1365 // regardless of which order they appear in the DOM. The priority is given b y the 1367 // regardless of which order they appear in the DOM. The priority is given b y the
1366 // ViewportDescription::Type enum. 1368 // ViewportDescription::Type enum.
1367 return origin >= m_legacyViewportDescription.type; 1369 return origin >= m_legacyViewportDescription.type;
1368 } 1370 }
1369 1371
1372 inline void Document::incrementNodeListWithIdNameCacheCount()
1373 {
1374 m_nodeListCounts[InvalidateOnIdNameAttrChange]++;
1375 }
1376
1377 inline void Document::decrementNodeListWithIdNameCacheCount()
1378 {
1379 ASSERT(m_nodeListCounts[InvalidateOnIdNameAttrChange] > 0);
1380 m_nodeListCounts[InvalidateOnIdNameAttrChange]--;
1381 }
1382
1370 DEFINE_TYPE_CASTS(Document, ExecutionContextClient, client, client->isDocument() , client.isDocument()); 1383 DEFINE_TYPE_CASTS(Document, ExecutionContextClient, client, client->isDocument() , client.isDocument());
1371 DEFINE_TYPE_CASTS(Document, ExecutionContext, context, context->isDocument(), co ntext.isDocument()); 1384 DEFINE_TYPE_CASTS(Document, ExecutionContext, context, context->isDocument(), co ntext.isDocument());
1372 DEFINE_NODE_TYPE_CASTS(Document, isDocumentNode()); 1385 DEFINE_NODE_TYPE_CASTS(Document, isDocumentNode());
1373 1386
1374 #define DEFINE_DOCUMENT_TYPE_CASTS(thisType) \ 1387 #define DEFINE_DOCUMENT_TYPE_CASTS(thisType) \
1375 DEFINE_TYPE_CASTS(thisType, Document, document, document->is##thisType(), do cument.is##thisType()) 1388 DEFINE_TYPE_CASTS(thisType, Document, document, document->is##thisType(), do cument.is##thisType())
1376 1389
1377 // All these varations are needed to avoid ambiguous overloads with the Node and TreeScope versions. 1390 // All these varations are needed to avoid ambiguous overloads with the Node and TreeScope versions.
1378 inline bool operator==(const Document& a, const Document& b) { return &a == &b; } 1391 inline bool operator==(const Document& a, const Document& b) { return &a == &b; }
1379 inline bool operator==(const Document& a, const Document* b) { return &a == b; } 1392 inline bool operator==(const Document& a, const Document* b) { return &a == b; }
1380 inline bool operator==(const Document* a, const Document& b) { return a == &b; } 1393 inline bool operator==(const Document* a, const Document& b) { return a == &b; }
1381 inline bool operator!=(const Document& a, const Document& b) { return !(a == b); } 1394 inline bool operator!=(const Document& a, const Document& b) { return !(a == b); }
1382 inline bool operator!=(const Document& a, const Document* b) { return !(a == b); } 1395 inline bool operator!=(const Document& a, const Document* b) { return !(a == b); }
1383 inline bool operator!=(const Document* a, const Document& b) { return !(a == b); } 1396 inline bool operator!=(const Document* a, const Document& b) { return !(a == b); }
1384 1397
1385 // Put these methods here, because they require the Document definition, but we really want to inline them. 1398 // Put these methods here, because they require the Document definition, but we really want to inline them.
1386 1399
1387 inline bool Node::isDocumentNode() const 1400 inline bool Node::isDocumentNode() const
1388 { 1401 {
1389 return this == document(); 1402 return this == document();
1390 } 1403 }
1391 1404
1392 Node* eventTargetNodeForDocument(Document*); 1405 Node* eventTargetNodeForDocument(Document*);
1393 1406
1394 } // namespace WebCore 1407 } // namespace WebCore
1395 1408
1396 #endif // Document_h 1409 #endif // Document_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | Source/core/dom/Document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698