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

Side by Side Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 2729453002: Revert of Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Created 3 years, 9 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
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 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 386 }
387 387
388 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) { 388 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) {
389 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) { 389 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) {
390 if (change != NoChange || needsStyleRecalc()) 390 if (change != NoChange || needsStyleRecalc())
391 layoutItem.setStyle(document().ensureStyleResolver().styleForText(this)); 391 layoutItem.setStyle(document().ensureStyleResolver().styleForText(this));
392 if (needsStyleRecalc()) 392 if (needsStyleRecalc())
393 layoutItem.setText(dataImpl()); 393 layoutItem.setText(dataImpl());
394 clearNeedsStyleRecalc(); 394 clearNeedsStyleRecalc();
395 } else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { 395 } else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) {
396 StyleReattachData styleReattachData; 396 rebuildTextLayoutTree(nextTextSibling);
397 styleReattachData.nextTextSibling = nextTextSibling;
398 document().addStyleReattachData(*this, styleReattachData);
399 setNeedsReattachLayoutTree();
400 } 397 }
401 } 398 }
402 399
403 void Text::rebuildTextLayoutTree() { 400 void Text::rebuildTextLayoutTree(Text* nextTextSibling) {
404 DCHECK(!childNeedsStyleRecalc());
405 DCHECK(needsReattachLayoutTree());
406 DCHECK(parentNode());
407
408 reattachLayoutTree(); 401 reattachLayoutTree();
409 if (layoutObject()) { 402 if (layoutObject())
410 reattachWhitespaceSiblingsIfNeeded( 403 reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
411 document().getStyleReattachData(*this).nextTextSibling);
412 }
413 clearNeedsReattachLayoutTree(); 404 clearNeedsReattachLayoutTree();
414 } 405 }
415 406
416 // If a whitespace node had no layoutObject and goes through a recalcStyle it 407 // If a whitespace node had no layoutObject and goes through a recalcStyle it
417 // may need to create one if the parent style now has white-space: pre. 408 // may need to create one if the parent style now has white-space: pre.
418 bool Text::needsWhitespaceLayoutObject() { 409 bool Text::needsWhitespaceLayoutObject() {
419 DCHECK(!layoutObject()); 410 DCHECK(!layoutObject());
420 if (const ComputedStyle* style = parentComputedStyle()) 411 if (const ComputedStyle* style = parentComputedStyle())
421 return style->preserveNewline(); 412 return style->preserveNewline();
422 return false; 413 return false;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 451
461 Text* Text::cloneWithData(const String& data) { 452 Text* Text::cloneWithData(const String& data) {
462 return create(document(), data); 453 return create(document(), data);
463 } 454 }
464 455
465 DEFINE_TRACE(Text) { 456 DEFINE_TRACE(Text) {
466 CharacterData::trace(visitor); 457 CharacterData::trace(visitor);
467 } 458 }
468 459
469 } // namespace blink 460 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.h ('k') | third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698