| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 292 { | 292 { | 
| 293     if (isSVGText(this)) | 293     if (isSVGText(this)) | 
| 294         return new RenderSVGInlineText(this, dataImpl()); | 294         return new RenderSVGInlineText(this, dataImpl()); | 
| 295 | 295 | 
| 296     if (style->hasTextCombine()) | 296     if (style->hasTextCombine()) | 
| 297         return new RenderCombineText(this, dataImpl()); | 297         return new RenderCombineText(this, dataImpl()); | 
| 298 | 298 | 
| 299     return new RenderText(this, dataImpl()); | 299     return new RenderText(this, dataImpl()); | 
| 300 } | 300 } | 
| 301 | 301 | 
| 302 void Text::attach(const AttachContext& context) | 302 void Text::createRenderTree(const AttachContext& context) | 
| 303 { | 303 { | 
| 304     NodeRenderingContext(this, context.resolvedStyle).createRendererForTextIfNee
     ded(); | 304     NodeRenderingContext(this, context.resolvedStyle).createRendererForTextIfNee
     ded(); | 
| 305     CharacterData::attach(context); | 305     CharacterData::createRenderTree(context); | 
| 306 } | 306 } | 
| 307 | 307 | 
| 308 bool Text::recalcTextStyle(StyleRecalcChange change) | 308 bool Text::recalcTextStyle(StyleRecalcChange change) | 
| 309 { | 309 { | 
| 310     if (RenderText* renderer = toRenderText(this->renderer())) { | 310     if (RenderText* renderer = toRenderText(this->renderer())) { | 
| 311         if (change != NoChange || needsStyleRecalc()) | 311         if (change != NoChange || needsStyleRecalc()) | 
| 312             renderer->setStyle(document().styleResolver()->styleForText(this)); | 312             renderer->setStyle(document().styleResolver()->styleForText(this)); | 
| 313         if (needsStyleRecalc()) | 313         if (needsStyleRecalc()) | 
| 314             renderer->setText(dataImpl()); | 314             renderer->setText(dataImpl()); | 
| 315         clearNeedsStyleRecalc(); | 315         clearNeedsStyleRecalc(); | 
| 316     } else if (needsStyleRecalc() || needsWhitespaceRenderer()) { | 316     } else if (needsStyleRecalc() || needsWhitespaceRenderer()) { | 
| 317         reattach(); | 317         recreateRenderTree(); | 
| 318         return true; | 318         return true; | 
| 319     } | 319     } | 
| 320     return false; | 320     return false; | 
| 321 } | 321 } | 
| 322 | 322 | 
| 323 // If a whitespace node had no renderer and goes through a recalcStyle it may | 323 // If a whitespace node had no renderer and goes through a recalcStyle it may | 
| 324 // need to create one if the parent style now has white-space: pre. | 324 // need to create one if the parent style now has white-space: pre. | 
| 325 bool Text::needsWhitespaceRenderer() | 325 bool Text::needsWhitespaceRenderer() | 
| 326 { | 326 { | 
| 327     ASSERT(!renderer()); | 327     ASSERT(!renderer()); | 
| 328     if (RenderStyle* style = parentRenderStyle()) | 328     if (RenderStyle* style = parentRenderStyle()) | 
| 329         return style->preserveNewline(); | 329         return style->preserveNewline(); | 
| 330     return false; | 330     return false; | 
| 331 } | 331 } | 
| 332 | 332 | 
| 333 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe
     placedData, RecalcStyleBehavior recalcStyleBehavior) | 333 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe
     placedData, RecalcStyleBehavior recalcStyleBehavior) | 
| 334 { | 334 { | 
| 335     if (!attached()) | 335     if (!attached()) | 
| 336         return; | 336         return; | 
| 337     RenderText* textRenderer = toRenderText(renderer()); | 337     RenderText* textRenderer = toRenderText(renderer()); | 
| 338     if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRe
     nderer->style()))) { | 338     if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRe
     nderer->style()))) { | 
| 339         lazyReattach(); | 339         scheduleRenderTreeReconstruction(); | 
| 340         // FIXME: Editing should be updated so this is not neccesary. | 340         // FIXME: Editing should be updated so this is not neccesary. | 
| 341         if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing) | 341         if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing) | 
| 342             document().updateStyleIfNeeded(); | 342             document().updateStyleIfNeeded(); | 
| 343         return; | 343         return; | 
| 344     } | 344     } | 
| 345     textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe
     placedData); | 345     textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe
     placedData); | 
| 346 } | 346 } | 
| 347 | 347 | 
| 348 bool Text::childTypeAllowed(NodeType) const | 348 bool Text::childTypeAllowed(NodeType) const | 
| 349 { | 349 { | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 382             result.appendLiteral("; "); | 382             result.appendLiteral("; "); | 
| 383         result.appendLiteral("value="); | 383         result.appendLiteral("value="); | 
| 384         result.append(s); | 384         result.append(s); | 
| 385     } | 385     } | 
| 386 | 386 | 
| 387     strncpy(buffer, result.toString().utf8().data(), length - 1); | 387     strncpy(buffer, result.toString().utf8().data(), length - 1); | 
| 388 } | 388 } | 
| 389 #endif | 389 #endif | 
| 390 | 390 | 
| 391 } // namespace WebCore | 391 } // namespace WebCore | 
| OLD | NEW | 
|---|