Bug 72957

Summary: :only-of-type pseudo selector breaks :hover on <summary>
Product: WebKit Reporter: Mattias Nissler <mnissler>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dominicc, hyatt, mkwst, morrita, shanestephens, shinyak
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 75930    
Bug Blocks: 72352    
Attachments:
Description Flags
Reduced test case. none

Description Mattias Nissler 2011-11-22 06:56:57 PST
Created attachment 116219 [details]
Reduced test case.

summary:hover doesn't trigger if the summary element is nested in a div that has a div:only-of-type rule and the details contain another div container. The contents of the div:only-of-type rule are not important, an empty rule triggers the problem.

I see this on the nightly at r100982 on Mac and on Chromium (webkit revision r100825).

Test case reduction is attached.
Comment 1 Shane Stephens 2011-11-30 19:42:41 PST
Also see https://bugs.webkit.org/show_bug.cgi?id=73068 which might be related.
Comment 2 Shinya Kawanaka 2011-12-26 04:44:33 PST
I've investigated this issue. Let me try to explain the cause.

Actually, :hover is triggered but discarded soon.

This is DOM tree of the DETAILS element.

DETAILS
  |-- SUMMARY
  |-- DIV

1) In DETAILS element's recalcStyle(), DIV's recalcStyle() is called.
2) In DIV's recalcStyle(), currentStyle is NULL but newStyle is not NULL
3) so reattach() will be called in DIV's recalcStyle().
4) This will make DETAILS's shadow->needsStyleRecalc() true.
5) So DETAILS's recalcShadowTreeStyle is called. It detaches shadow and re-attaches. This schedules SUMMARY's hover timer.
6) Since :only-of-time is specified, when whole DETAILS's style is calculated again
7) Return to (1).

You will be able to find that recalcStyle will be triggered many times when mouse cursor is located on DETAILS element.

Once DIV is shown, (2) won't happen.
Comment 3 Shinya Kawanaka 2012-02-03 01:11:41 PST
I think this will be fix in r106637.
Comment 4 Shinya Kawanaka 2012-02-03 01:26:30 PST
I confirmed that this is fixed in r106637.
Comment 5 Hajime Morrita 2012-02-13 22:37:00 PST
(In reply to comment #4)
> I confirmed that this is fixed in r106637.
closing.