Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7079bf907edc83bd5450946e068ce8b0d04b5333
      
https://github.com/WebKit/WebKit/commit/7079bf907edc83bd5450946e068ce8b0d04b5333
  Author: Cole Carley <[email protected]>
  Date:   2026-03-14 (Sat, 14 Mar 2026)

  Changed paths:
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebKit/Sources.txt
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebPage/FindController.cpp
    M Source/WebKit/WebProcess/WebPage/FindController.h
    A Source/WebKit/WebProcess/WebPage/FindIndicator.cpp
    A Source/WebKit/WebProcess/WebPage/FindIndicator.h
    R Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm
    A Source/WebKit/WebProcess/WebPage/ios/FindIndicatorIOS.cpp

  Log Message:
  -----------
  Clean up the FindController
https://bugs.webkit.org/show_bug.cgi?id=309536
rdar://172136026

Reviewed by Megan Gardner.

The goal of my changes is to make the FindController code
more managable.

I've done three things here:
1. change the m_foundStringMatchIndex from an int to an optional<uint32_t>

        We were using a value of -1 to track if we did or did not have a match, 
but
        that resulted in some weird edge cases when calcualting the current 
index.

2. break updateFindUIAfterPageScroll into two functions: 
updateFindUIAfterIncrementalFind
and updateFindUIAfterFindingAllMatches

        The FindController has two main paths for finding strings: FindString 
and
        FindStringMatches. updateFindUIAfterPageScroll was trying to be useful 
to
        both of these code paths, and this made for confusing and hacky code. 
There
        was a FIXME addressing this.

3. introduce a FindIndicator class

        This allows us to remove the confusing FindControllerIOS that only 
overrided
        the indicator logic. We now have one platform independent 
FindController with
        a polymorphic FindIndicator that handles all the platform dependent 
code.

* Source/WebCore/page/Page.cpp:
(WebCore::Page::findTextMatches):
* Source/WebCore/page/Page.h:
* Source/WebKit/Sources.txt:
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::FindController):
(WebKit::FindController::replaceMatches):
(WebKit::FindController::updateFindUIAfterIncrementalFind):
(WebKit::FindController::markMatches):
(WebKit::FindController::getMatchCount):
(WebKit::FindController::updateMatchIndex):
(WebKit::FindController::updateFindUIAfterFindingAllMatches):
(WebKit::FindController::updateFindPageOverlay):
(WebKit::FindController::updateFindIndicatorIfNeeded):
(WebKit::FindController::findString):
(WebKit::FindController::findStringMatches):
(WebKit::FindController::indicateFindMatch):
(WebKit::FindController::hideFindUI):
(WebKit::FindController::hideFindIndicator):
(WebKit::FindController::resetMatchIndex):
(WebKit::FindController::showFindIndicatorInSelection):
(WebKit::FindController::deviceScaleFactorDidChange):
(WebKit::FindController::redraw):
(WebKit::FindController::drawRect):
(WebKit::FindController::didScrollAffectingFindIndicatorPosition):
(WebKit::FindController::updateFindUIAfterPageScroll):
(WebKit::FindController::updateFindIndicator): Deleted.
(WebKit::FindController::willFindString): Deleted.
(WebKit::FindController::didFindString): Deleted.
(WebKit::FindController::didHideFindIndicator): Deleted.
(WebKit::FindController::findIndicatorRadius const): Deleted.
(WebKit::FindController::shouldHideFindIndicatorOnScroll const): Deleted.
* Source/WebKit/WebProcess/WebPage/FindController.h:
* Source/WebKit/WebProcess/WebPage/FindIndicator.cpp: Added.
(WebKit::FindIndicator::update):
(WebKit::FindIndicator::hide):
(WebKit::FindIndicator::didFindString):
* Source/WebKit/WebProcess/WebPage/FindIndicator.h: Added.
(WebKit::FindIndicator::FindIndicator):
(WebKit::FindIndicator::willFindString):
(WebKit::FindIndicator::shouldHideOnScroll const):
(WebKit::FindIndicator::radius const):
(WebKit::FindIndicator::isShowing const):
(WebKit::FindIndicator::rect const):
* Source/WebKit/WebProcess/WebPage/ios/FindIndicatorIOS.cpp: Renamed from 
Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm.
(WebKit::FindIndicatorOverlayClientIOS::drawRect):
(WebKit::FindIndicatorIOS::update):
(WebKit::FindIndicatorIOS::hide):
(WebKit::FindIndicatorIOS::willFindString):
(WebKit::FindIndicatorIOS::didFindString):
* Source/WebKit/WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h:
(WebKit::FindIndicatorOverlayClientIOS::FindIndicatorOverlayClientIOS):

Canonical link: https://commits.webkit.org/309268@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to