Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index ecc9665a2604c3edf58b5a3089be3f5056fc00e7..9f1e2e215d002ec6e9c82af40ed37dc1387bd7cb 100644 |
| --- a/Source/core/rendering/RenderBlock.cpp |
| +++ b/Source/core/rendering/RenderBlock.cpp |
| @@ -28,6 +28,7 @@ |
| #include "core/accessibility/AXObjectCache.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/Element.h" |
| +#include "core/dom/Text.h" |
| #include "core/events/OverflowEvent.h" |
| #include "core/dom/shadow/ShadowRoot.h" |
| #include "core/editing/Editor.h" |
| @@ -5810,8 +5811,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; |
| @@ -5842,9 +5841,25 @@ 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(); |
| + if (remainingText && currChild->node() != remainingText->node()) { |
| + if (!remainingText->isText() || remainingText->isBR()) |
| + return; |
| + |
| + LayoutStateDisabler layoutStateDisabler(view()); |
| + |
| + RenderObject* oldRemainingText = toRenderBoxModelObject(currChild->parent())->firstLetterRemainingText(); |
| + if (oldRemainingText) |
|
esprehn
2013/09/27 18:30:15
We usually write these as one statement:
if (Rend
|
| + toRenderText(oldRemainingText)->setText(toText(oldRemainingText->node())->data().impl()); |
| + |
| + createFirstLetterRenderer(firstLetterBlock, remainingText); |
| + return; |
| + } |
| + |
| + // If the child already has style, then it has already been created, so we just want |
| + // to update it. |
| updateFirstLetterStyle(firstLetterBlock, currChild); |
| return; |
| } |