Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: Source/core/dom/Text.cpp

Issue 17054002: Element::recalcStyle() overly reattach()-es InsertionPoints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698