Skip to content

Commit

Permalink
[content-visibility] Return up-to-date values when script asks for me…
Browse files Browse the repository at this point in the history
…trics

https://bugs.webkit.org/show_bug.cgi?id=259730

Reviewed by Alan Baradlay.

Return up-to-date values when script asks for metrics when using
API (like getBoundingClientRect()) that needs to measure layout, rather
than waiting for the step in "update the rendering" [1].

This matches the gecko implementation whereas chromium uses a
"whitelist" solution, needing to adjust many call sites.

[1] https://drafts.csswg.org/css-contain/#cv-notes (Step 3)

* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-012-expected.txt:
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
(WebCore::Document::updateLayoutIfDimensionsOutOfDate):

Canonical link: https://commits.webkit.org/267449@main
  • Loading branch information
rwlbuis committed Aug 30, 2023
1 parent ceb8e61 commit 62ac47b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FAIL Sizing normally assert_equals: clientWidth expected 50 but got 100
PASS Sizing normally
PASS Sizing with c-i-s fallback
PASS Still sizing with c-i-s fallback
PASS Sizing with last remembered size
Expand Down
8 changes: 1 addition & 7 deletions LayoutTests/platform/mac-wk1/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -2595,13 +2595,7 @@ imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-eleme
# rdar://111704637 - 'mousemove' not emitted from 'eventSender.moveMouseTo()'
fast/html/transient-activation.html [ Skip ]

webkit.org/b/259075 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-079.html [ ImageOnlyFailure ]
webkit.org/b/259075 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-auto-in-iframe.html [ ImageOnlyFailure ]
webkit.org/b/259075 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-auto-intrinsic-width.html [ ImageOnlyFailure ]
webkit.org/b/259075 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-auto-nested.html [ ImageOnlyFailure ]
webkit.org/b/259075 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-resize-observer-no-error.html [ ImageOnlyFailure ]

webkit.org/b/259485 [ Ventura+ ] http/tests/media/hls/track-in-band-multiple-cues.html [ Crash ]
webkit.org/b/259485 [ Ventura ] http/tests/media/hls/track-in-band-multiple-cues.html [ Crash ]

webkit.org/b/259546 [ Debug ] media/modern-media-controls/tracks-support/text-track-selected-via-media-api.html [ Crash Timeout ]

Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/dom/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,8 @@ void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
scheduleFullStyleRebuild();
}

updateRelevancyOfContentVisibilityElements();

updateLayout();

if (runPostLayoutTasks == RunPostLayoutTasks::Synchronously && view())
Expand Down Expand Up @@ -2384,6 +2386,8 @@ bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, OptionSet<Dim
requireFullLayout = true;
}

updateRelevancyOfContentVisibilityElements();

updateStyleIfNeeded();

RenderObject* renderer = element.renderer();
Expand Down

0 comments on commit 62ac47b

Please sign in to comment.