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

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

Issue 1023393002: Cache element indices for :nth-child and :nth-last-child selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing initializer and incorrect assert. Created 5 years, 8 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
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 class LayoutPoint; 122 class LayoutPoint;
123 class LiveNodeListBase; 123 class LiveNodeListBase;
124 class Locale; 124 class Locale;
125 class LocalFrame; 125 class LocalFrame;
126 class Location; 126 class Location;
127 class MainThreadTaskRunner; 127 class MainThreadTaskRunner;
128 class MediaQueryListListener; 128 class MediaQueryListListener;
129 class MediaQueryMatcher; 129 class MediaQueryMatcher;
130 class NodeFilter; 130 class NodeFilter;
131 class NodeIterator; 131 class NodeIterator;
132 class NthIndexCache;
132 class Page; 133 class Page;
133 class PlatformMouseEvent; 134 class PlatformMouseEvent;
134 class ProcessingInstruction; 135 class ProcessingInstruction;
135 class QualifiedName; 136 class QualifiedName;
136 class Range; 137 class Range;
137 class LayoutView; 138 class LayoutView;
138 class ResourceFetcher; 139 class ResourceFetcher;
139 class SVGDocumentExtensions; 140 class SVGDocumentExtensions;
140 class SVGUseElement; 141 class SVGUseElement;
141 class ScriptRunner; 142 class ScriptRunner;
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1055
1055 void platformColorsChanged(); 1056 void platformColorsChanged();
1056 1057
1057 virtual DOMTimerCoordinator* timers() override final; 1058 virtual DOMTimerCoordinator* timers() override final;
1058 1059
1059 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override; 1060 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override;
1060 virtual v8::Handle<v8::Object> associateWithWrapper(v8::Isolate*, const Wrap perTypeInfo*, v8::Handle<v8::Object> wrapper) override; 1061 virtual v8::Handle<v8::Object> associateWithWrapper(v8::Isolate*, const Wrap perTypeInfo*, v8::Handle<v8::Object> wrapper) override;
1061 1062
1062 OriginsUsingFeatures::Value& originsUsingFeaturesValue() { return m_originsU singFeaturesValue; } 1063 OriginsUsingFeatures::Value& originsUsingFeaturesValue() { return m_originsU singFeaturesValue; }
1063 1064
1065 NthIndexCache* nthIndexCache() const { return m_nthIndexCache; }
1066
1064 protected: 1067 protected:
1065 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); 1068 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
1066 1069
1067 virtual void didUpdateSecurityOrigin() override final; 1070 virtual void didUpdateSecurityOrigin() override final;
1068 1071
1069 void clearXMLVersion() { m_xmlVersion = String(); } 1072 void clearXMLVersion() { m_xmlVersion = String(); }
1070 1073
1071 #if !ENABLE(OILPAN) 1074 #if !ENABLE(OILPAN)
1072 virtual void dispose() override; 1075 virtual void dispose() override;
1073 #endif 1076 #endif
1074 1077
1075 virtual PassRefPtrWillBeRawPtr<Document> cloneDocumentWithoutChildren(); 1078 virtual PassRefPtrWillBeRawPtr<Document> cloneDocumentWithoutChildren();
1076 1079
1077 bool importContainerNodeChildren(ContainerNode* oldContainerNode, PassRefPtr WillBeRawPtr<ContainerNode> newContainerNode, ExceptionState&); 1080 bool importContainerNodeChildren(ContainerNode* oldContainerNode, PassRefPtr WillBeRawPtr<ContainerNode> newContainerNode, ExceptionState&);
1078 void lockCompatibilityMode() { m_compatibilityModeLocked = true; } 1081 void lockCompatibilityMode() { m_compatibilityModeLocked = true; }
1079 ParserSynchronizationPolicy parserSynchronizationPolicy() const { return m_p arserSyncPolicy; } 1082 ParserSynchronizationPolicy parserSynchronizationPolicy() const { return m_p arserSyncPolicy; }
1080 1083
1081 private: 1084 private:
1082 friend class IgnoreDestructiveWriteCountIncrementer; 1085 friend class IgnoreDestructiveWriteCountIncrementer;
1086 friend class NthIndexCache;
1083 1087
1084 bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check. 1088 bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check.
1085 bool isDocumentNode() const = delete; // This will catch anyone doing an unn ecessary check. 1089 bool isDocumentNode() const = delete; // This will catch anyone doing an unn ecessary check.
1086 bool isElementNode() const = delete; // This will catch anyone doing an unne cessary check. 1090 bool isElementNode() const = delete; // This will catch anyone doing an unne cessary check.
1087 1091
1088 ScriptedAnimationController& ensureScriptedAnimationController(); 1092 ScriptedAnimationController& ensureScriptedAnimationController();
1089 virtual SecurityContext& securityContext() override final { return *this; } 1093 virtual SecurityContext& securityContext() override final { return *this; }
1090 virtual EventQueue* eventQueue() const override final; 1094 virtual EventQueue* eventQueue() const override final;
1091 1095
1092 // FIXME: Rename the StyleRecalc state to RenderTreeUpdate. 1096 // FIXME: Rename the StyleRecalc state to RenderTreeUpdate.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 bool haveStylesheetsLoaded() const; 1169 bool haveStylesheetsLoaded() const;
1166 1170
1167 void setHoverNode(PassRefPtrWillBeRawPtr<Node>); 1171 void setHoverNode(PassRefPtrWillBeRawPtr<Node>);
1168 Node* hoverNode() const { return m_hoverNode.get(); } 1172 Node* hoverNode() const { return m_hoverNode.get(); }
1169 1173
1170 using EventFactorySet = HashSet<OwnPtr<EventFactoryBase>>; 1174 using EventFactorySet = HashSet<OwnPtr<EventFactoryBase>>;
1171 static EventFactorySet& eventFactories(); 1175 static EventFactorySet& eventFactories();
1172 1176
1173 void updateElementOpacity(const AtomicString& cssSelector, double opacity); 1177 void updateElementOpacity(const AtomicString& cssSelector, double opacity);
1174 1178
1179 void setNthIndexCache(NthIndexCache* nthIndexCache) { ASSERT(!m_nthIndexCach e || !nthIndexCache); m_nthIndexCache = nthIndexCache; }
1180
1175 DocumentLifecycle m_lifecycle; 1181 DocumentLifecycle m_lifecycle;
1176 1182
1177 bool m_hasNodesWithPlaceholderStyle; 1183 bool m_hasNodesWithPlaceholderStyle;
1178 bool m_evaluateMediaQueriesOnStyleRecalc; 1184 bool m_evaluateMediaQueriesOnStyleRecalc;
1179 1185
1180 // If we do ignore the pending stylesheet count, then we need to add a boole an 1186 // If we do ignore the pending stylesheet count, then we need to add a boole an
1181 // to track that this happened so that we can do a full repaint when the sty lesheets 1187 // to track that this happened so that we can do a full repaint when the sty lesheets
1182 // do eventually load. 1188 // do eventually load.
1183 PendingSheetLayout m_pendingSheetLayout; 1189 PendingSheetLayout m_pendingSheetLayout;
1184 1190
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions; 1317 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions;
1312 1318
1313 Vector<AnnotatedRegionValue> m_annotatedRegions; 1319 Vector<AnnotatedRegionValue> m_annotatedRegions;
1314 bool m_hasAnnotatedRegions; 1320 bool m_hasAnnotatedRegions;
1315 bool m_annotatedRegionsDirty; 1321 bool m_annotatedRegionsDirty;
1316 1322
1317 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement>> m_cssCanvas Elements; 1323 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement>> m_cssCanvas Elements;
1318 1324
1319 OwnPtr<SelectorQueryCache> m_selectorQueryCache; 1325 OwnPtr<SelectorQueryCache> m_selectorQueryCache;
1320 1326
1327 // It is safe to keep a raw, untraced pointer to this stack-allocated
1328 // cache object: it is set upon the cache object being allocated on
1329 // the stack and cleared upon leaving its allocated scope. Hence it
1330 // is acceptable not to trace it -- should a conservative GC occur,
1331 // the cache object's references will be traced by a stack walk.
1332 GC_PLUGIN_IGNORE("461878")
1333 NthIndexCache* m_nthIndexCache = nullptr;
1334
1321 bool m_useSecureKeyboardEntryWhenActive; 1335 bool m_useSecureKeyboardEntryWhenActive;
1322 1336
1323 DocumentClassFlags m_documentClasses; 1337 DocumentClassFlags m_documentClasses;
1324 1338
1325 bool m_isViewSource; 1339 bool m_isViewSource;
1326 bool m_sawElementsInKnownNamespaces; 1340 bool m_sawElementsInKnownNamespaces;
1327 bool m_isSrcdocDocument; 1341 bool m_isSrcdocDocument;
1328 bool m_isMobileDocument; 1342 bool m_isMobileDocument;
1329 bool m_isTransitionDocument; 1343 bool m_isTransitionDocument;
1330 1344
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); 1451 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true);
1438 1452
1439 } // namespace blink 1453 } // namespace blink
1440 1454
1441 #ifndef NDEBUG 1455 #ifndef NDEBUG
1442 // Outside the WebCore namespace for ease of invocation from gdb. 1456 // Outside the WebCore namespace for ease of invocation from gdb.
1443 void showLiveDocumentInstances(); 1457 void showLiveDocumentInstances();
1444 #endif 1458 #endif
1445 1459
1446 #endif // Document_h 1460 #endif // Document_h
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698