[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
cfleizach at apple.com
cfleizach at apple.com
Wed Dec 22 11:27:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 29c04dbd517744bd1fefba796feb624fba26d623
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jul 24 22:36:25 2010 +0000
AX: need a layout test testing misspelled words in attributed strings
https://bugs.webkit.org/show_bug.cgi?id=42899
Reviewed by David Kilzer.
WebKitTools:
* DumpRenderTree/AccessibilityUIElement.cpp:
(attributedStringForRangeCallback):
(attributedStringRangeIsMisspelledCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(AccessibilityUIElement::attributedStringForRange):
(AccessibilityUIElement::attributedStringRangeIsMisspelled):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::attributedStringForRange):
(AccessibilityUIElement::attributedStringRangeIsMisspelled):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::attributedStringForRange):
(AccessibilityUIElement::attributedStringRangeIsMisspelled):
LayoutTests:
* platform/mac/accessibility/misspelled-attributed-string-expected.txt: Added.
* platform/mac/accessibility/misspelled-attributed-string.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 052bf3f..b16a7a2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-24 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by David Kilzer.
+
+ AX: need a layout test testing misspelled words in attributed strings
+ https://bugs.webkit.org/show_bug.cgi?id=42899
+
+ * platform/mac/accessibility/misspelled-attributed-string-expected.txt: Added.
+ * platform/mac/accessibility/misspelled-attributed-string.html: Added.
+
2010-07-23 Ryosuke Niwa <rniwa at webkit.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/mac/accessibility/misspelled-attributed-string-expected.txt b/LayoutTests/platform/mac/accessibility/misspelled-attributed-string-expected.txt
new file mode 100644
index 0000000..00c4da4
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/misspelled-attributed-string-expected.txt
@@ -0,0 +1,24 @@
+wrods is misspelled aa lotsi nowadays. euep.
+This tests that misspelled words are correctly marked when asking for an attributed string.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text.stringForRange(0, 5) is 'wrods'
+PASS text.attributedStringRangeIsMisspelled(0, 5) is true
+PASS text.stringForRange(6, 2) is 'is'
+PASS text.attributedStringRangeIsMisspelled(6, 2) is false
+PASS text.stringForRange(9, 10) is 'misspelled'
+PASS text.attributedStringRangeIsMisspelled(9, 10) is false
+PASS text.stringForRange(20, 2) is 'aa'
+PASS text.attributedStringRangeIsMisspelled(20, 2) is true
+PASS text.stringForRange(23, 5) is 'lotsi'
+PASS text.attributedStringRangeIsMisspelled(23, 5) is true
+PASS text.stringForRange(29, 8) is 'nowadays'
+PASS text.attributedStringRangeIsMisspelled(29, 8) is false
+PASS text.stringForRange(39, 5) is 'euep.'
+PASS text.attributedStringRangeIsMisspelled(39, 5) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/misspelled-attributed-string.html b/LayoutTests/platform/mac/accessibility/misspelled-attributed-string.html
new file mode 100644
index 0000000..11a23b4
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/misspelled-attributed-string.html
@@ -0,0 +1,75 @@
+<!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>
+var successfullyParsed = false;
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+</head>
+<body>
+
+<div contenteditable=true id="content" role="textbox">
+wrods is misspelled aa lotsi nowadays. euep.
+</div>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that misspelled words are correctly marked when asking for an attributed string.");
+
+ if (window.accessibilityController) {
+ var content = document.getElementById("content");
+ content.focus();
+
+ // Iterate all the words so that misspelled markings get generated.
+ var length = content.innerText.length;
+ var s = window.getSelection();
+ s.setPosition(content, 0);
+ for (var k = 0; k < length; k++) {
+ s.modify("move", "forward", "character");
+ }
+
+ var text = accessibilityController.focusedElement;
+ // wrods
+ shouldBe("text.stringForRange(0, 5)", "'wrods'");
+ shouldBeTrue("text.attributedStringRangeIsMisspelled(0, 5)");
+
+ // is
+ shouldBe("text.stringForRange(6, 2)", "'is'");
+ shouldBeFalse("text.attributedStringRangeIsMisspelled(6, 2)");
+
+ // misspelled
+ shouldBe("text.stringForRange(9, 10)", "'misspelled'");
+ shouldBeFalse("text.attributedStringRangeIsMisspelled(9, 10)");
+
+ // aa
+ shouldBe("text.stringForRange(20, 2)", "'aa'");
+ shouldBeTrue("text.attributedStringRangeIsMisspelled(20, 2)");
+
+ // lotsi
+ shouldBe("text.stringForRange(23, 5)", "'lotsi'");
+ shouldBeTrue("text.attributedStringRangeIsMisspelled(23, 5)");
+
+ // nowadays
+ shouldBe("text.stringForRange(29, 8)", "'nowadays'");
+ shouldBeFalse("text.attributedStringRangeIsMisspelled(29, 8)");
+
+ // eue9
+ shouldBe("text.stringForRange(39, 5)", "'euep.'");
+ shouldBeTrue("text.attributedStringRangeIsMisspelled(39, 5)");
+ }
+
+ successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+
+</body>
+</html>
+
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 81b4eb8..01edca4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,25 @@
+2010-07-24 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by David Kilzer.
+
+ AX: need a layout test testing misspelled words in attributed strings
+ https://bugs.webkit.org/show_bug.cgi?id=42899
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (attributedStringForRangeCallback):
+ (attributedStringRangeIsMisspelledCallback):
+ (AccessibilityUIElement::getJSClass):
+ * DumpRenderTree/AccessibilityUIElement.h:
+ * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+ (AccessibilityUIElement::attributedStringForRange):
+ (AccessibilityUIElement::attributedStringRangeIsMisspelled):
+ * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+ (AccessibilityUIElement::attributedStringForRange):
+ (AccessibilityUIElement::attributedStringRangeIsMisspelled):
+ * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+ (AccessibilityUIElement::attributedStringForRange):
+ (AccessibilityUIElement::attributedStringRangeIsMisspelled):
+
2010-07-23 David Kilzer <ddkilzer at apple.com>
<http://webkit.org/b/42911> Update ruby tools to work with shallow framework bundles
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
index c4d5e6f..e09eb35 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -152,6 +152,29 @@ static JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef funct
return JSValueMakeString(context, stringDescription.get());
}
+static JSValueRef attributedStringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned location = UINT_MAX, length = 0;
+ if (argumentCount == 2) {
+ location = JSValueToNumber(context, arguments[0], exception);
+ length = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->attributedStringForRange(location, length));
+ return JSValueMakeString(context, stringDescription.get());
+}
+
+static JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned location = UINT_MAX, length = 0;
+ if (argumentCount == 2) {
+ location = JSValueToNumber(context, arguments[0], exception);
+ length = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length));
+}
+
static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount != 1)
@@ -711,6 +734,8 @@ JSClassRef AccessibilityUIElement::getJSClass()
{ "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
index 2a06962..13415cd 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
@@ -177,6 +177,8 @@ public:
JSStringRef boundsForRange(unsigned location, unsigned length);
void setSelectedTextRange(unsigned location, unsigned length);
JSStringRef stringForRange(unsigned location, unsigned length);
+ JSStringRef attributedStringForRange(unsigned location, unsigned length);
+ bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
// Table-specific
AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row);
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
index fbdbd23..a09ad2a 100644
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
@@ -499,6 +499,18 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned)
return JSStringCreateWithCharacters(0, 0);
}
+JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
+{
+ // FIXME: implement
+ return JSStringCreateWithCharacters(0, 0);
+}
+
+bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
+{
+ // FIXME: implement
+ return false;
+}
+
AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
{
// FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
index ba0631d..d1592b2 100644
--- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
@@ -855,6 +855,37 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned location, unsigned l
return 0;
}
+JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
+{
+ NSRange range = NSMakeRange(location, length);
+ BEGIN_AX_OBJC_EXCEPTIONS
+ NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
+ if (![string isKindOfClass:[NSAttributedString class]])
+ return 0;
+
+ NSString* stringWithAttrs = [string description];
+ return [stringWithAttrs createJSStringRef];
+ END_AX_OBJC_EXCEPTIONS
+
+ return 0;
+}
+
+bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
+{
+ NSRange range = NSMakeRange(location, length);
+ BEGIN_AX_OBJC_EXCEPTIONS
+ NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
+ if (![string isKindOfClass:[NSAttributedString class]])
+ return false;
+
+ NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil];
+ if([[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue])
+ return true;
+ END_AX_OBJC_EXCEPTIONS
+
+ return false;
+}
+
JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
{
// not yet defined in AppKit... odd
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
index 6aef32e..8c2fea2 100644
--- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
@@ -450,6 +450,16 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned)
return JSStringCreateWithCharacters(0, 0);
}
+JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
+{
+ return JSStringCreateWithCharacters(0, 0);
+}
+
+bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned)
+{
+ return false;
+}
+
AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
{
return 0;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list