Changeset 67451 in webkit


Ignore:
Timestamp:
Sep 14, 2010 12:50:32 AM (14 years ago)
Author:
mitz@apple.com
Message:

Only intercept ESC key press when autocorrection UI is visible.
https://bugs.webkit.org/show_bug.cgi?id=45071

Patch by Jia Pu <jpu@apple.com> on 2010-09-14
Reviewed by Dan Bernstein.

WebCore:

Only intercept ESC key when autocorrection panel is shown. Otherwise pressing
ESC will cancel current loading like usual.

  • editing/Editor.cpp:

(WebCore::Editor::isShowingCorrectionPanel): Query editor client whether autocorrection

panel is shown.

  • editing/Editor.h: Added declaration of isShowingCorrectionPanel().
  • editing/EditorCommand.cpp:

(WebCore::supportedDismissCorrectionPanel): Only support executeCancelOperation()

when autocorrection panel is shown.

(WebCore::createCommandMap): Replaced isSupported function pointer for

executeCancelOperation() command with supportedDismissCorrectionPanel().

  • loader/EmptyClients.h:

(WebCore::EmptyEditorClient::isShowingCorrectionPanel): Dummy implementation of

new member method declared in base class.

  • page/EditorClient.h: Declared new member method isShowingCorrectionPanel().

WebKit/mac:

  • WebCoreSupport/WebEditorClient.h: Added declaration of isShowingCorrectionPanel(), which provides an inteface to query whether autocorrection panel is shown.
  • WebCoreSupport/WebEditorClient.mm:

(WebEditorClient::WebEditorClient): Defined a constant, InvalidCorrectionPanelTag,

for invalid correction panel tag. Replaced -1 with this constant.

(WebEditorClient::dismissCorrectionPanel): Ditto
(WebEditorClient::isShowingCorrectionPanel): Query whether autocorrection panel is shown.

