Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp |
index 2be4dbc870e84d0d7a005a4c2bf77d72beea3346..326ddda335f5e773e7d90302a1fd0b72488fbfa0 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp |
@@ -149,25 +149,17 @@ void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(LayoutSVGText& textRo |
TextPosition wholeTextPosition(outermostTextElement, 0, m_textLength); |
fillCharacterDataMap(wholeTextPosition); |
- // Handle x/y default attributes. |
- SVGCharacterDataMap::iterator it = m_characterDataMap.find(1); |
- if (it == m_characterDataMap.end()) { |
- SVGCharacterData data; |
- data.x = 0; |
- data.y = 0; |
- m_characterDataMap.set(1, data); |
- } else { |
- SVGCharacterData& data = it->value; |
- if (SVGTextLayoutAttributes::isEmptyValue(data.x)) |
- data.x = 0; |
- if (SVGTextLayoutAttributes::isEmptyValue(data.y)) |
- data.y = 0; |
- } |
- |
// Fill character data map using child text positioning elements in top-down order. |
unsigned size = m_textPositions.size(); |
for (unsigned i = 0; i < size; ++i) |
fillCharacterDataMap(m_textPositions[i]); |
+ |
+ // Handle x/y default attributes. |
+ SVGCharacterData& data = m_characterDataMap.add(1, SVGCharacterData()).storedValue->value; |
+ if (SVGTextLayoutAttributes::isEmptyValue(data.x)) |
+ data.x = 0; |
+ if (SVGTextLayoutAttributes::isEmptyValue(data.y)) |
+ data.y = 0; |
} |
static inline void updateCharacterData(unsigned i, float& lastRotation, SVGCharacterData& data, const SVGLengthContext& lengthContext, const SVGLengthList* xList, const SVGLengthList* yList, const SVGLengthList* dxList, const SVGLengthList* dyList, const SVGNumberList* rotateList) |
@@ -213,15 +205,8 @@ void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po |
if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr) |
break; |
- SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.start + i + 1); |
- if (it == m_characterDataMap.end()) { |
- SVGCharacterData data; |
- updateCharacterData(i, lastRotation, data, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); |
- m_characterDataMap.set(position.start + i + 1, data); |
- continue; |
- } |
- |
- updateCharacterData(i, lastRotation, it->value, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); |
+ SVGCharacterData& data = m_characterDataMap.add(position.start + i + 1, SVGCharacterData()).storedValue->value; |
+ updateCharacterData(i, lastRotation, data, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); |
} |
// The last rotation value always spans the whole scope. |
@@ -229,15 +214,8 @@ void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po |
return; |
for (unsigned i = rotateList->length(); i < position.length; ++i) { |
- SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.start + i + 1); |
- if (it == m_characterDataMap.end()) { |
- SVGCharacterData data; |
- data.rotate = lastRotation; |
- m_characterDataMap.set(position.start + i + 1, data); |
- continue; |
- } |
- |
- it->value.rotate = lastRotation; |
+ SVGCharacterData& data = m_characterDataMap.add(position.start + i + 1, SVGCharacterData()).storedValue->value; |
+ data.rotate = lastRotation; |
} |
} |