Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec16a43776c20636d253cae1f0f76ee600d12bee
      
https://github.com/WebKit/WebKit/commit/ec16a43776c20636d253cae1f0f76ee600d12bee
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-06 (Thu, 06 Aug 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/dynamic-viewport-units-rule-cache-expected.txt
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h

  Log Message:
  -----------
  Fire resize event when iframe viewport transitions from display:none to 
visible
https://bugs.webkit.org/show_bug.cgi?id=312128
rdar://174638256

Reviewed by Antti Koivisto.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

When an iframe is loaded while its parent has display:none, no layout occurs.
When the parent becomes visible, the iframe gets its first layout but no resize
event fires on its contentWindow, because willDoLayout() pre-initializes
m_lastViewportSize to the current size, making scheduleResizeEventIfNeeded()
see no change.

Per the CSSOM View spec [1], a resize event should fire when a document's
viewport has had its width or height changed since the last time the resize
steps were run. The viewport going from 0x0 (no layout) to its actual size
is a genuine change.

Fix by adding a m_loadedWhileHidden flag to LocalFrameView, set in
Document::dispatchWindowLoadEvent() when the document finishes loading as a
subframe that was never laid out and whose owner element has no renderer
(i.e. parent had display:none). On first layout, willDoLayout() skips
pre-initializing m_lastViewportSize only when this flag is set, allowing
scheduleResizeEventIfNeeded() to detect the 0x0 to actual size transition.

[1] https://drafts.csswg.org/cssom-view/#resizing-viewports

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/dynamic-viewport-units-rule-cache-expected.txt:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::willDoLayout):

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



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

Reply via email to