2011-03-23 Jia Pu <jpu@apple.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 02:53:04 +0000 (02:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 02:53:04 +0000 (02:53 +0000)
commit811643c93d46be96a9785803843c712c093c412c
treea548507c70059f83dc3c5c73fe45681da9b2ca25
parent3daf7405c9bfe448b960fb42ba3d67fe23c4548f
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.

        * 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: https://svn.webkit.org/repository/webkit/trunk@81847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/manual-tests/autocorrection/close-window-when-correction-is-shown.html [new file with mode: 0644]
Source/WebCore/page/EditorClient.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewPrivate.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/mac/CorrectionPanel.h [new file with mode: 0644]
Source/WebKit2/UIProcess/mac/CorrectionPanel.mm [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in