https://bugs.webkit.org/show_bug.cgi?id=77934
.:
Reviewed by Kent Tamura.
* Source/autotools/symbols.filter: Added an exporting symbol.
Source/WebCore:
Reviewed by Kent Tamura.
On spellchecking, TextCheckingResult can contain a replacement text
which is usable both for an automatic replacement and for showing a suggestion.
But when marking a misspelled word ragarding to returned
TextCheckingResult, Editor uses only the misspelled range data and
discards the replacement value. Then it asks the same value again
when showing suggestion/autocorrection.
It would be great if the marker holds the replacement text
and Editor can use it on suggesting a correction, without any re-request.
This is especially true in the case when it needs IPC messaging for spellchecking:
We can save one round-trip by this technique.
Here is actual change:
- Passed the replacement text to addMarker() for for misspelling markers.
Note that this is done only for the unified checker path because legacy
TextCheckerClient API doesn't provide such a replacement.
- Added an Internals API to retrieve a description text on a marker.
Test: editing/spelling/spelling-marker-description.html
* WebCore.exp.in:
* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):
* testing/Internals.cpp:
(WebCore::Internals::markerAt):
(WebCore):
(WebCore::Internals::markerRangeForNode):
(WebCore::Internals::markerDescriptionForNode):
* testing/Internals.h:
(WebCore):
(Internals):
* testing/Internals.idl:
Source/WebKit/chromium:
didFinishCheckingText() accidentally dropped the description text
given from the backend. Fixed to copy it on the API-to-Core
convertion. The test won't work without this fix.
Reviewed by Kent Tamura.
* src/WebTextCheckingCompletionImpl.cpp:
(WebKit::toCoreResults):
Source/WebKit/win:
Reviewed by Kent Tamura.
* WebKit.vcproj/WebKit_Cairo.def:
* WebKit.vcproj/WebKit_Cairo_debug.def:
Source/WebKit2:
Reviewed by Kent Tamura.
* win/WebKit2.def:
* win/WebKit2CFLite.def:
Tools:
Made the mock requestCheckingOfText() implementation to return
a replacement text for each misspelled word if available.
Reviewed by Kent Tamura.
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::finishLastTextCheck):
LayoutTests:
Reviewed by Kent Tamura.
* editing/spelling/spelling-marker-description-expected.txt: Added.
* editing/spelling/spelling-marker-description.html: Added.
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107176
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Reviewed by Kent Tamura.
+
+ * Source/autotools/symbols.filter: Added an exporting symbol.
+
2012-02-07 Gyuyoung Kim <gyuyoung.kim@samsung.com>
[CMAKE] Use *bin* and *lib* directories for executable and libraries.
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Reviewed by Kent Tamura.
+
+ * editing/spelling/spelling-marker-description-expected.txt: Added.
+ * editing/spelling/spelling-marker-description.html: Added.
+ * platform/gtk/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+
2012-02-08 Igor Oliveira <igor.o@sisa.samsung.com>
Implement reverse animation direction
--- /dev/null
+The spellchecker should store replacement text in each marker.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS markedText is "wellcome"
+PASS markerDescription is "welcome"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+wellcome.
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="container">
+ <div id="destination" contentEditable></div>
+</div>
+
+<script>
+
+function done()
+{
+ layoutTestController.setAsynchronousSpellCheckingEnabled(false);
+ internals.settings.setUnifiedTextCheckingEnabled(false);
+ finishJSTest()
+}
+
+function verify(nretry)
+{
+ if (!nretry) {
+ done();
+ return;
+ }
+
+ var texts = destination.childNodes;
+ for (var i = 0; i < texts.length; ++i) {
+ if (internals.markerCountForNode(texts[i], "spelling")) {
+ markedText = internals.markerRangeForNode(texts[i], "spelling", 0).toString();
+ markerDescription = internals.markerDescriptionForNode(texts[i], "spelling", 0);
+ break;
+ }
+ }
+
+ if (markedText) {
+ shouldBeEqualToString("markedText", "wellcome");
+ shouldBeEqualToString("markerDescription", "welcome");
+ done();
+ }
+
+ // Wait until the async spellchecking is done.
+ window.setTimeout(function() { verify(nretry - 1); }, 0);
+}
+
+function test()
+{
+ jsTestIsAsync = true;
+ internals.settings.setUnifiedTextCheckingEnabled(true);
+ layoutTestController.setAsynchronousSpellCheckingEnabled(true);
+
+ var sel = window.getSelection();
+ var destination = document.getElementById("destination");
+ destination.focus();
+ document.execCommand("InsertHTML", false, "wellcome");
+ document.execCommand("InsertText", false, ".");
+
+ window.setTimeout(function() { verify(10); }, 0);
+}
+
+description("The spellchecker should store replacement text in each marker.");
+if (window.internals)
+ test();
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
editing/undo/undo-smart-delete-reversed-selection.html
editing/selection/directionality-after-undo-replace.html
+# EditorClient::checkTextOfParagraph() is not implemented
+editing/spelling/spelling-marker-description.html
+
# https://bugs.webkit.org/show_bug.cgi?id=64530
editing/selection/editable-html-element.html
editing/pasteboard/data-transfer-items-drag-drop-file.html
editing/pasteboard/data-transfer-items-drag-drop-string.html
+# Replacement text for misspelling is not given from NSSpellChecker.
+# https://bugs.webkit.org/show_bug.cgi?id=77934
+editing/spelling/spelling-marker-description.html
+
# Custom MIME type support in DataTransfer is not yet implemented.
editing/pasteboard/clipboard-customData.html
fast/events/drag-customData.html
editing/spelling/spellcheck-queue.html
editing/spelling/spellcheck-sequencenum.html
editing/spelling/spellcheck-async-mutation.html
+# EditorClient::checkTextOfParagraph() is not implemented
+editing/spelling/spelling-marker-description.html
# [Qt][GTK] editing/spelling/spellcheck-async.html fails
# https://bugs.webkit.org/show_bug.cgi?id=73003
# EditorClient::requestCheckingOfString() is not implemented
editing/spelling/spellcheck-paste.html
+# Replacement text for misspelling is not given.
+# https://bugs.webkit.org/show_bug.cgi?id=77934
+editing/spelling/spelling-marker-description.html
# IndexedDB is not yet enabled.
storage/indexeddb
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Reviewed by Kent Tamura.
+
+ On spellchecking, TextCheckingResult can contain a replacement text
+ which is usable both for an automatic replacement and for showing a suggestion.
+
+ But when marking a misspelled word ragarding to returned
+ TextCheckingResult, Editor uses only the misspelled range data and
+ discards the replacement value. Then it asks the same value again
+ when showing suggestion/autocorrection.
+
+ It would be great if the marker holds the replacement text
+ and Editor can use it on suggesting a correction, without any re-request.
+ This is especially true in the case when it needs IPC messaging for spellchecking:
+ We can save one round-trip by this technique.
+
+ Here is actual change:
+
+ - Passed the replacement text to addMarker() for for misspelling markers.
+ Note that this is done only for the unified checker path because legacy
+ TextCheckerClient API doesn't provide such a replacement.
+ - Added an Internals API to retrieve a description text on a marker.
+
+ Test: editing/spelling/spelling-marker-description.html
+
+ * WebCore.exp.in:
+ * editing/Editor.cpp:
+ (WebCore::Editor::markAndReplaceFor):
+ * testing/Internals.cpp:
+ (WebCore::Internals::markerAt):
+ (WebCore):
+ (WebCore::Internals::markerRangeForNode):
+ (WebCore::Internals::markerDescriptionForNode):
+ * testing/Internals.h:
+ (WebCore):
+ (Internals):
+ * testing/Internals.idl:
+
2012-02-08 Eric Seidel <eric@webkit.org>
Remove more cruft now that HTMLIsIndexElement is gone
__ZNK7WebCore14DocumentLoader21isLoadingMainResourceEv
__ZNK7WebCore14DocumentLoader28urlForHistoryReflectsFailureEv
__ZNK7WebCore14DocumentLoader3urlEv
+__ZNK7WebCore14DocumentMarker11descriptionEv
__ZNK7WebCore14FrameSelection11currentFormEv
__ZNK7WebCore14FrameSelection15copyTypingStyleEv
__ZNK7WebCore14FrameSelection17isInPasswordFieldEv
RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength);
if (!m_spellingCorrector->isSpellingMarkerAllowed(misspellingRange))
continue;
- misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
+ misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement);
} else if (shouldMarkGrammar && result->type == TextCheckingTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
ASSERT(resultLength > 0 && resultLocation >= 0);
for (unsigned j = 0; j < result->details.size(); j++) {
return node->document()->markers()->markersFor(node, markerTypes).size();
}
-PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
{
if (!node) {
ec = INVALID_ACCESS_ERR;
Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node, markerTypes);
if (markers.size() <= index)
return 0;
- return Range::create(node->document(), node, markers[index]->startOffset(), node, markers[index]->endOffset());
+ return markers[index];
+}
+
+PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+{
+ DocumentMarker* marker = markerAt(node, markerType, index, ec);
+ if (!marker)
+ return 0;
+ return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset());
+}
+
+String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+{
+ DocumentMarker* marker = markerAt(node, markerType, index, ec);
+ if (!marker)
+ return String();
+ return marker->description();
}
void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec)
class ClientRect;
class Document;
+class DocumentMarker;
class Element;
class InternalSettings;
class Node;
PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);
unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
- PassRefPtr<Range> markerRangeForNode(Node*, const String&, unsigned, ExceptionCode&);
+ PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
+ String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
void setScrollViewPosition(Document*, long x, long y, ExceptionCode&);
private:
explicit Internals(Document*);
+ DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
RefPtr<InternalSettings> m_settings;
};
ClientRect boundingBox(in Element element) raises(DOMException);
unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException);
Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);
+ DOMString markerDescriptionForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);
void setScrollViewPosition(in Document document, in long x, in long y) raises(DOMException);
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ didFinishCheckingText() accidentally dropped the description text
+ given from the backend. Fixed to copy it on the API-to-Core
+ convertion. The test won't work without this fix.
+
+ Reviewed by Kent Tamura.
+
+ * src/WebTextCheckingCompletionImpl.cpp:
+ (WebKit::toCoreResults):
+
2012-02-08 Dmitry Lomov <dslomov@chromium.org>
[V8][Chromium] Race between worker accessing WebDatabase and frame closing down.
namespace WebKit {
-static TextCheckingType toCoreCheckingType(WebTextCheckingResult::Error error)
-{
- if (error == WebTextCheckingResult::ErrorSpelling)
- return TextCheckingTypeSpelling;
- ASSERT(error == WebTextCheckingResult::ErrorGrammar);
- return TextCheckingTypeGrammar;
-}
-
static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingResult>& results)
{
Vector<TextCheckingResult> coreResults;
- for (size_t i = 0; i < results.size(); ++i) {
- TextCheckingResult coreResult;
- coreResult.type = toCoreCheckingType(results[i].error);
- coreResult.location = results[i].position;
- coreResult.length = results[i].length;
- coreResults.append(coreResult);
- }
-
+ for (size_t i = 0; i < results.size(); ++i)
+ coreResults.append(results[i]);
return coreResults;
}
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Reviewed by Kent Tamura.
+
+ * WebKit.vcproj/WebKit_Cairo.def:
+ * WebKit.vcproj/WebKit_Cairo_debug.def:
+
2012-02-02 Jon Lee <jonlee@apple.com>
Clear shown notifications when context is no longer active
??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
??0ClientRect@WebCore@@AAE@XZ
?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z
+ ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
?fastMalloc@WTF@@YAPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fastFree@WTF@@YAXPAX@Z
??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
??0ClientRect@WebCore@@AAE@XZ
?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z
+ ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
?fastMalloc@WTF@@YAPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fastFree@WTF@@YAXPAX@Z
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Reviewed by Kent Tamura.
+
+ * win/WebKit2.def:
+ * win/WebKit2CFLite.def:
+
2012-02-08 Anders Carlsson <andersca@apple.com>
Don't use the wheel event handler count to track if a page has horizontal scrollbars
??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
+ ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
+ ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
_ZNK7WebCore8Document8settingsEv;
_ZNK7WebCore8Document4viewEv;
_ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE;
+_ZNK7WebCore14DocumentMarker11descriptionEv;
_ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE;
_ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb;
_ZN7WebCore8Settings24setMockScrollbarsEnabledEb;
+2012-02-07 MORITA Hajime <morrita@google.com>
+
+ Replacement text should be available from the marker.
+ https://bugs.webkit.org/show_bug.cgi?id=77934
+
+ Made the mock requestCheckingOfText() implementation to return
+ a replacement text for each misspelled word if available.
+
+ Reviewed by Kent Tamura.
+
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::finishLastTextCheck):
+
2012-02-08 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
[Qt][DRT] DumpRenderTreeQt should support --no-timeout and --timeout options
m_spellcheck.spellCheckWord(WebString(text.characters(), text.length()), &misspelledPosition, &misspelledLength);
if (!misspelledLength)
break;
- results.append(WebTextCheckingResult(WebTextCheckingResult::ErrorSpelling, offset + misspelledPosition, misspelledLength));
+ Vector<WebString> suggestions;
+ m_spellcheck.fillSuggestionList(WebString(text.characters() + misspelledPosition, misspelledLength), &suggestions);
+ results.append(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength,
+ suggestions.isEmpty() ? WebString() : suggestions[0]));
text = text.substring(misspelledPosition + misspelledLength);
offset += misspelledPosition + misspelledLength;
}