1 /*
2 * Copyright (c) 2002-2026 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.javascript.host.svg;
16
17 import org.htmlunit.html.HtmlSvg;
18 import org.htmlunit.javascript.configuration.JsxClass;
19 import org.htmlunit.javascript.configuration.JsxConstant;
20 import org.htmlunit.javascript.configuration.JsxConstructor;
21 import org.htmlunit.javascript.configuration.JsxFunction;
22
23 /**
24 * JavaScript host object for {@code SVGSVGElement}.
25 *
26 * @author Ahmed Ashour
27 * @author Ronald Brill
28 *
29 * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/SVGSVGElement">MDN Documentation</a>
30 */
31 @JsxClass(domClass = HtmlSvg.class)
32 public class SVGSVGElement extends SVGGraphicsElement {
33
34 /** The constant {@code SVG_ZOOMANDPAN_UNKNOWN}. */
35 @JsxConstant
36 public static final int SVG_ZOOMANDPAN_UNKNOWN = 0;
37 /** The constant {@code SVG_ZOOMANDPAN_DISABLE}. */
38 @JsxConstant
39 public static final int SVG_ZOOMANDPAN_DISABLE = 1;
40 /** The constant {@code SVG_ZOOMANDPAN_MAGNIFY}. */
41 @JsxConstant
42 public static final int SVG_ZOOMANDPAN_MAGNIFY = 2;
43
44 /**
45 * Creates an instance of this object.
46 */
47 @Override
48 @JsxConstructor
49 public void jsConstructor() {
50 super.jsConstructor();
51 }
52
53 /**
54 * Creates a new {@link SVGMatrix}.
55 *
56 * @return the new matrix
57 */
58 @JsxFunction
59 public SVGMatrix createSVGMatrix() {
60 return new SVGMatrix(getParentScope());
61 }
62
63 /**
64 * Returns the transformation matrix from the current user units to the device for the nearest viewport element.
65 *
66 * @return the screen CTM matrix
67 */
68 @JsxFunction
69 public SVGMatrix getScreenCTM() {
70 return new SVGMatrix(getParentScope());
71 }
72
73 /**
74 * Creates a new {@link SVGRect}.
75 *
76 * @return the new rect
77 */
78 @JsxFunction
79 public SVGRect createSVGRect() {
80 final SVGRect rect = new SVGRect();
81 rect.setPrototype(getPrototype(rect.getClass()));
82 rect.setParentScope(getParentScope());
83 return rect;
84 }
85 }