-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX: Extremely long textareas/contenteditable fields are slow with Voi…
…ceover https://bugs.webkit.org/show_bug.cgi?id=263303 rdar://problem/117114220 Reviewed by Tyler Wilcock. Very long textareas/contenteditable fields can be slow with AT due to two expensive operations in WebKit: (1) Spellchecking long text & drawing misspellings. (2) Caching text using rangeForCharacterRange on the isolated tree. This patch addresses those two causes by: (1) Not spellchecking on the WebKit side when Voiceover is the AX client. (2) Only caching textarea/contenteditable values with fewer than 12,500 characters. There are also two tests included in this patch. The first verifies that not caching input values greater than 12,500 does not change behavior and the second confirms that we do not spellcheck within WebKit when VoiceOver is the AX client. * LayoutTests/accessibility/mac/large-text-area-expected.txt: Added. * LayoutTests/accessibility/mac/large-text-area.html: Added. * LayoutTests/accessibility/mac/spellcheck-with-voiceover-expected.txt: Added. * LayoutTests/accessibility/mac/spellcheck-with-voiceover.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm: (WebCore::AXIsolatedObject::initializePlatformProperties): * Source/WebCore/accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::shouldSpellCheck): * Source/WebCore/editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord): (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): (WebCore::Editor::markMisspellingsAndBadGrammar): * Source/WebCore/editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const): (WebCore::TextCheckingHelper::guessesForMisspelledWordOrUngrammaticalPhrase const): (WebCore::platformOrClientDrivenTextCheckerEnabled): * Source/WebCore/editing/TextCheckingHelper.h: * Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: * Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityControllerAtspi.cpp: (WTR::AccessibilityController::overrideClient): * Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityControllerIOS.mm: (WTR::AccessibilityController::overrideClient): * Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm: (WTR::AccessibilityController::overrideClient): * Tools/WebKitTestRunner/InjectedBundle/win/AccessibilityControllerWin.cpp: (WTR::AccessibilityController::overrideClient): Canonical link: https://commits.webkit.org/270066@main
- Loading branch information
1 parent
a3a7fc6
commit aa6898f
Showing
16 changed files
with
394 additions
and
20 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
LayoutTests/accessibility/mac/large-text-area-expected.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
LayoutTests/accessibility/mac/spellcheck-with-voiceover-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
This tests that when the AX client is VoiceOver, we do not spellcheck. | ||
|
||
Attributed String (without client set): | ||
Hello { | ||
AXBackgroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 0 )"; | ||
AXFont = { | ||
AXFontFamily = ".AppleSystemUIFont"; | ||
AXFontName = ".SFNS-Regular"; | ||
AXFontSize = 11; | ||
}; | ||
AXForegroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 1 )"; | ||
}wolrd{ | ||
AXBackgroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 0 )"; | ||
AXFont = { | ||
AXFontFamily = ".AppleSystemUIFont"; | ||
AXFontName = ".SFNS-Regular"; | ||
AXFontSize = 11; | ||
}; | ||
AXForegroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 1 )"; | ||
AXMarkedMisspelled = 1; | ||
AXMisspelled = 1; | ||
}.{ | ||
AXBackgroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 0 )"; | ||
AXFont = { | ||
AXFontFamily = ".AppleSystemUIFont"; | ||
AXFontName = ".SFNS-Regular"; | ||
AXFontSize = 11; | ||
}; | ||
AXForegroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 1 )"; | ||
} | ||
Attributed String (with VoiceOver specified as the client): | ||
Hello wolrd!{ | ||
AXBackgroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 0 )"; | ||
AXDidSpellCheck = 0; | ||
AXFont = { | ||
AXFontFamily = ".AppleSystemUIFont"; | ||
AXFontName = ".SFNS-Regular"; | ||
AXFontSize = 11; | ||
}; | ||
AXForegroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 1 )"; | ||
} | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
40 changes: 40 additions & 0 deletions
40
LayoutTests/accessibility/mac/spellcheck-with-voiceover.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
<script src="../../resources/accessibility-helper.js"></script> | ||
</head> | ||
<body> | ||
|
||
<textarea id="textarea">Hello wolrd.</textarea> | ||
|
||
<script> | ||
let output = "This tests that when the AX client is VoiceOver, we do not spellcheck.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
output += "Attributed String (without client set):\n" | ||
output += `${accessibilityController.accessibleElementById("textarea").attributedStringForRange(0, 12)}\n`; | ||
|
||
output += "Attributed String (with VoiceOver specified as the client):\n" | ||
accessibilityController.overrideClient("voiceover"); | ||
|
||
// Change the text to clear the cached attributed string | ||
document.getElementById("textarea").innerText = "Hello wolrd!"; | ||
setTimeout(async () => { | ||
await waitFor(() => { | ||
attributedString = accessibilityController.accessibleElementById("textarea").attributedStringForRange(0, 12); | ||
return attributedString.indexOf("AXMisspelled = 1") == -1; | ||
}); | ||
output += `${accessibilityController.accessibleElementById("textarea").attributedStringForRange(0, 12)}\n`; | ||
|
||
// Reset client (important for stress test runs) | ||
accessibilityController.overrideClient(""); | ||
debug(output); | ||
finishJSTest(); | ||
}) | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters