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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 CharacterData::attachLayoutTree(reattachContext); | 385 CharacterData::attachLayoutTree(reattachContext); |
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 // In case we don't perform rebuildTextLayoutTree we will never clear the | |
396 // NeedsReattachLayoutTree flag which is set on the creation of each | |
397 // Node. Clear that here. | |
398 clearNeedsReattachLayoutTree(); | |
esprehn
2017/02/16 05:49:25
I'm not sure how this is possible, I don't think i
nainar
2017/02/16 06:47:54
Done.
| |
395 } else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { | 399 } else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { |
396 rebuildTextLayoutTree(nextTextSibling); | 400 StyleReattachData styleReattachData; |
401 styleReattachData.nextTextSibling = nextTextSibling; | |
402 document().addStyleReattachData(*this, styleReattachData); | |
403 setNeedsReattachLayoutTree(); | |
397 } | 404 } |
398 } | 405 } |
399 | 406 |
400 void Text::rebuildTextLayoutTree(Text* nextTextSibling) { | 407 void Text::rebuildTextLayoutTree() { |
408 DCHECK(!childNeedsStyleRecalc()); | |
409 DCHECK(needsReattachLayoutTree()); | |
410 DCHECK(parentNode()); | |
411 | |
401 reattachLayoutTree(); | 412 reattachLayoutTree(); |
402 if (layoutObject()) | 413 if (layoutObject()) { |
403 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); | 414 reattachWhitespaceSiblingsIfNeeded( |
415 document().getStyleReattachData(*this).nextTextSibling); | |
416 } else { | |
417 clearNeedsStyleRecalc(); | |
esprehn
2017/02/16 05:49:25
how can this be true? reattachLayoutTree should ha
nainar
2017/02/16 06:47:54
Done.
| |
418 } | |
404 clearNeedsReattachLayoutTree(); | 419 clearNeedsReattachLayoutTree(); |
405 } | 420 } |
406 | 421 |
407 // If a whitespace node had no layoutObject and goes through a recalcStyle it | 422 // 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. | 423 // may need to create one if the parent style now has white-space: pre. |
409 bool Text::needsWhitespaceLayoutObject() { | 424 bool Text::needsWhitespaceLayoutObject() { |
410 DCHECK(!layoutObject()); | 425 DCHECK(!layoutObject()); |
411 if (const ComputedStyle* style = parentComputedStyle()) | 426 if (const ComputedStyle* style = parentComputedStyle()) |
412 return style->preserveNewline(); | 427 return style->preserveNewline(); |
413 return false; | 428 return false; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 | 466 |
452 Text* Text::cloneWithData(const String& data) { | 467 Text* Text::cloneWithData(const String& data) { |
453 return create(document(), data); | 468 return create(document(), data); |
454 } | 469 } |
455 | 470 |
456 DEFINE_TRACE(Text) { | 471 DEFINE_TRACE(Text) { |
457 CharacterData::trace(visitor); | 472 CharacterData::trace(visitor); |
458 } | 473 } |
459 | 474 |
460 } // namespace blink | 475 } // namespace blink |
OLD | NEW |