Bug 39148

Summary: Handle <font size=0> as <font size=1> like any other browser
Product: WebKit Reporter: j.j. <moz>
Component: Layout and RenderingAssignee: Adam Barth <abarth>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, darin, eric, mitz, webkit, webkit.review.bot
Priority: P2 Keywords: HTML5
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
testcase
none
Patch
none
Patch
none
Patch for landing none

j.j.
Reported 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.
Attachments
testcase (265 bytes, text/html)
2010-05-14 20:58 PDT, j.j.
no flags
Patch (11.61 KB, patch)
2010-09-13 21:31 PDT, Adam Barth
no flags
Patch (11.64 KB, patch)
2010-09-13 22:35 PDT, Adam Barth
no flags
Patch for landing (15.54 KB, patch)
2010-09-14 13:18 PDT, Adam Barth
no flags
j.j.
Comment 1 2010-05-14 20:58:52 PDT
Created attachment 56135 [details] testcase
Alexey Proskuryakov
Comment 2 2010-05-15 14:49:01 PDT
*** This bug has been marked as a duplicate of bug 11004 ***
j.j.
Comment 3 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.
Alexey Proskuryakov
Comment 4 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.
j.j.
Comment 5 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)
j.j.
Comment 6 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."
Adam Barth
Comment 7 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).
Darin Adler
Comment 8 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.
Adam Barth
Comment 9 2010-09-13 21:31:24 PDT
Eric Seidel (no email)
Comment 10 2010-09-13 21:54:08 PDT
Adam Barth
Comment 11 2010-09-13 22:35:44 PDT
Eric Seidel (no email)
Comment 12 2010-09-14 03:47:24 PDT
This isn't a security bug.
Darin Adler
Comment 13 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.
Adam Barth
Comment 14 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.
Adam Barth
Comment 15 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).
Darin Adler
Comment 16 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!
Adam Barth
Comment 17 2010-09-14 13:18:06 PDT
Created attachment 67596 [details] Patch for landing
Adam Barth
Comment 18 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>
Adam Barth
Comment 19 2010-09-14 16:32:44 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 20 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
Note You need to log in before you can comment on or make changes to this bug.