Commit 8c5332d2 authored by nghanavatian@rim.com's avatar nghanavatian@rim.com

[BlackBerry] Fix crash in SpellingHandler

https://bugs.webkit.org/show_bug.cgi?id=107842

Reviewed by Rob Buis.

If we have an empty range or one with all spaces, we can simply return 0 instead of
still creating a range. Putting in a null check after trimming to catch this case
which was causing the crash in some DRT tests.

Internally reviewed by Mike Fenton.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::trimWhitespaceFromRange):
* WebKitSupport/SpellingHandler.cpp:
(BlackBerry::WebKit::SpellingHandler::createSpellCheckRequest):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f972cbb4
2013-01-24 Nima Ghanavatian <nghanavatian@rim.com>
[BlackBerry] Fix crash in SpellingHandler
https://bugs.webkit.org/show_bug.cgi?id=107842
Reviewed by Rob Buis.
If we have an empty range or one with all spaces, we can simply return 0 instead of
still creating a range. Putting in a null check after trimming to catch this case
which was causing the crash in some DRT tests.
Internally reviewed by Mike Fenton.
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::trimWhitespaceFromRange):
* WebKitSupport/SpellingHandler.cpp:
(BlackBerry::WebKit::SpellingHandler::createSpellCheckRequest):
2013-01-24 Sean Wang <Xuewen.Wang@torchmobile.com.cn>
[BlackBerry] It can't Select texts in main frame when the current focus is in a IFrame
......
......@@ -524,7 +524,7 @@ PassRefPtr<Range> trimWhitespaceFromRange(PassRefPtr<Range> range)
PassRefPtr<Range> trimWhitespaceFromRange(VisiblePosition startPosition, VisiblePosition endPosition)
{
if (isEmptyRangeOrAllSpaces(startPosition, endPosition))
return VisibleSelection(endPosition, endPosition).toNormalizedRange();
return 0;
while (isWhitespace(startPosition.characterAfter()))
startPosition = startPosition.next();
......@@ -532,7 +532,7 @@ PassRefPtr<Range> trimWhitespaceFromRange(VisiblePosition startPosition, Visible
while (isWhitespace(endPosition.characterBefore()))
endPosition = endPosition.previous();
return VisibleSelection(startPosition, endPosition).toNormalizedRange();
return makeRange(startPosition, endPosition);
}
bool isEmptyRangeOrAllSpaces(VisiblePosition startPosition, VisiblePosition endPosition)
......
......@@ -81,6 +81,8 @@ void SpellingHandler::createSpellCheckRequest(PassRefPtr<WebCore::Range> rangeFo
{
RefPtr<WebCore::Range> rangeForSpellChecking = rangeForSpellCheckingPtr;
rangeForSpellChecking = DOMSupport::trimWhitespaceFromRange(rangeForSpellChecking);
if (!rangeForSpellChecking)
return;
SpellingLog(Platform::LogLevelInfo, "SpellingHandler::createSpellCheckRequest Substring text is '%s', of size %d"
, rangeForSpellChecking->text().latin1().data()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment