This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 431742 - [CSS] Provide support for inner-class selectors
Summary: [CSS] Provide support for inner-class selectors
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Stefan Winkler CLA
QA Contact: Daniel Rolka CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 430848
  Show dependency tree
 
Reported: 2014-04-01 14:40 EDT by Stefan Winkler CLA
Modified: 2014-04-29 11:45 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Winkler CLA 2014-04-01 14:40:50 EDT
As noted in Bug 430848, there is currently no way to refer to inner classes as part of a CSS selector.

For example, if we have a class Outer which contains a widget class InnerComposite, the computed CSS local name would be Outer$InnerComposite.
If we want to select this in a CSS stylesheet, we would need to write
Outer$InnerComposite { color: red; }

But the CSS specification does not allow $ as part of the selector.
Therefore we currently cannot write this CSS rule.
Comment 1 Stefan Winkler CLA 2014-04-01 14:43:08 EDT
My proposal:

The CSS specification does, in fact, allow a hyphen/minus sign as part of a selector, and since this character cannot be part of a Java class name, we could translate Outer$InnerCanvas to Outer-InnerCanvas and hence, write the following rule:

Outer-InnerComposite { color: red; }

I will upload a patch and test case demonstrating this to gerrit.
Comment 2 Stefan Winkler CLA 2014-04-01 14:49:51 EDT
here it is: https://git.eclipse.org/r/24281
Comment 3 Paul Webster CLA 2014-04-02 09:50:17 EDT
We also use that pattern to translate '.' in IDs.  Will this interfere with that?

PW
Comment 4 Stefan Winkler CLA 2014-04-02 10:06:47 EDT
(In reply to Paul Webster from comment #3)
> We also use that pattern to translate '.' in IDs.  Will this interfere with
> that?

Not that I am aware of. The translation is applied when computing the local name of the element for the DOM. So only element names should be affected here.
Comment 5 Brian de Alwis CLA 2014-04-03 09:36:53 EDT
Looks good to me. Thanks Stefan.

Committed to master:

   https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=9564a09045e4238087997be55f9e6603f8e47806
Comment 6 Brian de Alwis CLA 2014-04-29 11:45:31 EDT
Verified can access LayoutModifierToolControl-1 using the CSS Spy in I20140428-2000.