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

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

Issue 2421793002: Move layout tree reconstruction code for Text nodes into new function (Closed)
Patch Set: Bugs' changes Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.h ('k') | no next file » | 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 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 CharacterData::attachLayoutTree(reattachContext); 389 CharacterData::attachLayoutTree(reattachContext);
390 } 390 }
391 391
392 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) { 392 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) {
393 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) { 393 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) {
394 if (change != NoChange || needsStyleRecalc()) 394 if (change != NoChange || needsStyleRecalc())
395 layoutItem.setStyle(document().ensureStyleResolver().styleForText(this)); 395 layoutItem.setStyle(document().ensureStyleResolver().styleForText(this));
396 if (needsStyleRecalc()) 396 if (needsStyleRecalc())
397 layoutItem.setText(dataImpl()); 397 layoutItem.setText(dataImpl());
398 clearNeedsStyleRecalc(); 398 clearNeedsStyleRecalc();
399 } else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { 399 } else {
400 if (needsStyleRecalc()) {
401 setNeedsReattachLayoutTree();
Bugs Nash 2016/10/17 02:20:52 probably don't need to implement this yet, not nee
nainar 2016/10/17 16:57:31 The flag setting is being done in the mirror patch
402 clearNeedsStyleRecalc();
Bugs Nash 2016/10/17 02:20:52 why is this being changed in this patch?
403 }
404 rebuildTextLayoutTree(nextTextSibling);
405 }
406 }
407
408 void Text::rebuildTextLayoutTree(Text* nextTextSibling) {
409 if (needsReattachLayoutTree() || needsWhitespaceLayoutObject()) {
Bugs Nash 2016/10/17 02:20:52 this check doesn't belong in here, the method shou
nainar 2016/10/17 16:57:31 Seems like I misread your comment in the previous
400 reattachLayoutTree(); 410 reattachLayoutTree();
401 if (this->layoutObject()) 411 if (this->layoutObject())
402 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); 412 reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
403 clearNeedsReattachLayoutTree(); 413 clearNeedsReattachLayoutTree();
404 } 414 }
405 } 415 }
406 416
407 // If a whitespace node had no layoutObject and goes through a recalcStyle it 417 // If a whitespace node had no layoutObject and goes through a recalcStyle it
408 // may need to create one if the parent style now has white-space: pre. 418 // may need to create one if the parent style now has white-space: pre.
409 bool Text::needsWhitespaceLayoutObject() { 419 bool Text::needsWhitespaceLayoutObject() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 456
447 Text* Text::cloneWithData(const String& data) { 457 Text* Text::cloneWithData(const String& data) {
448 return create(document(), data); 458 return create(document(), data);
449 } 459 }
450 460
451 DEFINE_TRACE(Text) { 461 DEFINE_TRACE(Text) {
452 CharacterData::trace(visitor); 462 CharacterData::trace(visitor);
453 } 463 }
454 464
455 } // namespace blink 465 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698