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

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

Issue 1581333002: Make VisibleSelection::setWithoutValidation() to handle TextAffinity::Upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-01-14T14:55:53 Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/caret/set-without-validation-with-upstream-caret.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb22794170d9d7999a0bd5fcf5b0b9deb3f8a8b7..a88fba5875d9c183a74291bfcb30699b1c9fac91 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -655,10 +655,6 @@ void VisibleSelectionTemplate<Strategy>::setWithoutValidation(const PositionTemp
return;
}
- // TODO(hajimehoshi): We doubt this assertion is needed. This was introduced
- // by http://trac.webkit.org/browser/trunk/WebCore/editing/Selection.cpp?annotate=blame&rev=21071
- ASSERT(m_affinity == TextAffinity::Downstream);
-
m_base = base;
m_extent = extent;
m_baseIsFirst = base.compareTo(extent) <= 0;
@@ -670,6 +666,12 @@ void VisibleSelectionTemplate<Strategy>::setWithoutValidation(const PositionTemp
m_end = base;
}
m_selectionType = base == extent ? CaretSelection : RangeSelection;
+ if (m_selectionType != CaretSelection) {
+ // Since |m_affinity| for non-|CaretSelection| is always |Downstream|,
+ // we should keep this invariant. Note: This function can be called with
+ // |m_affinity| is |TextAffinity::Upstream|.
+ m_affinity = TextAffinity::Downstream;
+ }
didChange();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/caret/set-without-validation-with-upstream-caret.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698