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

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..07fa6dd213a4afa49d9856d7a45af5c3a86c8fba 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,6 +283,16 @@ void SVGFontFaceElement::rebuildFontFace()
list->append(CSSFontFaceSrcValue::createLocal(fontFamily()));
} else {
m_fontElement = 0;
+ // we currently ignore all but the first src element, alternatively we could concat them
Stephen Chennney 2014/01/10 12:22:34 The comment was wrong before and it's still wrong
gyuyoung-inactive 2014/01/10 15:46:23 Fixed. Thanks.
fs 2014/01/10 17:43:00 Friendly note: The comment was actually correct -
+ SVGFontFaceSrcElement* srcElement = 0;
+
+ for (Node* child = lastChild(); child && !srcElement; child = child->previousSibling()) {
+ if (child->hasTagName(font_face_srcTag)) {
+ srcElement = static_cast<SVGFontFaceSrcElement*>(child);
+ break;
+ }
+ }
+
if (srcElement)
list = srcElement->srcValue();
Stephen Chennney 2014/01/10 12:22:34 This can be moved up inside the if. You don't need
gyuyoung-inactive 2014/01/10 15:46:23 Yes, right. Moved it into inside the if.
}
« 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