Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 63f824e54433a84d58d6186d9e4dc27a66b4f7eb
      
https://github.com/WebKit/WebKit/commit/63f824e54433a84d58d6186d9e4dc27a66b4f7eb
  Author: Antti Koivisto <[email protected]>
  Date:   2025-11-12 (Wed, 12 Nov 2025)

  Changed paths:
    M Source/WebCore/style/calc/StyleCalculationTree+Traversal.h
    M Source/WebCore/style/calc/StyleCalculationTree.cpp
    M Source/WebCore/style/calc/StyleCalculationTree.h
    M Source/WebCore/style/values/primitives/StyleLengthWrapper+Blending.h

  Log Message:
  -----------
  Limit tree depth when blending Calculation tree with Blend node
https://bugs.webkit.org/show_bug.cgi?id=302401
rdar://164138229

Reviewed by Sam Weinig.

When blending calc() values we in complex cases add Blend(treeA, treeB, 
percent) nodes
to the calculation tree. The values being blended may themselves have been 
output of blending
and contain Blend nodes already. It is possible for the nodes to accumulate 
creating
a very deep tree. Recursive algorithms on such tree may blow up the stack.

* Source/WebCore/style/calc/StyleCalculationTree+Traversal.h:
(WebCore::Style::Calculation::forAllChildren):

Fix this to work in general case.

* Source/WebCore/style/calc/StyleCalculationTree.cpp:
(WebCore::Style::Calculation::computeDepth):

Add a function for computing the tree depth.

* Source/WebCore/style/calc/StyleCalculationTree.h:
* Source/WebCore/style/values/primitives/StyleLengthWrapper+Blending.h:
(WebCore::Style::LengthWrapperBlendingSupport::blendMixedSpecifiedTypes):

If the tree depth is already >128 don't create a Blend node and just return the 
target tree.

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



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

Reply via email to