diff options
author | George Mount <mount@google.com> | 2012-03-02 15:14:43 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-02 15:14:43 -0800 |
commit | 80c50c338a1cdc9295d4f712db8ae624f49d6301 (patch) | |
tree | 035368c49a3adb48525c4baf8fbda81af3bf11f0 /Source/WebKit | |
parent | a5814187e4b55a2682707ab4d69cdb586c0a9210 (diff) | |
parent | 1045cce1e3570e0eba94274e8960e1ed7a2335d0 (diff) | |
download | external_webkit-80c50c338a1cdc9295d4f712db8ae624f49d6301.zip external_webkit-80c50c338a1cdc9295d4f712db8ae624f49d6301.tar.gz external_webkit-80c50c338a1cdc9295d4f712db8ae624f49d6301.tar.bz2 |
Merge "Fix crash when getting input text on an empty node."
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 3a48490..7b3cf67 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -3662,11 +3662,11 @@ String WebViewCore::getInputText(Node* node) text = renderText->text(); else { // It must be content editable field. - Position inNode(node, 0); Position start = firstPositionInNode(node); Position end = lastPositionInNode(node); VisibleSelection allEditableText(start, end); - text = allEditableText.firstRange()->text(); + if (allEditableText.isRange()) + text = allEditableText.firstRange()->text(); } return text; } @@ -4205,12 +4205,14 @@ String WebViewCore::getText(int startX, int startY, int endX, int endY) for (size_t i = 0; i < ranges.size(); i++) { const VisibleSelection& selection = ranges[i]; - PassRefPtr<Range> range = selection.firstRange(); - String textInRange = range->text(); - if (textInRange.length() > 0) { - if (text.length() > 0) - text.append('\n'); - text.append(textInRange); + if (selection.isRange()) { + PassRefPtr<Range> range = selection.firstRange(); + String textInRange = range->text(); + if (textInRange.length() > 0) { + if (text.length() > 0) + text.append('\n'); + text.append(textInRange); + } } } |