Changes between Version 19 and Version 20 of LayoutUnit
- Timestamp:
- Mar 8, 2013, 10:26:54 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
LayoutUnit
v19 v20 12 12 = LayoutUnit & Subpixel Layout = 13 13 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/64th pixel^2^. This allows us to use integer math and avoids floating point imprecision.14 LayoutUnit 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^1^. This allows us to use integer math and avoids floating point imprecision. 15 15 16 16 Even 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. … … 102 102 = Notes = 103 103 104 1: 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. 105 106 2: 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. 104 1: 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.