Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the :hover selector #790

Closed
pcwalton opened this issue Aug 26, 2013 · 9 comments · Fixed by #1633
Closed

Support the :hover selector #790

pcwalton opened this issue Aug 26, 2013 · 9 comments · Fixed by #1633
Labels
A-content/css Interacting with CSS from web content (parsing, serializing, introspection) A-gfx/rendering A-layout/uncategorized
Milestone

Comments

@pcwalton
Copy link
Contributor

This is needed for Acid2 lines 6, 7, 8, 9 (the nose).

@larsbergstrom
Copy link
Contributor

Needed for #1366.

@larsbergstrom
Copy link
Contributor

@metajack
Copy link
Contributor

  1. Implement Rust event handlers and fix onclick to use them
  2. Get mousemove events into script from the compositor
  3. Script sets hover state on DOM node (special bit on the element)
  4. Selector matching can query that bit
  5. Trigger reflow

@jdm
Copy link
Member

jdm commented Jan 22, 2014

Step 1 is #1528.

@larsbergstrom
Copy link
Contributor

@sammykim you can work on numbers 2-5 while waiting for Rust event handlers to land. Please ask us in IRC or here on github if you have any questions, particularly about glfw mouse move, hooking into script, and querying the layout task for the correct DOM nodes.

@larsbergstrom
Copy link
Contributor

@sammykim I had a chance to chat with @jdm about some of your questions. Below is a rough outline of the work:

The specification for the :hover attribute is here:
http://www.w3.org/TR/CSS21/selector.html#x32

Note that unlike DOM events, which have a more complicated bubbling and cancellation semantics (which is why you need the list of all the DOM nodes for a point on the screen instead of just the top one!), a technically correct implementation of :hover only needs to set the property on the topmost element.

You can implement this work in any order that works for you, and we always prefer seeing partial results so we can give comments before there is too much work in progress. e.g., you could hook up the mouse events and messages and get script handling them but not doing much with them other than querying layout first, before working on the event handling and setting bits.

@hyunjunekim
Copy link
Contributor

@larsbergstrom @jdm
When find element for hover target, Could we use the HitTestQuery with layout_task like LINK?
right?

@larsbergstrom
Copy link
Contributor

@hyunjunekim The HitTestQuery message is almost correct, except that it only returns one item. While that works for the specific case of the :hover pseudo-class, you will need the full list of items to implement the event handler.

@larsbergstrom
Copy link
Contributor

In addition to the EventHandler work mentioned above (which requires #1688 to do), there is one more item. We do not currently parse the selector in ACID2 containing :hover correctly, which I believe is what prevents the patch already landed from working:

60:4 Invalid/unsupported selector: .nose div:hover :before 
61:4 Invalid/unsupported selector: .nose div:hover :after 
63:4 Invalid/unsupported selector: .nose div :after 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/css Interacting with CSS from web content (parsing, serializing, introspection) A-gfx/rendering A-layout/uncategorized
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants