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

Unified Diff: Source/core/svg/SVGFontFaceElement.cpp

Issue 133493002: Improve a search logic to find a SVGFontFaceSrcElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGFontFaceElement.cpp
diff --git a/Source/core/svg/SVGFontFaceElement.cpp b/Source/core/svg/SVGFontFaceElement.cpp
index 73402cb64b750f9febc1894f39c571360b7d9cfb..0ed949ca99fc1bc6aec9656d8c55615eb0ab0251 100644
--- a/Source/core/svg/SVGFontFaceElement.cpp
+++ b/Source/core/svg/SVGFontFaceElement.cpp
@@ -273,14 +273,6 @@ void SVGFontFaceElement::rebuildFontFace()
return;
}
- // we currently ignore all but the first src element, alternatively we could concat them
- SVGFontFaceSrcElement* srcElement = 0;
-
- for (Node* child = firstChild(); child && !srcElement; child = child->nextSibling()) {
- if (child->hasTagName(font_face_srcTag))
- srcElement = static_cast<SVGFontFaceSrcElement*>(child);
- }
-
bool describesParentFont = parentNode()->hasTagName(SVGNames::fontTag);
RefPtr<CSSValueList> list;
@@ -291,8 +283,13 @@ void SVGFontFaceElement::rebuildFontFace()
list->append(CSSFontFaceSrcValue::createLocal(fontFamily()));
} else {
m_fontElement = 0;
- if (srcElement)
- list = srcElement->srcValue();
+ // we currently ignore all but the last src element, alternatively we could concat them
+ for (Node* child = lastChild(); child && !list; child = child->previousSibling()) {
+ if (child->hasTagName(font_face_srcTag)) {
+ list = static_cast<SVGFontFaceSrcElement*>(child)->srcValue();
+ break;
+ }
+ }
}
if (!list || !list->length())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698