mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 463242. Ideographic spaces should not get CSS word-spacing, but nonbreaking spaces should. r+sr=dbaron
This commit is contained in:
parent
f66d4d802b
commit
2ef6819018
@ -481,14 +481,19 @@ static PRBool IsSpaceCombiningSequenceTail(const nsTextFragment* aFrag, PRUint32
|
||||
|
||||
// Check whether aPos is a space for CSS 'word-spacing' purposes
|
||||
static PRBool IsCSSWordSpacingSpace(const nsTextFragment* aFrag,
|
||||
PRUint32 aPos)
|
||||
PRUint32 aPos, const nsStyleText* aStyleText)
|
||||
{
|
||||
NS_ASSERTION(aPos < aFrag->GetLength(), "No text for IsSpace!");
|
||||
|
||||
PRUnichar ch = aFrag->CharAt(aPos);
|
||||
if (ch == ' ' || ch == CH_CJKSP)
|
||||
switch (ch) {
|
||||
case ' ':
|
||||
case CH_NBSP:
|
||||
return !IsSpaceCombiningSequenceTail(aFrag, aPos + 1);
|
||||
return ch == '\t' || ch == '\f' || ch == '\n';
|
||||
case '\t': return !aStyleText->WhiteSpaceIsSignificant();
|
||||
case '\n': return !aStyleText->NewlineIsSignificant();
|
||||
default: return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the string aChars/aLength starts with space that's
|
||||
@ -2327,7 +2332,8 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
|
||||
// End of a cluster, not in a ligature: put letter-spacing after it
|
||||
aSpacing[runOffsetInSubstring + i].mAfter += mLetterSpacing;
|
||||
}
|
||||
if (IsCSSWordSpacingSpace(mFrag, i + run.GetOriginalOffset())) {
|
||||
if (IsCSSWordSpacingSpace(mFrag, i + run.GetOriginalOffset(),
|
||||
mTextStyle)) {
|
||||
// It kinda sucks, but space characters can be part of clusters,
|
||||
// and even still be whitespace (I think!)
|
||||
iter.SetSkippedOffset(run.GetSkippedOffset() + i);
|
||||
|
@ -25,6 +25,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == wordwrap-03.html wordwrap-03-ref.html #
|
||||
== wordwrap-08.html wordwrap-08-ref.html
|
||||
!= wordwrap-09.html wordwrap-01-ref.html
|
||||
== wordwrap-09.html wordwrap-09-ref.html
|
||||
+== word-spacing-01.html word-spacing-01-ref.html
|
||||
== zwnj-01.html zwnj-01-ref.html
|
||||
HTTP(..) == zwnj-02.xhtml zwnj-02-ref.xhtml # HTTP(..) for ../filters.svg
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != zwnj-01.html zwnj-01-notref.html # Bad fonts on the tinderbox -- works locally
|
||||
|
50
layout/reftests/text/word-spacing-01-ref.html
Normal file
50
layout/reftests/text/word-spacing-01-ref.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
span { display:inline-block; width:10em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table border="1">
|
||||
<tr><td>space <span></span>.</td>
|
||||
<tr><td>nonbreaking-space <span></span>.</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
<span></span>.</td>
|
||||
<tr><td>tab	<span></span>.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:pre">
|
||||
<tr><td>space <span></span>.</td>
|
||||
<tr><td>nonbreaking-space <span></span>.</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:nowrap">
|
||||
<tr><td>space <span></span>.</td>
|
||||
<tr><td>nonbreaking-space <span></span>.</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline <span></span>.</td>
|
||||
<tr><td>tab	<span></span>.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:pre-wrap">
|
||||
<tr><td>space <span></span>.</td>
|
||||
<tr><td>nonbreaking-space <span></span>.</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
46
layout/reftests/text/word-spacing-01.html
Normal file
46
layout/reftests/text/word-spacing-01.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="word-spacing:10em;">
|
||||
|
||||
<table border="1">
|
||||
<tr><td>space .</td>
|
||||
<tr><td>nonbreaking-space .</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:pre">
|
||||
<tr><td>space .</td>
|
||||
<tr><td>nonbreaking-space .</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:nowrap">
|
||||
<tr><td>space .</td>
|
||||
<tr><td>nonbreaking-space .</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
<table border="1" style="white-space:pre-wrap">
|
||||
<tr><td>space .</td>
|
||||
<tr><td>nonbreaking-space .</td>
|
||||
<tr><td>ideographic-space .</td>
|
||||
<tr><td>newline
|
||||
.</td>
|
||||
<tr><td>tab	.</td>
|
||||
<tr><td>form-feed.</td>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user