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(); |
} |