OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2011 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 4 * |
4 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
8 * | 9 * |
9 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 13 * Library General Public License for more details. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 RenderText::willBeDestroyed(); | 50 RenderText::willBeDestroyed(); |
50 } | 51 } |
51 | 52 |
52 typedef HashMap<AtomicString, const QuotesData*, CaseFoldingHash> QuotesMap; | 53 typedef HashMap<AtomicString, const QuotesData*, CaseFoldingHash> QuotesMap; |
53 | 54 |
54 static const QuotesMap& quotesDataLanguageMap() | 55 static const QuotesMap& quotesDataLanguageMap() |
55 { | 56 { |
56 DEFINE_STATIC_LOCAL(QuotesMap, staticQuotesMap, ()); | 57 DEFINE_STATIC_LOCAL(QuotesMap, staticQuotesMap, ()); |
57 if (staticQuotesMap.size()) | 58 if (staticQuotesMap.size()) |
58 return staticQuotesMap; | 59 return staticQuotesMap; |
59 // FIXME: Expand this table to include all the languages in https://bug-3234
-attachments.webkit.org/attachment.cgi?id=2135 | 60 |
60 staticQuotesMap.set("en", QuotesData::create(U("\x201C"), U("\x201D"), U("\x
2018"), U("\x2019")).leakRef()); | 61 // Table of quotes from http://www.whatwg.org/specs/web-apps/current-work/mu
ltipage/rendering.html#quotes |
61 staticQuotesMap.set("no", QuotesData::create(U("\x00AB"), U("\x00BB"), U("\x
2039"), U("\x203A")).leakRef()); | 62 #define QUOTES_LANG(lang, o1, c1, o2, c2) staticQuotesMap.set(lang, QuotesDa
ta::create(U(o1), U(c1), U(o2), U(c2)).leakRef()) |
62 staticQuotesMap.set("ro", QuotesData::create(U("\x201E"), U("\x201D")).leakR
ef()); | 63 QUOTES_LANG("af", "\x201c", "\x201d", "\x2018", "\x2019"); |
63 staticQuotesMap.set("ru", QuotesData::create(U("\x00AB"), U("\x00BB"), U("\x
201E"), U("\x201C")).leakRef()); | 64 QUOTES_LANG("agq", "\x201e", "\x201d", "\x201a", "\x2019"); |
| 65 QUOTES_LANG("ak", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 66 QUOTES_LANG("am", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 67 QUOTES_LANG("ar", "\x201d", "\x201c", "\x2019", "\x2018"); |
| 68 QUOTES_LANG("asa", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 69 QUOTES_LANG("az-Cyrl", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 70 QUOTES_LANG("bas", "\x00ab", "\x00bb", "\x201e", "\x201c"); |
| 71 QUOTES_LANG("bem", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 72 QUOTES_LANG("bez", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 73 QUOTES_LANG("bg", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 74 QUOTES_LANG("bm", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 75 QUOTES_LANG("bn", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 76 QUOTES_LANG("br", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 77 QUOTES_LANG("brx", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 78 QUOTES_LANG("bs-Cyrl", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 79 QUOTES_LANG("ca", "\x201c", "\x201d", "\x00ab", "\x00bb"); |
| 80 QUOTES_LANG("cgg", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 81 QUOTES_LANG("chr", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 82 QUOTES_LANG("cs", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 83 QUOTES_LANG("da", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 84 QUOTES_LANG("dav", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 85 QUOTES_LANG("de", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 86 QUOTES_LANG("de-CH", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 87 QUOTES_LANG("dje", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 88 QUOTES_LANG("dua", "\x00ab", "\x00bb", "\x2018", "\x2019"); |
| 89 QUOTES_LANG("dyo", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 90 QUOTES_LANG("dz", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 91 QUOTES_LANG("ebu", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 92 QUOTES_LANG("ee", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 93 QUOTES_LANG("el", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 94 QUOTES_LANG("en", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 95 QUOTES_LANG("en-GB", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 96 QUOTES_LANG("es", "\x201c", "\x201d", "\x00ab", "\x00bb"); |
| 97 QUOTES_LANG("et", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 98 QUOTES_LANG("eu", "\x201c", "\x201d", "\x00ab", "\x00bb"); |
| 99 QUOTES_LANG("ewo", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 100 QUOTES_LANG("fa", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 101 QUOTES_LANG("ff", "\x201e", "\x201d", "\x201a", "\x2019"); |
| 102 QUOTES_LANG("fi", "\x201d", "\x201d", "\x2019", "\x2019"); |
| 103 QUOTES_LANG("fr", "\x00ab", "\x00bb", "\x00ab", "\x00bb"); |
| 104 QUOTES_LANG("fr-CA", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 105 QUOTES_LANG("fr-CH", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 106 QUOTES_LANG("gsw", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 107 QUOTES_LANG("gu", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 108 QUOTES_LANG("guz", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 109 QUOTES_LANG("ha", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 110 QUOTES_LANG("he", "\x0022", "\x0022", "\x0027", "\x0027"); |
| 111 QUOTES_LANG("hi", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 112 QUOTES_LANG("hr", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 113 QUOTES_LANG("hu", "\x201e", "\x201d", "\x00bb", "\x00ab"); |
| 114 QUOTES_LANG("id", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 115 QUOTES_LANG("ig", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 116 QUOTES_LANG("it", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 117 QUOTES_LANG("ja", "\x300c", "\x300d", "\x300e", "\x300f"); |
| 118 QUOTES_LANG("jgo", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 119 QUOTES_LANG("jmc", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 120 QUOTES_LANG("kab", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 121 QUOTES_LANG("kam", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 122 QUOTES_LANG("kde", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 123 QUOTES_LANG("kea", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 124 QUOTES_LANG("khq", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 125 QUOTES_LANG("ki", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 126 QUOTES_LANG("kkj", "\x00ab", "\x00bb", "\x2039", "\x203a"); |
| 127 QUOTES_LANG("kln", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 128 QUOTES_LANG("km", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 129 QUOTES_LANG("kn", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 130 QUOTES_LANG("ko", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 131 QUOTES_LANG("ksb", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 132 QUOTES_LANG("ksf", "\x00ab", "\x00bb", "\x2018", "\x2019"); |
| 133 QUOTES_LANG("lag", "\x201d", "\x201d", "\x2019", "\x2019"); |
| 134 QUOTES_LANG("lg", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 135 QUOTES_LANG("ln", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 136 QUOTES_LANG("lo", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 137 QUOTES_LANG("lt", "\x201e", "\x201c", "\x201e", "\x201c"); |
| 138 QUOTES_LANG("lu", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 139 QUOTES_LANG("luo", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 140 QUOTES_LANG("luy", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 141 QUOTES_LANG("lv", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 142 QUOTES_LANG("mas", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 143 QUOTES_LANG("mer", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 144 QUOTES_LANG("mfe", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 145 QUOTES_LANG("mg", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 146 QUOTES_LANG("mgo", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 147 QUOTES_LANG("mk", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 148 QUOTES_LANG("ml", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 149 QUOTES_LANG("mr", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 150 QUOTES_LANG("ms", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 151 QUOTES_LANG("mua", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 152 QUOTES_LANG("my", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 153 QUOTES_LANG("naq", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 154 QUOTES_LANG("nb", "\x00ab", "\x00bb", "\x2018", "\x2019"); |
| 155 QUOTES_LANG("nd", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 156 QUOTES_LANG("nl", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 157 QUOTES_LANG("nmg", "\x201e", "\x201d", "\x00ab", "\x00bb"); |
| 158 QUOTES_LANG("nn", "\x00ab", "\x00bb", "\x2018", "\x2019"); |
| 159 QUOTES_LANG("nnh", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 160 QUOTES_LANG("nus", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 161 QUOTES_LANG("nyn", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 162 QUOTES_LANG("pl", "\x201e", "\x201d", "\x00ab", "\x00bb"); |
| 163 QUOTES_LANG("pt", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 164 QUOTES_LANG("pt-PT", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 165 QUOTES_LANG("rn", "\x201d", "\x201d", "\x2019", "\x2019"); |
| 166 QUOTES_LANG("ro", "\x201e", "\x201d", "\x00ab", "\x00bb"); |
| 167 QUOTES_LANG("rof", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 168 QUOTES_LANG("ru", "\x00ab", "\x00bb", "\x201e", "\x201c"); |
| 169 QUOTES_LANG("rw", "\x00ab", "\x00bb", "\x2018", "\x2019"); |
| 170 QUOTES_LANG("rwk", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 171 QUOTES_LANG("saq", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 172 QUOTES_LANG("sbp", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 173 QUOTES_LANG("seh", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 174 QUOTES_LANG("ses", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 175 QUOTES_LANG("sg", "\x00ab", "\x00bb", "\x201c", "\x201d"); |
| 176 QUOTES_LANG("shi", "\x00ab", "\x00bb", "\x201e", "\x201d"); |
| 177 QUOTES_LANG("shi-Tfng", "\x00ab", "\x00bb", "\x201e", "\x201d"); |
| 178 QUOTES_LANG("si", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 179 QUOTES_LANG("sk", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 180 QUOTES_LANG("sl", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 181 QUOTES_LANG("sn", "\x201d", "\x201d", "\x2019", "\x2019"); |
| 182 QUOTES_LANG("so", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 183 QUOTES_LANG("sq", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 184 QUOTES_LANG("sr", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 185 QUOTES_LANG("sr-Latn", "\x201e", "\x201c", "\x201a", "\x2018"); |
| 186 QUOTES_LANG("sv", "\x201d", "\x201d", "\x2019", "\x2019"); |
| 187 QUOTES_LANG("sw", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 188 QUOTES_LANG("swc", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 189 QUOTES_LANG("ta", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 190 QUOTES_LANG("te", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 191 QUOTES_LANG("teo", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 192 QUOTES_LANG("th", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 193 QUOTES_LANG("ti-ER", "\x2018", "\x2019", "\x201c", "\x201d"); |
| 194 QUOTES_LANG("to", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 195 QUOTES_LANG("tr", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 196 QUOTES_LANG("twq", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 197 QUOTES_LANG("tzm", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 198 QUOTES_LANG("uk", "\x00ab", "\x00bb", "\x201e", "\x201c"); |
| 199 QUOTES_LANG("ur", "\x201d", "\x201c", "\x2019", "\x2018"); |
| 200 QUOTES_LANG("vai", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 201 QUOTES_LANG("vai-Latn", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 202 QUOTES_LANG("vi", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 203 QUOTES_LANG("vun", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 204 QUOTES_LANG("xh", "\x2018", "\x2019", "\x201c", "\x201d"); |
| 205 QUOTES_LANG("xog", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 206 QUOTES_LANG("yav", "\x00ab", "\x00bb", "\x00ab", "\x00bb"); |
| 207 QUOTES_LANG("yo", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 208 QUOTES_LANG("zh", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 209 QUOTES_LANG("zh-Hant", "\x300c", "\x300d", "\x300e", "\x300f"); |
| 210 QUOTES_LANG("zu", "\x201c", "\x201d", "\x2018", "\x2019"); |
| 211 #undef QUOTES_LANG |
| 212 |
64 return staticQuotesMap; | 213 return staticQuotesMap; |
65 } | 214 } |
66 | 215 |
67 static const QuotesData* basicQuotesData() | 216 static const QuotesData* basicQuotesData() |
68 { | 217 { |
| 218 // FIXME: The default quotes should be the fancy quotes for "en". |
69 static const QuotesData* staticBasicQuotes = QuotesData::create(U("\""), U("
\""), U("'"), U("'")).leakRef(); | 219 static const QuotesData* staticBasicQuotes = QuotesData::create(U("\""), U("
\""), U("'"), U("'")).leakRef(); |
70 return staticBasicQuotes; | 220 return staticBasicQuotes; |
71 } | 221 } |
72 | 222 |
73 PassRefPtr<StringImpl> RenderQuote::originalText() const | 223 PassRefPtr<StringImpl> RenderQuote::originalText() const |
74 { | 224 { |
75 switch (m_type) { | 225 switch (m_type) { |
76 case NO_OPEN_QUOTE: | 226 case NO_OPEN_QUOTE: |
77 case NO_CLOSE_QUOTE: | 227 case NO_CLOSE_QUOTE: |
78 return StringImpl::empty(); | 228 return StringImpl::empty(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 345 } |
196 // FIXME: Don't call setNeedsLayout or dirty our preferred widths during lay
out. | 346 // FIXME: Don't call setNeedsLayout or dirty our preferred widths during lay
out. |
197 // This is likely to fail anyway as one of our ancestor will call setNeedsLa
yout(false), | 347 // This is likely to fail anyway as one of our ancestor will call setNeedsLa
yout(false), |
198 // preventing the future layout to occur on |this|. The solution is to move
that to a | 348 // preventing the future layout to occur on |this|. The solution is to move
that to a |
199 // pre-layout phase. | 349 // pre-layout phase. |
200 if (oldDepth != m_depth) | 350 if (oldDepth != m_depth) |
201 setNeedsLayoutAndPrefWidthsRecalc(); | 351 setNeedsLayoutAndPrefWidthsRecalc(); |
202 } | 352 } |
203 | 353 |
204 } // namespace WebCore | 354 } // namespace WebCore |
OLD | NEW |