Changeset 84592 in webkit


Ignore:
Timestamp:
Apr 21, 2011 7:49:05 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-21 Jia Pu <jpu@apple.com>

Reviewed by Maciej Stachowiak.

[Mac] correctionPanelTimerFired() crashes due to rangeToBeReplaced being cleared.
https://bugs.webkit.org/show_bug.cgi?id=59155
<rdar://problem/9261698>

Make sure the range isn't cleared before calling windowRectForRange() on it. Also removed unused functions in Editor.h,
and fixed a typo in function name.

  • editing/Editor.h:
  • editing/SpellingCorrectionController.cpp: (WebCore::SpellingCorrectionController::correctionPanelTimerFired): (WebCore::SpellingCorrectionController::respondToChangedSelection):
  • editing/SpellingCorrectionController.h: (WebCore::SpellingCorrectionController::shouldStartTimerFor):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84589 r84592  
     12011-04-21  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        [Mac] correctionPanelTimerFired() crashes due to rangeToBeReplaced being cleared.
     6        https://bugs.webkit.org/show_bug.cgi?id=59155
     7        <rdar://problem/9261698>
     8
     9        Make sure the range isn't cleared before calling windowRectForRange() on it. Also removed unused functions in Editor.h,
     10        and fixed a typo in function name.
     11
     12        * editing/Editor.h:
     13        * editing/SpellingCorrectionController.cpp:
     14        (WebCore::SpellingCorrectionController::correctionPanelTimerFired):
     15        (WebCore::SpellingCorrectionController::respondToChangedSelection):
     16        * editing/SpellingCorrectionController.h:
     17        (WebCore::SpellingCorrectionController::shouldStartTimerFor):
     18
    1192011-04-21  Maciej Stachowiak  <mjs@apple.com>
    220
  • trunk/Source/WebCore/editing/Editor.h

    r84459 r84592  
    429429
    430430    Node* findEventTargetFromSelection() const;
    431     void stopCorrectionPanelTimer();
    432 
    433     void applyCorrectionPanelInfo(const Vector<DocumentMarker::MarkerType>& markerTypesToAdd);
    434     // Return true if correction was applied, false otherwise.
    435     bool applyAutocorrectionBeforeTypingIfAppropriate();
    436431};
    437432
  • trunk/Source/WebCore/editing/SpellingCorrectionController.cpp

    r84459 r84592  
    293293        break;
    294294    case CorrectionPanelInfo::PanelTypeReversion: {
     295        if (!m_correctionPanelInfo.rangeToBeReplaced)
     296            break;
    295297        m_correctionPanelInfo.isActive = true;
    296298        m_correctionPanelInfo.replacedString = plainText(m_correctionPanelInfo.rangeToBeReplaced.get());
     
    301303        break;
    302304    case CorrectionPanelInfo::PanelTypeSpellingSuggestions: {
    303         if (plainText(m_correctionPanelInfo.rangeToBeReplaced.get()) != m_correctionPanelInfo.replacedString)
     305        if (!m_correctionPanelInfo.rangeToBeReplaced || plainText(m_correctionPanelInfo.rangeToBeReplaced.get()) != m_correctionPanelInfo.replacedString)
    304306            break;
    305307        String paragraphText = plainText(TextCheckingParagraph(m_correctionPanelInfo.rangeToBeReplaced).paragraphRange().get());
     
    398400    for (size_t i = 0; i < markerCount; ++i) {
    399401        const DocumentMarker& marker = markers[i];
    400         if (!shouldStartTimeFor(marker, endOffset))
     402        if (!shouldStartTimerFor(marker, endOffset))
    401403            continue;
    402404        RefPtr<Range> wordRange = Range::create(m_frame->document(), node, marker.startOffset, node, marker.endOffset);
  • trunk/Source/WebCore/editing/SpellingCorrectionController.h

    r84433 r84592  
    122122    void recordAutocorrectionResponseReversed(const String& replacedString, const String& replacementString);
    123123
    124     bool shouldStartTimeFor(const DocumentMarker& marker, int endOffset) const
     124    bool shouldStartTimerFor(const DocumentMarker& marker, int endOffset) const
    125125    {
    126126        return (((marker.type == DocumentMarker::Replacement && !marker.description.isNull())
Note: See TracChangeset for help on using the changeset viewer.