OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "config.h" | 29 #include "config.h" |
30 #include "platform/text/StringTruncator.h" | 30 #include "platform/text/StringTruncator.h" |
31 | 31 |
32 #include "platform/fonts/Font.h" | 32 #include "platform/fonts/Font.h" |
33 #include "platform/text/TextBreakIterator.h" | 33 #include "platform/text/TextBreakIterator.h" |
34 #include "platform/text/TextRun.h" | 34 #include "platform/text/TextRun.h" |
35 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 #include "wtf/unicode/CharacterNames.h" | 37 #include "wtf/unicode/CharacterNames.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace blink { |
40 | 40 |
41 #define STRING_BUFFER_SIZE 2048 | 41 #define STRING_BUFFER_SIZE 2048 |
42 | 42 |
43 typedef unsigned TruncationFunction(const String&, unsigned length, unsigned kee
pCount, UChar* buffer); | 43 typedef unsigned TruncationFunction(const String&, unsigned length, unsigned kee
pCount, UChar* buffer); |
44 | 44 |
45 static inline int textBreakAtOrPreceding(const NonSharedCharacterBreakIterator&
it, int offset) | 45 static inline int textBreakAtOrPreceding(const NonSharedCharacterBreakIterator&
it, int offset) |
46 { | 46 { |
47 if (it.isBreak(offset)) | 47 if (it.isBreak(offset)) |
48 return offset; | 48 return offset; |
49 | 49 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 String StringTruncator::rightTruncate(const String& string, float maxWidth, cons
t Font& font) | 192 String StringTruncator::rightTruncate(const String& string, float maxWidth, cons
t Font& font) |
193 { | 193 { |
194 return truncateString(string, maxWidth, font, rightTruncateToBuffer); | 194 return truncateString(string, maxWidth, font, rightTruncateToBuffer); |
195 } | 195 } |
196 | 196 |
197 float StringTruncator::width(const String& string, const Font& font) | 197 float StringTruncator::width(const String& string, const Font& font) |
198 { | 198 { |
199 return stringWidth(font, string); | 199 return stringWidth(font, string); |
200 } | 200 } |
201 | 201 |
202 } // namespace WebCore | 202 } // namespace blink |
OLD | NEW |