Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 23cdbeb3cd776e2337f220c18b86f0ddb639bd50
      
https://github.com/WebKit/WebKit/commit/23cdbeb3cd776e2337f220c18b86f0ddb639bd50
  Author: Tim Nguyen <[email protected]>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/editing/find/cocoa/find-and-replace-in-closed-details-expected.txt
    A LayoutTests/editing/find/cocoa/find-and-replace-in-closed-details.html
    A 
LayoutTests/editing/text-iterator/find-in-page-in-closed-details-expected.txt
    A LayoutTests/editing/text-iterator/find-in-page-in-closed-details.html
    A 
LayoutTests/editing/text-iterator/find-in-page-in-summary-of-closed-details-expected.txt
    A 
LayoutTests/editing/text-iterator/find-in-page-in-summary-of-closed-details.html
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment-expected.txt
    M LayoutTests/platform/mac-wk1/TestExpectations
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/editing/TextIterator.cpp
    M Source/WebCore/editing/TextIteratorBehavior.h
    M Source/WebCore/html/HTMLDetailsElement.cpp
    M Source/WebCore/html/HTMLDetailsElement.h
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/RenderStyleSetters.h
    M Source/WebCore/rendering/style/StyleRareInheritedData.cpp
    M Source/WebCore/rendering/style/StyleRareInheritedData.h
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/C/WKPage.h
    M Source/WebKit/WebProcess/WebPage/FindController.cpp
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp
    M Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm
    M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
    M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
    M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
    M Tools/WebKitTestRunner/TestInvocation.cpp

  Log Message:
  -----------
  Auto-expand “details” element for find-in-page and scrolling to fragments
https://bugs.webkit.org/show_bug.cgi?id=228843
rdar://81856620

Reviewed by Darin Adler.

This change causes any closed <details> element to be opened
automatically (auto-expanded) if either:

- the user is using find-in-page and a descendant node of the closed
  <details> element contains a match for the given search string
- the user is navigating to a fragment ID and the fragment ID is for a
  descendant element of the closed <details> element

…per the requirements in the HTML spec’s Find-in-page section at
https://html.spec.whatwg.org/#interaction-with-details-and-hidden=until-found

Otherwise, without this change, when a descendant node of a closed
<details> element contains a match for the given find-in-page search
string, or when navigating to a fragment ID for a descendant element of
a closed <details> element, the closed <details> element isn’t opened
automatically (not auto-expanded).

Changes to TextIterator ensure that content inside details elements are
not skipped over for the purposes of find-in-page.

This change also introduces the DetailsAutoExpandEnabled preference
(disabled by default), for controlling whether <details> elements get
auto-expanded under the conditions described above.

And this also adds a testRunner.indicateMatchIndex(index) function —
to emulate jumping through matches in the non-findString codepath.

Original PR by: Michael[tm] Smith <[email protected]>

* LayoutTests/TestExpectations:
* 
LayoutTests/editing/find/cocoa/find-and-replace-in-closed-details-expected.txt: 
Added.
* LayoutTests/editing/find/cocoa/find-and-replace-in-closed-details.html: Added.
* 
LayoutTests/editing/text-iterator/find-in-page-in-closed-details-expected.txt: 
Added.
* LayoutTests/editing/text-iterator/find-in-page-in-closed-details.html: Added.
* 
LayoutTests/editing/text-iterator/find-in-page-in-summary-of-closed-details-expected.txt:
 Added.
* 
LayoutTests/editing/text-iterator/find-in-page-in-summary-of-closed-details.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment-expected.txt:
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::TextIterator):
(WebCore::isRendererAccessible):
(WebCore::isConsideredSkippedContent):
* Source/WebCore/editing/TextIteratorBehavior.h:
* Source/WebCore/html/HTMLDetailsElement.cpp:
(WebCore::revealClosedDetailsAncestors):
* Source/WebCore/html/HTMLDetailsElement.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::scrollToFragmentInternal):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::autoRevealsWhenFound const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setAutoRevealsWhenFound):
* Source/WebCore/rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
(WebCore::StyleRareInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleRareInheritedData.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageIndicateFindMatch):
* Source/WebKit/UIProcess/API/C/WKPage.h:
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::didFindString):
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::decorateTextRangeWithStyle):
* Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::FindController::didFindString):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::postPageMessage):
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::indicateFindMatch):
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
* Tools/WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to