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

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

Issue 2680943004: Make FrameSelection to hold non-canonicalized positions (Closed)
Patch Set: 2017-02-10T16:43:07 Rebase and update test expectation for cached Document Range 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/VisibleSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
index 93a33918ea786837abb6554909c17aab4b78dc89..8d89792653f41418faea5f8a3e9a1dd4f115a4f3 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -482,7 +482,8 @@ void VisibleSelectionTemplate<Strategy>::validate(TextGranularity granularity) {
// TODO(xiaochengh): Add a DocumentLifecycle::DisallowTransitionScope here.
m_granularity = granularity;
- m_hasTrailingWhitespace = false;
+ if (m_granularity != WordGranularity)
+ m_hasTrailingWhitespace = false;
setBaseAndExtentToDeepEquivalents();
if (m_base.isNull() || m_extent.isNull()) {
m_base = m_extent = m_start = m_end = PositionTemplate<Strategy>();
@@ -518,6 +519,9 @@ void VisibleSelectionTemplate<Strategy>::validate(TextGranularity granularity) {
m_start = mostForwardCaretPosition(m_start);
m_end = mostBackwardCaretPosition(m_end);
}
+ if (!m_hasTrailingWhitespace)
+ return;
+ appendTrailingWhitespace();
}
template <typename Strategy>

Powered by Google App Engine
This is Rietveld 408576698