Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 09:50:47 +0000 (09:50 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 09:50:47 +0000 (09:50 +0000)
commit94e2f725462c926354a664f84518797f5ad987f3
tree944d9cb97f9ac61f27433fc744875e5cf759f3dd
parent83f70ba9fe314c5fed474fd49ba69bf6b80bf168
Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties
https://bugs.webkit.org/show_bug.cgi?id=163875

Reviewed by Andreas Kling.

Source/WebCore:

Test: fast/css/getComputedStyle/getComputedStyle-style-resolution.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::hasValidStyleForProperty):

    For non-inherited properties we don't need to update style even if some ancestor style is invalid
    as long as explicit 'inherit' is not being used.
    We still need to update if we find out that the whole subtree we are in is invalid.

(WebCore::updateStyleIfNeededForProperty):

    Pass the property.

(WebCore::ComputedStyleExtractor::customPropertyValue):
(WebCore::ComputedStyleExtractor::propertyValue):
(WebCore::CSSComputedStyleDeclaration::length):
(WebCore::elementOrItsAncestorNeedsStyleRecalc): Deleted.
(WebCore::updateStyleIfNeededForElement): Deleted.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::colorFromPrimitiveValue):

    Mark style as using explicit inheritance if 'currentcolor' value is used.

LayoutTests:

* fast/css/getComputedStyle/getComputedStyle-style-resolution-expected.txt: Added.
* fast/css/getComputedStyle/getComputedStyle-style-resolution.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207755 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/getComputedStyle-style-resolution-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/getComputedStyle/getComputedStyle-style-resolution.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleResolver.cpp