Skip to content
Permalink
Browse files
2010-10-18 MORITA Hajime <morrita@google.com>
        Reviewed by Kent Tamura.

        TextInputController.hasSpellingMarkers() should be owned by LayoutTestController
        https://bugs.webkit.org/show_bug.cgi?id=47659

        Changed the reciever of hasSpellingMarkers from
        textInputController to layoutTestController.

        * editing/spelling/design-mode-spellcheck-off.html:
        * editing/spelling/script-tests/spelling-backspace-between-lines.js:
        (testWithDelete):
        (testWithForwardDelete):
        * editing/spelling/spelling-backspace-between-lines-expected.txt:
        * editing/spelling/spelling-contenteditable.html:
        * editing/spelling/spelling-textarea.html:
2010-10-18  MORITA Hajime  <morrita@google.com>

        Reviewed by Kent Tamura.

        TextInputController.hasSpellingMarkers() should be owned by LayoutTestController
        https://bugs.webkit.org/show_bug.cgi?id=47659

        Moved hasSpellingMarkers() from TextInputController to
        LayoutTestController.  Currently the implementation is available
        only for Mac and for Chromium.

        * DumpRenderTree/LayoutTestController.cpp:
        (hasSpellingMarkerCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (LayoutTestController::hasSpellingMarker):
        * DumpRenderTree/chromium/LayoutTestController.h:
        * DumpRenderTree/chromium/TextInputController.cpp:
        (TextInputController::TextInputController):
        (TextInputController::makeAttributedString):
        * DumpRenderTree/chromium/TextInputController.h:
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::hasSpellingMarker):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::hasSpellingMarker):
        * DumpRenderTree/mac/TextInputController.m:
        (+[TextInputController isSelectorExcludedFromWebScript:]):
        (+[TextInputController webScriptNameForSelector:]):
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::hasSpellingMarker):
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::hasSpellingMarker):
        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
        (LayoutTestController::hasSpellingMarker):

Canonical link: https://commits.webkit.org/60518@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
omo committed Oct 18, 2010
1 parent a7104a7 commit df8be8a8316f49f825f07c998ce51d2018244517
Showing 20 changed files with 123 additions and 35 deletions.
@@ -1,3 +1,21 @@
2010-10-18 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

TextInputController.hasSpellingMarkers() should be owned by LayoutTestController
https://bugs.webkit.org/show_bug.cgi?id=47659

Changed the reciever of hasSpellingMarkers from
textInputController to layoutTestController.

* editing/spelling/design-mode-spellcheck-off.html:
* editing/spelling/script-tests/spelling-backspace-between-lines.js:
(testWithDelete):
(testWithForwardDelete):
* editing/spelling/spelling-backspace-between-lines-expected.txt:
* editing/spelling/spelling-contenteditable.html:
* editing/spelling/spelling-textarea.html:

2010-10-18 Alejandro G. Castro <alex@igalia.com>

Unreviewed, skip another mathml flaky test, check bug:
@@ -18,7 +18,7 @@
document.body.addEventListener('mousedown', function() {
if (document.activeElement != document.body)
document.body.appendChild(document.createTextNode('FAIL: active element after click is not body element'));
else if (window.textInputController && textInputController.hasSpellingMarker && textInputController.hasSpellingMarker(0, 4))
else if (layoutTestController.hasSpellingMarker(0, 4))
document.body.appendChild(document.createTextNode('FAIL: spell check was invoked'));
else
document.body.appendChild(document.createTextNode('PASS'));
@@ -26,15 +26,15 @@ function testWithDelete()

shouldBe("firstLineText()", "'OK'");
shouldBe("sel.anchorNode.data", "'OK zz OK'");
shouldBe("textInputController.hasSpellingMarker(3, 2)", "1");
shouldBeTrue("layoutTestController.hasSpellingMarker(3, 2)");

sel.modify("move", "left", "lineboundary");
document.execCommand("Delete", false);
sel.modify("move", "right", "line"); // Moves to the line ending to focus the "OK zz OK" text.

shouldBe("sel.anchorNode.data", "'OK zz OK'");
shouldBe("firstLineText()", "'OKOK zz OK'");
shouldBe("textInputController.hasSpellingMarker(3, 2)", "1");
shouldBeTrue("layoutTestController.hasSpellingMarker(3, 2)");
}

function testWithForwardDelete()
@@ -47,15 +47,15 @@ function testWithForwardDelete()

shouldBe("firstLineText()", "'OK'");
shouldBe("sel.anchorNode.data", "'OK zz OK'");
shouldBe("textInputController.hasSpellingMarker(3, 2)", "1");
shouldBeTrue("layoutTestController.hasSpellingMarker(3, 2)");

sel.modify("move", "left", "line");
document.execCommand("ForwardDelete", false);
sel.modify("move", "right", "line"); // Moves to the line ending to focus the "OK zz OK" text.

shouldBe("firstLineText()", "'OKOK zz OK'");
shouldBe("sel.anchorNode.data", "'OK zz OK'");
shouldBe("textInputController.hasSpellingMarker(3, 2)", "1");
shouldBeTrue("layoutTestController.hasSpellingMarker(3, 2)");
}

