Bug 157230

Summary: Some content causes deep recursion.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, koivisto, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case
none
WIP patch
none
Patch
none
Patch none

Description zalan 2016-04-29 21:22:03 PDT
Created attachment 277795 [details]
Test case

See attached test case.
Comment 1 zalan 2016-04-29 21:23:01 PDT
rdar://problem/7694756
Comment 2 zalan 2016-04-29 21:27:36 PDT
Created attachment 277796 [details]
WIP patch

This patch limits render tree nesting. DOM can have all the nested nodes but renderer tree has only up to 512. (from 512 and up, it's like they were display: none}
This (DOM vs render tree) matches FF(45.0.2) behavior.
Comment 3 Alexey Proskuryakov 2016-04-29 23:56:27 PDT
> This (DOM vs render tree) matches FF(45.0.2) behavior.

But not Chrome?
Comment 4 zalan 2016-04-30 06:33:31 PDT
(In reply to comment #3)
> > This (DOM vs render tree) matches FF(45.0.2) behavior.
> 
> But not Chrome?
No, Chrome crashes when the stack space is exhausted.
Comment 5 zalan 2016-04-30 21:43:35 PDT
Created attachment 277839 [details]
Patch
Comment 6 Antti Koivisto 2016-04-30 21:45:52 PDT
Comment on attachment 277839 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277839&action=review

> Source/WebCore/style/StyleTreeResolver.cpp:370
>          auto& element = downcast<Element>(node);
> +        if (it.depth() > Settings::defaultMaximumRenderTreeDepth) {

An empty line after auto& element would look nicer.
Comment 7 zalan 2016-04-30 21:51:46 PDT
Created attachment 277840 [details]
Patch
Comment 8 WebKit Commit Bot 2016-04-30 22:41:53 PDT
Comment on attachment 277840 [details]
Patch

Clearing flags on attachment: 277840

Committed r200301: <http://trac.webkit.org/changeset/200301>
Comment 9 WebKit Commit Bot 2016-04-30 22:41:58 PDT
All reviewed patches have been landed.  Closing bug.