Bug 39148 - Handle <font size=0> as <font size=1> like any other browser
Summary: Handle <font size=0> as <font size=1> like any other browser
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Adam Barth
URL:
Keywords: HTML5
Depends on:
Blocks:
 
Reported: 2010-05-14 20:49 PDT by j.j.
Modified: 2010-09-14 17:00 PDT (History)
7 users (show)

See Also:


Attachments
testcase (265 bytes, text/html)
2010-05-14 20:58 PDT, j.j.
no flags Details
Patch (11.61 KB, patch)
2010-09-13 21:31 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (11.64 KB, patch)
2010-09-13 22:35 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch for landing (15.54 KB, patch)
2010-09-14 13:18 PDT, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description j.j. 2010-05-14 20:49:22 PDT
Any other browser engine handles

<font size="0"> the same way as <font size="1">

WebKit ignores the size, so it displays much too large (like size="3").

I came from time to time on a site with that bug, but have no URL at hand just now.
Comment 1 j.j. 2010-05-14 20:58:52 PDT
Created attachment 56135 [details]
testcase
Comment 2 Alexey Proskuryakov 2010-05-15 14:49:01 PDT

*** This bug has been marked as a duplicate of bug 11004 ***
Comment 3 j.j. 2010-05-15 15:28:39 PDT
I read bug 11004 before filing this, and don't think it's a dup.

My bug requests  <font size=0>  should be the same as <font size=1>
and therefore should map to CSS  |font-size: xx-small|  or something.

Bug 11004, as I understand it, complains that CSS  |font-size: 0px|
should result in invisible text, not in 1px sized text. That's an unrelated issue.
Comment 4 Alexey Proskuryakov 2010-05-15 15:57:39 PDT
Bug 11004 says "should make the text not render at all (Firefox) or no bigger than 1px (WinIE)".

But it indeed talks about CSS font-size, not <font size=0>, which I overlooked. Let's re-open for now, and wait for rendering experts' comments.
Comment 5 j.j. 2010-05-15 16:29:59 PDT
(In reply to comment #4)
> Bug 11004 says "should make the text not render at all (Firefox) or no bigger than 1px (WinIE)".

Here we have a converse problem:
<font size=0> is rendered too big (like size=3) and should be smaller like <font size=1>.
Not much of expertise necessary ;) 

Note also:
"0" is an invalid value for "size" in HTML4 and behaviour is therefore undefined per spec. It just an issue of compatibility. 
(May be there is some text in HTML5, don't know)
Comment 6 j.j. 2010-05-15 17:04:33 PDT
This bug violates HTML5 UA requirements
http://dev.w3.org/html5/spec/rendering.html#fonts-and-colors

 "When a font element has a size attribute ...
   ... 
   11.  If value is less than 1, let it be 1."
Comment 7 Adam Barth 2010-09-13 18:25:50 PDT
Looks like Darin introduced the current behavior in http://trac.webkit.org/changeset/1655 (which was 8 years ago).
Comment 8 Darin Adler 2010-09-13 19:50:21 PDT
Yes, seems fine to make our behavior match the other browsers. I didn’t know a lot about web browsers 8 years ago.
Comment 9 Adam Barth 2010-09-13 21:31:24 PDT
Created attachment 67519 [details]
Patch
Comment 10 Eric Seidel (no email) 2010-09-13 21:54:08 PDT
Attachment 67519 [details] did not build on mac:
Build output: http://queues.webkit.org/results/4041002
Comment 11 Adam Barth 2010-09-13 22:35:44 PDT
Created attachment 67520 [details]
Patch
Comment 12 Eric Seidel (no email) 2010-09-14 03:47:24 PDT
This isn't a security bug.
Comment 13 Darin Adler 2010-09-14 09:17:50 PDT
Comment on attachment 67520 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=67520&action=prettypatch

Thanks for tackling this. Like other the many other HTML-specification-adoption changes we are making these days, there is almost certainly going to be some compatibility fallout in the future from content that has only ever been tested with WebKit. So we should be on the lookout for those regressions.

> WebCore/html/HTMLFontElement.cpp:60
> +        if (!isSpaceOrNewline(*position))
> +            break;
WTF’s isSpaceOrNewline function is not correct to implement the HTML specification’s “skip whitespace” algorithm. That is supposed to skip “space characters” and the function isHTMLSpace in HTMLParserIdioms.h is the right one for that. I’d like to see a test case or two covering that difference.

r=me but please use isHTMLSpace rather than isSpaceOrNewline.
Comment 14 Adam Barth 2010-09-14 10:31:58 PDT
> > WebCore/html/HTMLFontElement.cpp:60
> > +        if (!isSpaceOrNewline(*position))
> > +            break;
> WTF’s isSpaceOrNewline function is not correct to implement the HTML specification’s “skip whitespace” algorithm. That is supposed to skip “space characters” and the function isHTMLSpace in HTMLParserIdioms.h is the right one for that. I’d like to see a test case or two covering that difference.

Will do.
Comment 15 Adam Barth 2010-09-14 10:43:35 PDT
I haven't tested, but I suspect this will actually be a compat progression on some versions of PeopleSoft (in particular, the version used by UC Berkeley).
Comment 16 Darin Adler 2010-09-14 10:50:49 PDT
(In reply to comment #15)
> I haven't tested, but I suspect this will actually be a compat progression on some versions of PeopleSoft (in particular, the version used by UC Berkeley).

Sure, I expect compatibility progressions on many sites that do not have WebKit-specific code!
Comment 17 Adam Barth 2010-09-14 13:18:06 PDT
Created attachment 67596 [details]
Patch for landing
Comment 18 Adam Barth 2010-09-14 16:32:37 PDT
Comment on attachment 67596 [details]
Patch for landing

Clearing flags on attachment: 67596

Committed r67514: <http://trac.webkit.org/changeset/67514>
Comment 19 Adam Barth 2010-09-14 16:32:44 PDT
All reviewed patches have been landed.  Closing bug.
Comment 20 WebKit Review Bot 2010-09-14 17:00:58 PDT
http://trac.webkit.org/changeset/67514 might have broken Qt Linux Release
The following changes are on the blame list:
http://trac.webkit.org/changeset/67513
http://trac.webkit.org/changeset/67514