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

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

Issue 1412713003: Reland 'Use FrameSelection::selectedText where possible.' Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reimplement setSelectionInTextFormControl: use setSelection. Created 5 years, 2 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 504a98c688b2619cf98ea95c0e05b7768545a06e..3369e7f6598644c725faf02d4648c0335f38697b 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -650,8 +650,11 @@ bool VisibleSelectionTemplate<Strategy>::isValidFor(const Document& document) co
template <typename Strategy>
void VisibleSelectionTemplate<Strategy>::setWithoutValidation(const PositionTemplate<Strategy>& base, const PositionTemplate<Strategy>& extent)
{
- ASSERT(!base.isNull());
- ASSERT(!extent.isNull());
+ if (base.isNull() || extent.isNull()) {
+ m_base = m_extent = m_start = m_end = PositionTemplate<Strategy>();
+ updateSelectionType();
+ 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

Powered by Google App Engine
This is Rietveld 408576698