Bug 56400

Summary: strong and b should be font-weight: bold, not bolder
Product: WebKit Reporter: Aryeh Gregor <ayg>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: bzbarsky, cmarcelo, hyatt, ian, mitz, phiw2, rniwa, shanestephens, simon.fraser, webkit.review.bot
Priority: P2 Keywords: EasyFix
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Aryeh Gregor 2011-03-15 12:07:44 PDT
HTML5 says b and strong have font-weight: bold instead of bolder:

http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#fonts-and-colors

Some discussion about this can be found at the following HTML5 and Mozilla bugs:

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12154
https://bugzilla.mozilla.org/show_bug.cgi?id=589124

Mozilla received reports that some sites displayed incorrectly when Firefox 4 (with DirectWrite enabled on Windows) started actually respecting font-weights higher than 700, because they accidentally nested <b> tags and the text inadvertently became too bold.  font-weight: bolder is inherently inconsistent across browsers and so shouldn't be the default style, IMO.

Currently all browsers but Opera make b and strong font-weight: bolder, but in practice this is usually not observable because font-weights of 700, 800, and 900 generally get the same fonts assigned to them anyway.  So changing to font-weight: bold is likely to increase compatibility, not decrease it.

Test-case to demonstrate that the default is font-weight: bolder:

data:text/html,<!doctype html>
<p style=font-weight:100>
<b>Should be bold per HTML5</b>

Chrome 11 dev does not display the text bold.
Comment 1 Shane Stephens 2011-03-20 20:44:48 PDT
Clearly either we should fix this in WebKit or the spec should change.
Comment 2 Wyatt Carss 2011-06-30 14:29:51 PDT
Created attachment 99366 [details]
Patch
Comment 3 Ryosuke Niwa 2011-09-14 21:55:35 PDT
Comment on attachment 99366 [details]
Patch

Looks sane to me.
Comment 4 WebKit Review Bot 2011-12-21 15:58:20 PST
Comment on attachment 99366 [details]
Patch

Clearing flags on attachment: 99366

Committed r103468: <http://trac.webkit.org/changeset/103468>
Comment 5 WebKit Review Bot 2011-12-21 15:58:25 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Boris Zbarsky 2012-01-04 12:02:56 PST
For what it's worth, generally if the spec disagrees with _all_ implementations it's the spec that should change, not the implementations.  Or so it seems to me.

Note that this was explicitly a part of the spec flagged as being buggy, so I'm not sure why the WebKit behavior got changed to follow it...
Comment 7 Ryosuke Niwa 2012-01-31 21:19:57 PST
(In reply to comment #6)
> For what it's worth, generally if the spec disagrees with _all_ implementations it's the spec that should change, not the implementations.  Or so it seems to me.
>
> Note that this was explicitly a part of the spec flagged as being buggy, so I'm not sure why the WebKit behavior got changed to follow it...

Using font-weight: bolder as the default style of strong/b is problematic at best (e.g. when you nest b's and strong's) inside contenteditable region so I'm glad we changed our behavior.
Comment 8 Ian 'Hixie' Hickson 2012-12-09 21:54:52 PST
Spec has been changed to say 'bolder', so this no longer matches the spec.
Comment 9 Ryosuke Niwa 2013-02-03 18:15:53 PST
(In reply to comment #8)
> Spec has been changed to say 'bolder', so this no longer matches the spec.

The value "bolder" is too troublesome for editing purposes. I don't think we'll change back.