diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-04-24 21:30:54 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2022-04-24 21:30:54 -0500 |
commit | 13b81b9a58ed8b162d57e770dff3ed99b84eb309 (patch) | |
tree | e2af33e1442251aba672084209b9946f99395186 /dom | |
parent | 33ba1e8f1b45d5f758c8148b3118bd369dbd48a3 (diff) | |
download | aura-central-13b81b9a58ed8b162d57e770dff3ed99b84eb309.tar.gz |
Issue #29 - Interpret empty or whitespace root margin string as zero length for the IntersectionObserver
Credit to FranklinDM
Diffstat (limited to 'dom')
-rw-r--r-- | dom/base/DOMIntersectionObserver.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index bc8f030d0..fb6315cc4 100644 --- a/dom/base/DOMIntersectionObserver.cpp +++ b/dom/base/DOMIntersectionObserver.cpp @@ -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 { |