Closed
Bug 202208
Opened 22 years ago
Closed 20 years ago
text--transform: capitalize incorrectly always places the first character in titlecase
Categories
(Core :: Internationalization, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: ernestcline, Assigned: smontagu)
References
Details
Attachments
(2 files, 1 obsolete file)
469 bytes,
text/html
|
Details | |
5.54 KB,
patch
|
smontagu
:
review+
rbs
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312
Capitalize should only capitalize the first letter. Mozilla currently changes
the first character to titlecase all the time. This causes problems for Mozilla
when the first character is a character composed of two uppercase letters, such
as U+0191 'DZ'.
Reproducible: Always
Steps to Reproduce:
1. Apply text-transform:capitalize to an uppercase character which is not the
same as its titlecase character.
Actual Results:
The uppercase character is transformed to titlecase (In the given example U+0192.)
Expected Results:
The uppercase should have remained in uppercase. The algorithm thatshould be
used is if the first character is not in uppercase, transform it into titlecase.
Reporter | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
intl.
Assignee: dbaron → smontagu
Component: Style System → Internationalization
QA Contact: ian → ylong
Updated•22 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Updated•22 years ago
|
Summary: text--transform: capitalize incorrectly always places the first characterr in titlecase → text--transform: capitalize incorrectly always places the first character in titlecase
Assignee | ||
Comment 3•20 years ago
|
||
Removing dependency. I've decided to keep this bugfix separate from bug 210501
No longer depends on: 210501
Assignee | ||
Comment 4•20 years ago
|
||
I also changed the expected results in UnicharSelfTest.cpp to fit the change,
and since I was there, added a test for ToTitle(PRUnichar*, PRUnichar*,
PRUint32). This exposed a nasty bug (previously unnoticed because all other
callers transform the buffer in place) which I have also fixed.
Attachment #178727 -
Flags: review?(jshin1987)
Comment 5•20 years ago
|
||
Comment on attachment 178727 [details] [diff] [review]
Patch
>+ // First check for uppercase characters whose titlecase mapping is different,
>+ // like U+01F1 DZ: they must remain unchanged.
>+ if( 0x01C0 == ( aChar & 0xFFC0)) // 0x01Cx - 0x01Fx
... snip ..
How about moving this block after the ASCII case?
> if( IS_ASCII(aChar)) // optimize for ASCII
> {
>+ for (i = 0; i < T4LEN; i++)
Although it works as it is now, |i+=2| is better because the input chunk size
is 2 below.
>+ {
>+ PRUnichar* titleTest = t4data + i;
>+ res = t->ToTitle(titleTest, buf, 2);
>+ if(NS_FAILED(res)) {
>+ printf("\tFailed!! return value != NS_OK\n");
>+ } else {
>+ if (buf[0] != t4result[i] || buf[1] != t4data[i + 1])
|t4data[i + 1]| should be |t4result[i + 1]|, shouldn't it?
With those changes, r=jshin
Attachment #178727 -
Flags: review?(jshin1987) → review+
Assignee | ||
Comment 6•20 years ago
|
||
(In reply to comment #5)
> Although it works as it is now, |i+=2| is better because the input chunk size
> is 2 below.
> >+ if (buf[0] != t4result[i] || buf[1] != t4data[i + 1])
>
> |t4data[i + 1]| should be |t4result[i + 1]|, shouldn't it?
No: what I'm trying to do here is pass a series of buffers each 2 characters
long, using every position in the test data as starting character, and then
check that ToTitle() transforms the first character as expected and leaves the
second character as is. I'll add comments to make this clear.
Comment 7•20 years ago
|
||
Aha. Sorry I forgot that it's 'Titlecase' !!
Assignee | ||
Comment 8•20 years ago
|
||
Transferring r=jshin and requesting sr.
Attachment #178727 -
Attachment is obsolete: true
Attachment #178784 -
Flags: superreview?(rbs)
Attachment #178784 -
Flags: review+
Assignee | ||
Comment 9•20 years ago
|
||
Grr. I just saw a typo: "expect" for "expected". I won't attach a new patch, but
I've already corrected that locally.
Comment 10•20 years ago
|
||
Comment on attachment 178784 [details] [diff] [review]
Made the first change Jungshik suggested and added comments
r=rbs
Attachment #178784 -
Flags: superreview?(rbs) → superreview+
Assignee | ||
Comment 11•20 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•