1 /*
2 * Copyright (c) 2002-2025 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.html;
16
17 import org.htmlunit.html.HtmlMarquee;
18 import org.htmlunit.javascript.configuration.JsxClass;
19 import org.htmlunit.javascript.configuration.JsxConstructor;
20 import org.htmlunit.javascript.configuration.JsxGetter;
21 import org.htmlunit.javascript.configuration.JsxSetter;
22
23 /**
24 * The JavaScript object {@code HTMLMarqueeElement}.
25 *
26 * @author Ronald Brill
27 * @author Ahmed Ashour
28 */
29 @JsxClass(domClass = HtmlMarquee.class)
30 public class HTMLMarqueeElement extends HTMLElement {
31
32 /**
33 * JavaScript constructor.
34 */
35 @Override
36 @JsxConstructor
37 public void jsConstructor() {
38 super.jsConstructor();
39 }
40
41 /**
42 * Returns the {@code width} property.
43 * @return the {@code width} property
44 */
45 @JsxGetter
46 public int getWidth() {
47 final String value = getDomNodeOrDie().getAttributeDirect("width");
48 final Integer intValue = HTMLCanvasElement.getValue(value);
49 if (intValue != null) {
50 return intValue;
51 }
52 return 0;
53 }
54
55 /**
56 * Sets the {@code width} property.
57 * @param width the {@code width} property
58 */
59 @JsxSetter
60 public void setWidth(final int width) {
61 getDomNodeOrDie().setAttribute("width", Integer.toString(width));
62 }
63
64 /**
65 * Returns the {@code height} property.
66 * @return the {@code height} property
67 */
68 @JsxGetter
69 public int getHeight() {
70 final String value = getDomNodeOrDie().getAttributeDirect("height");
71 final Integer intValue = HTMLCanvasElement.getValue(value);
72 if (intValue != null) {
73 return intValue;
74 }
75 return 0;
76 }
77
78 /**
79 * Sets the {@code height} property.
80 * @param height the {@code height} property
81 */
82 @JsxSetter
83 public void setHeight(final int height) {
84 getDomNodeOrDie().setAttribute("height", Integer.toString(height));
85 }
86
87 /**
88 * Returns the value of the {@code bgColor} property.
89 * @return the value of the {@code bgColor} property
90 */
91 @JsxGetter
92 public String getBgColor() {
93 return getDomNodeOrDie().getAttribute("bgColor");
94 }
95
96 /**
97 * Sets the value of the {@code bgColor} property.
98 * @param bgColor the value of the {@code bgColor} property
99 */
100 @JsxSetter
101 public void setBgColor(final String bgColor) {
102 setColorAttribute("bgColor", bgColor);
103 }
104
105 }