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

Unified Diff: Source/core/rendering/svg/SVGRootInlineBox.cpp

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/svg/SVGRootInlineBox.cpp
diff --git a/Source/core/rendering/svg/SVGRootInlineBox.cpp b/Source/core/rendering/svg/SVGRootInlineBox.cpp
index 6fe6f19b66470d69685e7ce5703f48f07311f1e0..fd4e4a7baf8b088aa0ac84e5992346411a49b918 100644
--- a/Source/core/rendering/svg/SVGRootInlineBox.cpp
+++ b/Source/core/rendering/svg/SVGRootInlineBox.cpp
@@ -38,10 +38,7 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
ASSERT(!paintInfo.context->paintingDisabled());
- RenderObject* boxRenderer = renderer();
- ASSERT(boxRenderer);
-
- bool isPrinting = renderer()->document().printing();
+ bool isPrinting = renderer().document().printing();
bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
PaintInfo childPaintInfo(paintInfo);
@@ -54,7 +51,7 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
}
}
- SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingContext::SaveGraphicsContext);
+ SVGRenderingContext renderingContext(&renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
if (renderingContext.isRenderingPrepared()) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine())
child->paint(paintInfo, paintOffset, 0, 0);
@@ -71,14 +68,13 @@ void SVGRootInlineBox::markDirty(bool dirty)
void SVGRootInlineBox::computePerCharacterLayoutInformation()
{
- RenderSVGText* textRoot = toRenderSVGText(block());
- ASSERT(textRoot);
+ RenderSVGText& textRoot = toRenderSVGText(block());
- Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot->layoutAttributes();
+ Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot.layoutAttributes();
if (layoutAttributes.isEmpty())
return;
- if (textRoot->needsReordering())
+ if (textRoot.needsReordering())
reorderValueLists(layoutAttributes);
// Perform SVG text layout phase two (see SVGTextLayoutEngine for details).
@@ -99,12 +95,11 @@ void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
{
for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox()) {
- ASSERT(child->renderer());
- ASSERT(child->renderer()->isSVGInlineText());
+ ASSERT(child->renderer().isSVGInlineText());
characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child));
} else {
// Skip generated content.
- Node* node = child->renderer()->node();
+ Node* node = child->renderer().node();
if (!node)
continue;
@@ -116,7 +111,7 @@ void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes());
layoutCharactersInTextBoxes(flowBox, lineLayout);
- characterLayout.beginTextPathLayout(child->renderer(), lineLayout);
+ characterLayout.beginTextPathLayout(&child->renderer(), lineLayout);
}
layoutCharactersInTextBoxes(flowBox, characterLayout);
@@ -132,8 +127,7 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
FloatRect boxRect;
if (child->isSVGInlineTextBox()) {
- ASSERT(child->renderer());
- ASSERT(child->renderer()->isSVGInlineText());
+ ASSERT(child->renderer().isSVGInlineText());
SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
boxRect = textBox->calculateBoundaries();
@@ -143,7 +137,7 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
textBox->setLogicalHeight(boxRect.height());
} else {
// Skip generated content.
- if (!child->renderer()->node())
+ if (!child->renderer().node())
continue;
SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
@@ -162,8 +156,7 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
void SVGRootInlineBox::layoutRootBox(const FloatRect& childRect)
{
- RenderBlockFlow* parentBlock = block();
- ASSERT(parentBlock);
+ RenderBlockFlow* parentBlock = &block();
Inactive 2014/02/28 02:28:19 RenderBlockFlow& parentBlock = block();
ostap 2014/02/28 08:29:14 Done.
// Finally, assign the root block position, now that all content is laid out.
LayoutRect boundingRect = enclosingLayoutRect(childRect);
@@ -173,7 +166,7 @@ void SVGRootInlineBox::layoutRootBox(const FloatRect& childRect)
// Position all children relative to the parent block.
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
// Skip generated content.
- if (!child->renderer()->node())
+ if (!child->renderer().node())
continue;
child->adjustPosition(-childRect.x(), -childRect.y());
}
@@ -268,12 +261,12 @@ static inline void reverseInlineBoxRangeAndValueListsIfNeeded(void* userData, Ve
// Reordering is only necessary for BiDi text that is _absolutely_ positioned.
if (firstTextBox->len() == 1 && firstTextBox->len() == lastTextBox->len()) {
- RenderSVGInlineText* firstContext = toRenderSVGInlineText(firstTextBox->textRenderer());
- RenderSVGInlineText* lastContext = toRenderSVGInlineText(lastTextBox->textRenderer());
+ RenderSVGInlineText& firstContext = toRenderSVGInlineText(firstTextBox->textRenderer());
+ RenderSVGInlineText& lastContext = toRenderSVGInlineText(lastTextBox->textRenderer());
SVGTextLayoutAttributes* firstAttributes = 0;
SVGTextLayoutAttributes* lastAttributes = 0;
- findFirstAndLastAttributesInVector(attributes, firstContext, lastContext, firstAttributes, lastAttributes);
+ findFirstAndLastAttributesInVector(attributes, &firstContext, &lastContext, firstAttributes, lastAttributes);
swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTextBox->start(), lastTextBox->start());
}

Powered by Google App Engine
This is Rietveld 408576698