blob: 9da05f0997e4610ebb3e19d1bf0baa79ace2fc18 [file] [log] [blame]
eseidel5fced7c2007-10-23 00:38:49 +00001/*
zimmermann@webkit.org711245f2010-08-03 19:39:01 +00002 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
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
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
eseidel5fced7c2007-10-23 00:38:49 +000021
commit-queue@webkit.org46c0f522016-11-13 10:05:43 +000022#pragma once
eseidel5fced7c2007-10-23 00:38:49 +000023
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000024#if ENABLE(SVG_FONTS)
commit-queue@webkit.org46c0f522016-11-13 10:05:43 +000025
eseidel5fced7c2007-10-23 00:38:49 +000026#include "SVGElement.h"
27
28namespace WebCore {
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000029
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000030class SVGFontElement;
antti@apple.comd09a7922012-04-02 19:50:34 +000031class StyleRuleFontFace;
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000032
andersca@apple.com16d2dd42014-01-16 23:08:24 +000033class SVGFontFaceElement final : public SVGElement {
fpizlo@apple.com197cd322018-03-17 06:11:00 +000034 WTF_MAKE_ISO_ALLOCATED(SVGFontFaceElement);
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000035public:
weinig@apple.com10923572015-01-07 20:56:24 +000036 static Ref<SVGFontFaceElement> create(const QualifiedName&, Document&);
darin@apple.com3cbd5cb2010-08-30 06:51:56 +000037
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000038 unsigned unitsPerEm() const;
39 int xHeight() const;
mmaxfield@apple.com73121d22015-04-06 15:30:49 +000040 int capHeight() const;
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000041 float horizontalOriginX() const;
42 float horizontalOriginY() const;
43 float horizontalAdvanceX() const;
44 float verticalOriginX() const;
45 float verticalOriginY() const;
46 float verticalAdvanceY() const;
47 int ascent() const;
48 int descent() const;
49 String fontFamily() const;
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000050
jschuh@chromium.org79d31db2011-01-28 22:26:19 +000051 SVGFontElement* associatedFontElement() const;
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000052 void rebuildFontFace();
antti@apple.com846f7b32012-03-27 12:40:38 +000053
mmaxfield@apple.com2b428902016-02-22 21:40:02 +000054 StyleRuleFontFace& fontFaceRule() { return m_fontFaceRule.get(); }
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000055
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000056private:
weinig@apple.com52e786e2013-09-15 18:06:06 +000057 SVGFontFaceElement(const QualifiedName&, Document&);
simon.fraser@apple.com985a9082018-09-10 21:19:49 +000058 ~SVGFontFaceElement();
darin@apple.comc8b8f872010-08-30 18:44:06 +000059
darin@apple.com0ce67df2019-06-17 01:48:13 +000060 void parseAttribute(const QualifiedName&, const AtomString&) final;
darin@apple.comc8b8f872010-08-30 18:44:06 +000061
commit-queue@webkit.orge6d3df02016-07-20 21:21:21 +000062 void childrenChanged(const ChildChange&) final;
rniwa@webkit.orgddc3f392017-10-21 00:49:21 +000063 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
64 void removedFromAncestor(RemovalType, ContainerNode&) final;
darin@apple.comc8b8f872010-08-30 18:44:06 +000065
commit-queue@webkit.orge6d3df02016-07-20 21:21:21 +000066 bool rendererIsNeeded(const RenderStyle&) final { return false; }
ch.dumez@sisa.samsung.com7dd31bf2013-08-22 21:58:09 +000067
mmaxfield@apple.com03357532015-11-02 00:52:46 +000068 Ref<StyleRuleFontFace> m_fontFaceRule;
rniwa@webkit.org00bac932013-01-24 19:18:22 +000069 SVGFontElement* m_fontElement;
krit@webkit.org6a0cb5b2010-12-22 20:15:51 +000070};
eseidel5fced7c2007-10-23 00:38:49 +000071
72} // namespace WebCore
73
zimmermann@webkit.orgce57f042007-12-29 02:41:53 +000074#endif // ENABLE(SVG_FONTS)