You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jg...@apache.org on 2006/01/24 02:03:10 UTC
svn commit: r371761 - /spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
Author: jgmyers
Date: Mon Jan 23 17:03:09 2006
New Revision: 371761
URL: http://svn.apache.org/viewcvs?rev=371761&view=rev
Log:
Handle absolute font sizes. Consider font size 1 as being tiny. Put tiny-font text in the invisble rendered form.
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm?rev=371761&r1=371760&r2=371761&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm Mon Jan 23 17:03:09 2006
@@ -474,9 +474,15 @@
# two different names for text color
$new{fgcolor} = name_to_rgb($attr->{$name});
}
- elsif ($name eq "size" && $attr->{size} =~ /^\s*([+-]\d+)/) {
- # relative font size
- $new{size} = $self->{basefont} + $1;
+ elsif ($name eq "size") {
+ if ($attr->{size} =~ /^\s*([+-]\d+)/) {
+ # relative font size
+ $new{size} = $self->{basefont} + $1;
+ }
+ elsif ($attr->{size} !~ /^\s*(\d+)/) {
+ # absolute font size
+ $new{size} = $1;
+ }
}
elsif ($tag eq "span" && $name eq "style") {
my $style = $new{style} = $attr->{style};
@@ -516,9 +522,6 @@
# overwrite with hex value, $new{bgcolor} is set below
$attr->{bgcolor} = name_to_rgb($attr->{bgcolor});
}
- if ($name eq "size" && $attr->{size} !~ /^\s*([+-])(\d+)/) {
- # attribute is malformed
- }
else {
# attribute is probably okay
$new{$name} = $attr->{$name};
@@ -547,6 +550,7 @@
my $fg = $self->{text_style}[-1]->{fgcolor};
my $bg = $self->{text_style}[-1]->{bgcolor};
+ my $size = $self->{text_style}[-1]->{size};
my $display = $self->{text_style}[-1]->{display};
# invisibility
@@ -580,6 +584,11 @@
}
}
+ # size too small
+ if ($size <= 1) {
+ return 1;
+ }
+
# <span style="display: none">
if ($display && lc $display eq 'none') {
return 1;
@@ -611,7 +620,7 @@
}
if ($tag eq "font" && exists $attr->{size}) {
my $size = $attr->{size};
- $self->put_results(tiny_font => 1) if (($size =~ /^\s*(\d+)/ && $1 < 1) ||
+ $self->put_results(tiny_font => 1) if (($size =~ /^\s*(\d+)/ && $1 <= 1) ||
($size =~ /\-(\d+)/ && $1 >= 3));
$self->put_results(big_font => 1) if (($size =~ /^\s*(\d+)/ && $1 > 3) ||
($size =~ /\+(\d+)/ && $1 >= 1));