testWithDelete();
@@ -5,16 +5,16 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE

PASS firstLineText() is 'OK'
PASS sel.anchorNode.data is 'OK zz OK'
PASS textInputController.hasSpellingMarker(3, 2) is 1
PASS layoutTestController.hasSpellingMarker(3, 2) is true
PASS sel.anchorNode.data is 'OK zz OK'
PASS firstLineText() is 'OKOK zz OK'
PASS textInputController.hasSpellingMarker(3, 2) is 1
PASS layoutTestController.hasSpellingMarker(3, 2) is true
PASS firstLineText() is 'OK'
PASS sel.anchorNode.data is 'OK zz OK'
PASS textInputController.hasSpellingMarker(3, 2) is 1
PASS layoutTestController.hasSpellingMarker(3, 2) is true
PASS firstLineText() is 'OKOK zz OK'
PASS sel.anchorNode.data is 'OK zz OK'
PASS textInputController.hasSpellingMarker(3, 2) is 1
PASS layoutTestController.hasSpellingMarker(3, 2) is true
PASS successfullyParsed is true

TEST COMPLETE
@@ -28,8 +28,7 @@

// 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));
logResult(layoutTestController.hasSpellingMarker(0, 2));
}

var successfullyParsed = true;
@@ -28,8 +28,7 @@

// 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));
logResult(layoutTestController.hasSpellingMarker(0, 2));
}

var successfullyParsed = true;
@@ -1,3 +1,41 @@
2010-10-18 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

TextInputController.hasSpellingMarkers() should be owned by LayoutTestController
https://bugs.webkit.org/show_bug.cgi?id=47659

Moved hasSpellingMarkers() from TextInputController to
LayoutTestController. Currently the implementation is available
only for Mac and for Chromium.

* DumpRenderTree/LayoutTestController.cpp:
(hasSpellingMarkerCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::hasSpellingMarker):
* DumpRenderTree/chromium/LayoutTestController.h:
* DumpRenderTree/chromium/TextInputController.cpp:
(TextInputController::TextInputController):
(TextInputController::makeAttributedString):
* DumpRenderTree/chromium/TextInputController.h:
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::hasSpellingMarker):
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::hasSpellingMarker):
* DumpRenderTree/mac/TextInputController.m:
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::hasSpellingMarker):
* DumpRenderTree/qt/LayoutTestControllerQt.h:
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::hasSpellingMarker):
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::hasSpellingMarker):

2010-10-18 Adam Barth <abarth@webkit.org>

Reviewed by David Levin.
@@ -1723,6 +1723,19 @@ static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}

static JSValueRef hasSpellingMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount != 2)
return JSValueMakeUndefined(context);

int from = JSValueToNumber(context, arguments[0], 0);
int length = JSValueToNumber(context, arguments[1], 0);
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
bool ok = controller->hasSpellingMarker(from, length);

return JSValueMakeBoolean(context, ok);
}

static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -1891,6 +1904,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "hasSpellingMarker", hasSpellingMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -279,6 +279,8 @@ class LayoutTestController : public RefCounted<LayoutTestController> {

void abortModal();

bool hasSpellingMarker(int from, int length);

// The following API test functions should probably be moved to platform-specific
// unit tests outside of DRT once they exist.
void apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL);
@@ -108,6 +108,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled);
bindMethod("layerTreeAsText", &LayoutTestController::layerTreeAsText);
bindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem);
bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker);
bindMethod("notifyDone", &LayoutTestController::notifyDone);
bindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAnimations);
bindMethod("numberOfPages", &LayoutTestController::numberOfPages);
@@ -1558,3 +1559,10 @@ WebDeviceOrientationClient* LayoutTestController::deviceOrientationClient()
m_deviceOrientationClientMock.set(WebDeviceOrientationClientMock::create());
return m_deviceOrientationClientMock.get();
}

