-
commit-queue@webkit.org authored
Reviewed by Darin Adler. Hook up new AppKit autocorrection UI with WK2. https://bugs.webkit.org/show_bug.cgi?id=56055 <rdar://problem/8947463> Please see WebCore/ChangeLog for detail. * platform/mac-wk2/Skipped: Enable autocorrection tests for WK2. 2011-03-23 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Hook up new AppKit autocorrection UI with WK2. https://bugs.webkit.org/show_bug.cgi?id=56055 <rdar://problem/8947463> This patch is to enable WK2 to utilize autocorrection UI on Mac OS X. It contains following major changes: 1. All but one autocorrection related message is synchronous. Since dismissing autocorrection panel can potentially cause editing to occur, a synchronous dismissCorrectionPanelSoon() function is introduced to ensure all editing commands occur in correct order. 2. Additional condition variable is needed to implement dismissCorrectionPanelSoon(). To improve maintainability, CorrectionPanel class is introduced to manage the internal state related to correction panel. This change is applied to both WK1 and WK2. 3. EditorClient::isShowingCorrectionPanel() has been removed. The original purpose is to allow editor to know when to handle ESC key event. Now this is handled internally in AppKit, so EditorClient::isShowingCorrectionPanel() isn't necessary anymore. 4. The Editor* argument in EditorClient::showCorrectionPanel() has been removed, since we can access object via WebView or WKView. * editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord): (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): (WebCore::Editor::correctionPanelTimerFired): (WebCore::Editor::dismissCorrectionPanel): (WebCore::Editor::dismissCorrectionPanelSoon): (WebCore::Editor::applyAutocorrectionBeforeTypingIfAppropriate): * editing/Editor.h: * editing/EditorCommand.cpp: (WebCore::createCommandMap): * loader/EmptyClients.h: (WebCore::EmptyEditorClient::showCorrectionPanel): (WebCore::EmptyEditorClient::dismissCorrectionPanelSoon): * manual-tests/autocorrection/close-window-when-correction-is-shown.html: Added. * page/EditorClient.h: 2011-03-23 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Hook up new AppKit autocorrection UI with WK2. https://bugs.webkit.org/show_bug.cgi?id=56055 <rdar://problem/8947463> Please see WebCore/ChangeLog for detail. * WebKit.xcodeproj/project.pbxproj: 2011-03-23 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Hook up new AppKit autocorrection UI with WK2. https://bugs.webkit.org/show_bug.cgi?id=56055 <rdar://problem/8947463> Please see WebCore/ChangeLog for detail. * WebCoreSupport/CorrectionPanel.h: Added. (CorrectionPanel::isShowing): * WebCoreSupport/CorrectionPanel.mm: Added. (correctionBubbleType): (CorrectionPanel::CorrectionPanel): (CorrectionPanel::~CorrectionPanel): (CorrectionPanel::show): (CorrectionPanel::dismiss): (CorrectionPanel::dismissSoon): (CorrectionPanel::dismissInternal): (CorrectionPanel::recordAutocorrectionResponse): * WebCoreSupport/WebEditorClient.h: * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::WebEditorClient): (WebEditorClient::showCorrectionPanel): (WebEditorClient::dismissCorrectionPanel): (WebEditorClient::dismissCorrectionPanelSoon): (WebEditorClient::recordAutocorrectionResponse): * WebView/WebView.mm: (-[WebView handleCorrectionPanelResult:]): * WebView/WebViewPrivate.h: 2011-03-23 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Hook up new AppKit autocorrection UI with WK2. https://bugs.webkit.org/show_bug.cgi?id=56055 <rdar://problem/8947463> Please see WebCore/ChangeLog for detail. The calls to AppKit are implemented in PageClientImpl. Other changes are necessary for the plumbing work. * UIProcess/API/mac/PageClientImpl.h: * UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::showCorrectionPanel): (WebKit::PageClientImpl::dismissCorrectionPanel): (WebKit::PageClientImpl::dismissCorrectionPanelSoon): (WebKit::PageClientImpl::recordAutocorrectionResponse): * UIProcess/API/mac/WKView.mm: (-[WKView spellCheckerDocumentTag]): (-[WKView handleCorrectionPanelResult:]): * UIProcess/API/mac/WKViewPrivate.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::showCorrectionPanel): (WebKit::WebPageProxy::dismissCorrectionPanel): (WebKit::WebPageProxy::dismissCorrectionPanelSoon): (WebKit::WebPageProxy::recordAutocorrectionResponse): (WebKit::WebPageProxy::handleCorrectionPanelResult): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/CorrectionPanel.h: Added. (WebKit::CorrectionPanel::isShowing): * UIProcess/mac/CorrectionPanel.mm: Added. (correctionBubbleType): (WebKit::CorrectionPanel::CorrectionPanel): (WebKit::CorrectionPanel::~CorrectionPanel): (WebKit::CorrectionPanel::show): (WebKit::CorrectionPanel::dismiss): (WebKit::CorrectionPanel::dismissSoon): (WebKit::CorrectionPanel::dismissInternal): (WebKit::CorrectionPanel::recordAutocorrectionResponse): * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: (WebKit::WebEditorClient::showCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanelSoon): (WebKit::WebEditorClient::recordAutocorrectionResponse): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::handleCorrectionPanelResult): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
b5484ecd