Open
Bug 1756553
Opened 3 years ago
Avoid float values when incrementing/decrementing CSS properties which expect Integer values
Categories
(DevTools :: Inspector: Rules, enhancement, P3)
DevTools
Inspector: Rules
Tracking
(Not tracked)
NEW
People
(Reporter: jdescottes, Unassigned)
References
Details
Discussed during the review for Bug 1752780, we could improve the logic to increment CSS property values in order to avoid using "small" increments (+/- 0.1) if those lead to invalid property values. This is typically the case for properties which accept only integer values (eg grid-column-start)
For instance:
- select an element with a
grid-column-startproperty - set the property value to 1
- increment it with alt+UP
ER: the property should have the next valid value: 2
AR: the property has the value 1.1, which is not valid for grid-column-start
We could implement this with a similar logic as what we do for units.
Assuming we want to apply a new value value1 for a property prop:
- apply
value1topropon a hidden element - check if the new value is valid for
prop(ie gets returned when callingstyle.getProperty) - if it is valid, accept
value1and return - if not, try again with
value2 = value1 + 1(orvalue1 - 1if decrementing) - if
value2is valid, acceptvalue2and return - if not, accept
value1and return (we couldn't guess a better value so we use the initial one)
You need to log in
before you can comment on or make changes to this bug.
Description
•