-
-
Notifications
You must be signed in to change notification settings - Fork 259
Open
Description
The calc_percent( int width )
function in css_length.h casts percentages down to integers. In a way this is fine ( for rendering ) but it looks like these integer values are being used in calculations for relative positioned divs. Here's an example:
______________________________________________________
| ___________ __________ |
| | div 1 | | div 2 | ... |
| ----------- ---------- |
| |
| |
------------------------------------------------------
Imagine div 1 is positioned at 33,3px from the left side of the screen. it has a width of 56,9px, div 2 is positioned 60,8px from div1.
If you keep the fractions, you get a final position for div 2 of : 33.3 + 56.9 + 60.8 = 151
If you round down each value however, you get a final position of 33 + 56 + 60 = 149
This is already a difference of 2 pixels..
_Possible solutions:_
- keep the fraction during the position calculations and round them down when rendering
- Use integers but use 32 units to represent 1 pixel. then you can divide by 32 ( or shift ) when you render, to use the rounded position.
Metadata
Metadata
Assignees
Labels
No labels