haikuwebkit/LayoutTests/fast/css/ancestor-of-hovered-element...

18 lines
934 B
Plaintext
Raw Permalink Normal View History

:hover CSS pseudo-class sometimes keeps matching ever after mouse has left the element https://bugs.webkit.org/show_bug.cgi?id=158340 Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-21 Reviewed by Simon Fraser. Source/WebCore: When removing a hovered subtree from the document, we were getting into an inconsistent state where m_hoveredElement is in the detached subtree and we have no way of clearing the existing IsHovered flags. What happens is: -The root "a" has an child "b" that is hovered. -"a" starts being removed from the tree, its renderer is destroyed. -RenderTreeUpdater::tearDownRenderers() pushes "a" on the teardownStack and calls hoveredElementDidDetach(). -hoveredElementDidDetach() is called with "a". "a" is not the hovered element, the function does nothing. -RenderTreeUpdater::tearDownRenderers() pushes "b" on the teardownStack and calls hoveredElementDidDetach(). -hoveredElementDidDetach() is called with "b". The next parent with a renderer is "a", m_hoveredElement is set to "a". -"a"'s parent is set to nullptr. -> We have a m_hoveredElement on the root of a detached tree, making it impossible to clear the real dirty tree. This patch changes the order in which we clear the flags. It is done in the order in which we clear the renderers to ensure the last element with a dead renderer is the last to update m_hoveredElement. Tests: fast/css/ancestor-of-hovered-element-detached.html fast/css/ancestor-of-hovered-element-removed.html * Source/WebCore/style/RenderTreeUpdater.cpp: LayoutTests: * fast/css/ancestor-of-hovered-element-detached-expected.txt: Added. * fast/css/ancestor-of-hovered-element-detached.html: Added. * fast/css/ancestor-of-hovered-element-removed-expected.txt: Added. * fast/css/ancestor-of-hovered-element-removed.html: Added. Canonical link: https://commits.webkit.org/177091@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-22 05:52:05 +00:00
Verify the hovered state is updated correctly when an ancestor of the hovered element is detached from the document's tree
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Initial state
PASS elementsWithHoverStyle() is ["html", "body", "prime-ancestor"]
PASS elementsMatchingHoverSelector() is ["html", "body", "prime-ancestor"]
Moving over #target
PASS elementsWithHoverStyle() is ["html", "body", "prime-ancestor", "group", "element-to-remove", "target"]
PASS elementsMatchingHoverSelector() is ["html", "body", "prime-ancestor", "group", "element-to-remove", "target"]
Removing the renderer of #element-to-remove
PASS elementsMatchingHoverSelector(elementToRemove) is []
PASS elementsWithHoverStyle() is ["html", "body", "prime-ancestor", "interceptor"]
PASS elementsMatchingHoverSelector() is ["html", "body", "prime-ancestor", "interceptor"]
PASS successfullyParsed is true
TEST COMPLETE