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

Side by Side 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: For landing 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/NodeRenderingTraversal.cpp ('k') | Source/core/dom/shadow/ContentDistributor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 void Text::attach(const AttachContext& context) 273 void Text::attach(const AttachContext& context)
274 { 274 {
275 createTextRendererIfNeeded(); 275 createTextRendererIfNeeded();
276 CharacterData::attach(context); 276 CharacterData::attach(context);
277 } 277 }
278 278
279 void Text::recalcTextStyle(StyleChange change) 279 void Text::recalcTextStyle(StyleChange change)
280 { 280 {
281 RenderText* renderer = toRenderText(this->renderer()); 281 RenderText* renderer = toRenderText(this->renderer());
282 282
283 if (change != NoChange && renderer) 283 if (!renderer) {
284 renderer->setStyle(document()->styleResolver()->styleForText(this)); 284 if (needsStyleRecalc())
285 reattach();
286 clearNeedsStyleRecalc();
287 return;
288 }
285 289
286 if (needsStyleRecalc()) { 290 if (needsStyleRecalc()) {
287 if (renderer) 291 renderer->setStyle(document()->styleResolver()->styleForText(this));
288 renderer->setText(dataImpl()); 292 renderer->setText(dataImpl());
289 else 293 } else if (change != NoChange) {
290 reattach(); 294 renderer->setStyle(document()->styleResolver()->styleForText(this));
291 } 295 }
296
292 clearNeedsStyleRecalc(); 297 clearNeedsStyleRecalc();
293 } 298 }
294 299
295 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe placedData) 300 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe placedData)
296 { 301 {
297 if (!attached()) 302 if (!attached())
298 return; 303 return;
299 RenderText* textRenderer = toRenderText(renderer()); 304 RenderText* textRenderer = toRenderText(renderer());
300 if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRe nderer->style()))) { 305 if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRe nderer->style()))) {
301 reattach(); 306 reattach();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 result.appendLiteral("; "); 346 result.appendLiteral("; ");
342 result.appendLiteral("value="); 347 result.appendLiteral("value=");
343 result.append(s); 348 result.append(s);
344 } 349 }
345 350
346 strncpy(buffer, result.toString().utf8().data(), length - 1); 351 strncpy(buffer, result.toString().utf8().data(), length - 1);
347 } 352 }
348 #endif 353 #endif
349 354
350 } // namespace WebCore 355 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/NodeRenderingTraversal.cpp ('k') | Source/core/dom/shadow/ContentDistributor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698