WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
107505
Abstract the logic for appending a UChar32 onto StringBuilder
https://bugs.webkit.org/show_bug.cgi?id=107505
Summary
Abstract the logic for appending a UChar32 onto StringBuilder
Martin Robinson
Reported
2013-01-21 23:20:18 PST
Several StringBuilder clients in WebCore want to a append a UChar32 onto a StringBuilder. Right now the logic for doing this is repeated at each place.
Attachments
Patch for landing
(11.37 KB, patch)
2013-01-23 08:41 PST
,
Martin Robinson
no flags
Details
Formatted Diff
Diff
Patch
(8.96 KB, patch)
2013-01-23 08:45 PST
,
Martin Robinson
no flags
Details
Formatted Diff
Diff
Patch for final review and landing
(10.45 KB, patch)
2013-01-23 21:08 PST
,
Martin Robinson
no flags
Details
Formatted Diff
Diff
Patch for final review and landing
(11.19 KB, patch)
2013-01-24 06:35 PST
,
Martin Robinson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Martin Robinson
Comment 1
2013-01-23 08:41:35 PST
Created
attachment 184244
[details]
Patch for landing
Martin Robinson
Comment 2
2013-01-23 08:43:19 PST
Comment on
attachment 184244
[details]
Patch for landing Sorry, apparently I hit a bug in webkit-patch. This is for another bug.
Martin Robinson
Comment 3
2013-01-23 08:45:33 PST
Created
attachment 184246
[details]
Patch
Darin Adler
Comment 4
2013-01-23 09:35:27 PST
Comment on
attachment 184246
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184246&action=review
Nice improvement at every call site!
> Source/WTF/wtf/text/StringBuilder.h:149 > + UChar character = static_cast<UChar>(c); > + ASSERT(character == c); > + append(character);
Tiny nit: This seems like overkill to me. I would follow the CSSOMUtils.cpp version and just do this. append(static_cast<UChar>(c)); We can trust that U_IS_BMP works properly and don’t need to restate what it does in the form of an assertion.
Benjamin Poulain
Comment 5
2013-01-23 13:54:30 PST
Comment on
attachment 184246
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184246&action=review
> Source/WebCore/ChangeLog:9 > + No new tests. This is just refactor, so it's covered by > + existing tests.
Actually, WTF has a growing corpus of C++ tests. They already caught some bugs in the past. I would appreciate if you could spend 5 minutes extending the tests of StringBuilder of this use case.
Benjamin Poulain
Comment 6
2013-01-23 14:00:41 PST
Comment on
attachment 184246
[details]
Patch Actually, I am gonna cq-. I agree with Darin's r+ but I would like this to have its test.
Martin Robinson
Comment 7
2013-01-23 14:16:00 PST
(In reply to
comment #6
)
> (From update of
attachment 184246
[details]
) > Actually, I am gonna cq-. I agree with Darin's r+ but I would like this to have its test.
I don't mind adding a test, I'll do that and have you do a quick review before landing.
Martin Robinson
Comment 8
2013-01-23 21:08:51 PST
Created
attachment 184393
[details]
Patch for final review and landing
Build Bot
Comment 9
2013-01-23 22:34:29 PST
Comment on
attachment 184393
[details]
Patch for final review and landing
Attachment 184393
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://queues.webkit.org/results/16096002
Benjamin Poulain
Comment 10
2013-01-23 23:04:03 PST
Comment on
attachment 184393
[details]
Patch for final review and landing View in context:
https://bugs.webkit.org/attachment.cgi?id=184393&action=review
Thank you for adding the test. Some comments bellow:
> Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp:97 > + > + StringBuilder builder3; > + UChar32 frakturAChar = 0x1D504; > + builder3.append(frakturAChar); // The fraktur A is not in the BMP, so it's two UTF-16 code units long. > + ASSERT_EQ(2, builder3.length()); > + builder3.append(static_cast<UChar32>('A')); > + ASSERT_EQ(3, builder3.length()); > + ASSERT_EQ(builder3[0], U16_LEAD(frakturAChar)); > + ASSERT_EQ(builder3[1], U16_TRAIL(frakturAChar)); > + ASSERT_EQ(builder3[2], 'A');
Please add a little comment saying this is testing the append(UChar32). Instead of ASSERT_EQ(builder3[0], U16_LEAD(frakturAChar)); Please to builder3.toString() -> then test the characters of the string. This way, we test append() end to end and make sure the builder does its job at building strings.
Build Bot
Comment 11
2013-01-23 23:09:47 PST
Comment on
attachment 184393
[details]
Patch for final review and landing
Attachment 184393
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/16034031
Build Bot
Comment 12
2013-01-24 00:16:59 PST
Comment on
attachment 184393
[details]
Patch for final review and landing
Attachment 184393
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/16073652
Martin Robinson
Comment 13
2013-01-24 06:35:40 PST
Created
attachment 184484
[details]
Patch for final review and landing
WebKit Review Bot
Comment 14
2013-01-24 15:02:37 PST
Comment on
attachment 184484
[details]
Patch for final review and landing Clearing flags on attachment: 184484 Committed
r140731
: <
http://trac.webkit.org/changeset/140731
>
WebKit Review Bot
Comment 15
2013-01-24 15:02:43 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug