Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2010-09-03 Hironori Bono <hbono@chromium.org>
        Reviewed by Kent Tamura.

        Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
        and implements it for Mac.
        https://bugs.webkit.org/show_bug.cgi?id=41832

        * editing/spelling/spelling-contenteditable-expected.txt: Added the expected result for
        spelling-contenteditable.html.
        * editing/spelling/spelling-contenteditable.html: Added a text test of spellcheker APIs
        for contenteditable <div> elements.
        * editing/spelling/spelling-textarea-expected.txt: Added the expected result for spelling-textarea.html.
        * editing/spelling/spelling-textarea.html: Added a text test of spellchecker APIs
        for <textarea> elements.
        * platform/chromium/test_expectations.txt: Skipped the new tests because
        textInputController.hasSpelingMarker() is not implemented.
        * platform/gtk/Skipped: ditto.
        * platform/qt/Skipped: ditto.
        * platform/win/Skipped: ditto.
2010-09-03  Hironori Bono  <hbono@chromium.org>

        Reviewed by Kent Tamura.

        Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
        and implements it for Mac.
        https://bugs.webkit.org/show_bug.cgi?id=41832

        Tests: editing/spelling/spelling-contenteditable.html
               editing/spelling/spelling-textarea.html

        * WebCore.exp.in: Exported symbols used by [WebFrame hasSpellingMarker:length:].
2010-09-03  Hironori Bono  <hbono@chromium.org>

        Reviewed by Kent Tamura.

        Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
        and implements it for Mac.
        https://bugs.webkit.org/show_bug.cgi?id=41832

        * WebView/WebFrame.mm: Implemented [WebFrame hasSpellingMarker:length:].
        (spellingNode):
        (-[WebFrame hasSpellingMarker:length:]):
        * WebView/WebFramePrivate.h: Added [WebFrame hasSpellingMarker:length:] so TextInputController can use it.
2010-09-03  Hironori Bono  <hbono@chromium.org>

        Reviewed by Kent Tamura.

        Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
        and implements it for Mac.
        https://bugs.webkit.org/show_bug.cgi?id=41832

        * DumpRenderTree/mac/TextInputController.m: Added [TextInputController hasSpellingMarker:length:]
        and bind it so we can call it from JavaScript.
        (+[TextInputController isSelectorExcludedFromWebScript:]):
        (+[TextInputController webScriptNameForSelector:]):
        (-[TextInputController hasSpellingMarker:length:]):

Canonical link: https://commits.webkit.org/57480@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Sep 3, 2010
1 parent 9c96ba6 commit 8bfb9d6
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
2010-09-03 Hironori Bono <hbono@chromium.org>

Reviewed by Kent Tamura.

Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
and implements it for Mac.
https://bugs.webkit.org/show_bug.cgi?id=41832

* editing/spelling/spelling-contenteditable-expected.txt: Added the expected result for
spelling-contenteditable.html.
* editing/spelling/spelling-contenteditable.html: Added a text test of spellcheker APIs
for contenteditable <div> elements.
* editing/spelling/spelling-textarea-expected.txt: Added the expected result for spelling-textarea.html.
* editing/spelling/spelling-textarea.html: Added a text test of spellchecker APIs
for <textarea> elements.
* platform/chromium/test_expectations.txt: Skipped the new tests because
textInputController.hasSpelingMarker() is not implemented.
* platform/gtk/Skipped: ditto.
* platform/qt/Skipped: ditto.
* platform/win/Skipped: ditto.

2010-09-03 Philippe Normand <pnormand@igalia.com>

Unreviewed, updated GTK baselines of a mathml test.
Expand Down
11 changes: 11 additions & 0 deletions LayoutTests/editing/spelling/spelling-contenteditable-expected.txt
@@ -0,0 +1,11 @@
This tests we can write text tests for spellcheckers. To test manually, type 'zz ' in the contenteditable <div> element and see they are marked as misspelled.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


zz 
PASS 'zz' is marked as misspelled.
PASS successfullyParsed is true

TEST COMPLETE

39 changes: 39 additions & 0 deletions LayoutTests/editing/spelling/spelling-contenteditable.html
@@ -0,0 +1,39 @@
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js" language="javascript" type="text/javascript"></script>
<script src="../editing.js" language="javascript" type="text/javascript"></script>
<title>Editing Test</title>
</head>
<body>
<p id="description"></p>
<div id="test" contenteditable="true"></div>
<div id="console"></div>
<script language="javascript" type="text/javascript">
description('This tests we can write text tests for spellcheckers. To test manually, type \'zz \' in the contenteditable &lt;div&gt; element and see they are marked as misspelled.');

function logResult(result) {
if (result)
testPassed('\'zz\' is marked as misspelled.');
else
testPassed('\'zz\' is not marked as misspelled.');
}

