Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1299)

Unified Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 622253002: Pass start/length at InlineTextBox construction time. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/core/rendering/RenderText.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockLineLayout.cpp
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index 2bdbe2d8814a979da92f732d55f793eb59700188..4cd3937e549461039aa480e123f0871bd251c9bf 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -54,24 +54,33 @@ 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();
return toRenderInline(obj)->createAndAppendInlineFlowBox();
}
+static inline InlineTextBox* createInlineBoxForText(BidiRun& run, bool isOnlyRun)
+{
+ ASSERT(run.m_object->isText());
+ RenderText* text = toRenderText(run.m_object);
+ InlineTextBox* textBox = text->createInlineTextBox(run.m_start, run.m_stop - run.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 (text->isBR())
+ textBox->setIsText(isOnlyRun || text->document().inNoQuirksMode());
+ textBox->setDirOverride(run.dirOverride(text->style()->rtlOrdering() == VisualOrder));
+ if (run.m_hasHyphen)
+ textBox->setHasHyphen(true);
+ return textBox;
+}
+
static inline void dirtyLineBoxesForRenderer(RenderObject* o, bool fullLayout)
{
if (o->isText()) {
@@ -199,7 +208,11 @@ 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())
+ box = createInlineBoxForText(*r, isOnlyRun);
+ else
+ box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
r->m_box = box;
ASSERT(box);
@@ -221,17 +234,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);
}
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/core/rendering/RenderText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698