Closed Bug 310848 Opened 19 years ago Closed 6 years ago

Lots of nested lists effectively make pageload O(N^2)

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

This happens with attachment 157457 [details], which is on bug 256311 (the "minimal
testcase, 168 kb <DL> between body tags, hanging" attachment).  That page has
lots of nested <DL> tags.

The problem is that we have the following rule in html.css:

339 /* nested lists have no top/bottom margins */
340 ul ul,   ul ol,   ul dir,   ul menu,   ul dl,
341 ol ul,   ol ol,   ol dir,   ol menu,   ol dl,
342 dir ul,  dir ol,  dir dir,  dir menu,  dir dl,
343 menu ul, menu ol, menu dir, menu menu, menu dl,
344 dl ul,   dl ol,   dl dir,   dl menu,   dl dl {
345   margin-top: 0;
346   margin-bottom: 0;
347 }

So for each dl we walk every single ancestor (eg to see whether it matches |ul
dl|), constructing RuleProcessorData structs as we go.  Which makes the whole
thing O(N^2) in number of lists (in particular, the number of times
RuleProcessorData() is called is O(N^2)).

Granted, this is a pathological case, and perhaps lazy population of
RuleProcessorData (which I can't find the bug for) would help enough here.
I've always thought that margin rule could use something like li > ul, etc.

The list-style-type rules, though, require implementing -moz-cycle or something
like it: http://lists.w3.org/Archives/Public/www-style/1999May/0067
I just checked opera's impl, and it has zero margins for a list in a div in an
<li>...  So we might not be able to change this for compat reasons.  :(
Assignee: dbaron → nobody
QA Contact: ian → style-system
Bug 705877 should have fixed this.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.