Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c20412ce58d8394299285a4958abbf9576303361
      
https://github.com/WebKit/WebKit/commit/c20412ce58d8394299285a4958abbf9576303361
  Author: Nathan Solomon <[email protected]>
  Date:   2026-04-23 (Thu, 23 Apr 2026)

  Changed paths:
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  Skip descendant style resolution when parent transitions to display:none
https://bugs.webkit.org/show_bug.cgi?id=312824
rdar://175197342

Reviewed by Antti Koivisto.

When a parent element's display property changes via inline style, the
style resolver forces full resolution on every descendant. The
descendants' styles are unchanged because display is not inherited, but
the resolver does not distinguish between renderer changes that affect
descendants and those that do not. Every descendant pays the full cost
of resolution only to produce the same style it already had.

This occurs when JavaScript toggles display on a container with
children. The parent's renderer is torn down along with all descendant
renderers, but the descendants do not need new styles.

Skip descendant traversal entirely when the parent resolves to
display:none. The optimization is only for display:none transitions. Other
display type changes can affect descendant styles through
StyleAdjuster (example: flex containers blockify inline children).

Descendants under display:none are not rendered, and when the parent
later becomes visible they have no existing style and receive full
resolution.

No new tests since there should be no expected behavior changes.

* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveComposedTree):

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



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

Reply via email to