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

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionTemplate.h

Issue 2698793003: Get rid of redundant layout tree update related to selection (Closed)
Patch Set: 2017-02-17T00:37:54 FrameSelection::selectFrameElementInParentIfFullySelected() to use FS::isRange() 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SelectionTemplate_h 5 #ifndef SelectionTemplate_h
6 #define SelectionTemplate_h 6 #define SelectionTemplate_h
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "core/editing/EphemeralRange.h" 10 #include "core/editing/EphemeralRange.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 SelectionTemplate& operator=(const SelectionTemplate&) = default; 80 SelectionTemplate& operator=(const SelectionTemplate&) = default;
81 81
82 bool operator==(const SelectionTemplate&) const; 82 bool operator==(const SelectionTemplate&) const;
83 bool operator!=(const SelectionTemplate&) const; 83 bool operator!=(const SelectionTemplate&) const;
84 84
85 const PositionTemplate<Strategy>& base() const; 85 const PositionTemplate<Strategy>& base() const;
86 const PositionTemplate<Strategy>& extent() const; 86 const PositionTemplate<Strategy>& extent() const;
87 TextAffinity affinity() const { return m_affinity; } 87 TextAffinity affinity() const { return m_affinity; }
88 TextGranularity granularity() const { return m_granularity; } 88 TextGranularity granularity() const { return m_granularity; }
89 bool hasTrailingWhitespace() const { return m_hasTrailingWhitespace; } 89 bool hasTrailingWhitespace() const { return m_hasTrailingWhitespace; }
90 bool isCaret() const { return m_base.isNotNull() && m_base == m_extent; }
90 bool isDirectional() const { return m_isDirectional; } 91 bool isDirectional() const { return m_isDirectional; }
91 bool isHandleVisible() const { return m_isHandleVisible; } 92 bool isHandleVisible() const { return m_isHandleVisible; }
92 bool isNone() const { return m_base.isNull(); } 93 bool isNone() const { return m_base.isNull(); }
94 bool isRange() const { return m_base != m_extent; }
93 95
94 // Returns true if |this| selection holds valid values otherwise it causes 96 // Returns true if |this| selection holds valid values otherwise it causes
95 // assertion failure. 97 // assertion failure.
96 bool assertValid() const; 98 bool assertValid() const;
97 bool assertValidFor(const Document&) const; 99 bool assertValidFor(const Document&) const;
98 100
101 const PositionTemplate<Strategy>& computeEndPosition() const;
102 const PositionTemplate<Strategy>& computeStartPosition() const;
103
99 DECLARE_TRACE(); 104 DECLARE_TRACE();
100 105
101 void printTo(std::ostream*, const char* type) const; 106 void printTo(std::ostream*, const char* type) const;
102 #ifndef NDEBUG 107 #ifndef NDEBUG
103 void showTreeForThis() const; 108 void showTreeForThis() const;
104 #endif 109 #endif
105 110
106 private: 111 private:
107 friend class SelectionEditor; 112 friend class SelectionEditor;
108 113
(...skipping 18 matching lines...) Expand all
127 132
128 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>; 133 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>;
129 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>; 134 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>;
130 135
131 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&); 136 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&);
132 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&); 137 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&);
133 138
134 } // namespace blink 139 } // namespace blink
135 140
136 #endif // SelectionTemplate_h 141 #endif // SelectionTemplate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698