if (window.layoutTestController) {
// Type the test text 'zz '.
document.getElementById('test').focus();
typeCharacterCommand('z');
typeCharacterCommand('z');
typeCharacterCommand(' ');

// Test the above 'zz' is marked as misspelled. We test it only on platforms that implement
// textInputController.hasSpellingMarker() to avoid exceptions.
if (textInputController && textInputController.hasSpellingMarker)
logResult(textInputController.hasSpellingMarker(0, 2));
}

var successfullyParsed = true;
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions LayoutTests/editing/spelling/spelling-textarea-expected.txt
@@ -0,0 +1,11 @@
This tests we can write text tests for spellcheckers. To test manually, type 'zz ' in the <textarea> element and see they are marked as misspelled.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".



PASS 'zz' is marked as misspelled.
PASS successfullyParsed is true

TEST COMPLETE

39 changes: 39 additions & 0 deletions LayoutTests/editing/spelling/spelling-textarea.html
@@ -0,0 +1,39 @@
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js" language="javascript" type="text/javascript"></script>
<script src=../editing.js language="javascript" type="text/javascript"></script>
<title>Editing Test</title>
</head>
<body>
<p id="description"></p>
<textarea id="test" cols="80" rows="10"></textarea>
<div id="console"></div>
<script language="javascript" type="text/javascript">
description('This tests we can write text tests for spellcheckers. To test manually, type \'zz \' in the &lt;textarea&gt; element and see they are marked as misspelled.');

function logResult(result) {
if (result)
testPassed('\'zz\' is marked as misspelled.');
else
testPassed('\'zz\' is not marked as misspelled.');
}

if (window.layoutTestController) {
// Type the test text 'zz '.
document.getElementById('test').focus();
typeCharacterCommand('z');
typeCharacterCommand('z');
typeCharacterCommand(' ');

// Test the above 'zz' is marked as misspelled. We test it only on platforms that implement
// textInputController.hasSpellingMarker() to avoid exceptions.
if (textInputController && textInputController.hasSpellingMarker)
logResult(textInputController.hasSpellingMarker(0, 2));
}

var successfullyParsed = true;
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions LayoutTests/platform/chromium/test_expectations.txt
Expand Up @@ -2749,6 +2749,10 @@ 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 textInputController.hasSpellingMarkers().
BUGWK41832 : editing/spelling/spelling-textarea.html = FAIL
BUGWK41832 : editing/spelling/spelling-contenteditable.html = FAIL

// 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
Expand Down
2 changes: 2 additions & 0 deletions LayoutTests/platform/gtk/Skipped
Expand Up @@ -1013,6 +1013,8 @@ editing/selection/unrendered-space.html
editing/selection/word-granularity.html
editing/spelling/inline_spelling_markers.html
editing/spelling/spellcheck-attribute.html
editing/spelling/spelling-contenteditable.html
editing/spelling/spelling-textarea.html
editing/style/5065910.html
editing/style/apple-style-editable-mix.html
editing/style/block-style-001.html
Expand Down
4 changes: 4 additions & 0 deletions LayoutTests/platform/qt/Skipped
Expand Up @@ -2297,6 +2297,10 @@ editing/spelling/spelling-linebreak.html
editing/spelling/spellcheck-attribute.html
editing/spelling/spelling.html

# textInputController.hasSpellingMarkers() is not implemented.
editing/spelling/spelling-contenteditable.html
editing/spelling/spelling-textarea.html

# ============================================================================= #
# failing editing/style tests
# ============================================================================= #
Expand Down
4 changes: 4 additions & 0 deletions LayoutTests/platform/win/Skipped
Expand Up @@ -878,6 +878,10 @@ canvas/philip
# https://bugs.webkit.org/show_bug.cgi?id=39104
editing/spelling/context-menu-suggestions.html

# textInputController.hasSpellingMarkers() is not implemented.
editing/spelling/spelling-contenteditable.html
editing/spelling/spelling-textarea.html

# IndexedDB is not yet enabled.
storage/indexeddb

Expand Down
13 changes: 13 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,16 @@
2010-09-03 Hironori Bono <hbono@chromium.org>

Reviewed by Kent Tamura.

Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
and implements it for Mac.
https://bugs.webkit.org/show_bug.cgi?id=41832

Tests: editing/spelling/spelling-contenteditable.html
editing/spelling/spelling-textarea.html

* WebCore.exp.in: Exported symbols used by [WebFrame hasSpellingMarker:length:].

