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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionTemplate.cpp

Issue 2698793003: Get rid of redundant layout tree update related to selection (Closed)
Patch Set: 2017-02-17T16:13:56 selectionTypeWithLegacyGranularity() 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/SelectionTemplate.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
index 36ef7ba5f453f83aaa81dd24b6dd88b566c9aaa0..42d2e24cc5bb3a26116bbab933247563a9c7971a 100644
--- a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
@@ -133,6 +133,32 @@ void SelectionTemplate<Strategy>::showTreeForThis() const {
#endif
template <typename Strategy>
+const PositionTemplate<Strategy>&
+SelectionTemplate<Strategy>::computeEndPosition() const {
+ if (m_base == m_extent)
+ return m_base;
+ return m_base < m_extent ? m_extent : m_base;
+}
+
+template <typename Strategy>
+const PositionTemplate<Strategy>&
+SelectionTemplate<Strategy>::computeStartPosition() const {
+ if (m_base == m_extent)
+ return m_base;
+ return m_base < m_extent ? m_base : m_extent;
+}
+
+template <typename Strategy>
+SelectionType SelectionTemplate<Strategy>::selectionTypeWithLegacyGranularity()
+ const {
+ if (m_base.isNull())
+ return NoSelection;
+ if (m_base == m_extent && m_granularity == CharacterGranularity)
+ return CaretSelection;
+ return RangeSelection;
+}
+
+template <typename Strategy>
void SelectionTemplate<Strategy>::printTo(std::ostream* ostream,
const char* type) const {
if (isNone()) {

Powered by Google App Engine
This is Rietveld 408576698