Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 rebuildTextLayoutTree(nextTextSibling); | |
| 401 } | |
| 402 } | |
| 403 | |
| 404 void Text::rebuildTextLayoutTree(Text* nextTextSibling) { | |
| 405 if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { | |
|
Bugs Nash
2016/10/14 03:58:18
needsStyleRecalc() probably shouldn't be inside th
| |
| 400 reattachLayoutTree(); | 406 reattachLayoutTree(); |
| 401 if (this->layoutObject()) | 407 if (this->layoutObject()) |
| 402 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); | 408 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); |
| 403 clearNeedsReattachLayoutTree(); | 409 clearNeedsReattachLayoutTree(); |
| 404 } | 410 } |
| 405 } | 411 } |
| 406 | 412 |
| 407 // If a whitespace node had no layoutObject and goes through a recalcStyle it | 413 // 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. | 414 // may need to create one if the parent style now has white-space: pre. |
| 409 bool Text::needsWhitespaceLayoutObject() { | 415 bool Text::needsWhitespaceLayoutObject() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 | 452 |
| 447 Text* Text::cloneWithData(const String& data) { | 453 Text* Text::cloneWithData(const String& data) { |
| 448 return create(document(), data); | 454 return create(document(), data); |
| 449 } | 455 } |
| 450 | 456 |
| 451 DEFINE_TRACE(Text) { | 457 DEFINE_TRACE(Text) { |
| 452 CharacterData::trace(visitor); | 458 CharacterData::trace(visitor); |
| 453 } | 459 } |
| 454 | 460 |
| 455 } // namespace blink | 461 } // namespace blink |
| OLD | NEW |