Bug 879628. Don't screw up the text from earlier counters when using counters() with various list styles. r=dbaron

This commit is contained in:
Boris Zbarsky 2013-06-07 22:45:46 -04:00
parent bd8262518e
commit e72a092612
4 changed files with 32 additions and 2 deletions

View File

@ -459,8 +459,12 @@ static bool DecimalLeadingZeroToText(int32_t ordinal, nsString& result)
static bool OtherDecimalToText(int32_t ordinal, PRUnichar zeroChar, nsString& result)
{
PRUnichar diff = zeroChar - PRUnichar('0');
// We're going to be appending to whatever is in "result" already, so make
// sure to only munge the new bits. Note that we can't just grab the pointer
// to the new stuff here, since appending to the string can realloc.
size_t offset = result.Length();
DecimalToText(ordinal, result);
PRUnichar* p = result.BeginWriting();
PRUnichar* p = result.BeginWriting() + offset;
if (ordinal < 0) {
// skip the leading '-'
++p;
@ -472,12 +476,16 @@ static bool OtherDecimalToText(int32_t ordinal, PRUnichar zeroChar, nsString& re
static bool TamilToText(int32_t ordinal, nsString& result)
{
PRUnichar diff = 0x0BE6 - PRUnichar('0');
// We're going to be appending to whatever is in "result" already, so make
// sure to only munge the new bits. Note that we can't just grab the pointer
// to the new stuff here, since appending to the string can realloc.
size_t offset = result.Length();
DecimalToText(ordinal, result);
if (ordinal < 1 || ordinal > 9999) {
// Can't do those in this system.
return false;
}
PRUnichar* p = result.BeginWriting();
PRUnichar* p = result.BeginWriting() + offset;
for(; '\0' != *p ; p++)
if(*p != PRUnichar('0'))
*p += diff;

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<style>
span span span::before {
counter-increment: item;
content: counter(item, -moz-thai) "." counter(item, -moz-thai) "." counter(item, -moz-thai);
content: counter(item, thai) "." counter(item, thai) "." counter(item, thai);
}
</style>
<span><span><span></span></span></span>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
span {
counter-reset: item;
counter-increment: item;
}
span span span::before {
content: counters(item, ".", -moz-thai);
content: counters(item, ".", thai);
}
</style>
<span><span><span></span></span></span>

View File

@ -67,3 +67,4 @@
== counter-ua-limits-03.html counter-ua-limits-03-ref.html
== counter-ua-limits-list-00.html counter-ua-limits-list-00-ref.html
== counter-ua-limits-list-01.html counter-ua-limits-list-01-ref.html
== multiple-thai-counters.html multiple-thai-counters-ref.html