2011-04-06 Jia Pu <jpu@apple.com>

        Reviewed by Darin Adler.

        [Mac] When autocorrection occurs without showing correction panel, WebCore need to post accessibility notification.
        https://bugs.webkit.org/show_bug.cgi?id=57800
        <rdar://problem/9218223>

        Defined a new accessibility notification type, AXAutocorrectionOccured. Editor::markAllMisspellingsAndBadGrammarInRanges()
        now posts said notification when any autocorrection or text replacement (e.g. replacing "(c)" with copyright mark) takes place.

        * accessibility/AXObjectCache.h:
        * accessibility/chromium/AXObjectCacheChromium.cpp:
        (WebCore::AXObjectCache::postPlatformNotification):
        * accessibility/mac/AXObjectCacheMac.mm:
        (WebCore::AXObjectCache::postPlatformNotification):
        * editing/Editor.cpp:
        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):

git-svn-id: svn://svn.chromium.org/blink/trunk@83049 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e3f3befa
2011-04-06 Jia Pu <jpu@apple.com>
Reviewed by Darin Adler.
[Mac] When autocorrection occurs without showing correction panel, WebCore need to post accessibility notification.
https://bugs.webkit.org/show_bug.cgi?id=57800
<rdar://problem/9218223>
Defined a new accessibility notification type, AXAutocorrectionOccured. Editor::markAllMisspellingsAndBadGrammarInRanges()
now posts said notification when any autocorrection or text replacement (e.g. replacing "(c)" with copyright mark) takes place.
* accessibility/AXObjectCache.h:
* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* editing/Editor.cpp:
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
2011-04-06 Martin Robinson <mrobinson@igalia.com> 2011-04-06 Martin Robinson <mrobinson@igalia.com>
Build fix for debug Cairo builds. Build fix for debug Cairo builds.
...@@ -118,6 +118,7 @@ public: ...@@ -118,6 +118,7 @@ public:
enum AXNotification { enum AXNotification {
AXActiveDescendantChanged, AXActiveDescendantChanged,
AXAutocorrectionOccured,
AXCheckedStateChanged, AXCheckedStateChanged,
AXChildrenChanged, AXChildrenChanged,
AXFocusedUIElementChanged, AXFocusedUIElementChanged,
......
...@@ -76,6 +76,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific ...@@ -76,6 +76,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
// descendant and send the AXFocusedUIElementChanged notification. // descendant and send the AXFocusedUIElementChanged notification.
handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer()); handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer());
break; break;
case AXAutocorrectionOccured:
case AXCheckedStateChanged: case AXCheckedStateChanged:
case AXChildrenChanged: case AXChildrenChanged:
case AXFocusedUIElementChanged: case AXFocusedUIElementChanged:
......
...@@ -70,6 +70,13 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific ...@@ -70,6 +70,13 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
else else
macNotification = NSAccessibilityFocusedUIElementChangedNotification; macNotification = NSAccessibilityFocusedUIElementChangedNotification;
break; break;
case AXAutocorrectionOccured:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
macNotification = @"AXAutocorrectionOccurred";
break;
#else
return;
#endif
case AXFocusedUIElementChanged: case AXFocusedUIElementChanged:
macNotification = NSAccessibilityFocusedUIElementChangedNotification; macNotification = NSAccessibilityFocusedUIElementChangedNotification;
break; break;
......
...@@ -2385,7 +2385,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh ...@@ -2385,7 +2385,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
replacedString = plainText(rangeToReplace.get()); replacedString = plainText(rangeToReplace.get());
bool useSpellingCorrectionCommand = false; bool useSpellingCorrectionCommand = false;
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) #if SUPPORT_AUTOCORRECTION_PANEL
if (result->type == TextCheckingTypeCorrection) if (result->type == TextCheckingTypeCorrection)
useSpellingCorrectionCommand = true; useSpellingCorrectionCommand = true;
#endif #endif
...@@ -2396,6 +2396,11 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh ...@@ -2396,6 +2396,11 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
replaceSelectionWithText(result->replacement, false, false); replaceSelectionWithText(result->replacement, false, false);
} }
if (AXObjectCache::accessibilityEnabled()) {
if (Element* root = m_frame->selection()->selection().rootEditableElement())
m_frame->document()->axObjectCache()->postNotification(root->renderer(), AXObjectCache::AXAutocorrectionOccured, true);
}
selectionChanged = true; selectionChanged = true;
offsetDueToReplacement += replacementLength - resultLength; offsetDueToReplacement += replacementLength - resultLength;
if (resultLocation < selectionOffset) { if (resultLocation < selectionOffset) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment