OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "platform/text/TextRun.h" | 27 #include "platform/text/TextRun.h" |
28 | 28 |
29 #include "platform/fonts/Character.h" | 29 #include "platform/fonts/Character.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 struct ExpectedTextRunSize { | 33 struct ExpectedTextRunSize { |
| 34 DISALLOW_NEW(); |
34 const void* pointer; | 35 const void* pointer; |
35 int integers[2]; | 36 int integers[2]; |
36 float float1; | 37 float float1; |
37 float float2; | 38 float float2; |
38 float float3; | 39 float float3; |
39 uint32_t bitfields : 12; | 40 uint32_t bitfields : 12; |
40 TabSize tabSize; | 41 TabSize tabSize; |
41 }; | 42 }; |
42 | 43 |
43 static_assert(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun should ha
ve expected size"); | 44 static_assert(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun should ha
ve expected size"); |
44 | 45 |
45 void TextRun::setText(const String& string) | 46 void TextRun::setText(const String& string) |
46 { | 47 { |
47 m_len = string.length(); | 48 m_len = string.length(); |
48 if (!m_len) { | 49 if (!m_len) { |
49 m_data.characters8 = 0; | 50 m_data.characters8 = 0; |
50 m_is8Bit = true; | 51 m_is8Bit = true; |
51 return; | 52 return; |
52 } | 53 } |
53 m_is8Bit = string.is8Bit(); | 54 m_is8Bit = string.is8Bit(); |
54 if (m_is8Bit) | 55 if (m_is8Bit) |
55 m_data.characters8 = string.characters8(); | 56 m_data.characters8 = string.characters8(); |
56 else | 57 else |
57 m_data.characters16 = string.characters16(); | 58 m_data.characters16 = string.characters16(); |
58 } | 59 } |
59 | 60 |
60 } | 61 } |
OLD | NEW |