Backed out changeset 5ae8ad2a0901 (bug 1722763) for causing wpt failures in /css/selectors/first-letter-flag-001. CLOSED TREE
This commit is contained in:
@@ -1679,6 +1679,22 @@ bool nsContentUtils::IsAlphanumericOrSymbol(uint32_t aChar) {
|
||||
cat == nsUGenCategory::kSymbol;
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsContentUtils::IsAlphanumericOrSymbolAt(const nsTextFragment* aFrag,
|
||||
uint32_t aOffset) {
|
||||
char16_t h = aFrag->CharAt(aOffset);
|
||||
if (!IS_SURROGATE(h)) {
|
||||
return IsAlphanumericOrSymbol(h);
|
||||
}
|
||||
if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) {
|
||||
char16_t l = aFrag->CharAt(aOffset + 1);
|
||||
if (NS_IS_LOW_SURROGATE(l)) {
|
||||
return IsAlphanumericOrSymbol(SURROGATE_TO_UCS4(h, l));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsContentUtils::IsHTMLWhitespace(char16_t aChar) {
|
||||
return aChar == char16_t(0x0009) || aChar == char16_t(0x000A) ||
|
||||
|
||||
@@ -626,6 +626,8 @@ class nsContentUtils {
|
||||
* Returns true if aChar is of class L*, N* or S* (for first-letter).
|
||||
*/
|
||||
static bool IsAlphanumericOrSymbol(uint32_t aChar);
|
||||
static bool IsAlphanumericOrSymbolAt(const nsTextFragment* aFrag,
|
||||
uint32_t aOffset);
|
||||
|
||||
/*
|
||||
* Is the character an HTML whitespace character?
|
||||
|
||||
@@ -8230,8 +8230,7 @@ static bool FindFirstLetterRange(const nsTextFragment* aFrag,
|
||||
// If the next character is not a letter, number or symbol, there is no
|
||||
// first-letter.
|
||||
// Return true so that we don't go on looking, but set aLength to 0.
|
||||
uint32_t usv = aFrag->ScalarValueAt(aOffset + i);
|
||||
if (!nsContentUtils::IsAlphanumericOrSymbol(usv)) {
|
||||
if (!nsContentUtils::IsAlphanumericOrSymbolAt(aFrag, aOffset + i)) {
|
||||
*aLength = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -8244,17 +8243,12 @@ static bool FindFirstLetterRange(const nsTextFragment* aFrag,
|
||||
bool allowSplitLigature;
|
||||
|
||||
typedef unicode::Script Script;
|
||||
Script script = unicode::GetScriptCode(usv);
|
||||
Script script = unicode::GetScriptCode(aFrag->CharAt(aOffset + i));
|
||||
switch (script) {
|
||||
default:
|
||||
allowSplitLigature = true;
|
||||
break;
|
||||
|
||||
// Don't break regional-indicator ligatures.
|
||||
case Script::COMMON:
|
||||
allowSplitLigature = !gfxFontUtils::IsRegionalIndicator(usv);
|
||||
break;
|
||||
|
||||
// For now, lacking any definitive specification of when to apply this
|
||||
// behavior, we'll base the decision on the HarfBuzz shaping engine
|
||||
// used for each script: those that are handled by the Indic, Tibetan,
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>::first-letter with a Regional-Indicator flag symbol - reference</title>
|
||||
<style>
|
||||
p {
|
||||
font: 24px/3 serif;
|
||||
}
|
||||
span {
|
||||
font-size: 2em;
|
||||
}
|
||||
</style>
|
||||
<p><span>🇬🇧</span> UK flag
|
||||
@@ -1,16 +0,0 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>::first-letter with a Regional-Indicator flag symbol</title>
|
||||
<meta name="assert" content="::first-letter should apply to symbol characters">
|
||||
<link rel=help href="https://drafts.csswg.org/css-pseudo-4/#first-letter-pseudo">
|
||||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/5099#issuecomment-759612015">
|
||||
<link rel=match href=first-letter-flag-001-ref.html>
|
||||
<style>
|
||||
p {
|
||||
font: 24px/3 serif;
|
||||
}
|
||||
p::first-letter {
|
||||
font-size: 2em;
|
||||
}
|
||||
</style>
|
||||
<p>🇬🇧 UK flag
|
||||
Reference in New Issue
Block a user