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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionEditor.h

Issue 2653523003: Make DOMSelection cache Range (Closed)
Patch Set: cache Range in SelectionEditor Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/SelectionEditor.h
diff --git a/third_party/WebKit/Source/core/editing/SelectionEditor.h b/third_party/WebKit/Source/core/editing/SelectionEditor.h
index cd1e2dafb5194f76847e1f55e337c58bd9b3b2e2..9b72a2be9e2f74bfd2ae2f26f1409359114aeac7 100644
--- a/third_party/WebKit/Source/core/editing/SelectionEditor.h
+++ b/third_party/WebKit/Source/core/editing/SelectionEditor.h
@@ -82,6 +82,10 @@ class SelectionEditor final
// layout if needed.
void updateIfNeeded();
+ void cacheRangeOfDocument(Range* range) { m_cachedRange = range; }
yosin_UTC9 2017/02/09 06:52:06 Let's move an implementation to "SelectionEdtior.c
yoichio 2017/02/09 09:31:19 Done.
+ Range* documentCachedRange() const { return m_cachedRange; }
yosin_UTC9 2017/02/09 06:52:06 Let's move an implementation to "SelectionEdtior.c
yoichio 2017/02/09 09:31:19 Done.
+ void clearDocumentCachedRange();
+
DECLARE_TRACE();
private:
@@ -100,11 +104,15 @@ class SelectionEditor final
VisibleSelectionInFlatTree m_selectionInFlatTree;
bool m_observingVisibleSelection;
+ // TODO(editing-dev): Removing |m_logicalRange|
// The range specified by the user, which may not be visually canonicalized
// (hence "logical"). This will be invalidated if the underlying
// |VisibleSelection| changes. If that happens, this variable will
// become |nullptr|, in which case logical positions == visible positions.
Member<Range> m_logicalRange;
+ // If document is root, document.getSelection().addRange(range) is cached on
+ // this.
+ Member<Range> m_cachedRange;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698