Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index fbf39328a2d0617a72cd8936225e39b99c16b7eb..d2ab0c0081ce5f779b3c4ce1a54e0988e041b256 100644 |
| --- a/Source/core/rendering/RenderBlock.cpp |
| +++ b/Source/core/rendering/RenderBlock.cpp |
| @@ -29,6 +29,7 @@ |
| #include "core/dom/Document.h" |
| #include "core/dom/Element.h" |
| #include "core/dom/OverflowEvent.h" |
| +#include "core/dom/Text.h" |
| #include "core/dom/shadow/ShadowRoot.h" |
| #include "core/editing/Editor.h" |
| #include "core/editing/FrameSelection.h" |
| @@ -6724,8 +6725,6 @@ void RenderBlock::updateFirstLetter() |
| if (style()->styleType() == FIRST_LETTER) |
| return; |
| - // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find |
| - // an efficient way to check for that situation though before implementing anything. |
| RenderObject* firstLetterBlock = findFirstLetterBlock(this); |
| if (!firstLetterBlock) |
| return; |
| @@ -6756,9 +6755,22 @@ void RenderBlock::updateFirstLetter() |
| if (!currChild) |
| return; |
| - // If the child already has style, then it has already been created, so we just want |
| - // to update it. |
| if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
| + // Destroy the first-letter object if it is no longer the first child. |
| + RenderObject* remainingText = currChild->parent()->nextSibling(); |
|
esprehn
2013/09/09 21:22:57
How do you know the currentCuild->parent() has a n
joone
2013/09/09 22:36:25
The currentChild is the firstLetter(RenderTextFrag
|
| + if (currChild->node() != remainingText->node()) { |
| + LayoutStateDisabler layoutStateDisabler(view()); |
| + |
| + RenderObject* oldRemainingText = toRenderBoxModelObject(currChild->parent())->firstLetterRemainingText(); |
| + if (oldRemainingText) |
| + toRenderText(oldRemainingText)->setText(toText(oldRemainingText->node())->data().impl()); |
| + |
| + createFirstLetterRenderer(firstLetterBlock, remainingText); |
|
esprehn
2013/09/09 21:22:57
What destroyed the original RenderTextFragment tha
joone
2013/09/09 22:36:25
When setting a new text to RenderTextFragment(Rema
|
| + return; |
| + } |
| + |
| + // If the child already has style, then it has already been created, so we just want |
| + // to update it. |
| updateFirstLetterStyle(firstLetterBlock, currChild); |
| return; |
| } |