Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 581b4484918e32d68543837c383423f55734666c
https://github.com/WebKit/WebKit/commit/581b4484918e32d68543837c383423f55734666c
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-09 (Fri, 09 Oct 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/getBoundingClientRect-content-visibility-hidden-expected.txt
M Source/WebCore/dom/Range.cpp
Log Message:
-----------
Range.getBoundingClientRect() returns empty rects for content inside a
content-visibility: hidden subtree
https://bugs.webkit.org/show_bug.cgi?id=322910
rdar://186165755
Reviewed by Antti Koivisto.
A Range's getBoundingClientRect()/getClientRects() ran a plain layout update
before collecting rects. Content inside a content-visibility: hidden subtree is
skipped during layout, so its text has no line boxes and the range geometry
collapsed to a zero-sized rect.
Element.getBoundingClientRect() already handles this by updating layout with
LayoutOptions::TreatContentVisibilityHiddenAsVisible (and ...AutoAsVisible),
which forces the skipped subtree to lay out, scoped to the queried element.
Route both Range geometry entry points through a shared helper that passes those
same options, scoped to the range's nearest ancestor element.
Document::updateLayout()
only forces a skipped subtree when the context element is itself skipped
content,
so this is a no-op for ordinary ranges.
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/getBoundingClientRect-content-visibility-hidden-expected.txt:
Progression
* Source/WebCore/dom/Range.cpp:
(WebCore::updateLayoutForRangeBoundingRect):
(WebCore::Range::getClientRects const):
(WebCore::Range::boundingClientRect):
Canonical link: https://commits.webkit.org/323204@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications