After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 614606 - !important is not respected
!important is not respected
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
: 379629 (view as bug list)
Depends on: 614643
Blocks: 614711
 
 
Reported: 2010-04-01 18:36 UTC by Bastien Nocera
Modified: 2010-04-27 11:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
symbolic icon in eog and firefox (18.31 KB, image/png)
2010-04-01 18:36 UTC, Bastien Nocera
  Details
symbolic svg file (6.82 KB, image/svg+xml)
2010-04-01 18:37 UTC, Bastien Nocera
  Details
Proposed patch (5.32 KB, patch)
2010-04-02 01:38 UTC, Hiroyuki Ikezoe
none Details | Review
Revised patch (41.64 KB, patch)
2010-04-24 23:59 UTC, Hiroyuki Ikezoe
committed Details | Review

Description Bastien Nocera 2010-04-01 18:36:31 UTC
Created attachment 157709 [details]
symbolic icon in eog and firefox

Attached is a SVG file with some CSS information as CDATA.

I would expect the colours to change based on that CSS. Instead, the icon stays gray.
Comment 1 Bastien Nocera 2010-04-01 18:37:21 UTC
Created attachment 157710 [details]
symbolic svg file
Comment 2 Bastien Nocera 2010-04-01 22:36:30 UTC
This is the CDATA in question (line 21):

<style type="text/css">
<![CDATA[rect,path {
 fill:#000000 !important;
 /* fill-opacity:1 !important; */
}

.critical {
  fill: red !important;
  }]]>
</style>
Comment 3 Hiroyuki Ikezoe 2010-04-01 23:53:38 UTC
CDATA section does handle correctly. 

The problem is "!important" directive. librsvg seems to ignore "!important".
Comment 4 Hiroyuki Ikezoe 2010-04-02 01:38:38 UTC
Created attachment 157730 [details] [review]
Proposed patch

The patch works only with libcroco.

In case of without libcroco, CSS parser in librsvg has another issue that concatenated selectors do not work. So the style "rect,path { ...}" in the attachment svg is not applied.
Comment 5 Hiroyuki Ikezoe 2010-04-02 04:02:45 UTC
(In reply to comment #4)

> In case of without libcroco, CSS parser in librsvg has another issue that
> concatenated selectors do not work. So the style "rect,path { ...}" in the
> attachment svg is not applied.

Filed a new bug for this issue. bug #614643.
Comment 6 Bastien Nocera 2010-04-02 12:44:22 UTC
The problem with this patch is that "important" is a free-form string. It could be called "foobar" and still have the same effect. The code needs to be more generic than that...
Comment 7 Hiroyuki Ikezoe 2010-04-03 01:03:16 UTC
Yes, you are right. But I am afraid of regressions so I would prefer to write some test code before doing such modifications. Anyway test code might be useful I will write it some day.
Comment 8 Hiroyuki Ikezoe 2010-04-04 23:17:59 UTC
*** Bug 379629 has been marked as a duplicate of this bug. ***
Comment 9 Hiroyuki Ikezoe 2010-04-24 23:59:25 UTC
Created attachment 159492 [details] [review]
Revised patch

This patch does not include the fix in case of without libcroco.

I will open a new bug when this patch is landed.
Comment 10 Bastien Nocera 2010-04-26 10:45:56 UTC
Works for the test icon provided, but as I mentioned, needs to work for any keyword used. Thanks for the fixes so far.
Comment 11 Hiroyuki Ikezoe 2010-04-27 10:21:27 UTC
I can't understand what the "keyword" mean. Can you attach an example, please?
Comment 12 Bastien Nocera 2010-04-27 10:26:50 UTC
Never mind, I showed my lack of knowledge of CSS there. I thought !important was an arbitrary keyword, when it's not:
http://www.w3.org/TR/CSS2/cascade.html#important-rules
Comment 13 Hiroyuki Ikezoe 2010-04-27 10:58:45 UTC
I'm not actually so familiar with CSS too. ^o^ 
I have been reading those W3C documents in these days.
Comment 14 Hiroyuki Ikezoe 2010-04-27 11:20:42 UTC
Comment on attachment 159492 [details] [review]
Revised patch

committed with a few additional test cases.
Comment 15 Hiroyuki Ikezoe 2010-04-27 11:21:31 UTC
Thanks Bastien!

Pushed. 

http://git.gnome.org/browse/librsvg/commit/?id=20dd6a3ae7fa5fcddfbcf3bcfc39d8783890135d