Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 278519 - [CSS] CSS does not handle "focus:hover" pseudo classes unless "hover" is defined separately
Summary: [CSS] CSS does not handle "focus:hover" pseudo classes unless "hover" is defi...
Status: CLOSED WONTFIX
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 0.9   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Bogdan Gheorghe CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-30 10:39 EDT by Remy Suen CLA
Modified: 2019-06-16 15:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2009-05-30 10:39:06 EDT
The code below works:

Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());

String style = "Button:hover { color: #0000ff }\n" +
		"Button:focus:hover { color: #00ff00 }";

CSSEngine engine = new CSSSWTEngineImpl(display);

engine.setErrorHandler(new CSSErrorHandler() {
	public void error(Exception e) {
		fail(e.getMessage());
	}
});

try {
	engine.parseStyleSheet(new StringReader(style));
} catch (IOException e) {
	e.printStackTrace();
	return;
}

Button button1 = new Button(shell, SWT.PUSH);
button1.setText("Button 1"); //$NON-NLS-1$

Button button2 = new Button(shell, SWT.PUSH);
button2.setText("Button 2"); //$NON-NLS-1$

engine.applyStyles(shell, true);

shell.pack();
shell.open();

while (!shell.isDisposed()) {
	if (!display.readAndDispatch()) {
		display.sleep();
	}
}
display.dispose();

-----------------------

If we have...

String style = "Button:focus { color: #0000ff }\n" +
		"Button:focus:hover { color: #00ff00 }";

...instead, you can hover and tab between the two buttons all you want to alter focus and such but the buttons will never be coloured green. Likewise, just having...

String style = "Button:focus:hover { color: #00ff00 }";

...will also fail.
Comment 1 Angelo ZERR CLA 2009-05-30 11:45:07 EDT
Hi remy,

I believe the problem comes from with IDynamicPseudoClassesHandler which manage dfocus, hover.

I know IDynamicPseudoClassesHandler  is awfull (I don't know why I have done that?). I have send a patch at https://bugs.eclipse.org/bugs/show_bug.cgi?id=268249 to remove  IDynamicPseudoClassesHandler  and have cleaner API, but I don't know if Kevin is OK to apply this patch.

We must check if this patch resolve your problem.

Regards Angelo
Comment 2 Remy Suen CLA 2009-05-30 11:57:05 EDT
(In reply to comment #1)
> I believe the problem comes from with IDynamicPseudoClassesHandler which manage
> dfocus, hover.
> 
> I know IDynamicPseudoClassesHandler  is awfull (I don't know why I have done
> that?). I have send a patch at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=268249 to remove 
> IDynamicPseudoClassesHandler  and have cleaner API, but I don't know if Kevin
> is OK to apply this patch.

I'll try to read through the thread to see what's going on.

> We must check if this patch resolve your problem.

The patches do not seem to apply cleanly to HEAD.
Comment 3 Angelo ZERR CLA 2009-05-30 14:56:55 EDT
Remy 

My answer is just a supposition(I have not tested), so I don't know if the patch which remove IDynamicPseudoClassesHandler will correct really your problem, but I suggest to test your case with the patch. 
Comment 4 Remy Suen CLA 2009-05-30 15:05:17 EDT
(In reply to comment #3)
> My answer is just a supposition(I have not tested), so I don't know if the
> patch which remove IDynamicPseudoClassesHandler will correct really your
> problem, but I suggest to test your case with the patch.

Agreed. I have CC'd myself on the other bug. Once updated patches have been submitted into bugzilla, I will test them to see if it resolves this problem.
Comment 5 Eclipse Genie CLA 2019-06-16 15:16:49 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.