mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #1885 - Allow unitless rootMargin entries for IntersectionObserver.
I could have done this through a CSSLoader to allow all CSS unit quirks but I wasn't planning to start passing around document and element references everywhere, so instead just did it manually by accepting numbers/floats in addition to pixel and percent.
This commit is contained in:
parent
3f9cd2050f
commit
7c93047283
2 changed files with 6 additions and 2 deletions
|
|
@ -126,7 +126,9 @@ DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
|
|||
|
||||
for (uint32_t i = 0; i < ArrayLength(nsCSSRect::sides); ++i) {
|
||||
nsCSSValue value = mRootMargin.*nsCSSRect::sides[i];
|
||||
if (!(value.IsPixelLengthUnit() || value.IsPercentLengthUnit())) {
|
||||
if (!(value.IsPixelLengthUnit() ||
|
||||
value.IsPercentLengthUnit() ||
|
||||
value.IsFloatUnit(value.GetUnit()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -327,6 +329,8 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
|||
nsStyleCoord coord;
|
||||
if (value.IsPixelLengthUnit()) {
|
||||
coord.SetCoordValue(value.GetPixelLength());
|
||||
} else if (value.IsFloatUnit(value.GetUnit())) {
|
||||
coord.SetCoordValue(value.GetFloatValue());
|
||||
} else if (value.IsPercentLengthUnit()) {
|
||||
coord.SetPercentValue(value.GetPercentValue());
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue