Changeset 86406 in webkit


Ignore:
Timestamp:
May 12, 2011 6:19:03 PM (13 years ago)
Author:
jpu@apple.com
Message:

2011-05-12 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Regression caused by changeset 86281
https://bugs.webkit.org/show_bug.cgi?id=60712

Changed wording in some tests to reflect AppKit UI change.

  • manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html:
  • manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html:

2011-05-12 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Regression caused by changeset 86281
https://bugs.webkit.org/show_bug.cgi?id=60712
<rdar://problem/9427970>

Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking.
So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal()
returns. So we don't need to use the condition to coordinate between these two function. In fact,
all callbacks are delivered on main thread. We don't really need any locking here.

Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has
been removed.

  • WebCoreSupport/CorrectionPanel.h:
  • WebCoreSupport/CorrectionPanel.mm: (CorrectionPanel::CorrectionPanel): (CorrectionPanel::show): (CorrectionPanel::dismiss): (CorrectionPanel::dismissInternal): (CorrectionPanel::handleAcceptedReplacement):
  • WebCoreSupport/WebEditorClient.mm: (WebEditorClient::dismissCorrectionPanelSoon):

2011-05-12 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Regression caused by changeset 86281
https://bugs.webkit.org/show_bug.cgi?id=60712
<rdar://problem/9427970>

Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking.
So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal()
returns. So we don't need to use the condition to coordinate between these two function. In fact,
all callbacks are delivered on main thread. We don't really need any locking here.

Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has
been removed.

  • UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::dismissCorrectionPanelSoon):
  • UIProcess/mac/CorrectionPanel.h:
  • UIProcess/mac/CorrectionPanel.mm: (WebKit::CorrectionPanel::CorrectionPanel): (WebKit::CorrectionPanel::show): (WebKit::CorrectionPanel::dismiss): (WebKit::CorrectionPanel::dismissInternal): (WebKit::CorrectionPanel::handleAcceptedReplacement):
Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86404 r86406  
     12011-05-12  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Regression caused by changeset 86281
     6        https://bugs.webkit.org/show_bug.cgi?id=60712
     7
     8        Changed wording in some tests to reflect AppKit UI change.
     9
     10        * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html:
     11        * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html:
     12
    1132011-05-12  Daniel Bates  <dbates@rim.com>
    214
  • trunk/Source/WebCore/manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html

    r77577 r86406  
    3333<body>
    3434<div><p>This test verifies that reversion panel is shown when user moves carret to previously corrected word using delete key.</p>
    35 <p>After seeing the reversion panel, press ESC key, then space key. You should see the phrase "the mesage". </p>
     35<p>After seeing the reversion panel, press down key followed by return key. You should see the phrase "the mesage". </p>
    3636<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
    3737<div contenteditable id="root" class="editing">
  • trunk/Source/WebCore/manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html

    r77577 r86406  
    3333<body>
    3434<div><p>This test verifies that reversion panel is shown when user moves carret to previously corrected word</p>
    35 <p>After seeing the reversion panel, press ESC key, then space key. You should see the phrase "the mesage". </p>
     35<p>After seeing the reversion panel, press down key followed by return key. You should see the phrase "the mesage". </p>
    3636<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
    3737<div contenteditable id="root" class="editing">
  • trunk/Source/WebKit/mac/ChangeLog

    r86391 r86406  
     12011-05-12  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Regression caused by changeset 86281
     6        https://bugs.webkit.org/show_bug.cgi?id=60712
     7        <rdar://problem/9427970>
     8
     9        Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking.
     10        So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal()
     11        returns. So we don't need to use the condition to coordinate between these two function. In fact,
     12        all callbacks are delivered on main thread. We don't really need any locking here.
     13
     14        Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has
     15        been removed.
     16
     17        * WebCoreSupport/CorrectionPanel.h:
     18        * WebCoreSupport/CorrectionPanel.mm:
     19        (CorrectionPanel::CorrectionPanel):
     20        (CorrectionPanel::show):
     21        (CorrectionPanel::dismiss):
     22        (CorrectionPanel::dismissInternal):
     23        (CorrectionPanel::handleAcceptedReplacement):
     24        * WebCoreSupport/WebEditorClient.mm:
     25        (WebEditorClient::dismissCorrectionPanelSoon):
     26
    1272011-05-12  Patrick Gansterer  <paroga@webkit.org>
    228
  • trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h

    r86281 r86406  
    4040    ~CorrectionPanel();
    4141    void show(WebView*, WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
    42     void dismiss(WebCore::ReasonForDismissingCorrectionPanel);
    43     String dismissSoon(WebCore::ReasonForDismissingCorrectionPanel);
     42    String dismiss(WebCore::ReasonForDismissingCorrectionPanel);
    4443    static void recordAutocorrectionResponse(WebView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
    4544
    4645private:
    4746    bool isShowing() const { return m_view; }
    48     void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
     47    String dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
    4948    void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType);
    5049
     
    5251    WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing;
    5352    RetainPtr<WebView> m_view;
    54     RetainPtr<NSString> m_resultForSynchronousDismissal;
    55     RetainPtr<NSCondition> m_resultCondition;
    56     bool m_isDismissing;
     53    RetainPtr<NSString> m_resultForDismissal;
    5754};
    5855
  • trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm

    r86281 r86406  
    4747    : m_wasDismissedExternally(false)
    4848    , m_reasonForDismissing(ReasonForDismissingCorrectionPanelIgnored)
    49     , m_resultCondition(AdoptNS, [[NSCondition alloc] init])
    50     , m_isDismissing(false)
    5149{
    5250}
     
    8078        handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType);
    8179    }];
    82     m_isDismissing = false;
    8380}
    8481
    85 void CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
     82String CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
    8683{
    87     dismissInternal(reason, true);
     84    return dismissInternal(reason, true);
    8885}
    8986
    90 String CorrectionPanel::dismissSoon(ReasonForDismissingCorrectionPanel reason)
    91 {
    92     dismissInternal(reason, true);
    93     [m_resultCondition.get() lock];
    94     while (m_isDismissing)
    95         [m_resultCondition.get() wait];
    96     [m_resultCondition.get() unlock];
    97     return m_resultForSynchronousDismissal.get();
    98 }
    99 
    100 void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
     87String CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
    10188{
    10289    if (!isShowing())
    103         return;
    104        
    105     m_isDismissing = true;
     90        return String();
     91   
    10692    m_wasDismissedExternally = dismissingExternally;
    10793    m_reasonForDismissing = reason;
    108     m_resultForSynchronousDismissal.clear();
     94    m_resultForDismissal.clear();
    10995    [[NSSpellChecker sharedSpellChecker] dismissCorrectionIndicatorForView:m_view.get()];
    110     m_view.clear();
     96    return m_resultForDismissal.get();
    11197}
    11298
     
    117103
    118104void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement,  NSCorrectionIndicatorType correctionIndicatorType)
    119 {
     105{   
     106    if (!m_view)
     107        return;
     108   
    120109    NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
    121110    NSInteger documentTag = [m_view.get() spellCheckerDocumentTag];
     
    142131    }
    143132   
    144     if (!m_wasDismissedExternally)
    145         [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
     133    [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
     134    m_view.clear();
    146135    if (acceptedReplacement)
    147         m_resultForSynchronousDismissal.adoptNS([acceptedReplacement copy]);
    148    
    149     [m_resultCondition.get() lock];
    150     m_isDismissing = false;
    151     [m_resultCondition.get() signal];
    152     [m_resultCondition.get() unlock];
     136        m_resultForDismissal.adoptNS([acceptedReplacement copy]);
    153137}
    154138
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r85302 r86406  
    876876String WebEditorClient::dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel reasonForDismissing)
    877877{
    878     return m_correctionPanel.dismissSoon(reasonForDismissing);
     878    return m_correctionPanel.dismiss(reasonForDismissing);
    879879}
    880880
  • trunk/Source/WebKit2/ChangeLog

    r86380 r86406  
     12011-05-12  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Regression caused by changeset 86281
     6        https://bugs.webkit.org/show_bug.cgi?id=60712
     7        <rdar://problem/9427970>
     8
     9        Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking.
     10        So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal()
     11        returns. So we don't need to use the condition to coordinate between these two function. In fact,
     12        all callbacks are delivered on main thread. We don't really need any locking here.
     13
     14        Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has
     15        been removed.
     16
     17        * UIProcess/API/mac/PageClientImpl.mm:
     18        (WebKit::PageClientImpl::dismissCorrectionPanelSoon):
     19        * UIProcess/mac/CorrectionPanel.h:
     20        * UIProcess/mac/CorrectionPanel.mm:
     21        (WebKit::CorrectionPanel::CorrectionPanel):
     22        (WebKit::CorrectionPanel::show):
     23        (WebKit::CorrectionPanel::dismiss):
     24        (WebKit::CorrectionPanel::dismissInternal):
     25        (WebKit::CorrectionPanel::handleAcceptedReplacement):
     26
    1272011-05-12  Brian Weinstein  <bweinstein@apple.com>
    228
  • trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm

    r85376 r86406  
    433433{
    434434#if !defined(BUILDING_ON_SNOW_LEOPARD)
    435     return m_correctionPanel.dismissSoon(reason);
     435    return m_correctionPanel.dismiss(reason);
    436436#else
    437437    return String();
  • trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h

    r86281 r86406  
    4141    ~CorrectionPanel();
    4242    void show(WKView*, WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
    43     void dismiss(WebCore::ReasonForDismissingCorrectionPanel);
    44     String dismissSoon(WebCore::ReasonForDismissingCorrectionPanel);
     43    String dismiss(WebCore::ReasonForDismissingCorrectionPanel);
    4544    static void recordAutocorrectionResponse(WKView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
    4645
    4746private:
    4847    bool isShowing() const { return m_view; }
    49     void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
     48    String dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
    5049    void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType);
    5150
     
    5352    WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing;
    5453    RetainPtr<WKView> m_view;
    55     RetainPtr<NSString> m_resultForSynchronousDismissal;
    56     RetainPtr<NSCondition> m_resultCondition;
    57     bool m_isDismissing;
     54    RetainPtr<NSString> m_resultForDismissal;
    5855};
    5956
  • trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm

    r86281 r86406  
    5353    : m_wasDismissedExternally(false)
    5454    , m_reasonForDismissing(ReasonForDismissingCorrectionPanelIgnored)
    55     , m_resultCondition(AdoptNS, [[NSCondition alloc] init])
    56     , m_isDismissing(false)
    5755{
    5856}
     
    8785        handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType);
    8886    }];
    89     m_isDismissing = false;
    9087}
    9188
    92 void CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
     89String CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
    9390{
    94     dismissInternal(reason, true);
     91    return dismissInternal(reason, true);
    9592}
    9693
    97 String CorrectionPanel::dismissSoon(ReasonForDismissingCorrectionPanel reason)
    98 {
    99     dismissInternal(reason, true);
    100     [m_resultCondition.get() lock];
    101     while (m_isDismissing)
    102         [m_resultCondition.get() wait];
    103     [m_resultCondition.get() unlock];
    104     return m_resultForSynchronousDismissal.get();
    105 }
    106 
    107 void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
     94String CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
    10895{
    10996    if (!isShowing())
    110         return;
     97        return String();
    11198
    112     m_isDismissing = true;
    11399    m_wasDismissedExternally = dismissingExternally;
    114100    m_reasonForDismissing = reason;
    115     m_resultForSynchronousDismissal.clear();
     101    m_resultForDismissal.clear();
    116102    [[NSSpellChecker sharedSpellChecker] dismissCorrectionIndicatorForView:m_view.get()];
    117     m_view.clear();
     103    return m_resultForDismissal.get();
    118104}
    119105
     
    125111void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement,  NSCorrectionIndicatorType correctionIndicatorType)
    126112{
     113    if (!m_view)
     114        return;
     115
    127116    NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
    128117    NSInteger documentTag = [m_view.get() spellCheckerDocumentTag];
     
    148137        break;
    149138    }
    150    
    151     if (!m_wasDismissedExternally)
    152         [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
     139
     140    [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
     141    m_view.clear();
    153142    if (acceptedReplacement)
    154         m_resultForSynchronousDismissal.adoptNS([acceptedReplacement copy]);
    155    
    156     [m_resultCondition.get() lock];
    157     m_isDismissing = false;
    158     [m_resultCondition.get() signal];
    159     [m_resultCondition.get() unlock];
     143        m_resultForDismissal.adoptNS([acceptedReplacement copy]);
    160144}
    161145
Note: See TracChangeset for help on using the changeset viewer.