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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 setDataWithoutUpdate(oldStr.substring(0, offset)); | 66 setDataWithoutUpdate(oldStr.substring(0, offset)); |
67 | 67 |
68 didModifyData(oldStr); | 68 didModifyData(oldStr); |
69 | 69 |
70 if (parentNode()) | 70 if (parentNode()) |
71 parentNode()->insertBefore(newText.get(), nextSibling(), es); | 71 parentNode()->insertBefore(newText.get(), nextSibling(), es); |
72 if (es.hadException()) | 72 if (es.hadException()) |
73 return 0; | 73 return 0; |
74 | 74 |
75 if (parentNode()) | 75 if (parentNode()) |
76 document()->textNodeSplit(this); | 76 document().textNodeSplit(this); |
77 | 77 |
78 if (renderer()) | 78 if (renderer()) |
79 toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr.length
()); | 79 toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr.length
()); |
80 | 80 |
81 return newText.release(); | 81 return newText.release(); |
82 } | 82 } |
83 | 83 |
84 static const Text* earliestLogicallyAdjacentTextNode(const Text* t) | 84 static const Text* earliestLogicallyAdjacentTextNode(const Text* t) |
85 { | 85 { |
86 const Node* n = t; | 86 const Node* n = t; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void Text::attach(const AttachContext& context) | 264 void Text::attach(const AttachContext& context) |
265 { | 265 { |
266 NodeRenderingContext(this, context.resolvedStyle).createRendererForTextIfNee
ded(); | 266 NodeRenderingContext(this, context.resolvedStyle).createRendererForTextIfNee
ded(); |
267 CharacterData::attach(context); | 267 CharacterData::attach(context); |
268 } | 268 } |
269 | 269 |
270 bool Text::recalcTextStyle(StyleChange change) | 270 bool Text::recalcTextStyle(StyleChange change) |
271 { | 271 { |
272 if (RenderText* renderer = toRenderText(this->renderer())) { | 272 if (RenderText* renderer = toRenderText(this->renderer())) { |
273 if (change != NoChange || needsStyleRecalc()) | 273 if (change != NoChange || needsStyleRecalc()) |
274 renderer->setStyle(document()->styleResolver()->styleForText(this)); | 274 renderer->setStyle(document().styleResolver()->styleForText(this)); |
275 if (needsStyleRecalc()) | 275 if (needsStyleRecalc()) |
276 renderer->setText(dataImpl()); | 276 renderer->setText(dataImpl()); |
277 clearNeedsStyleRecalc(); | 277 clearNeedsStyleRecalc(); |
278 } else if (needsStyleRecalc() || needsWhitespaceRenderer()) { | 278 } else if (needsStyleRecalc() || needsWhitespaceRenderer()) { |
279 reattach(); | 279 reattach(); |
280 return true; | 280 return true; |
281 } | 281 } |
282 return false; | 282 return false; |
283 } | 283 } |
284 | 284 |
(...skipping 22 matching lines...) Expand all 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()); |
(...skipping 16 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 |