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

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

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. Created 6 years, 10 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
Index: Source/core/rendering/RenderInline.cpp
diff --git a/Source/core/rendering/RenderInline.cpp b/Source/core/rendering/RenderInline.cpp
index c4a3360bffc533a61d83bb09db5fb584d90c65f2..6f6fdd6db85ff08ae782227e7596763ed7ca6057 100644
--- a/Source/core/rendering/RenderInline.cpp
+++ b/Source/core/rendering/RenderInline.cpp
@@ -558,9 +558,9 @@ void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren
if (curr->isBox()) {
RenderBox* currBox = toRenderBox(curr);
if (currBox->inlineBoxWrapper()) {
- RootInlineBox* rootBox = currBox->inlineBoxWrapper()->root();
- int logicalTop = rootBox->logicalTop() + (rootBox->renderer().style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
- int logicalHeight = container->style(rootBox->isFirstLineStyle())->font().fontMetrics().height();
+ RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root();
+ int logicalTop = rootBox.logicalTop() + (rootBox.renderer().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
+ int logicalHeight = container->style(rootBox.isFirstLineStyle())->font().fontMetrics().height();
if (isHorizontal)
yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox->marginLeft(), logicalTop, currBox->width() + currBox->marginWidth(), logicalHeight));
else
@@ -573,9 +573,9 @@ void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren
currInline->generateCulledLineBoxRects(yield, container);
else {
for (InlineFlowBox* childLine = currInline->firstLineBox(); childLine; childLine = childLine->nextLineBox()) {
- RootInlineBox* rootBox = childLine->root();
- int logicalTop = rootBox->logicalTop() + (rootBox->renderer().style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
- int logicalHeight = container->style(rootBox->isFirstLineStyle())->font().fontMetrics().height();
+ RootInlineBox& rootBox = childLine->root();
+ int logicalTop = rootBox.logicalTop() + (rootBox.renderer().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
+ int logicalHeight = container->style(rootBox.isFirstLineStyle())->font().fontMetrics().height();
if (isHorizontal)
yield(FloatRect(childLine->x() - childLine->marginLogicalLeft(),
logicalTop,
@@ -591,9 +591,9 @@ void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren
} else if (curr->isText()) {
RenderText* currText = toRenderText(curr);
for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) {
- RootInlineBox* rootBox = childText->root();
- int logicalTop = rootBox->logicalTop() + (rootBox->renderer().style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
- int logicalHeight = container->style(rootBox->isFirstLineStyle())->font().fontMetrics().height();
+ RootInlineBox& rootBox = childText->root();
+ int logicalTop = rootBox.logicalTop() + (rootBox.renderer().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
+ int logicalHeight = container->style(rootBox.isFirstLineStyle())->font().fontMetrics().height();
if (isHorizontal)
yield(FloatRect(childText->x(), logicalTop, childText->logicalWidth(), logicalHeight));
else
@@ -980,12 +980,12 @@ LayoutRect RenderInline::linesVisualOverflowBoundingBox() const
logicalRightSide = max(logicalRightSide, curr->logicalRightVisualOverflow());
}
- RootInlineBox* firstRootBox = firstLineBox()->root();
- RootInlineBox* lastRootBox = lastLineBox()->root();
+ RootInlineBox& firstRootBox = firstLineBox()->root();
+ RootInlineBox& lastRootBox = lastLineBox()->root();
- LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBox->lineTop());
+ LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBox.lineTop());
LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
- LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRootBox->lineBottom()) - logicalTop;
+ LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRootBox.lineBottom()) - logicalTop;
LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
if (!style()->isHorizontalWritingMode())
@@ -1246,16 +1246,16 @@ void RenderInline::dirtyLineBoxes(bool fullLayout)
if (curr->isBox() && !curr->needsLayout()) {
RenderBox* currBox = toRenderBox(curr);
if (currBox->inlineBoxWrapper())
- currBox->inlineBoxWrapper()->root()->markDirty();
+ currBox->inlineBoxWrapper()->root().markDirty();
} else if (!curr->selfNeedsLayout()) {
if (curr->isRenderInline()) {
RenderInline* currInline = toRenderInline(curr);
for (InlineFlowBox* childLine = currInline->firstLineBox(); childLine; childLine = childLine->nextLineBox())
- childLine->root()->markDirty();
+ childLine->root().markDirty();
} else if (curr->isText()) {
RenderText* currText = toRenderText(curr);
for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox())
- childText->root()->markDirty();
+ childText->root().markDirty();
}
}
}
@@ -1424,9 +1424,9 @@ void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf
rects.append(LayoutRect());
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
- RootInlineBox* root = curr->root();
- LayoutUnit top = max<LayoutUnit>(root->lineTop(), curr->logicalTop());
- LayoutUnit bottom = min<LayoutUnit>(root->lineBottom(), curr->logicalBottom());
+ RootInlineBox& root = curr->root();
+ LayoutUnit top = max<LayoutUnit>(root.lineTop(), curr->logicalTop());
+ LayoutUnit bottom = min<LayoutUnit>(root.lineBottom(), curr->logicalBottom());
rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - top));
}
rects.append(LayoutRect());

Powered by Google App Engine
This is Rietveld 408576698