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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.h
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index 8e2379b87dbb9f46de569918391676782f842009..99ac211f8e1c1e51c2c72a19d5abb6bb48bfb827 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -41,6 +41,7 @@
#include "core/dom/DocumentTiming.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/MutationObserver.h"
+#include "core/dom/Text.h"
#include "core/dom/TextLinkColors.h"
#include "core/dom/TreeScope.h"
#include "core/dom/UserActionElementSet.h"
@@ -51,6 +52,7 @@
#include "core/frame/HostsUsingFeatures.h"
#include "core/html/parser/ParserSynchronizationPolicy.h"
#include "core/page/PageVisibilityState.h"
+#include "core/style/ComputedStyle.h"
#include "platform/Length.h"
#include "platform/Timer.h"
#include "platform/weborigin/KURL.h"
@@ -159,7 +161,6 @@ class StringOrDictionary;
class StyleEngine;
class StyleResolver;
class StyleSheetList;
-class Text;
class TextAutosizer;
class Touch;
class TouchList;
@@ -251,6 +252,17 @@ enum WouldLoadReason {
WouldLoadReasonEnd
};
+struct StyleRecalcData : public GarbageCollectedFinalized<StyleRecalcData> {
rune 2016/11/07 09:43:19 This is only used for reattachment, right? How abo
+ StyleRecalcData(RefPtr<ComputedStyle> computedStyle, Text* nextTextSibling)
+ : computedStyle(std::move(computedStyle)),
+ nextTextSibling(nextTextSibling) {}
+
+ RefPtr<ComputedStyle> computedStyle;
+ Member<Text> nextTextSibling;
+
+ DEFINE_INLINE_TRACE() { visitor->trace(nextTextSibling); }
+};
+
using DocumentClassFlags = unsigned char;
class CORE_EXPORT Document : public ContainerNode,
@@ -345,8 +357,8 @@ class CORE_EXPORT Document : public ContainerNode,
Range* caretRangeFromPoint(int x, int y);
Element* scrollingElement();
- void addNonAttachedStyle(Element&, RefPtr<ComputedStyle>);
- ComputedStyle* getNonAttachedStyle(Element&);
+ void addStyleRecalcData(Element&, StyleRecalcData*);
+ StyleRecalcData* getStyleRecalcData(Element&);
String readyState() const;
@@ -1450,7 +1462,7 @@ class CORE_EXPORT Document : public ContainerNode,
Member<DocumentParser> m_parser;
Member<ContextFeatures> m_contextFeatures;
- HeapHashMap<Member<Element>, RefPtr<ComputedStyle>> m_nonAttachedStyle;
+ HeapHashMap<Member<Element>, Member<StyleRecalcData>> m_styleRecalcDataMap;
esprehn 2016/11/07 22:26:26 HeapHashMap<Member<Element>, StyleRecalcData> tha
bool m_wellFormed;
« 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