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

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

Issue 1377963004: Use FrameSelection::selectedText where possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 a44fb7fe158a41f6cea467fb506ce0c457227f9c..5e33c70f0e8b531f4afe6e591f24f53cbf0b8996 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -269,7 +269,8 @@ EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const
// ^ selected
//
ASSERT(isRange());
- return normalizeRange(EphemeralRange(m_start, m_end));
+ const EphemeralRange range(m_start, m_end);
+ return range.isNotNull() ? normalizeRange(range) : range;
yosin_UTC9 2015/10/01 06:29:09 Why do you check |range.isNotNull()|? If |isRange(
kotenkov 2015/10/02 08:28:07 Yes, you are right. Now I understand that I should
}
bool VisibleSelection::expandUsingGranularity(TextGranularity granularity)
@@ -1172,7 +1173,8 @@ VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate()
template <typename Strategy>
EphemeralRangeTemplate<Strategy> VisibleSelectionTemplate<Strategy>::toNormalizedEphemeralRange() const
{
- return normalizeRange(EphemeralRangeTemplate<Strategy>(start(), end()));
+ const EphemeralRangeTemplate<Strategy> range(start(), end());
yosin_UTC9 2015/10/01 06:29:09 Do you have a case we call |toNormalizedEphemeralR
kotenkov 2015/10/02 08:28:07 No, it seems, that we should only call |toNormaliz
+ return range.isNotNull() ? normalizeRange(range) : range;
}
template <typename Strategy>

Powered by Google App Engine
This is Rietveld 408576698