This is a great optimization - thanks wcp! On Thu, Sep 28, 2017 at 2:00 AM, Wei-Cheng Pan <w...@mozilla.com> wrote:
> Hi, > > This week I landed bug 1363805[1], which will skip restyling if the > element does > not need that for getting correct value. Normal users should not notice any > difference, but this change may affect some test cases which need to force > restyle. > > The optimization only happens when the element satisfies *all* the > following > conditions: > > 1. The CSS property does not depend on layout. > 2. getComputedStyle and the element belong to the same document. > 3. The document does not need to restyle for this element, i.e. > 3-1. The document has a presshell. > 3-2. The style set has not changed yet. > 3-3. All ancestors (including the element itself) are not animating. > 3-4. All ancestors (including the element itself) do not need to restyle > themselves. > 4. All ancestor documents satisfy 3 for the sub-document. > > For example, getComputedStyle(document.body).color will not trigger > restyling if > only descendants have changed but not document.body itself. If you are > not sure > (or just don't care about it), choose a layout dependent property will > do the > trick. (e.g.: getComputedStyle(document.body).width) > > [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1363805 > > Cheers, > Wei-Cheng Pan > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform