Changeset 67534 in webkit


Ignore:
Timestamp:
Sep 14, 2010 9:38:56 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-14 Jia Pu <jpu@apple.com>

Reviewed by Dan Bernstein.

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

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().

2010-09-14 Jia Pu <jpu@apple.com>

Reviewed by Dan Bernstein.

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

  • 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.

2010-09-14 Jia Pu <jpu@apple.com>

Reviewed by Dan Bernstein.

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

  • 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

    r67532 r67534  
     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  Sheriff Bot  <webkit.review.bot@gmail.com>
    230
  • trunk/WebCore/editing/Editor.cpp

    r67458 r67534  
    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

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

    r67458 r67534  
    11221122    return false;
    11231123}
     1124
     1125#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     1126static bool supportedDismissCorrectionPanel(Frame* frame, EditorCommandSource source)
     1127{
     1128    return supportedFromMenuOrKeyBinding(frame, source) && frame->editor()->isShowingCorrectionPanel();
     1129}
     1130#endif
    11241131
    11251132// Enabled functions
     
    14681475        { "YankAndSelect", { executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14691476#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 } },
     1477        { "CancelOperation", { executeCancelOperation, supportedDismissCorrectionPanel, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14711478#endif
    14721479    };
  • trunk/WebCore/loader/EmptyClients.h

    r67458 r67534  
    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

    r67458 r67534  
    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

    r67533 r67534  
     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-14  Jia Pu  <jpu@apple.com>
    218
  • trunk/WebKit/mac/WebCoreSupport/WebEditorClient.h

    r67458 r67534  
    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

    r67458 r67534  
    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

    r67510 r67534  
     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-14  Sam Weinig  <sam@webkit.org>
    214
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r67458 r67534  
    494494}
    495495
    496 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     496#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    497497void WebEditorClient::showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*)
    498498{
     
    504504    notImplemented();
    505505}
     506
     507bool WebEditorClient::isShowingCorrectionPanel()
     508{
     509    notImplemented();
     510    return false;
     511}
    506512#endif
    507513
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

    r67458 r67534  
    134134    virtual void willSetInputMethodState();
    135135    virtual void setInputMethodState(bool enabled);
    136 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     136#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    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.