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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2292913002: Ensure clean layout before calling plainText() (flat tree version) (Closed)
Patch Set: 201608301918 Created 4 years, 4 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/iterators/TextIterator.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index 5cc04a2bce4a99d935bfcbbc1b3fa9d29d1b0319..238385e2c460f66a6cb440149332f43f8e3c8f64 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -1211,6 +1211,12 @@ String plainText(const EphemeralRange& range, TextIteratorBehaviorFlags behavior
String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlags behavior)
{
+ // TODO(xiaochengh): Move this check and the DisallowTransitionScope to
+ // |createPlainText| after we have ensure that both versions of |plainText|
+ // are called with clean layout.
+ if (range.isNull())
+ return emptyString();
+ DocumentLifecycle::DisallowTransitionScope disallowTransition(range.startPosition().document()->lifecycle());
return createPlainText<EditingInFlatTreeStrategy>(range, behavior);
}

Powered by Google App Engine
This is Rietveld 408576698