Title: [167542] trunk/Source/WebCore
- Revision
- 167542
- Author
- [email protected]
- Date
- 2014-04-19 12:47:27 -0700 (Sat, 19 Apr 2014)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (167541 => 167542)
--- trunk/Source/WebCore/ChangeLog 2014-04-19 18:57:46 UTC (rev 167541)
+++ trunk/Source/WebCore/ChangeLog 2014-04-19 19:47:27 UTC (rev 167542)
@@ -1,3 +1,23 @@
+2014-04-19 Darin Adler <[email protected]>
+
+ 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.
+
2014-04-19 Andrei Bucur <[email protected]>
[CSS Regions] Harden the layout in case there are no regions
Modified: trunk/Source/WebCore/editing/Editor.cpp (167541 => 167542)
--- trunk/Source/WebCore/editing/Editor.cpp 2014-04-19 18:57:46 UTC (rev 167541)
+++ trunk/Source/WebCore/editing/Editor.cpp 2014-04-19 19:47:27 UTC (rev 167542)
@@ -3324,7 +3324,8 @@
client()->respondToChangedSelection(&m_frame);
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
- m_telephoneNumberDetectionUpdateTimer.startOneShot(0);
+ if (shouldDetectTelephoneNumbers())
+ m_telephoneNumberDetectionUpdateTimer.startOneShot(0);
#endif
setStartNewKillRingSequence(true);
@@ -3340,16 +3341,19 @@
}
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
+
+bool Editor::shouldDetectTelephoneNumbers()
+{
+ if (!m_frame.document())
+ return false;
+ return document().isTelephoneNumberParsingEnabled() && TelephoneNumberDetector::isSupported();
+}
+
void Editor::scanSelectionForTelephoneNumbers(Timer<Editor>&)
{
- if (!TelephoneNumberDetector::isSupported())
+ if (!shouldDetectTelephoneNumbers())
return;
- if (!m_frame.document())
- return;
-
- clearDataDetectedTelephoneNumbers();
-
Vector<RefPtr<Range>> markedRanges;
RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange();
@@ -3409,10 +3413,11 @@
void Editor::clearDataDetectedTelephoneNumbers()
{
- m_frame.document()->markers().removeMarkers(DocumentMarker::TelephoneNumber);
+ document().markers().removeMarkers(DocumentMarker::TelephoneNumber);
// FIXME: Do other UI cleanup here once we have other UI.
}
+
#endif // ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
void Editor::updateEditorUINowIfScheduled()
Modified: trunk/Source/WebCore/editing/Editor.h (167541 => 167542)
--- trunk/Source/WebCore/editing/Editor.h 2014-04-19 18:57:46 UTC (rev 167541)
+++ trunk/Source/WebCore/editing/Editor.h 2014-04-19 19:47:27 UTC (rev 167542)
@@ -507,6 +507,7 @@
bool m_editorUIUpdateTimerWasTriggeredByDictation;
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
+ bool shouldDetectTelephoneNumbers();
void scanSelectionForTelephoneNumbers(Timer<Editor>&);
void scanRangeForTelephoneNumbers(Range&, const StringView&, Vector<RefPtr<Range>>& markedRanges);
void clearDataDetectedTelephoneNumbers();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes