Open Bug 1558433 Opened 5 years ago Updated 2 years ago

Improvements to the visible content heuristic during page load.

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: emilio, Unassigned)

References

Details

The commit message for bug 1555133 mentions a few potential improvements that could be made to the heuristic introduced there. Quoting:

  • Maybe have some more heuristics for hidden elements, like presence of the
    hidden attribute?

  • Maybe skip whitespace-only text? This does a pretty good job anyways because
    whitespace nodes are usually pretty small (like a couple newlines and
    spaces), so they don't add too much to the number. This could be done cheaply if
    looking at sSpaceSharedString / sTabSharedString.

  • Add some weight to some elements? Maybe images should have a fixed weight,
    for example. Though you don't want 0x0 images and such to count... Maybe we
    should add to this heuristic out of band when processing image loads or some
    such.

  • Handle shadow DOM and such better? Right now Shadow DOM and XBL are always
    assumed visible as long as they're connected. You can in theory do
    something like stash a <div> inside a <style> element, attach a
    ShadowRoot and such, and append a bunch of stuff inside. But I don't think
    it's something we should be particularly worried about.

  • Probably add some check to CharacterData::AppendText as well? Otherwise this
    undercounts when loading big amount of text arrives via the network, for
    example, but also I'm not sure we're optimizing for log files and such so it
    might be ok.

We should measure and tune it if there are bits of the heuristic which don't work great.

I think the whitespace stuff and the AppendText stuff are likely to be worth doing.

Type: defect → enhancement
Severity: normal normal → S3 S3
You need to log in before you can comment on or make changes to this bug.