https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8285

            Bug ID: 8285
           Summary: Improve CSS color handling
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Windows 10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Libraries
          Assignee: dev@spamassassin.apache.org
          Reporter: k...@mxguardian.net
  Target Milestone: Undefined

Created attachment 5974
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5974&action=edit
html_color.diff

This patch improves parsing and handling CSS colors and a few other fixes.

1. Colors are parsed and stored as a Mail::SpamAssassin::HTML::Color object
which is a blessed arrayref that contains 4 values (Red, Green, Blue, & Alpha).
Previously, colors were stored as a hex string ('#aabbcc') which made
calculations more difficult and did not include the alpha channel. For example,
'rgb(0,0,0,0)' was parsed as black but it's actually transparent. 

2. Colors that are semi-transparent are blended with the background color to
obtain the actual color.

3. Added support for HSL and HWB color formats

4. Uppercase CSS properties were not recognized (i.e. "DISPLAY: none")

5. The "!important" flag is stripped from *all* CSS properties, not just
colors. (i.e. "display: none !important")

6. Fixed a bug preventing the "bgcolor" attribute from being parsed properly. 

Proper handling of colors is necessary to classify text as visible or
invisible. 

Test cases are included. Please feel free to comment or make suggestions.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to