-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Auto-expand “details” element for find-in-page and scrolling to fragments #43558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-expand “details” element for find-in-page and scrolling to fragments #43558
Conversation
EWS run on previous version of this PR (hash 660e5ec) |
660e5ec
to
47cffb9
Compare
EWS run on previous version of this PR (hash 47cffb9) |
47cffb9
to
b055db9
Compare
EWS run on previous version of this PR (hash b055db9) |
b055db9
to
48b3402
Compare
EWS run on previous version of this PR (hash 48b3402) |
48b3402
to
b1149db
Compare
EWS run on previous version of this PR (hash b1149db) |
b1149db
to
d81e33c
Compare
EWS run on previous version of this PR (hash d81e33c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work for the find command that’s implemented in Safari?
d81e33c
to
3e71e35
Compare
e76bb53
to
c2ba414
Compare
EWS run on previous version of this PR (hash c2ba414) |
c2ba414
to
c11fc64
Compare
EWS run on previous version of this PR (hash c11fc64) |
c11fc64
to
87f98d0
Compare
EWS run on previous version of this PR (hash 87f98d0) |
87f98d0
to
31d9861
Compare
EWS run on previous version of this PR (hash 31d9861) |
31d9861
to
8430e86
Compare
EWS run on previous version of this PR (hash 8430e86) |
@@ -218,4 +219,26 @@ void HTMLDetailsElement::toggleOpen() | |||
setBooleanAttribute(HTMLNames::openAttr, !hasAttributeWithoutSynchronization(HTMLNames::openAttr)); | |||
} | |||
|
|||
// https://html.spec.whatwg.org/#ancestor-details-revealing-algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm in the spec does the toggling during the iteration, not separately after building a list of details elements. Is that observably different in any unusual edge cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make a difference. I was just being cautious since we usually don't mutate during iteration, but it's probably more relevant when you use the special iterators, which is not the case now that I switched to a while loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to match the spec
8430e86
to
aa8c8c0
Compare
EWS run on previous version of this PR (hash aa8c8c0) |
aa8c8c0
to
79318c2
Compare
EWS run on current version of this PR (hash 79318c2) |
…ents 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
79318c2
to
23cdbeb
Compare
Committed 296708@main (23cdbeb): https://commits.webkit.org/296708@main Reviewed commits have been landed. Closing PR #43558 and removing active labels. |
23cdbeb
79318c2
🛠 win🧪 wpe-wk2🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 mac-AS-debug-wk2🧪 gtk-wk2