| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 bool Text::childTypeAllowed(NodeType) const | 307 bool Text::childTypeAllowed(NodeType) const |
| 308 { | 308 { |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 PassRefPtr<Text> Text::cloneWithData(const String& data) | 312 PassRefPtr<Text> Text::cloneWithData(const String& data) |
| 313 { | 313 { |
| 314 return create(document(), data); | 314 return create(document(), data); |
| 315 } | 315 } |
| 316 | 316 |
| 317 PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& d
ata, unsigned start, unsigned maxChars) | 317 PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& d
ata, unsigned start, unsigned lengthLimit) |
| 318 { | 318 { |
| 319 unsigned dataLength = data.length(); | 319 unsigned dataLength = data.length(); |
| 320 | 320 |
| 321 if (!start && dataLength <= maxChars) | 321 if (!start && dataLength <= lengthLimit) |
| 322 return create(document, data); | 322 return create(document, data); |
| 323 | 323 |
| 324 RefPtr<Text> result = Text::create(document, String()); | 324 RefPtr<Text> result = Text::create(document, String()); |
| 325 result->parserAppendData(data, start, maxChars); | 325 result->parserAppendData(data, start, lengthLimit); |
| 326 | 326 |
| 327 return result; | 327 return result; |
| 328 } | 328 } |
| 329 | 329 |
| 330 #ifndef NDEBUG | 330 #ifndef NDEBUG |
| 331 void Text::formatForDebugger(char *buffer, unsigned length) const | 331 void Text::formatForDebugger(char *buffer, unsigned length) const |
| 332 { | 332 { |
| 333 StringBuilder result; | 333 StringBuilder result; |
| 334 String s; | 334 String s; |
| 335 | 335 |
| 336 result.append(nodeName()); | 336 result.append(nodeName()); |
| 337 | 337 |
| 338 s = data(); | 338 s = data(); |
| 339 if (s.length() > 0) { | 339 if (s.length() > 0) { |
| 340 if (result.length()) | 340 if (result.length()) |
| 341 result.appendLiteral("; "); | 341 result.appendLiteral("; "); |
| 342 result.appendLiteral("value="); | 342 result.appendLiteral("value="); |
| 343 result.append(s); | 343 result.append(s); |
| 344 } | 344 } |
| 345 | 345 |
| 346 strncpy(buffer, result.toString().utf8().data(), length - 1); | 346 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 347 } | 347 } |
| 348 #endif | 348 #endif |
| 349 | 349 |
| 350 } // namespace WebCore | 350 } // namespace WebCore |
| OLD | NEW |