Commit 7a18feed authored by morrita@google.com's avatar morrita@google.com

2010-10-28 MORITA Hajime <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        * editing/spelling/script-tests/spellcheck-paste.js: Added.
        * editing/spelling/spellcheck-paste.html: Added.
        * editing/spelling/spellcheck-paste-expected.txt: Added.
        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/mac-leopard/Skipped:
        * platform/mac-tiger/Skipped:
        * platform/mac-wk2/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        - Introduced SpellChecker class to encapsulate asynchronous spell
          checker state: sequence id, requesting text and target node.
          This is also the first step to decompose spell-check related
          code to a separate class.
        - Added EditorClient::isAsynchronousSpellCheckingEnabled()
          to use async spellcheck API on the platform.
          These APIs are touched by SpellChecker.
        - Used SpellChecker to check a pasted test. Text to check is
          collected from the subtree under the editingRoot.
        - Added Setting::m_asynchronousSpellCheckingEnabled to control
          async spell checking.

        Test: editing/spelling/spellcheck-paste.html

        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.exp.in:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * dom/DocumentMarkerController.cpp:
        (WebCore::DocumentMarkerController::showMarkers):
        (showDocumentMarkers):
        * dom/DocumentMarkerController.h:
        * dom/PositionIterator.cpp:
        (WebCore::PositionIterator::setOffsetInLeafNode):
        * dom/PositionIterator.h:
        * editing/Editor.cpp:
        (WebCore::Editor::replaceSelectionWithFragment):
        (WebCore::Editor::Editor):
        (WebCore::findFirstMarkable):
        (WebCore::Editor::selectionStartHasSpellingMarkerFor):
        * editing/Editor.h:
        (WebCore::Editor::spellChecker):
        * editing/SpellChecker.cpp: Added.
        (WebCore::SpellChecker::SpellChecker):
        (WebCore::SpellChecker::~SpellChecker):
        (WebCore::SpellChecker::initRequest):
        (WebCore::SpellChecker::clearRequest):
        (WebCore::SpellChecker::isAsynchronousEnabled):
        (WebCore::SpellChecker::canCheckAsynchronously):
        (WebCore::SpellChecker::isBusy):
        (WebCore::SpellChecker::isValid):
        (WebCore::SpellChecker::isCheckable):
        (WebCore::SpellChecker::requestCheckingFor):
        (WebCore::forwardIterator):
        (WebCore::SpellChecker::didCheck):
        * editing/SpellChecker.h: Added.
        (WebCore::SpellCheckingResult::SpellCheckingResult):
        (WebCore::SpellCheckingResult::type):
        (WebCore::SpellCheckingResult::location):
        (WebCore::SpellCheckingResult::length):
        * loader/EmptyClients.h:
        (WebCore::EmptyEditorClient::requestCheckingOfString):
        * page/EditorClient.h:
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        * page/Settings.h:
        (WebCore::Settings::setAsynchronousSpellCheckingEnabled):
        (WebCore::Settings::asynchronousSpellCheckingEnabled):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * src/EditorClientImpl.h:
        (WebKit::EditorClientImpl::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/EditorClientEfl.h:
        (WebCore::EditorClientEfl::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/EditorClientGtk.h:
        (WebKit::EditorClient::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/EditorClientHaiku.h:
        (WebCore::EditorClientHaiku::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added asynchronous spell checking API to WebEditorClient using
        -[NSSpellChecker requestCheckingOfString].
        Note that WebEditorSpellCheckResponder is a small class to receive
        requested spell-checking result. Note that this feature is
        disabled at default.

        Also added [WebPreferences setAsynchronousSpellCheckingEnabled:] to
        enable the feature from LayoutTestController.

        * WebCoreSupport/WebEditorClient.h:
        * WebCoreSupport/WebEditorClient.mm:
        (-[WebEditorSpellCheckResponder initWithSender:WebCore::sequence:results:]):
        (-[WebEditorSpellCheckResponder perform]):
        (toCoreSpellingResult):
        (-[WebEditorSpellCheckResponder WTF::WebCore::]):
        (WebEditorClient::requestCheckingOfString):
        * WebView/WebPreferenceKeysPrivate.h:
        * WebView/WebPreferences.mm:
        (+[WebPreferences initialize]):
        (-[WebPreferences setAsynchronousSpellCheckingEnabled:]):
        (-[WebPreferences asynchronousSpellCheckingEnabled]):
        * WebView/WebPreferencesPrivate.h:
        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/EditorClientQt.h:
        (WebCore::EditorClientQt::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/WebEditorClient.h:
        (WebEditorClient::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebCoreSupport/EditorClientWinCE.h:
        (WebKit::EditorClient::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebKitSupport/EditorClientWx.h:
        (WebCore::EditorClientWx::requestCheckingOfString):
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added a stub implememntation.

        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
        (WebKit::WebEditorClient::requestCheckingOfString):
        * WebProcess/WebCoreSupport/WebEditorClient.h:
2010-10-28  MORITA Hajime  <morrita@google.com>

        Reviewed by Ojan Vafai.

        spellcheck does not check pasted text
        https://bugs.webkit.org/show_bug.cgi?id=40092

        Added LayoutTestController::setAsynchronousSpellCheckingEnabled()
        to control the setting.

        * DumpRenderTree/LayoutTestController.cpp:
        (setAsynchronousSpellCheckingEnabledCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):
        * DumpRenderTree/mac/DumpRenderTree.mm:
        (resetDefaultsToConsistentValues):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):
        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
        (LayoutTestController::setAsynchronousSpellCheckingEnabled):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 237c1ea4
2010-10-28 MORITA Hajime <morrita@google.com>
Reviewed by Ojan Vafai.
spellcheck does not check pasted text
https://bugs.webkit.org/show_bug.cgi?id=40092
* editing/spelling/script-tests/spellcheck-paste.js: Added.
* editing/spelling/spellcheck-paste.html: Added.
* editing/spelling/spellcheck-paste-expected.txt: Added.
* platform/chromium/test_expectations.txt:
* platform/gtk/Skipped:
* platform/mac-leopard/Skipped:
* platform/mac-tiger/Skipped:
* platform/mac-wk2/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
2010-12-12 Sam Weinig <sam@webkit.org>
Update WebKit2 skipped list.
......
description('For Bug 40092: Spell checking for pasted text.');
layoutTestController.waitUntilDone();
var testRoot = document.createElement("div");
document.body.insertBefore(testRoot, document.body.firstChild);
var testTextArea = document.createElement("textarea");
testRoot.appendChild(testTextArea);
var testInput = document.createElement("input");
testInput.setAttribute("type", "text");
testRoot.appendChild(testInput);
var testEditable = document.createElement("div");
testEditable.setAttribute("contentEditable", "true");
testRoot.appendChild(testEditable);
var testSourcePlain = document.createElement("div");
testSourcePlain.innerHTML = "foo bar";
testRoot.appendChild(testSourcePlain);
var testSourceDecorated = document.createElement("div");
testSourceDecorated.innerHTML = "fo<b>o ba</b>r";
testRoot.appendChild(testSourceDecorated);
var sel = window.getSelection();
var tests = [];
function done()
{
var next = tests.shift();
if (next)
return window.setTimeout(next, 0);
testRoot.style.display = "none";
layoutTestController.notifyDone();
}
function verifyMarker(node, expectedMarked)
{
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
node.focus();
} else {
sel.selectAllChildren(node);
}
return layoutTestController.hasSpellingMarker(expectedMarked[0], expectedMarked[1]);
}
function pasteAndVerify(source, dest, expectedMarked)
{
sel.selectAllChildren(source);
document.execCommand("Copy");
if (dest instanceof HTMLInputElement || dest instanceof HTMLTextAreaElement) {
dest.value = "";
dest.focus();
} else {
dest.innerHTML = "";
sel.selectAllChildren(dest);
}
document.execCommand("Paste");
var nretry = 10;
var nsleep = 1;
function trial() {
var verified = verifyMarker(dest, expectedMarked);
if (verified) {
testPassed(dest.tagName + " has a marker on '" + source.innerHTML + "'");
done();
return;
}
nretry--;
if (0 == nretry) {
testFailed(dest.tagName + " should have a marker on for '" + source.innerHTML + "'");
done();
return;
}
nsleep *= 2;
window.setTimeout(trial, nsleep);
};
trial();
};
if (window.layoutTestController)
layoutTestController.setAsynchronousSpellCheckingEnabled(true);
tests.push(function() { pasteAndVerify(testSourcePlain, testInput, [0, 3]); });
tests.push(function() { pasteAndVerify(testSourceDecorated, testInput, [0, 3]); });
tests.push(function() { pasteAndVerify(testSourcePlain, testTextArea, [0, 3]); });
tests.push(function() { pasteAndVerify(testSourceDecorated, testTextArea, [0, 3]); });
tests.push(function() { pasteAndVerify(testSourcePlain, testEditable, [0, 3]); });
tests.push(function() { pasteAndVerify(testSourceDecorated, testEditable, [0, 2]); }); // To check "fo" part of foo.
done();
var successfullyParsed = true;
For Bug 40092: Spell checking for pasted text.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
PASS INPUT has a marker on 'foo bar'
PASS INPUT has a marker on 'fo<b>o ba</b>r'
PASS TEXTAREA has a marker on 'foo bar'
PASS TEXTAREA has a marker on 'fo<b>o ba</b>r'
PASS DIV has a marker on 'foo bar'
PASS DIV has a marker on 'fo<b>o ba</b>r'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script src="resources/js-test-selection-shared.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/spellcheck-paste.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -2485,6 +2485,9 @@ BUGWK41311 WIN LINUX : fast/borders/borderRadiusDouble07.html = IMAGE
BUGWK41311 WIN LINUX : fast/borders/borderRadiusDouble08.html = IMAGE
BUGWK41311 WIN LINUX : fast/borders/borderRadiusDouble09.html = IMAGE
// Need to implement EditorClient::requestCheckingOfString()
BUGWK41423 : editing/spelling/spellcheck-paste.html = TIMEOUT
// Flaky tests.
BUG44345 LINUX : svg/zoom/text/zoom-hixie-mixed-009.xml = IMAGE PASS
BUG44346 LINUX : svg/zoom/page/zoom-hixie-mixed-009.xml = IMAGE PASS
......
......@@ -964,6 +964,14 @@ editing/selection/unrendered-004.html
editing/selection/unrendered-005.html
editing/selection/unrendered-space.html
editing/selection/word-granularity.html
editing/spelling/inline_spelling_markers.html
editing/spelling/spellcheck-attribute.html
editing/spelling/spelling-hasspellingmarker.html
editing/spelling/spelling-backspace-between-lines.html
editing/spelling/spelling-linebreak.html
editing/spelling/spelling-attribute-change.html
editing/spelling/spelling-attribute-at-child.html
editing/spelling/spellcheck-paste.html
editing/style/5065910.html
editing/style/apple-style-editable-mix.html
editing/style/block-style-001.html
......
......@@ -88,6 +88,9 @@ fast/text/hyphenate-locale.html
# See https://bugs.webkit.org/show_bug.cgi?id=35271
http/tests/media/video-seekable-stall.html
# Available 10.6 or later
editing/spelling/spellcheck-paste.html
# Disable tests which started failing after r66961
# Failures look like an underlying platform issue
# https://bugs.webkit.org/show_bug.cgi?id=45546
......
......@@ -209,6 +209,9 @@ fast/harness/show-modal-dialog.html
# Loading fails on Tiger with error -1012 after asking NSURLConnection to continue without credentials.
http/tests/misc/401-alternative-content.php
# Available only 10.6 or later
editing/spelling/spellcheck-paste.html
# Disable spelling tests for autocorrection panel
platform/mac/editing/spelling/autocorrection-contraction.html
platform/mac/editing/spelling/autocorrection-delete.html
......
......@@ -173,6 +173,7 @@ editing/selection/triple-click-in-pre.html
editing/selection/user-drag-element-and-user-select-none.html
editing/selection/word-granularity.html
editing/spelling/context-menu-suggestions.html
editing/spelling/spellcheck-paste.html
editing/undo/undo-deleteWord.html
editing/undo/undo-smart-delete-reversed-selection.html
editing/undo/undo-smart-delete-word.html
......
......@@ -2090,6 +2090,9 @@ editing/spelling/spelling-backspace-between-lines.html
editing/spelling/spelling-attribute-change.html
editing/spelling/spelling-attribute-at-child.html
# EditorClient::requestCheckingOfString() is not implemented
editing/spelling/spellcheck-paste.html
# ============================================================================= #
# failing editing/style tests
# ============================================================================= #
......
......@@ -945,6 +945,9 @@ editing/spelling/spelling-backspace-between-lines.html
editing/spelling/spelling-contenteditable.html
editing/spelling/spelling-textarea.html
# EditorClient::requestCheckingOfString() is not implemented
editing/spelling/spellcheck-paste.html
# IndexedDB is not yet enabled.
storage/indexeddb
......
......@@ -951,6 +951,7 @@ SET(WebCore_SOURCES
editing/SelectionController.cpp
editing/SetNodeAttributeCommand.cpp
editing/SmartReplace.cpp
editing/SpellChecker.cpp
editing/SplitElementCommand.cpp
editing/SplitTextNodeCommand.cpp
editing/SplitTextNodeContainingElementCommand.cpp
......
2010-10-28 MORITA Hajime <morrita@google.com>
Reviewed by Ojan Vafai.
spellcheck does not check pasted text
https://bugs.webkit.org/show_bug.cgi?id=40092
- Introduced SpellChecker class to encapsulate asynchronous spell
checker state: sequence id, requesting text and target node.
This is also the first step to decompose spell-check related
code to a separate class.
- Added EditorClient::isAsynchronousSpellCheckingEnabled()
to use async spellcheck API on the platform.
These APIs are touched by SpellChecker.
- Used SpellChecker to check a pasted test. Text to check is
collected from the subtree under the editingRoot.
- Added Setting::m_asynchronousSpellCheckingEnabled to control
async spell checking.
Test: editing/spelling/spellcheck-paste.html
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::showMarkers):
(showDocumentMarkers):
* dom/DocumentMarkerController.h:
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::setOffsetInLeafNode):
* dom/PositionIterator.h:
* editing/Editor.cpp:
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::Editor):
(WebCore::findFirstMarkable):
(WebCore::Editor::selectionStartHasSpellingMarkerFor):
* editing/Editor.h:
(WebCore::Editor::spellChecker):
* editing/SpellChecker.cpp: Added.
(WebCore::SpellChecker::SpellChecker):
(WebCore::SpellChecker::~SpellChecker):
(WebCore::SpellChecker::initRequest):
(WebCore::SpellChecker::clearRequest):
(WebCore::SpellChecker::isAsynchronousEnabled):
(WebCore::SpellChecker::canCheckAsynchronously):
(WebCore::SpellChecker::isBusy):
(WebCore::SpellChecker::isValid):
(WebCore::SpellChecker::isCheckable):
(WebCore::SpellChecker::requestCheckingFor):
(WebCore::forwardIterator):
(WebCore::SpellChecker::didCheck):
* editing/SpellChecker.h: Added.
(WebCore::SpellCheckingResult::SpellCheckingResult):
(WebCore::SpellCheckingResult::type):
(WebCore::SpellCheckingResult::location):
(WebCore::SpellCheckingResult::length):
* loader/EmptyClients.h:
(WebCore::EmptyEditorClient::requestCheckingOfString):
* page/EditorClient.h:
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(WebCore::Settings::setAsynchronousSpellCheckingEnabled):
(WebCore::Settings::asynchronousSpellCheckingEnabled):
2010-12-09 Antonio Gomes <agomes@rim.com>
Reviewed by Daniel Bates.
......
......@@ -1423,6 +1423,8 @@ webcore_sources += \
WebCore/editing/SmartReplace.cpp \
WebCore/editing/SmartReplace.h \
WebCore/editing/SmartReplaceICU.cpp \
WebCore/editing/SpellChecker.cpp \
WebCore/editing/SpellChecker.h \
WebCore/editing/SplitElementCommand.cpp \
WebCore/editing/SplitElementCommand.h \
WebCore/editing/SplitTextNodeCommand.cpp \
......
......@@ -518,6 +518,7 @@ __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16Doc
__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
__ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE
__ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
......@@ -922,6 +923,7 @@ __ZN7WebCore9makeRangeERKNS_15VisiblePositionES2_
__ZN7WebCore9pageCacheEv
__ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorE
__ZN7WebCore9toElementEN3JSC7JSValueE
__ZN7WebCore12SpellChecker8didCheckEiRKN3WTF6VectorINS_19SpellCheckingResultELm0EEE
__ZNK3JSC8Bindings10RootObject12globalObjectEv
__ZNK3WTF6String14createCFStringEv
__ZNK7WebCore10Credential11persistenceEv
......
......@@ -1475,6 +1475,8 @@
'editing/SmartReplace.h',
'editing/SmartReplaceCF.cpp',
'editing/SmartReplaceICU.cpp',
'editing/SpellChecker.cpp',
'editing/SpellChecker.h',
'editing/SplitElementCommand.cpp',
'editing/SplitElementCommand.h',
'editing/SplitTextNodeCommand.cpp',
......
......@@ -831,6 +831,7 @@ SOURCES += \
editing/SelectionController.cpp \
editing/SetNodeAttributeCommand.cpp \
editing/SmartReplaceICU.cpp \
editing/SpellChecker.cpp \
editing/SplitElementCommand.cpp \
editing/SplitTextNodeCommand.cpp \
editing/SplitTextNodeContainingElementCommand.cpp \
......
<<<<<<< HEAD
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
......@@ -49269,6 +49270,62 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\editing\SpellChecker.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_Cairo_CFLite|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release_Cairo_CFLite|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_All|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release_LTCG|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\editing\SpellChecker.h"
>
</File>
<File
RelativePath="..\editing\SplitElementCommand.cpp"
>
......@@ -3112,6 +3112,8 @@
A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77979240D6B9E64003851B9 /* JSImageData.cpp */; };
A77979290D6B9E64003851B9 /* JSImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979250D6B9E64003851B9 /* JSImageData.h */; };
A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; };
A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */; };
A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A78FE13A12366B1000ACE8D0 /* SpellChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A795463D0B5C4C80007B438F /* DragDataMac.mm */; };
A79546430B5C4CB4007B438F /* DragData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79546420B5C4CB4007B438F /* DragData.cpp */; };
A7AA66D611C5ED6A001D8C8C /* RenderIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AA66D411C5ED6A001D8C8C /* RenderIndicator.cpp */; };
......@@ -9439,6 +9441,8 @@
A77979240D6B9E64003851B9 /* JSImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImageData.cpp; sourceTree = "<group>"; };
A77979250D6B9E64003851B9 /* JSImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSImageData.h; sourceTree = "<group>"; };
A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; };
A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellChecker.cpp; sourceTree = "<group>"; };
A78FE13A12366B1000ACE8D0 /* SpellChecker.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = SpellChecker.h; sourceTree = "<group>"; };
A795463D0B5C4C80007B438F /* DragDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DragDataMac.mm; sourceTree = "<group>"; };
A79546420B5C4CB4007B438F /* DragData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragData.cpp; sourceTree = "<group>"; };
A7AA66D411C5ED6A001D8C8C /* RenderIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderIndicator.cpp; sourceTree = "<group>"; };
......@@ -15104,6 +15108,8 @@
4B6FA6F30C39E48C00087011 /* SmartReplace.cpp */,
4B6FA6F20C39E48C00087011 /* SmartReplace.h */,
4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */,
A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */,
A78FE13A12366B1000ACE8D0 /* SpellChecker.h */,
93309DC2099E64910056E581 /* SplitElementCommand.cpp */,
93309DC3099E64910056E581 /* SplitElementCommand.h */,
93309DC4099E64910056E581 /* SplitTextNodeCommand.cpp */,
......@@ -21584,6 +21590,7 @@
75415AFD12958D5E003AD669 /* SpeechInputEvent.h in Headers */,
7578F92011E4E32800D933C5 /* SpeechInputListener.h in Headers */,
75415B0012958D5E003AD669 /* SpeechInputResultList.h in Headers */,
A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */,
93309E12099E64920056E581 /* SplitElementCommand.h in Headers */,
93309E14099E64920056E581 /* SplitTextNodeCommand.h in Headers */,
93309E16099E64920056E581 /* SplitTextNodeContainingElementCommand.h in Headers */,
......@@ -24350,6 +24357,7 @@
75415C28129A9920003AD669 /* SpeechInputEvent.cpp in Sources */,
758978EC127090D60076D5A9 /* SpeechInputResult.cpp in Sources */,
75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */,
A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */,
93309E11099E64920056E581 /* SplitElementCommand.cpp in Sources */,
93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */,
93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */,
......@@ -567,4 +567,31 @@ bool DocumentMarkerController::hasMarkers(Range* range, DocumentMarker::MarkerTy
return false;
}
#ifndef NDEBUG
void DocumentMarkerController::showMarkers() const
{
fprintf(stderr, "%d nodes have markers:\n", m_markers.size());
MarkerMap::const_iterator end = m_markers.end();
for (MarkerMap::const_iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
Node* node = nodeIterator->first.get();
fprintf(stderr, "%p", node);
MarkerMapVectorPair* vectorPair = nodeIterator->second;
Vector<DocumentMarker>& markers = vectorPair->first;
unsigned markerCount = markers.size();
for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex)
fprintf(stderr, " %d:[%d:%d](%d)", markers[markerIndex].type, markers[markerIndex].startOffset, markers[markerIndex].endOffset, markers[markerIndex].activeMatch);
fprintf(stderr, "\n");
}
}
#endif
} // namespace WebCore
#ifndef NDEBUG
void showDocumentMarkers(const WebCore::DocumentMarkerController* controller)
{
if (controller)
controller->showMarkers();
}
#endif
......@@ -62,6 +62,10 @@ public:
Vector<DocumentMarker> markersForNode(Node*);
Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
#ifndef NDEBUG
void showMarkers() const;
#endif
private:
typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair;
typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap;
......@@ -71,4 +75,8 @@ private:
} // namespace WebCore
#ifndef NDEBUG
void showDocumentMarkers(const WebCore::DocumentMarkerController*);
#endif
#endif // DocumentMarkerController_h
......@@ -98,6 +98,13 @@ void PositionIterator::decrement()
}
}
void PositionIterator::setOffsetInLeafNode(int offset)
{
ASSERT(!m_anchorNode->hasChildNodes());
ASSERT(0 <= offset && offset <= lastOffsetForEditing(m_anchorNode));
m_offsetInAnchor = offset;
}
bool PositionIterator::atStart() const
{
if (!m_anchorNode)
......
......@@ -56,6 +56,7 @@ public:
Node* node() const { return m_anchorNode; }
int offsetInLeafNode() const { return m_offsetInAnchor; }
void setOffsetInLeafNode(int offset);
bool atStart() const;
bool atEnd() const;
......
......@@ -67,9 +67,11 @@
#include "RemoveFormatCommand.h"
#include "RenderBlock.h"
#include "RenderPart.h"
#include "RenderTextControl.h"
#include "ReplaceSelectionCommand.h"
#include "Settings.h"
#include "Sound.h"
#include "SpellChecker.h"
#include "Text.h"
#include "TextEvent.h"
#include "TextIterator.h"
......@@ -423,6 +425,10 @@ void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment,
applyCommand(ReplaceSelectionCommand::create(m_frame->document(), fragment, selectReplacement, smartReplace, matchStyle));
revealSelectionAfterEditingOperation();
Node* nodeToCheck = m_frame->selection()->rootEditableElement();
if (m_spellChecker->canCheckAsynchronously(nodeToCheck))
m_spellChecker->requestCheckingFor(nodeToCheck);
}
void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace)
......@@ -1140,6 +1146,7 @@ Editor::Editor(Frame* frame)
// This is off by default, since most editors want this behavior (this matches IE but not FF).
, m_shouldStyleWithCSS(false)
, m_killRing(adoptPtr(new KillRing))
, m_spellChecker(new SpellChecker(frame, frame->page() ? frame->page()->editorClient() : 0))
, m_correctionPanelTimer(this, &Editor::correctionPanelTimerFired)
, m_areMarkedTextMatchesHighlighted(false)
{
......@@ -3476,12 +3483,29 @@ void Editor::respondToChangedSelection(const VisibleSelection& oldSelection, boo
respondToChangedSelection(oldSelection);
}
static Node* findFirstMarkable(Node* node)
{
while (node) {
if (!node->renderer())
return 0;
if (node->renderer()->isText())
return node;
if (node->renderer()->isTextControl())
node = toRenderTextControl(node->renderer())->visiblePositionForIndex(1).deepEquivalent().node();
else if (node->firstChild())
node = node->firstChild();
else
node = node->nextSibling();
}
return 0;
}
bool Editor::selectionStartHasSpellingMarkerFor(int from, int length) const
{
Node* node = m_frame->selection()->start().node();
if (!node || !node->renderer())
Node* node = findFirstMarkable(m_frame->selection()->start().node());
if (!node)
return false;
ASSERT(node->renderer()->isText());
unsigned int startOffset = static_cast<unsigned int>(from);
unsigned int endOffset = static_cast<unsigned int>(from + length);
......
......@@ -55,6 +55,7 @@ class HitTestResult;
class KillRing;
class Pasteboard;