REGRESSION (r196383): Drop down CSS menus not working on cnet.com, apmex.com
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2016 18:00:48 +0000 (18:00 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2016 18:00:48 +0000 (18:00 +0000)
commit56c49cadfbfc2f891c1b446f4f012dc28735ab62
treec089363c4762f7775e01b6503d6111b0e9776e1d
parent4c444f171046b8ddc32c96e1abf4236cddf65b08
REGRESSION (r196383): Drop down CSS menus not working on cnet.com, apmex.com
https://bugs.webkit.org/show_bug.cgi?id=160390

Reviewed by Simon Fraser.

Source/WebCore:

The case here is that we have a rule like

    .enableHover:hover .child { ... }

and the "enableHover" class is added dynamically. The class change invalidation optimization code would figure out
that nothing needs to be invalidated as the class change doesn't make the rule match (since :hover doesn't match).

However for event driven hover to actually work the hover element needs to have its childrenAffectedByHover bit set.
This bits is set when the selector match is attempted, whether it actually matches or not. Since we optimized away
the style invalidation we never set the bit either.

Fix by treating :hover as always matching (==ignored) when collecting rules for invalidation optimization purposes.
Dynamic pseudo elements are already treated this way for similar reasons.

Test: fast/selectors/hover-invalidation-descendant-dynamic.html

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):

    Match always in CollectingRulesIgnoringVirtualPseudoElements mode (now slightly misnamed).

    This mode is used for optimization purposes in StyleInvalidationAnalysis (which we care about here) and
    StyleSharingResolver. The change is fine for both.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsHovered):

    Same change for the slow path selector checker.

LayoutTests:

* fast/selectors/hover-invalidation-descendant-dynamic-expected.txt: Added.
* fast/selectors/hover-invalidation-descendant-dynamic.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/selectors/hover-invalidation-descendant-dynamic-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/hover-invalidation-descendant-dynamic.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/cssjit/SelectorCompiler.cpp