Avoid style recalc in display:none subtrees.

ParentComputedStyle() should be null in display:none subtrees to avoid
computing style unnecessarily when we start at a recalc root inside a
display:none subtree where the parent of the recalc root has a
ComputedStyle because it's forced by Window.getComputedStyle().

First, we introduce a flag to mark ComputedStyle as being forced inside
a display:none subtree. This is strictly not necessary for the current
code since we can check where it is stored, but for the
unify-computed-style storage issue (914784), we will start storing
ComputedStyle in the same place for both rendered and display:none
elements, so we'll need it soon.

Let ParentComputedStyle() return null when this flag is set to make sure
display:none subtrees stay free of ComputedStyles unless enforced.

Bug: 920600, 914784
Change-Id: Iea07af009c0237d4ac6ba155af774d2e3dece354
Reviewed-on: https://chromium-review.googlesource.com/c/1404171
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622414}
4 files changed