Changeset 167542 in webkit


Ignore:
Timestamp:
Apr 19, 2014 12:47:27 PM (10 years ago)
Author:
Darin Adler
Message:

Telephone number detection should respect its setting consistently
https://bugs.webkit.org/show_bug.cgi?id=131893
rdar://problem/16597639

Reviewed by Tim Horton.

  • editing/Editor.cpp:

(WebCore::Editor::respondToChangedSelection): Only start the timer
if shouldDetectTelephoneNumbers returns true.
(WebCore::Editor::shouldDetectTelephoneNumbers): Added. Calls both
isTelephoneNumberParsingEnabled and TelephoneNumberDetector::isSupported.
(WebCore::Editor::scanSelectionForTelephoneNumbers): Use
shouldDetectTelephoneNumbers.
(WebCore::Editor::clearDataDetectedTelephoneNumbers): Use document()
instead of m_frame.document().

  • editing/Editor.h: Added declaration of shouldDetectTelephoneNumbers.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167541 r167542  
     12014-04-19  Darin Adler  <darin@apple.com>
     2
     3        Telephone number detection should respect its setting consistently
     4        https://bugs.webkit.org/show_bug.cgi?id=131893
     5        rdar://problem/16597639
     6
     7        Reviewed by Tim Horton.
     8
     9        * editing/Editor.cpp:
     10        (WebCore::Editor::respondToChangedSelection): Only start the timer
     11        if shouldDetectTelephoneNumbers returns true.
     12        (WebCore::Editor::shouldDetectTelephoneNumbers): Added. Calls both
     13        isTelephoneNumberParsingEnabled and TelephoneNumberDetector::isSupported.
     14        (WebCore::Editor::scanSelectionForTelephoneNumbers): Use
     15        shouldDetectTelephoneNumbers.
     16        (WebCore::Editor::clearDataDetectedTelephoneNumbers): Use document()
     17        instead of m_frame.document().
     18
     19        * editing/Editor.h: Added declaration of shouldDetectTelephoneNumbers.
     20
    1212014-04-19  Andrei Bucur  <abucur@adobe.com>
    222
  • trunk/Source/WebCore/editing/Editor.cpp

    r167169 r167542  
    33253325
    33263326#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
    3327     m_telephoneNumberDetectionUpdateTimer.startOneShot(0);
     3327    if (shouldDetectTelephoneNumbers())
     3328        m_telephoneNumberDetectionUpdateTimer.startOneShot(0);
    33283329#endif
    33293330
     
    33413342
    33423343#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
     3344
     3345bool Editor::shouldDetectTelephoneNumbers()
     3346{
     3347    if (!m_frame.document())
     3348        return false;
     3349    return document().isTelephoneNumberParsingEnabled() && TelephoneNumberDetector::isSupported();
     3350}
     3351
    33433352void Editor::scanSelectionForTelephoneNumbers(Timer<Editor>&)
    33443353{
    3345     if (!TelephoneNumberDetector::isSupported())
    3346         return;
    3347 
    3348     if (!m_frame.document())
    3349         return;
    3350 
    3351     clearDataDetectedTelephoneNumbers();
     3354    if (!shouldDetectTelephoneNumbers())
     3355        return;
    33523356
    33533357    Vector<RefPtr<Range>> markedRanges;
     
    34103414void Editor::clearDataDetectedTelephoneNumbers()
    34113415{
    3412     m_frame.document()->markers().removeMarkers(DocumentMarker::TelephoneNumber);
     3416    document().markers().removeMarkers(DocumentMarker::TelephoneNumber);
    34133417
    34143418    // FIXME: Do other UI cleanup here once we have other UI.
    34153419}
     3420
    34163421#endif // ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
    34173422
  • trunk/Source/WebCore/editing/Editor.h

    r167148 r167542  
    508508
    509509#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
     510    bool shouldDetectTelephoneNumbers();
    510511    void scanSelectionForTelephoneNumbers(Timer<Editor>&);
    511512    void scanRangeForTelephoneNumbers(Range&, const StringView&, Vector<RefPtr<Range>>& markedRanges);
Note: See TracChangeset for help on using the changeset viewer.