WebKit2:

  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::WebEditorClient::isShowingCorrectionPanel): Dummy implementation.

  • WebProcess/WebCoreSupport/WebEditorClient.h: Adopt new method delcared in base class.
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67450 r67451  
     12010-09-14  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Only intercept ESC key press when autocorrection UI is visible.
     6        https://bugs.webkit.org/show_bug.cgi?id=45071
     7
     8        Only intercept ESC key when autocorrection panel is shown. Otherwise pressing
     9        ESC will cancel current loading like usual.
     10
     11        * editing/Editor.cpp:
     12        (WebCore::Editor::isShowingCorrectionPanel): Query editor client whether autocorrection
     13          panel is shown.
     14
     15        * editing/Editor.h: Added declaration of isShowingCorrectionPanel().
     16
     17        * editing/EditorCommand.cpp:
     18        (WebCore::supportedDismissCorrectionPanel): Only support executeCancelOperation()
     19          when autocorrection panel is shown.
     20        (WebCore::createCommandMap): Replaced isSupported function pointer for
     21          executeCancelOperation() command with supportedDismissCorrectionPanel().
     22
     23        * loader/EmptyClients.h:
     24        (WebCore::EmptyEditorClient::isShowingCorrectionPanel): Dummy implementation of
     25          new member method declared in base class.
     26
     27        * page/EditorClient.h: Declared new member method isShowingCorrectionPanel().
     28
    1292010-09-14  Kwang Yul Seo  <skyul@company100.net>
    230
  • trunk/WebCore/editing/Editor.cpp

    r67441 r67451  
    28552855}
    28562856
     2857bool Editor::isShowingCorrectionPanel()
     2858{
     2859#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     2860    if (client())
     2861        return client()->isShowingCorrectionPanel();
     2862#endif
     2863    return false;
     2864}
     2865
    28572866PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
    28582867{
  • trunk/WebCore/editing/Editor.h

    r67362 r67451  
    314314    void startCorrectionPanelTimer();
    315315    void handleRejectedCorrection();
     316    bool isShowingCorrectionPanel();
    316317
    317318    void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle);
  • trunk/WebCore/editing/EditorCommand.cpp

    r67238 r67451  
    11211121    ASSERT_NOT_REACHED();
    11221122    return false;
     1123}
     1124
     1125static bool supportedDismissCorrectionPanel(Frame* frame, EditorCommandSource source)
     1126{
     1127    return supportedFromMenuOrKeyBinding(frame, source) && frame->editor()->isShowingCorrectionPanel();
    11231128}
    11241129
     
    14681473        { "YankAndSelect", { executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14691474#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    1470         { "CancelOperation", { executeCancelOperation, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1475        { "CancelOperation", { executeCancelOperation, supportedDismissCorrectionPanel, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14711476#endif
    14721477    };
  • trunk/WebCore/loader/EmptyClients.h

    r67403 r67451  
    471471    virtual void showCorrectionPanel(const FloatRect&, const String&, const String&, Editor*) { }
    472472    virtual void dismissCorrectionPanel(bool) { }
     473    virtual bool isShowingCorrectionPanel() { return false; }
    473474#endif
    474475    virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
  • trunk/WebCore/page/EditorClient.h

    r67403 r67451  
    192192    virtual void showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, Editor*) = 0;
    193193    virtual void dismissCorrectionPanel(bool correctionAccepted) = 0;
     194    virtual bool isShowingCorrectionPanel() = 0;
    194195#endif
    195196
  • trunk/WebKit/mac/ChangeLog

    r67423 r67451  
     12010-09-14  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Only intercept ESC key press when autocorrection UI is visible.
     6        https://bugs.webkit.org/show_bug.cgi?id=45071
     7
     8        * WebCoreSupport/WebEditorClient.h: Added declaration of isShowingCorrectionPanel(),
     9          which provides an inteface to query whether autocorrection panel is shown.
     10
     11        * WebCoreSupport/WebEditorClient.mm:
     12        (WebEditorClient::WebEditorClient): Defined a constant, InvalidCorrectionPanelTag,
     13          for invalid correction panel tag. Replaced -1 with this constant.
     14        (WebEditorClient::dismissCorrectionPanel): Ditto
     15        (WebEditorClient::isShowingCorrectionPanel): Query whether autocorrection panel is shown.
     16
    1172010-09-13  Darin Adler  <darin@apple.com>
    218
  • trunk/WebKit/mac/WebCoreSupport/WebEditorClient.h

    r67403 r67451  
    136136    virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
    137137    virtual void dismissCorrectionPanel(bool correctionAccepted);
     138    virtual bool isShowingCorrectionPanel();
    138139#endif
    139140private:
  • trunk/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r67403 r67451  
    8888}
    8989
     90static const int InvalidCorrectionPanelTag = 0;
     91
    9092#ifdef BUILDING_ON_TIGER
    9193@interface NSSpellChecker (NotYetPublicMethods)
     
    185187    , m_haveUndoRedoOperations(false)
    186188#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    187     , m_correctionPanelTag(-1)
     189    , m_correctionPanelTag(InvalidCorrectionPanelTag)
    188190#endif
    189191{
     
    885887void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
    886888{
    887     if (m_correctionPanelTag >= 0) {
     889    if (m_correctionPanelTag != InvalidCorrectionPanelTag) {
    888890        [[NSSpellChecker sharedSpellChecker] dismissCorrection:m_correctionPanelTag acceptCorrection:correctionAccepted];
    889         m_correctionPanelTag = -1;
     891        m_correctionPanelTag = InvalidCorrectionPanelTag;
    890892    }
     893}
     894
     895bool WebEditorClient::isShowingCorrectionPanel()
     896{
     897    return m_correctionPanelTag != InvalidCorrectionPanelTag;
    891898}
    892899#endif
  • trunk/WebKit2/ChangeLog

    r67437 r67451  
     12010-09-14  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Only intercept ESC key press when autocorrection UI is visible.
     6        https://bugs.webkit.org/show_bug.cgi?id=45071
     7
     8        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     9        (WebKit::WebEditorClient::isShowingCorrectionPanel): Dummy implementation.
     10
     11        * WebProcess/WebCoreSupport/WebEditorClient.h: Adopt new method delcared in base class.
     12
    1132010-09-13  Sam Weinig  <sam@webkit.org>
    214
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r67403 r67451  
    504504    notImplemented();
    505505}
     506
     507bool WebEditorClient::isShowingCorrectionPanel()
     508{
     509    notImplemented();
     510    return false;
     511}
    506512#endif
    507513
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

    r67403 r67451  
    137137    virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
    138138    virtual void dismissCorrectionPanel(bool correctionAccepted);
     139    virtual bool isShowingCorrectionPanel();
    139140#endif
    140141    WebPage* m_page;
Note: See TracChangeset for help on using the changeset viewer.