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

Unified Diff: third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h

Issue 1547263002: Fix SVGInlineTextMetricsIterator not to keep a pointer to LineLayoutItem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eae review, remove excessive assert Created 5 years 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 | « no previous file | third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h
index 02496d4ab935ff2495281dfb7d636f28ae06ace0..3fe308cf0aaabf058fcf56088e8b0f155f88e9eb 100644
--- a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h
+++ b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h
@@ -63,12 +63,12 @@ private:
class SVGInlineTextMetricsIterator {
DISALLOW_NEW();
public:
- SVGInlineTextMetricsIterator() { reset(nullptr); }
+ SVGInlineTextMetricsIterator() { reset(LineLayoutSVGInlineText()); }
- void advanceToTextStart(LineLayoutSVGInlineText* textLineLayout, unsigned startCharacterOffset)
+ void advanceToTextStart(LineLayoutSVGInlineText textLineLayout, unsigned startCharacterOffset)
{
ASSERT(textLineLayout);
- if (m_textLineLayout != textLineLayout) {
+ if (!m_textLineLayout || !m_textLineLayout.isEqual(textLineLayout)) {
reset(textLineLayout);
ASSERT(!metricsList().isEmpty());
}
@@ -82,11 +82,14 @@ public:
while (m_characterOffset < startCharacterOffset)
next();
+ ASSERT(m_characterOffset == startCharacterOffset);
}
void next()
{
m_characterOffset += metrics().length();
+ ASSERT(m_characterOffset <= m_textLineLayout.length());
+ ASSERT(m_metricsListOffset < metricsList().size());
++m_metricsListOffset;
}
@@ -95,20 +98,20 @@ public:
ASSERT(m_textLineLayout && m_metricsListOffset < metricsList().size());
return metricsList()[m_metricsListOffset];
}
- const Vector<SVGTextMetrics>& metricsList() const { return m_textLineLayout->layoutAttributes()->textMetricsValues(); }
+ const Vector<SVGTextMetrics>& metricsList() const { return m_textLineLayout.layoutAttributes()->textMetricsValues(); }
unsigned metricsListOffset() const { return m_metricsListOffset; }
unsigned characterOffset() const { return m_characterOffset; }
bool isAtEnd() const { return m_metricsListOffset == metricsList().size(); }
private:
- void reset(LineLayoutSVGInlineText* textLineLayout)
+ void reset(LineLayoutSVGInlineText textLineLayout)
{
m_textLineLayout = textLineLayout;
m_characterOffset = 0;
m_metricsListOffset = 0;
}
- LineLayoutSVGInlineText* m_textLineLayout;
+ LineLayoutSVGInlineText m_textLineLayout;
unsigned m_metricsListOffset;
unsigned m_characterOffset;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698