Index: third_party/WebKit/Source/core/editing/DOMSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
index d473161afba0f1e496fda0842d1b9f6079b6c2fb..5baad3bab0b5703e3fdb928a53a847f096b230f8 100644 |
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
@@ -538,7 +538,12 @@ Range* DOMSelection::getRangeAt(unsigned index, |
} |
Range* DOMSelection::primaryRangeOrNull() const { |
- return rangeCount() > 0 ? getRangeAt(0, ASSERT_NO_EXCEPTION) : nullptr; |
+ if (rangeCount() <= 0) |
+ return nullptr; |
+ Range* range = getRangeAt(0, ASSERT_NO_EXCEPTION); |
+ if (!isSelectionOfDocument()) |
yosin_UTC9
2017/04/04 04:50:07
I'm not a fan of this approach. We still create te
yoichio
2017/04/04 05:32:42
Creating temporary Ranges and Disposing them is di
yosin_UTC9
2017/04/04 07:21:31
Calling Range::dispose() is error prone in this ca
tkent
2017/04/04 08:41:24
I agree that it's a hack :)
If we have no reason t
|
+ range->dispose(); |
+ return range; |
} |
EphemeralRange DOMSelection::createRangeFromSelectionEditor() const { |