Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329832 - [Theming] CSS gradient overrides background image set in java
Summary: [Theming] CSS gradient overrides background image set in java
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.4 M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 12:13 EST by Istvan Ballok CLA
Modified: 2010-11-10 07:31 EST (History)
1 user (show)

See Also:


Attachments
proposed patch for the Maintenance branch (similar for trunk) (2.25 KB, patch)
2010-11-09 12:50 EST, Istvan Ballok CLA
tbuschto: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Istvan Ballok CLA 2010-11-09 12:13:05 EST
A gradient can be set in the CSS style for the background-image property for, e.g. all the Buttons.
On the widget instance (where the above mentioned CSS gradient applies), the background image 
property (an Image) can be set in java, too.

The value set in Java should override the value set in CSS.

Problem: In this case (gradient as background image), the value set in CSS always wins.
Comment 1 Istvan Ballok CLA 2010-11-09 12:50:16 EST
Created attachment 182738 [details]
proposed patch for the Maintenance branch (similar for trunk)

change the priority of gradient/image/solid in GraphicsMixin#_handleGfxBackground
    
before:
1) gradient 2) image 3) solid
after:
1) image 2) gradient 3) solid
    
motivation: if we have a "confict": both image and gradient is set,
then always the image should win, because the conflict can happen
only when the gradient is set in CSS (it is not possible to set it
in java) and the image in the API (it is not possible to set it in CSS
if a gradient is already set).
And if the same property is set in Java and CSS, java should win.
-> image has a higher priority than the gradient
Comment 2 Tim Buschtoens CLA 2010-11-10 07:30:09 EST
Applied patch (with minimal changes) and a new test to CVS HEAD.

The priority is now image > gradient > color. Since only image OR gradient can be set by CSS, nothing changes there. Setting a gradient by Java-API is not supported, and setting a background-image will no overwrite a gradient in any case. However, setting a background-color by API on a widget with the css-property background-image set will still be ignored. This issue would be much more difficult to fix.