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 23 matching lines...) Expand all Loading... |
34 #include "core/rendering/RenderCombineText.h" | 34 #include "core/rendering/RenderCombineText.h" |
35 #include "core/rendering/RenderText.h" | 35 #include "core/rendering/RenderText.h" |
36 #include "core/rendering/svg/RenderSVGInlineText.h" | 36 #include "core/rendering/svg/RenderSVGInlineText.h" |
37 #include "wtf/text/CString.h" | 37 #include "wtf/text/CString.h" |
38 #include "wtf/text/StringBuilder.h" | 38 #include "wtf/text/StringBuilder.h" |
39 | 39 |
40 using namespace std; | 40 using namespace std; |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 PassRefPtr<Text> Text::create(Document* document, const String& data) | 44 PassRefPtr<Text> Text::create(Document& document, const String& data) |
45 { | 45 { |
46 return adoptRef(new Text(document, data, CreateText)); | 46 return adoptRef(new Text(document, data, CreateText)); |
47 } | 47 } |
48 | 48 |
49 PassRefPtr<Text> Text::createEditingText(Document* document, const String& data) | 49 PassRefPtr<Text> Text::createEditingText(Document& document, const String& data) |
50 { | 50 { |
51 return adoptRef(new Text(document, data, CreateEditingText)); | 51 return adoptRef(new Text(document, data, CreateEditingText)); |
52 } | 52 } |
53 | 53 |
54 PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& es) | 54 PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& es) |
55 { | 55 { |
56 // IndexSizeError: Raised if the specified offset is negative or greater tha
n | 56 // IndexSizeError: Raised if the specified offset is negative or greater tha
n |
57 // the number of 16-bit units in data. | 57 // the number of 16-bit units in data. |
58 if (offset > length()) { | 58 if (offset > length()) { |
59 es.throwDOMException(IndexSizeError); | 59 es.throwDOMException(IndexSizeError); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe
placedData); | 307 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe
placedData); |
308 } | 308 } |
309 | 309 |
310 bool Text::childTypeAllowed(NodeType) const | 310 bool Text::childTypeAllowed(NodeType) const |
311 { | 311 { |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
315 PassRefPtr<Text> Text::cloneWithData(const String& data) | 315 PassRefPtr<Text> Text::cloneWithData(const String& data) |
316 { | 316 { |
317 return create(&document(), data); | 317 return create(document(), data); |
318 } | 318 } |
319 | 319 |
320 PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& d
ata, unsigned start, unsigned lengthLimit) | 320 PassRefPtr<Text> Text::createWithLengthLimit(Document& document, const String& d
ata, unsigned start, unsigned lengthLimit) |
321 { | 321 { |
322 unsigned dataLength = data.length(); | 322 unsigned dataLength = data.length(); |
323 | 323 |
324 if (!start && dataLength <= lengthLimit) | 324 if (!start && dataLength <= lengthLimit) |
325 return create(document, data); | 325 return create(document, data); |
326 | 326 |
327 RefPtr<Text> result = Text::create(document, String()); | 327 RefPtr<Text> result = Text::create(document, String()); |
328 result->parserAppendData(data, start, lengthLimit); | 328 result->parserAppendData(data, start, lengthLimit); |
329 | 329 |
330 return result; | 330 return result; |
(...skipping 13 matching lines...) Expand all Loading... |
344 result.appendLiteral("; "); | 344 result.appendLiteral("; "); |
345 result.appendLiteral("value="); | 345 result.appendLiteral("value="); |
346 result.append(s); | 346 result.append(s); |
347 } | 347 } |
348 | 348 |
349 strncpy(buffer, result.toString().utf8().data(), length - 1); | 349 strncpy(buffer, result.toString().utf8().data(), length - 1); |
350 } | 350 } |
351 #endif | 351 #endif |
352 | 352 |
353 } // namespace WebCore | 353 } // namespace WebCore |
OLD | NEW |