void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
return;
result->set(m_shell->webView()->mainFrame()->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32()));
}
@@ -328,6 +328,7 @@ class LayoutTestController : public CppBoundClass {
void layerTreeAsText(const CppArgumentList& args, CppVariant* result);

void markerTextForListItem(const CppArgumentList&, CppVariant*);
void hasSpellingMarker(const CppArgumentList&, CppVariant*);

public:
// The following methods are not exposed to JavaScript.
@@ -58,7 +58,6 @@ TextInputController::TextInputController(TestShell* shell)
bindMethod("doCommand", &TextInputController::doCommand);
bindMethod("firstRectForCharacterRange", &TextInputController::firstRectForCharacterRange);
bindMethod("hasMarkedText", &TextInputController::hasMarkedText);
bindMethod("hasSpellingMarker", &TextInputController::hasSpellingMarker);
bindMethod("insertText", &TextInputController::insertText);
bindMethod("makeAttributedString", &TextInputController::makeAttributedString);
bindMethod("markedRange", &TextInputController::markedRange);
@@ -233,14 +232,3 @@ void TextInputController::makeAttributedString(const CppArgumentList&, CppVarian
// FIXME: Implement this.
result->setNull();
}

void TextInputController::hasSpellingMarker(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
return;
WebFrame* mainFrame = getMainFrame();
if (!mainFrame)
return;
// Returns as a number for a compatibility reason.
result->set(mainFrame->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32()) ? 1 : 0);
}
@@ -61,7 +61,6 @@ class TextInputController : public CppBoundClass {
void characterIndexForPoint(const CppArgumentList&, CppVariant*);
void validAttributesForMarkedText(const CppArgumentList&, CppVariant*);
void makeAttributedString(const CppArgumentList&, CppVariant*);
void hasSpellingMarker(const CppArgumentList&, CppVariant*);

private:
// Returns the test shell's main WebFrame.
@@ -808,3 +808,9 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior)
void LayoutTestController::abortModal()
{
}

bool LayoutTestController::hasSpellingMarker(int, int)
{
// FIXME: Implement this.
return false;
}
@@ -944,3 +944,8 @@ + (void)makeRequest:(NSURLRequest *)request withUsername:(NSString *)username pa
{
[NSApp abortModal];
}

bool LayoutTestController::hasSpellingMarker(int from, int length)
{
return [mainFrame hasSpellingMarker:from length:length];
}
@@ -170,8 +170,7 @@ + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
|| aSelector == @selector(characterIndexForPointX:Y:)
|| aSelector == @selector(validAttributesForMarkedText)
|| aSelector == @selector(attributedStringWithString:)
|| aSelector == @selector(setInputMethodHandler:)
|| aSelector == @selector(hasSpellingMarker:length:))
|| aSelector == @selector(setInputMethodHandler:))
return NO;
return YES;
}
@@ -196,8 +195,6 @@ + (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;
}
@@ -431,9 +428,4 @@ - (BOOL)interpretKeyEvents:(NSArray *)eventArray withSender:(WebHTMLView *)sende
return YES;
}

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

@end
@@ -798,5 +798,11 @@ void LayoutTestController::removeAllVisitedLinks()
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true);
}

bool LayoutTestController::hasSpellingMarker(int, int)
{
// FIXME: Implement.
return false;
}

const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
@@ -219,6 +219,7 @@ public slots:

// Empty stub method to keep parity with object model exposed by global LayoutTestController.
void abortModal() {}
bool hasSpellingMarker(int from, int length);

/*
Policy values: 'on', 'auto' or 'off'.
@@ -1390,3 +1390,9 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior)
void LayoutTestController::abortModal()
{
}

bool LayoutTestController::hasSpellingMarker(int, int)
{
// FIXME: Implement this.
return false;
}
@@ -505,6 +505,12 @@ void LayoutTestController::abortModal()
{
}

bool LayoutTestController::hasSpellingMarker(int, int)
{
// FIXME: Implement
return false;
}

JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
{
// FIXME: Implement

0 comments on commit df8be8a

Please sign in to comment.