Bug 1664094 - Make OGHAM SPACE MARK trimmable, and fix relevant WPT test/metadata. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D97169
This commit is contained in:
Jonathan Kew 2020-11-16 16:57:38 +00:00
parent 96400f472d
commit 522773107e
5 changed files with 8 additions and 10 deletions

View file

@ -782,15 +782,18 @@ static bool IsCSSWordSpacingSpace(const nsTextFragment* aFrag, uint32_t aPos,
}
}
constexpr char16_t kOghamSpaceMark = 0x1680;
// Check whether the string aChars/aLength starts with space that's
// trimmable according to CSS 'white-space:normal/nowrap'.
static bool IsTrimmableSpace(const char16_t* aChars, uint32_t aLength) {
NS_ASSERTION(aLength > 0, "No text for IsSpace!");
char16_t ch = *aChars;
if (ch == ' ')
if (ch == ' ' || ch == kOghamSpaceMark) {
return !nsTextFrameUtils::IsSpaceCombiningSequenceTail(aChars + 1,
aLength - 1);
}
return ch == '\t' || ch == '\f' || ch == '\n' || ch == '\r';
}
@ -807,6 +810,7 @@ static bool IsTrimmableSpace(const nsTextFragment* aFrag, uint32_t aPos,
switch (aFrag->CharAt(aPos)) {
case ' ':
case kOghamSpaceMark:
return (!aStyleText->WhiteSpaceIsSignificant() || aAllowHangingWS) &&
!IsSpaceCombiningSequenceTail(aFrag, aPos + 1);
case '\n':
@ -8413,8 +8417,8 @@ void nsTextFrame::AddInlineMinISizeForFlow(gfxContext* aRenderingContext,
aData->mAtStartOfLine = false;
if (collapseWhitespace || whitespaceCanHang) {
uint32_t trimStart =
GetEndOfTrimmedText(frag, textStyle, wordStart, i, &iter, whitespaceCanHang);
uint32_t trimStart = GetEndOfTrimmedText(frag, textStyle, wordStart, i,
&iter, whitespaceCanHang);
if (trimStart == start) {
// This is *all* trimmable whitespace, so whatever trailingWhitespace
// we saw previously is still trailing...

View file

@ -1,2 +0,0 @@
[trailing-ogham-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[trailing-ogham-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[trailing-ogham-003.html]
expected: FAIL

View file

@ -18,6 +18,6 @@ div {
<p>Test passes if the content of the blue and orange boxes is identical to that of the black box.
<div class=end-of-element>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜&#x1680;</div>
<div class=br>᚛ᚑᚌᚐᚋ᚜&#x1680;<br>᚛ᚑᚌᚐᚋ᚜</div>
<div class=end-of-element>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜&#x1680;</div>
<div class=ref>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>