Changeset 132292 in webkit
- Timestamp:
- Oct 23, 2012 7:16:57 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r132291 r132292 1 2012-10-23 Kent Tamura <tkent@chromium.org> 2 3 Move appendAsLDMLLiteral in LocaleWin.cpp to a common place 4 https://bugs.webkit.org/show_bug.cgi?id=100129 5 6 Reviewed by Kentaro Hara. 7 8 We're going to use appendAsLDMLLiteral in other code, and it is 9 related to DateTimeFormat class. So we move it to DateTimeFormat 10 class as quoteAndAppendLiteral. 11 12 No new tests because of no behavior change. 13 14 * platform/text/DateTimeFormat.cpp: 15 (WebCore::DateTimeFormat::quoteAndAppendLiteral): 16 Moved from LocaleWin.cpp 17 * platform/text/DateTimeFormat.h: 18 Declare StringBuilder by wtf/Forward.h. It also declares String. 19 (DateTimeFormat): Declare quoteAndAppendLiteral. 20 * platform/text/LocaleWin.cpp: 21 (WebCore): Move appendLDMLLiteral to DateTimeFormat. 22 (WebCore::convertWindowsDateFormatToLDML): 23 Follow the moving. 24 1 25 2012-10-23 Kent Tamura <tkent@chromium.org> 2 26 -
trunk/Source/WebCore/platform/text/DateTimeFormat.cpp
r130116 r132292 242 242 } 243 243 244 void DateTimeFormat::quoteAndAppendLiteral(const String& literal, StringBuilder& buffer) 245 { 246 if (literal.length() <= 0) 247 return; 248 249 if (literal.find('\'') == notFound) { 250 buffer.append("'"); 251 buffer.append(literal); 252 buffer.append("'"); 253 return; 254 } 255 256 for (unsigned i = 0; i < literal.length(); ++i) { 257 if (literal[i] == '\'') 258 buffer.append("''"); 259 else { 260 String escaped = literal.substring(i); 261 escaped.replace(ASCIILiteral("'"), ASCIILiteral("''")); 262 buffer.append("'"); 263 buffer.append(escaped); 264 buffer.append("'"); 265 return; 266 } 267 } 268 } 269 244 270 } // namespace WebCore 245 271 -
trunk/Source/WebCore/platform/text/DateTimeFormat.h
r130116 r132292 28 28 29 29 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 30 #include <wtf/ text/WTFString.h>30 #include <wtf/Forward.h> 31 31 32 32 namespace WebCore { … … 104 104 // Returns true if succeeded, false if failed. 105 105 static bool parse(const String&, TokenHandler&); 106 static void quoteAndAppendLiteral(const String&, StringBuilder&); 106 107 }; 107 108 -
trunk/Source/WebCore/platform/text/LocaleWin.cpp
r132170 r132292 580 580 581 581 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 582 static void appendAsLDMLLiteral(const String& literal, StringBuilder& buffer)583 {584 if (literal.length() <= 0)585 return;586 587 if (literal.find('\'') == notFound) {588 buffer.append("'");589 buffer.append(literal);590 buffer.append("'");591 return;592 }593 594 for (unsigned i = 0; i < literal.length(); ++i) {595 if (literal[i] == '\'')596 buffer.append("''");597 else {598 String escaped = literal.substring(i);599 escaped.replace(ASCIILiteral("'"), ASCIILiteral("''"));600 buffer.append("'");601 buffer.append(escaped);602 buffer.append("'");603 return;604 }605 }606 }607 608 582 static String convertWindowsDateFormatToLDML(const Vector<DateFormatToken>& tokens) 609 583 { … … 612 586 switch (tokens[i].type) { 613 587 case DateFormatToken::Literal: 614 appendAsLDMLLiteral(tokens[i].data, buffer);588 DateTimeFormat::quoteAndAppendLiteral(tokens[i].data, buffer); 615 589 break; 616 590
Note: See TracChangeset
for help on using the changeset viewer.