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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 1335573004: Introduce Range::dispose() for prompt detachment from owner Document. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: replace use of selectNodeContents() also 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
« no previous file with comments | « Source/core/editing/spellcheck/SpellCheckRequester.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 5e2b49ed4ad94f60b53136cab1ed99bba2dc580d..7c47db4a1c2964afc7fcda5a912dedc3b8087f8e 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -256,15 +256,16 @@ static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu
// Select the document body.
RefPtrWillBeRawPtr<Range> range(document->createRange());
yosin_UTC9 2015/09/11 07:07:19 Thus, we don't need to use |Range|. We may want to
sof 2015/09/11 07:11:42 I'm sorry, spaced out completely - we clearly don'
- TrackExceptionState exceptionState;
- range->selectNodeContents(document->body(), exceptionState);
+ ScopedDisposal<Range> disposeScope(range.get());
+
+ if (document->body()) {
+ const EphemeralRange range = EphemeralRange::rangeOfContents(*document->body());
- if (!exceptionState.hadException()) {
// The text iterator will walk nodes giving us text. This is similar to
// the plainText() function in core/editing/TextIterator.h, but we implement the maximum
// size and also copy the results directly into a wstring, avoiding the
// string conversion.
- for (TextIterator it(range->startPosition(), range->endPosition()); !it.atEnd(); it.advance()) {
+ for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(); it.advance()) {
it.text().appendTextToStringBuilder(output, 0, maxChars - output.length());
if (output.length() >= maxChars)
return; // Filled up the buffer.
« no previous file with comments | « Source/core/editing/spellcheck/SpellCheckRequester.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698