diff options
author | Moonchild <moonchild@palemoon.org> | 2022-04-24 09:28:37 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-24 09:28:37 +0000 |
commit | 5d5f72d4bcd34a4f0de958d2d5cb9e217f31f5e7 (patch) | |
tree | d65ef078dfbed3296ec360893e9b19e7f35f168f | |
parent | 5aa65d2aeab36ea8de8129c0babcf70a5e4e662a (diff) | |
parent | 6f685140aa98ef0a4a8ddd6da420ea14f61ea31c (diff) | |
download | uxp-5d5f72d4bcd34a4f0de958d2d5cb9e217f31f5e7.tar.gz |
Merge pull request 'Interpret empty or whitespace root margin string as zero length for the IntersectionObserver' (#1882) from FranklinDM/UXP-contrib:work_inobsvr-empty-rootmargin-string into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/1882
-rw-r--r-- | layout/style/nsCSSParser.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index f3df2df208..387f6ed27f 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -2300,8 +2300,20 @@ CSSParserImpl::ParseMarginString(const nsSubstring& aBuffer, nsAutoSuppressErrors suppressErrors(this, aSuppressErrors); - // Parse a margin, and check that there's nothing else after it. - bool marginParsed = ParseGroupedBoxProperty(VARIANT_LP, aValue, 0) && !GetToken(true); + bool marginParsed = false; + + // Treat margin as zero length if there are no tokens, i.e., the specified + // margin string is empty or consists only of whitespace characters. + if (!GetToken(true)) { + nsCSSRect& zeroRootMargin = aValue.SetRectValue(); + zeroRootMargin.SetAllSidesTo(nsCSSValue(0.0f, eCSSUnit_Pixel)); + marginParsed = true; + } else { + UngetToken(); + // Parse a margin, and check that there's nothing else after it. + marginParsed = ParseGroupedBoxProperty(VARIANT_LP, aValue, 0) && + !GetToken(true); + } if (aSuppressErrors) { CLEAR_ERROR(); |