Source/WebCore: Fix recently-introduced off-by-one error in centerTruncateToBuffer
https://bugs.webkit.org/show_bug.cgi?id=130889
<rdar://problem/
16408694>
Reviewed by Alexey Proskuryakov.
* platform/graphics/StringTruncator.cpp:
(WebCore::centerTruncateToBuffer): Simplified expression that computes truncatedLength.
Removed incorrect "+ 1" from computation of where to write characters.
Source/WebKit/mac: Fix recently-introduced off-by-one error in centerTruncateToBuffer
https://bugs.webkit.org/show_bug.cgi?id=130889
Reviewed by Alexey Proskuryakov.
* Misc/WebStringTruncator.mm:
(defaultMenuFont): Changed to use NeverDestroyed since I had to touch this file anyway.
(fontFromNSFont): Ditto. Also improved variable names a bit.
(+[WebStringTruncator initialize]): Added threading initialization, needed for main
thread assertions in string truncator code.
Tools: Fix recently-introduced off-by-one error in centerTruncateToBuffer
https://bugs.webkit.org/show_bug.cgi?id=130889
Reviewed by Alexey Proskuryakov.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added StringTruncator.mm.
* TestWebKitAPI/Tests/mac/StringTruncator.mm: Added. One test for each of the
WebStringTruncator methods; should be good for a start. These are dependent on the
metrics of Helvetica 12, but I am hoping that will be consistent across OS X machines.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166448
268f45cc-cd09-0410-ab3c-
d52691b4dbfc