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

Side by Side Diff: Source/core/svg/SVGFontFaceElement.h

Issue 216563002: [SVG Fonts] Fix <font-face> element leak document (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGFontData.cpp ('k') | Source/core/svg/SVGFontFaceElement.cpp » ('j') | 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) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #ifndef SVGFontFaceElement_h 22 #ifndef SVGFontFaceElement_h
23 #define SVGFontFaceElement_h 23 #define SVGFontFaceElement_h
24 24
25 #if ENABLE(SVG_FONTS) 25 #if ENABLE(SVG_FONTS)
26 #include "SVGNames.h" 26 #include "SVGNames.h"
27 #include "core/svg/SVGElement.h" 27 #include "core/svg/SVGElement.h"
28 #include "wtf/WeakPtr.h"
28 29
29 namespace WebCore { 30 namespace WebCore {
30 31
31 class SVGFontElement; 32 class SVGFontElement;
33 class SVGFontData;
32 class StyleRuleFontFace; 34 class StyleRuleFontFace;
33 35
34 class SVGFontFaceElement FINAL : public SVGElement { 36 class SVGFontFaceElement FINAL : public SVGElement {
35 public: 37 public:
36 static PassRefPtr<SVGFontFaceElement> create(Document&); 38 static PassRefPtr<SVGFontFaceElement> create(Document&);
37 39
38 unsigned unitsPerEm() const; 40 unsigned unitsPerEm() const;
39 int xHeight() const; 41 int xHeight() const;
40 float horizontalOriginX() const; 42 float horizontalOriginX() const;
41 float horizontalOriginY() const; 43 float horizontalOriginY() const;
42 float horizontalAdvanceX() const; 44 float horizontalAdvanceX() const;
43 float verticalOriginX() const; 45 float verticalOriginX() const;
44 float verticalOriginY() const; 46 float verticalOriginY() const;
45 float verticalAdvanceY() const; 47 float verticalAdvanceY() const;
46 int ascent() const; 48 int ascent() const;
47 int descent() const; 49 int descent() const;
48 String fontFamily() const; 50 String fontFamily() const;
49 51
50 SVGFontElement* associatedFontElement() const; 52 SVGFontElement* associatedFontElement() const;
51 void rebuildFontFace(); 53 void rebuildFontFace();
52 54
53 StyleRuleFontFace* fontFaceRule() const { return m_fontFaceRule.get(); } 55 StyleRuleFontFace* fontFaceRule() const { return m_fontFaceRule.get(); }
56 WeakPtr<SVGFontFaceElement> createWeakRef() { return m_weakFactory.createWea kPtr(); }
54 57
55 private: 58 private:
56 explicit SVGFontFaceElement(Document&); 59 explicit SVGFontFaceElement(Document&);
57 60
58 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 61 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
59 62
60 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; 63 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
61 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 64 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
62 virtual void removedFrom(ContainerNode*) OVERRIDE; 65 virtual void removedFrom(ContainerNode*) OVERRIDE;
63 66
64 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } 67 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
65 68
66 RefPtrWillBePersistent<StyleRuleFontFace> m_fontFaceRule; 69 RefPtrWillBePersistent<StyleRuleFontFace> m_fontFaceRule;
67 SVGFontElement* m_fontElement; 70 SVGFontElement* m_fontElement;
71 WeakPtrFactory<SVGFontFaceElement> m_weakFactory;
68 }; 72 };
69 73
70 } // namespace WebCore 74 } // namespace WebCore
71 75
72 #endif // ENABLE(SVG_FONTS) 76 #endif // ENABLE(SVG_FONTS)
73 #endif 77 #endif
74 78
75 // vim:ts=4:noet 79 // vim:ts=4:noet
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFontData.cpp ('k') | Source/core/svg/SVGFontFaceElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698