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

Side by Side Diff: Source/core/svg/SVGFontFaceUriElement.cpp

Issue 21032002: Introduce toSVGFontFaceElement, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGFontFaceSrcElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void SVGFontFaceUriElement::childrenChanged(bool changedByParser, Node* beforeCh ange, Node* afterChange, int childCountDelta) 73 void SVGFontFaceUriElement::childrenChanged(bool changedByParser, Node* beforeCh ange, Node* afterChange, int childCountDelta)
74 { 74 {
75 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta); 75 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta);
76 76
77 if (!parentNode() || !parentNode()->hasTagName(font_face_srcTag)) 77 if (!parentNode() || !parentNode()->hasTagName(font_face_srcTag))
78 return; 78 return;
79 79
80 ContainerNode* grandparent = parentNode()->parentNode(); 80 ContainerNode* grandparent = parentNode()->parentNode();
81 if (grandparent && grandparent->hasTagName(font_faceTag)) 81 if (grandparent && grandparent->hasTagName(font_faceTag))
82 static_cast<SVGFontFaceElement*>(grandparent)->rebuildFontFace(); 82 toSVGFontFaceElement(grandparent)->rebuildFontFace();
83 } 83 }
84 84
85 Node::InsertionNotificationRequest SVGFontFaceUriElement::insertedInto(Container Node* rootParent) 85 Node::InsertionNotificationRequest SVGFontFaceUriElement::insertedInto(Container Node* rootParent)
86 { 86 {
87 loadFont(); 87 loadFont();
88 return SVGElement::insertedInto(rootParent); 88 return SVGElement::insertedInto(rootParent);
89 } 89 }
90 90
91 void SVGFontFaceUriElement::loadFont() 91 void SVGFontFaceUriElement::loadFont()
92 { 92 {
93 if (m_cachedFont) 93 if (m_cachedFont)
94 m_cachedFont->removeClient(this); 94 m_cachedFont->removeClient(this);
95 95
96 const AtomicString& href = getAttribute(XLinkNames::hrefAttr); 96 const AtomicString& href = getAttribute(XLinkNames::hrefAttr);
97 if (!href.isNull()) { 97 if (!href.isNull()) {
98 ResourceFetcher* fetcher = document()->fetcher(); 98 ResourceFetcher* fetcher = document()->fetcher();
99 FetchRequest request(ResourceRequest(document()->completeURL(href)), loc alName()); 99 FetchRequest request(ResourceRequest(document()->completeURL(href)), loc alName());
100 m_cachedFont = fetcher->requestFont(request); 100 m_cachedFont = fetcher->requestFont(request);
101 if (m_cachedFont) { 101 if (m_cachedFont) {
102 m_cachedFont->addClient(this); 102 m_cachedFont->addClient(this);
103 m_cachedFont->beginLoadIfNeeded(fetcher); 103 m_cachedFont->beginLoadIfNeeded(fetcher);
104 } 104 }
105 } else 105 } else
106 m_cachedFont = 0; 106 m_cachedFont = 0;
107 } 107 }
108 108
109 } 109 }
110 110
111 #endif // ENABLE(SVG_FONTS) 111 #endif // ENABLE(SVG_FONTS)
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFontFaceSrcElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698