OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "platform/text/Character.h" | 47 #include "platform/text/Character.h" |
48 #include "platform/text/Hyphenation.h" | 48 #include "platform/text/Hyphenation.h" |
49 #include "platform/text/TextBreakIterator.h" | 49 #include "platform/text/TextBreakIterator.h" |
50 #include "platform/text/TextRunIterator.h" | 50 #include "platform/text/TextRunIterator.h" |
51 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
52 #include "public/platform/WebScheduler.h" | 52 #include "public/platform/WebScheduler.h" |
53 #include "public/platform/WebThread.h" | 53 #include "public/platform/WebThread.h" |
54 #include "wtf/text/StringBuffer.h" | 54 #include "wtf/text/StringBuffer.h" |
55 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
56 | 56 |
57 using namespace WTF; | |
58 using namespace Unicode; | |
59 | |
60 namespace blink { | 57 namespace blink { |
61 | 58 |
62 struct SameSizeAsLayoutText : public LayoutObject { | 59 struct SameSizeAsLayoutText : public LayoutObject { |
63 uint32_t bitfields : 16; | 60 uint32_t bitfields : 16; |
64 float widths[4]; | 61 float widths[4]; |
65 String text; | 62 String text; |
66 void* pointers[2]; | 63 void* pointers[2]; |
67 }; | 64 }; |
68 | 65 |
69 static_assert(sizeof(LayoutText) == sizeof(SameSizeAsLayoutText), | 66 static_assert(sizeof(LayoutText) == sizeof(SameSizeAsLayoutText), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (!boundary) | 129 if (!boundary) |
133 return; | 130 return; |
134 | 131 |
135 StringBuilder result; | 132 StringBuilder result; |
136 result.reserveCapacity(length); | 133 result.reserveCapacity(length); |
137 | 134 |
138 int32_t endOfWord; | 135 int32_t endOfWord; |
139 int32_t startOfWord = boundary->first(); | 136 int32_t startOfWord = boundary->first(); |
140 for (endOfWord = boundary->next(); endOfWord != TextBreakDone; | 137 for (endOfWord = boundary->next(); endOfWord != TextBreakDone; |
141 startOfWord = endOfWord, endOfWord = boundary->next()) { | 138 startOfWord = endOfWord, endOfWord = boundary->next()) { |
142 if (startOfWord) // Ignore first char of previous string | 139 if (startOfWord) { // Ignore first char of previous string |
143 result.append(input[startOfWord - 1] == noBreakSpaceCharacter | 140 result.append( |
144 ? noBreakSpaceCharacter | 141 input[startOfWord - 1] == noBreakSpaceCharacter |
145 : toTitleCase(stringWithPrevious[startOfWord])); | 142 ? noBreakSpaceCharacter |
| 143 : WTF::Unicode::toTitleCase(stringWithPrevious[startOfWord])); |
| 144 } |
146 for (int i = startOfWord + 1; i < endOfWord; i++) | 145 for (int i = startOfWord + 1; i < endOfWord; i++) |
147 result.append(input[i - 1]); | 146 result.append(input[i - 1]); |
148 } | 147 } |
149 | 148 |
150 *string = result.toString(); | 149 *string = result.toString(); |
151 } | 150 } |
152 | 151 |
153 LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str) | 152 LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str) |
154 : LayoutObject(!node || node->isDocumentNode() ? 0 : node), | 153 : LayoutObject(!node || node->isDocumentNode() ? 0 : node), |
155 m_hasTab(false), | 154 m_hasTab(false), |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 LayoutRect rect = LayoutRect( | 2027 LayoutRect rect = LayoutRect( |
2029 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); | 2028 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); |
2030 LayoutBlock* block = containingBlock(); | 2029 LayoutBlock* block = containingBlock(); |
2031 if (block && hasTextBoxes()) | 2030 if (block && hasTextBoxes()) |
2032 block->adjustChildDebugRect(rect); | 2031 block->adjustChildDebugRect(rect); |
2033 | 2032 |
2034 return rect; | 2033 return rect; |
2035 } | 2034 } |
2036 | 2035 |
2037 } // namespace blink | 2036 } // namespace blink |
OLD | NEW |