Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b44b2cea5f88d369c0f147710c37fe0869539469
https://github.com/WebKit/WebKit/commit/b44b2cea5f88d369c0f147710c37fe0869539469
Author: Ben Nham <[email protected]>
Date: 2026-09-30 (Wed, 30 Sep 2026)
Changed paths:
A
LayoutTests/editing/mac/selection/telephone-number-ranges-changed-only-when-needed-expected.txt
A
LayoutTests/editing/mac/selection/telephone-number-ranges-changed-only-when-needed.html
M Source/WebCore/editing/Editor.cpp
M Source/WebCore/page/mac/ServicesOverlayController.h
M Source/WebCore/page/mac/ServicesOverlayController.mm
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
Log Message:
-----------
Don't invalidate telephone number highlights on every rendering update
https://bugs.webkit.org/show_bug.cgi?id=325685
rdar://problem/188743822
Reviewed by Ryosuke Niwa.
Every rendering update calls
FrameSelection::updateAppearanceAfterUpdatingRendering(), which calls
Editor::scanSelectionForTelephoneNumbers() on every document. This then
unconditionally called
selectedTelephoneNumberRangesChanged(), which invalidates telephone number
highlights and starts
a timer that rebuilds them by walking the frame tree.
This patch avoids calling selectedTelephoneNumberRangesChanged() in the common
case where there are
no telephone number ranges both before and after the telephone number scan.
We also had to add an explicit call to selectedTelephoneNumberRangesChanged()
when Editor::clear()
was called and there was a telephone number range in the document. That is to
cover the case where
an iframe with a selected telephone number is removed. Previously, the next
scan in the next
rendering update would unconditionally call
selectedTelephoneNumberRangesChanged() and the overlay
controller would drop the stale highlight. Now, since we are calling
selectedTelephoneNumberRangesChanged() conditionally, the next scan might not
notify the overlay
controller. The added layout test tests this scenario.
Test:
editing/mac/selection/telephone-number-ranges-changed-only-when-needed.html
*
LayoutTests/editing/mac/selection/telephone-number-ranges-changed-only-when-needed-expected.txt:
Added.
*
LayoutTests/editing/mac/selection/telephone-number-ranges-changed-only-when-needed.html:
Added.
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::clear):
(WebCore::Editor::scanSelectionForTelephoneNumbers):
* Source/WebCore/page/mac/ServicesOverlayController.h:
(WebCore::ServicesOverlayController::telephoneNumberRangesChangedCountForTesting
const):
* Source/WebCore/page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::telephoneNumberRangesChangedCount const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
Canonical link: https://commits.webkit.org/322322@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications