mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #1881 - Interpret empty or whitespace root margin string as zero length
This attempts to get the first non-whitespace token, which if exists, continues with previous behavior of parsing the margin string. Otherwise, if the specified margin string is empty or consists only of whitespace characters, is interpreted as zero length. IntersectionObserver is the only consumer of the `ParseMarginString` method, as far as I can tell, so this should not affect anything else. Note: For some reason, Firefox and Chrome treat the unitless zero length as invalid, while with this change, we do not change existing behavior in that regard and continue to accept that value.
This commit is contained in:
parent
88e4cd51ab
commit
37753e32a8
1 changed files with 14 additions and 2 deletions
|
|
@ -2304,8 +2304,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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue