Index: Source/core/dom/Text.cpp |
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp |
index 9ace889c425cee2227e1365d5dcf7b5f3cc521f0..a0bade340290be0b89c0ce1a7fbb5b32eaef70ce 100644 |
--- a/Source/core/dom/Text.cpp |
+++ b/Source/core/dom/Text.cpp |
@@ -276,20 +276,33 @@ void Text::attach(const AttachContext& context) |
CharacterData::attach(context); |
} |
+class ClearNeedsStyleRecalcScope { |
+public: |
+ ClearNeedsStyleRecalcScope(Node* node) : m_node(node) { } |
+ ~ClearNeedsStyleRecalcScope() { m_node->clearNeedsStyleRecalc(); } |
esprehn
2013/06/14 08:32:29
I'd prefer you just put the clearNeedsStyleRecalc(
Hajime Morrita
2013/06/14 09:59:14
Done.
|
+private: |
+ Node* m_node; |
+}; |
+ |
void Text::recalcTextStyle(StyleChange change) |
esprehn
2013/06/14 08:32:29
I don't understand why you changed this function,
Hajime Morrita
2013/06/14 09:59:14
There is a case there change == NoChange but needs
|
{ |
+ ClearNeedsStyleRecalcScope scope(this); |
RenderText* renderer = toRenderText(this->renderer()); |
- if (change != NoChange && renderer) |
- renderer->setStyle(document()->styleResolver()->styleForText(this)); |
+ if (!renderer) { |
+ if (needsStyleRecalc()) |
+ reattach(); |
+ return; |
+ } |
if (needsStyleRecalc()) { |
- if (renderer) |
- renderer->setText(dataImpl()); |
- else |
- reattach(); |
+ renderer->setStyle(document()->styleResolver()->styleForText(this)); |
+ renderer->setText(dataImpl()); |
+ return; |
esprehn
2013/06/14 08:32:29
Remove this return and make the below if () an els
Hajime Morrita
2013/06/14 09:59:14
Done.
|
} |
- clearNeedsStyleRecalc(); |
+ |
+ if (change != NoChange) |
+ renderer->setStyle(document()->styleResolver()->styleForText(this)); |
} |
void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData) |