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

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

Issue 715023002: Make SVGTextPositioningElement::elementFromRenderer take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compile problem Created 6 years, 1 month 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/SVGTextLayoutAttributesBuilder.cpp
diff --git a/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp b/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
index fdee455dbee485dd4482e641aa5729979d9f644c..ff4cd225ef401bb6c7db852f101e569d0ebe41cc 100644
--- a/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
@@ -21,6 +21,7 @@
#include "core/rendering/svg/SVGTextLayoutAttributesBuilder.h"
+#include "core/rendering/svg/RenderSVGInline.h"
#include "core/rendering/svg/RenderSVGInlineText.h"
#include "core/rendering/svg/RenderSVGText.h"
#include "core/rendering/svg/SVGTextMetricsBuilder.h"
@@ -46,21 +47,19 @@ void SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextRenderer(Render
m_textLength = 0;
UChar lastCharacter = ' ';
- collectTextPositioningElements(textRoot, lastCharacter);
+ collectTextPositioningElements(*textRoot, lastCharacter);
if (!m_textLength)
return;
- buildCharacterDataMap(textRoot);
+ buildCharacterDataMap(*textRoot);
}
SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(textRoot, text, m_characterDataMap);
}
-bool SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree(RenderSVGText* textRoot)
+bool SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree(RenderSVGText& textRoot)
{
- ASSERT(textRoot);
-
m_characterDataMap.clear();
if (m_textPositions.isEmpty()) {
@@ -73,7 +72,7 @@ bool SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree(RenderSV
return false;
buildCharacterDataMap(textRoot);
- SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(textRoot, 0, m_characterDataMap);
+ SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(&textRoot, nullptr, m_characterDataMap);
return true;
}
@@ -101,11 +100,11 @@ static inline void processRenderSVGInlineText(RenderSVGInlineText* text, unsigne
}
}
-void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject* start, UChar& lastCharacter)
+void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderBoxModelObject& start, UChar& lastCharacter)
{
- ASSERT(!start->isSVGText() || m_textPositions.isEmpty());
+ ASSERT(!start.isSVGText() || m_textPositions.isEmpty());
- for (RenderObject* child = start->slowFirstChild(); child; child = child->nextSibling()) {
+ for (RenderObject* child = start.slowFirstChild(); child; child = child->nextSibling()) {
if (child->isSVGInlineText()) {
processRenderSVGInlineText(toRenderSVGInlineText(child), m_textLength, lastCharacter);
continue;
@@ -114,12 +113,13 @@ void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject
if (!child->isSVGInline())
continue;
- SVGTextPositioningElement* element = SVGTextPositioningElement::elementFromRenderer(child);
+ RenderSVGInline& inlineChild = toRenderSVGInline(*child);
+ SVGTextPositioningElement* element = SVGTextPositioningElement::elementFromRenderer(inlineChild);
unsigned atPosition = m_textPositions.size();
if (element)
m_textPositions.append(TextPosition(element, m_textLength));
- collectTextPositioningElements(child, lastCharacter);
+ collectTextPositioningElements(inlineChild, lastCharacter);
if (!element)
continue;
@@ -131,7 +131,7 @@ void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject
}
}
-void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(RenderSVGText* textRoot)
+void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(RenderSVGText& textRoot)
{
SVGTextPositioningElement* outermostTextElement = SVGTextPositioningElement::elementFromRenderer(textRoot);
ASSERT(outermostTextElement);
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.h ('k') | Source/core/svg/SVGTextPositioningElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698