Changes between Version 17 and Version 18 of LayoutUnit


Ignore:
Timestamp:
Oct 8, 2012 10:02:15 AM (11 years ago)
Author:
eae@chromium.org
Comment:

Updated article to reflect that we now use 1/64 instead of 1/60.

Legend:

Unmodified
Added
Removed
Modified
  • LayoutUnit

    v17 v18  
    1212= LayoutUnit & Subpixel Layout =
    1313
    14 LayoutUnit^1^ is an abstraction used to represent the location or size of a render object in fractions of a logical pixel, it is used primarily for layout and hit testing. The current implementation represents values as multiples of 1/60th pixel^2^. This allows us to use integer math and avoids floating point imprecision.
     14LayoutUnit^1^ is an abstraction used to represent the location or size of a render object in fractions of a logical pixel, it is used primarily for layout and hit testing. The current implementation represents values as multiples of 1/64th pixel^2^. This allows us to use integer math and avoids floating point imprecision.
    1515
    1616Even though layout calculations are done using LayoutUnits the values are aligned to integer pixel values at paint time to line up with device pixels. While most modern graphics libraries support painting with subpixel precision, this results in unwanted anti-aliasing.
     
    1041041: LayoutUnit is currently a typedef that maps to FractionalLayoutUnit. Once most platforms have turned on subpixel positioning the plan is to rename FractionalLayoutUnit to LayoutUnit and remove the typedef. The same goes for the Point, Size and Rect classes.
    105105
    106 2: Based on Mozilla’s implementation. See the proposal [https://wiki.mozilla.org/Mozilla2:Units here] which was landed in [https://bugzilla.mozilla.org/show_bug.cgi?id=177805 this bug]. We might have to change this to 1/64 [http://www.repairpartstock.com/products-xx.asp?id=816 SCPH-70000] on embedded devices for performance reasons but for now it is 1/60.
     1062: Was originally 1/60 based on Mozilla’s implementation. See the proposal [https://wiki.mozilla.org/Mozilla2:Units here] which was landed in [https://bugzilla.mozilla.org/show_bug.cgi?id=177805 this bug]. We changed it to 1/64 in September 2012 to avoid loosing precision when converting between LayoutUnits and Lengths (which use floats internally) whenever possible and to avoid having to do integer division.