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

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

Issue 2476163002: Fixed perf regression by removing tree traversal for text sibling. (Closed)
Patch Set: Created 4 years, 1 month 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 23 matching lines...) Expand all
34 #include "bindings/core/v8/ScriptValue.h" 34 #include "bindings/core/v8/ScriptValue.h"
35 #include "bindings/core/v8/TraceWrapperMember.h" 35 #include "bindings/core/v8/TraceWrapperMember.h"
36 #include "core/CoreExport.h" 36 #include "core/CoreExport.h"
37 #include "core/dom/ContainerNode.h" 37 #include "core/dom/ContainerNode.h"
38 #include "core/dom/DocumentEncodingData.h" 38 #include "core/dom/DocumentEncodingData.h"
39 #include "core/dom/DocumentInit.h" 39 #include "core/dom/DocumentInit.h"
40 #include "core/dom/DocumentLifecycle.h" 40 #include "core/dom/DocumentLifecycle.h"
41 #include "core/dom/DocumentTiming.h" 41 #include "core/dom/DocumentTiming.h"
42 #include "core/dom/ExecutionContext.h" 42 #include "core/dom/ExecutionContext.h"
43 #include "core/dom/MutationObserver.h" 43 #include "core/dom/MutationObserver.h"
44 #include "core/dom/Text.h"
44 #include "core/dom/TextLinkColors.h" 45 #include "core/dom/TextLinkColors.h"
45 #include "core/dom/TreeScope.h" 46 #include "core/dom/TreeScope.h"
46 #include "core/dom/UserActionElementSet.h" 47 #include "core/dom/UserActionElementSet.h"
47 #include "core/dom/ViewportDescription.h" 48 #include "core/dom/ViewportDescription.h"
48 #include "core/dom/custom/V0CustomElement.h" 49 #include "core/dom/custom/V0CustomElement.h"
49 #include "core/fetch/ClientHintsPreferences.h" 50 #include "core/fetch/ClientHintsPreferences.h"
50 #include "core/frame/DOMTimerCoordinator.h" 51 #include "core/frame/DOMTimerCoordinator.h"
51 #include "core/frame/HostsUsingFeatures.h" 52 #include "core/frame/HostsUsingFeatures.h"
52 #include "core/html/parser/ParserSynchronizationPolicy.h" 53 #include "core/html/parser/ParserSynchronizationPolicy.h"
53 #include "core/page/PageVisibilityState.h" 54 #include "core/page/PageVisibilityState.h"
55 #include "core/style/ComputedStyle.h"
54 #include "platform/Length.h" 56 #include "platform/Length.h"
55 #include "platform/Timer.h" 57 #include "platform/Timer.h"
56 #include "platform/weborigin/KURL.h" 58 #include "platform/weborigin/KURL.h"
57 #include "platform/weborigin/ReferrerPolicy.h" 59 #include "platform/weborigin/ReferrerPolicy.h"
58 #include "public/platform/WebFocusType.h" 60 #include "public/platform/WebFocusType.h"
59 #include "public/platform/WebInsecureRequestPolicy.h" 61 #include "public/platform/WebInsecureRequestPolicy.h"
60 #include "wtf/HashSet.h" 62 #include "wtf/HashSet.h"
61 #include "wtf/PassRefPtr.h" 63 #include "wtf/PassRefPtr.h"
62 #include <memory> 64 #include <memory>
63 65
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 class SecurityOrigin; 154 class SecurityOrigin;
153 class SegmentedString; 155 class SegmentedString;
154 class SelectorQueryCache; 156 class SelectorQueryCache;
155 class SerializedScriptValue; 157 class SerializedScriptValue;
156 class Settings; 158 class Settings;
157 class SnapCoordinator; 159 class SnapCoordinator;
158 class StringOrDictionary; 160 class StringOrDictionary;
159 class StyleEngine; 161 class StyleEngine;
160 class StyleResolver; 162 class StyleResolver;
161 class StyleSheetList; 163 class StyleSheetList;
162 class Text;
163 class TextAutosizer; 164 class TextAutosizer;
164 class Touch; 165 class Touch;
165 class TouchList; 166 class TouchList;
166 class TransformSource; 167 class TransformSource;
167 class TreeWalker; 168 class TreeWalker;
168 class VisitedLinkState; 169 class VisitedLinkState;
169 enum class SelectionBehaviorOnFocus; 170 enum class SelectionBehaviorOnFocus;
170 struct AnnotatedRegionValue; 171 struct AnnotatedRegionValue;
171 struct FocusParams; 172 struct FocusParams;
172 struct IconURL; 173 struct IconURL;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 WouldLoadZeroByZero, 245 WouldLoadZeroByZero,
245 WouldLoadAboveAndLeft, 246 WouldLoadAboveAndLeft,
246 WouldLoadAbove, 247 WouldLoadAbove,
247 WouldLoadLeft, 248 WouldLoadLeft,
248 // We have to load documents in visible frames. 249 // We have to load documents in visible frames.
249 WouldLoadVisible, 250 WouldLoadVisible,
250 251
251 WouldLoadReasonEnd 252 WouldLoadReasonEnd
252 }; 253 };
253 254
255 struct StyleRecalcData : public GarbageCollectedFinalized<StyleRecalcData> {
rune 2016/11/07 09:43:19 This is only used for reattachment, right? How abo
256 StyleRecalcData(RefPtr<ComputedStyle> computedStyle, Text* nextTextSibling)
257 : computedStyle(std::move(computedStyle)),
258 nextTextSibling(nextTextSibling) {}
259
260 RefPtr<ComputedStyle> computedStyle;
261 Member<Text> nextTextSibling;
262
263 DEFINE_INLINE_TRACE() { visitor->trace(nextTextSibling); }
264 };
265
254 using DocumentClassFlags = unsigned char; 266 using DocumentClassFlags = unsigned char;
255 267
256 class CORE_EXPORT Document : public ContainerNode, 268 class CORE_EXPORT Document : public ContainerNode,
257 public TreeScope, 269 public TreeScope,
258 public SecurityContext, 270 public SecurityContext,
259 public ExecutionContext, 271 public ExecutionContext,
260 public Supplementable<Document> { 272 public Supplementable<Document> {
261 DEFINE_WRAPPERTYPEINFO(); 273 DEFINE_WRAPPERTYPEINFO();
262 USING_GARBAGE_COLLECTED_MIXIN(Document); 274 USING_GARBAGE_COLLECTED_MIXIN(Document);
263 275
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 Element* createElementNS(const AtomicString& namespaceURI, 350 Element* createElementNS(const AtomicString& namespaceURI,
339 const AtomicString& qualifiedName, 351 const AtomicString& qualifiedName,
340 ExceptionState&); 352 ExceptionState&);
341 Element* createElement(const QualifiedName&, CreateElementFlags); 353 Element* createElement(const QualifiedName&, CreateElementFlags);
342 354
343 Element* elementFromPoint(int x, int y) const; 355 Element* elementFromPoint(int x, int y) const;
344 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const; 356 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const;
345 Range* caretRangeFromPoint(int x, int y); 357 Range* caretRangeFromPoint(int x, int y);
346 Element* scrollingElement(); 358 Element* scrollingElement();
347 359
348 void addNonAttachedStyle(Element&, RefPtr<ComputedStyle>); 360 void addStyleRecalcData(Element&, StyleRecalcData*);
349 ComputedStyle* getNonAttachedStyle(Element&); 361 StyleRecalcData* getStyleRecalcData(Element&);
350 362
351 String readyState() const; 363 String readyState() const;
352 364
353 AtomicString characterSet() const { return Document::encodingName(); } 365 AtomicString characterSet() const { return Document::encodingName(); }
354 366
355 AtomicString encodingName() const; 367 AtomicString encodingName() const;
356 368
357 void setContent(const String&); 369 void setContent(const String&);
358 370
359 String suggestedMIMEType() const; 371 String suggestedMIMEType() const;
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 PendingSheetLayout m_pendingSheetLayout; 1455 PendingSheetLayout m_pendingSheetLayout;
1444 1456
1445 Member<LocalFrame> m_frame; 1457 Member<LocalFrame> m_frame;
1446 Member<LocalDOMWindow> m_domWindow; 1458 Member<LocalDOMWindow> m_domWindow;
1447 TraceWrapperMember<HTMLImportsController> m_importsController; 1459 TraceWrapperMember<HTMLImportsController> m_importsController;
1448 1460
1449 Member<ResourceFetcher> m_fetcher; 1461 Member<ResourceFetcher> m_fetcher;
1450 Member<DocumentParser> m_parser; 1462 Member<DocumentParser> m_parser;
1451 Member<ContextFeatures> m_contextFeatures; 1463 Member<ContextFeatures> m_contextFeatures;
1452 1464
1453 HeapHashMap<Member<Element>, RefPtr<ComputedStyle>> m_nonAttachedStyle; 1465 HeapHashMap<Member<Element>, Member<StyleRecalcData>> m_styleRecalcDataMap;
esprehn 2016/11/07 22:26:26 HeapHashMap<Member<Element>, StyleRecalcData> tha
1454 1466
1455 bool m_wellFormed; 1467 bool m_wellFormed;
1456 1468
1457 // Document URLs. 1469 // Document URLs.
1458 KURL m_url; // Document.URL: The URL from which this document was retrieved. 1470 KURL m_url; // Document.URL: The URL from which this document was retrieved.
1459 KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs. 1471 KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs.
1460 KURL m_baseURLOverride; // An alternative base URL that takes precedence over 1472 KURL m_baseURLOverride; // An alternative base URL that takes precedence over
1461 // m_baseURL (but not m_baseElementURL). 1473 // m_baseURL (but not m_baseElementURL).
1462 KURL m_baseElementURL; // The URL set by the <base> element. 1474 KURL m_baseElementURL; // The URL set by the <base> element.
1463 KURL m_cookieURL; // The URL to use for cookie access. 1475 KURL m_cookieURL; // The URL to use for cookie access.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); 1735 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true);
1724 1736
1725 } // namespace blink 1737 } // namespace blink
1726 1738
1727 #ifndef NDEBUG 1739 #ifndef NDEBUG
1728 // Outside the WebCore namespace for ease of invocation from gdb. 1740 // Outside the WebCore namespace for ease of invocation from gdb.
1729 CORE_EXPORT void showLiveDocumentInstances(); 1741 CORE_EXPORT void showLiveDocumentInstances();
1730 #endif 1742 #endif
1731 1743
1732 #endif // Document_h 1744 #endif // Document_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.cpp ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698