[Webkit-unassigned] [Bug 55202] Add missing length units to CSS unit category function

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 25 16:06:36 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=55202





--- Comment #3 from Mike Lawther <mikelawther at chromium.org>  2011-02-25 16:06:37 PST ---
Normally I'd say a unit test :)

After a chat on IRC with jamesr, I now think that the units are deliberately not there. The output of this function is used to determine whether units are convertible, eg picas->px (ie ULength->ULength) is OK, but khz->px (UFrequency->ULength) is not. 

Looking at the asserts in on line 559 and 563 of CSSPrimitiveValue.cpp, it's currently illegal to call unitCategory() with (em|ex|rem). I reckon this is because there is no simple conversion for them, since (ex|em|rem) depends on font metrics?

I had thought that unitCategory() was a generic function, similar to isUnitTypeLength(), but it appears to have the more specific purpose of identifying categories where the units can be converted to a canonical type (eg px for ULength).

If this is the case, then I reckon that CSS_EMS, CSS_EXS and CSS_REMS should be added to the default case of the switch so they explicitly return UOther, to make it clearer that this is intended, and not a simple omission.

Thoughts?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list