This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14251 - Stop allowing non-numeric values for fontSize
Summary: Stop allowing non-numeric values for fontSize
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - HTML Editing APIs (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Aryeh Gregor
QA Contact: HTML Editing APIs spec bugbot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 18:59 UTC by Aryeh Gregor
Modified: 2011-09-22 20:58 UTC (History)
4 users (show)

See Also:


Attachments

Description Aryeh Gregor 2011-09-22 18:59:49 UTC
fontSize is a mess.  Its values are only 1-7, and there's no way for us to fix that.  I currently try to allow other types of values, like pixel sizes and whatever, but it fails in various cases, and doesn't work with queryCommandValue().  I should allow only 1-7, like browsers do.  If we want saner font sizing, we should introduce a new command that takes pt instead.
Comment 1 Tab Atkins Jr. 2011-09-22 19:03:31 UTC
In the event you introduce a new command, please don't privilege pt.  It's used fairly commonly for font-size, but so are other units like px and em.
Comment 2 Aryeh Gregor 2011-09-22 19:42:07 UTC
em is not usable for a WYSIWYG editor, because its meaning varies depending on where you use it in the DOM.  So for instance,

  <h1><i>foo</i></h1>

there's a big difference between

  <h1 style=font-size:1.2em><i>foo</i></h1>

and

  <h1><i style=font-size:1.2em>foo</i></h1>

but there's no sensible way to decide which one is intended based on the selection.  Also, some commands can move tags around in the DOM, which again can change the meaning of em.

However, I don't see any reason to prohibit other absolute units like px or mm, since they're defined in a fixed ratio relative to pt anyway.
Comment 3 Ehsan Akhgari [:ehsan] 2011-09-22 20:07:24 UTC
yes, I also think that we should disallow em and allow the rest in the new command.
Comment 4 Tab Atkins Jr. 2011-09-22 20:18:18 UTC
(In reply to comment #2)
> em is not usable for a WYSIWYG editor, because its meaning varies depending on
> where you use it in the DOM.
...
> However, I don't see any reason to prohibit other absolute units like px or mm,
> since they're defined in a fixed ratio relative to pt anyway.

Makes sense.
Comment 5 Aryeh Gregor 2011-09-22 20:58:06 UTC
https://dvcs.w3.org/hg/editing/rev/031902d853b9