2010-09-02 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.
Expand Down
2 changes: 2 additions & 0 deletions WebCore/WebCore.exp.in
Expand Up @@ -462,6 +462,7 @@ __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16Doc
__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
__ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
__ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore24contextMenuItemTagItalicEv
__ZN7WebCore24contextMenuItemTagStylesEv
Expand Down Expand Up @@ -886,6 +887,7 @@ __ZNK7WebCore12EventHandler20currentKeyboardEventEv
__ZNK7WebCore12IconDatabase12databasePathEv
__ZNK7WebCore12IconDatabase24shouldStopThreadActivityEv
__ZNK7WebCore12IconDatabase9isEnabledEv
__ZNK7WebCore12RenderObject7childAtEj
__ZNK7WebCore12RenderObject14enclosingLayerEv
__ZNK7WebCore12RenderObject15localToAbsoluteENS_10FloatPointEbb
__ZNK7WebCore12RenderWidget14windowClipRectEv
Expand Down
13 changes: 13 additions & 0 deletions WebKit/mac/ChangeLog
@@ -1,3 +1,16 @@
2010-09-03 Hironori Bono <hbono@chromium.org>

Reviewed by Kent Tamura.

Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
and implements it for Mac.
https://bugs.webkit.org/show_bug.cgi?id=41832

* WebView/WebFrame.mm: Implemented [WebFrame hasSpellingMarker:length:].
(spellingNode):
(-[WebFrame hasSpellingMarker:length:]):
* WebView/WebFramePrivate.h: Added [WebFrame hasSpellingMarker:length:] so TextInputController can use it.

2010-09-02 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.
Expand Down
34 changes: 34 additions & 0 deletions WebKit/mac/WebView/WebFrame.mm
Expand Up @@ -1366,6 +1366,40 @@ - (NSString*)_layerTreeAsText
return coreFrame->layerTreeAsText();
}

static Node* spellingNode(Frame* coreFrame)
{
Node* focusedNode = coreFrame->document()->focusedNode();
if (!focusedNode || !focusedNode->renderer())
return 0;

for (const RenderObject* renderer = focusedNode->renderer(); renderer; renderer = renderer->childAt(0)) {
if (renderer->isText())
return renderer->node();
}
return 0;
}

- (BOOL)hasSpellingMarker:(int)from length:(int)length
{
Frame* coreFrame = _private->coreFrame;
if (!coreFrame)
return NO;

Node* node = spellingNode(coreFrame);
if (!node)
return NO;

unsigned int startOffset = static_cast<unsigned int>(from);
unsigned int endOffset = static_cast<unsigned int>(from + length);
Vector<DocumentMarker> markers = coreFrame->document()->markers()->markersForNode(node);
for (size_t i = 0; i < markers.size(); ++i) {
DocumentMarker marker = markers[i];
if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == DocumentMarker::Spelling)
return YES;
}
return NO;
}

@end

@implementation WebFrame
Expand Down
3 changes: 3 additions & 0 deletions WebKit/mac/WebView/WebFramePrivate.h
Expand Up @@ -143,4 +143,7 @@ typedef enum {

- (NSString*)_layerTreeAsText;

// Returns whether there is a spelling marker in the specified range of the focused node.
- (BOOL)hasSpellingMarker:(int)location length:(int)length;

@end
14 changes: 14 additions & 0 deletions WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
2010-09-03 Hironori Bono <hbono@chromium.org>

Reviewed by Kent Tamura.

Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests
and implements it for Mac.
https://bugs.webkit.org/show_bug.cgi?id=41832

* DumpRenderTree/mac/TextInputController.m: Added [TextInputController hasSpellingMarker:length:]
and bind it so we can call it from JavaScript.
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController hasSpellingMarker:length:]):

2010-09-02 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.
Expand Down
11 changes: 10 additions & 1 deletion WebKitTools/DumpRenderTree/mac/TextInputController.m
Expand Up @@ -33,6 +33,7 @@
#import <AppKit/NSInputManager.h>
#import <WebKit/WebDocument.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebFrameView.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebScriptObject.h>
Expand Down Expand Up @@ -169,7 +170,8 @@ + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
|| aSelector == @selector(characterIndexForPointX:Y:)
|| aSelector == @selector(validAttributesForMarkedText)
|| aSelector == @selector(attributedStringWithString:)
|| aSelector == @selector(setInputMethodHandler:))
|| aSelector == @selector(setInputMethodHandler:)
|| aSelector == @selector(hasSpellingMarker:length:))
return NO;
return YES;
}
Expand All @@ -194,6 +196,8 @@ + (NSString *)webScriptNameForSelector:(SEL)aSelector
return @"makeAttributedString"; // just a factory method, doesn't call into NSTextInput
else if (aSelector == @selector(setInputMethodHandler:))
return @"setInputMethodHandler";
else if (aSelector == @selector(hasSpellingMarker:length:))
return @"hasSpellingMarker";

return nil;
}
Expand Down Expand Up @@ -427,4 +431,9 @@ - (BOOL)interpretKeyEvents:(NSArray *)eventArray withSender:(WebHTMLView *)sende
return YES;
}

- (BOOL)hasSpellingMarker:(int)from length:(int)length
{
return [[webView mainFrame] hasSpellingMarker:from length:length];
}

@end

0 comments on commit 8bfb9d6

Please sign in to comment.