Chromium Code Reviews| Index: Source/core/rendering/RenderBlockLineLayout.cpp |
| diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
| index 2bdbe2d8814a979da92f732d55f793eb59700188..b9e6114da09a68f1805e5c03ec49fc34b8acd87a 100644 |
| --- a/Source/core/rendering/RenderBlockLineLayout.cpp |
| +++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
| @@ -54,18 +54,12 @@ using namespace WTF::Unicode; |
| static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRootLineBox, bool isOnlyRun = false) |
| { |
| + // Callers should handle text themselves. |
| + ASSERT(!obj->isText()); |
| + |
| if (isRootLineBox) |
| return toRenderBlockFlow(obj)->createAndAppendRootInlineBox(); |
| - if (obj->isText()) { |
| - InlineTextBox* textBox = toRenderText(obj)->createInlineTextBox(); |
| - // We only treat a box as text for a <br> if we are on a line by ourself or in strict mode |
| - // (Note the use of strict mode. In "almost strict" mode, we don't treat the box for <br> as text.) |
| - if (obj->isBR()) |
| - textBox->setIsText(isOnlyRun || obj->document().inNoQuirksMode()); |
| - return textBox; |
| - } |
| - |
| if (obj->isBox()) |
| return toRenderBox(obj)->createInlineBox(); |
| @@ -199,7 +193,22 @@ RootInlineBox* RenderBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, co |
| if (lineInfo.isEmpty()) |
| continue; |
| - InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun); |
| + InlineBox* box; |
| + if (r->m_object->isText()) { |
| + RenderText* text = toRenderText(r->m_object); |
|
f(malita)
2014/10/06 15:18:23
Let's use a helper for this block too (createInlin
jbroman
2014/10/06 19:08:48
Done.
|
| + InlineTextBox* textBox = text->createInlineTextBox(r->m_start, r->m_stop - r->m_start); |
| + // We only treat a box as text for a <br> if we are on a line by ourself or in strict mode |
| + // (Note the use of strict mode. In "almost strict" mode, we don't treat the box for <br> as text.) |
| + if (r->m_object->isBR()) |
| + textBox->setIsText(isOnlyRun || text->document().inNoQuirksMode()); |
| + textBox->setDirOverride(r->dirOverride(text->style()->rtlOrdering() == VisualOrder)); |
| + if (r->m_hasHyphen) |
| + textBox->setHasHyphen(true); |
| + |
| + box = textBox; |
| + } else { |
| + box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun); |
| + } |
| r->m_box = box; |
| ASSERT(box); |
| @@ -221,17 +230,9 @@ RootInlineBox* RenderBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, co |
| parentBox->addToLine(box); |
| } |
| - bool visuallyOrdered = r->m_object->style()->rtlOrdering() == VisualOrder; |
| box->setBidiLevel(r->level()); |
| if (box->isInlineTextBox()) { |
| - InlineTextBox* text = toInlineTextBox(box); |
| - text->setStart(r->m_start); |
| - text->setLen(r->m_stop - r->m_start); |
| - text->setDirOverride(r->dirOverride(visuallyOrdered)); |
| - if (r->m_hasHyphen) |
| - text->setHasHyphen(true); |
| - |
| if (AXObjectCache* cache = document().existingAXObjectCache()) |
| cache->inlineTextBoxesUpdated(r->m_object); |
| } |