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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Range* firstRange() const; 75 Range* firstRange() const;
76 76
77 // There functions are exposed for |FrameSelection|. 77 // There functions are exposed for |FrameSelection|.
78 void resetLogicalRange(); 78 void resetLogicalRange();
79 void setLogicalRange(Range*); 79 void setLogicalRange(Range*);
80 80
81 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date 81 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date
82 // layout if needed. 82 // layout if needed.
83 void updateIfNeeded(); 83 void updateIfNeeded();
84 84
85 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.
86 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.
87 void clearDocumentCachedRange();
88
85 DECLARE_TRACE(); 89 DECLARE_TRACE();
86 90
87 private: 91 private:
88 explicit SelectionEditor(LocalFrame&); 92 explicit SelectionEditor(LocalFrame&);
89 93
90 const Document& document() const; 94 const Document& document() const;
91 LocalFrame* frame() const { return m_frame.get(); } 95 LocalFrame* frame() const { return m_frame.get(); }
92 96
93 void clearVisibleSelection(); 97 void clearVisibleSelection();
94 bool shouldAlwaysUseDirectionalSelection() const; 98 bool shouldAlwaysUseDirectionalSelection() const;
95 99
96 Member<Document> m_document; 100 Member<Document> m_document;
97 Member<LocalFrame> m_frame; 101 Member<LocalFrame> m_frame;
98 102
99 VisibleSelection m_selection; 103 VisibleSelection m_selection;
100 VisibleSelectionInFlatTree m_selectionInFlatTree; 104 VisibleSelectionInFlatTree m_selectionInFlatTree;
101 bool m_observingVisibleSelection; 105 bool m_observingVisibleSelection;
102 106
107 // TODO(editing-dev): Removing |m_logicalRange|
103 // The range specified by the user, which may not be visually canonicalized 108 // The range specified by the user, which may not be visually canonicalized
104 // (hence "logical"). This will be invalidated if the underlying 109 // (hence "logical"). This will be invalidated if the underlying
105 // |VisibleSelection| changes. If that happens, this variable will 110 // |VisibleSelection| changes. If that happens, this variable will
106 // become |nullptr|, in which case logical positions == visible positions. 111 // become |nullptr|, in which case logical positions == visible positions.
107 Member<Range> m_logicalRange; 112 Member<Range> m_logicalRange;
113 // If document is root, document.getSelection().addRange(range) is cached on
114 // this.
115 Member<Range> m_cachedRange;
108 }; 116 };
109 117
110 } // namespace blink 118 } // namespace blink
111 119
112 #endif // SelectionEditor_h 120 #endif // SelectionEditor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698