1414 */
1515package org .htmlunit .javascript .host .svg ;
1616
17+ import org .htmlunit .corejs .javascript .TopLevel ;
1718import org .htmlunit .javascript .HtmlUnitScriptable ;
1819import org .htmlunit .javascript .JavaScriptEngine ;
1920import org .htmlunit .javascript .configuration .JsxClass ;
2021import org .htmlunit .javascript .configuration .JsxConstructor ;
2122import org .htmlunit .javascript .configuration .JsxFunction ;
2223import org .htmlunit .javascript .configuration .JsxGetter ;
2324import org .htmlunit .javascript .configuration .JsxSetter ;
24- import org .htmlunit .javascript .host .Window ;
2525import org .htmlunit .javascript .host .dom .DOMException ;
2626
2727/**
@@ -66,7 +66,7 @@ public void jsConstructor() {
6666 * Instantiates and configure scope and prototype.
6767 * @param scope the parent scope
6868 */
69- public SVGMatrix (final Window scope ) {
69+ public SVGMatrix (final TopLevel scope ) {
7070 this ();
7171 setParentScope (scope );
7272 setPrototype (getPrototype (getClass ()));
@@ -186,7 +186,7 @@ public void setF(final double newValue) {
186186 */
187187 @ JsxFunction
188188 public SVGMatrix flipX () {
189- final SVGMatrix result = new SVGMatrix (getWindow ());
189+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
190190 result .shearX_ = shearX_ ;
191191 result .shearY_ = -shearY_ ;
192192 result .scaleX_ = -scaleX_ ;
@@ -203,7 +203,7 @@ public SVGMatrix flipX() {
203203 */
204204 @ JsxFunction
205205 public SVGMatrix flipY () {
206- final SVGMatrix result = new SVGMatrix (getWindow ());
206+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
207207 result .shearX_ = -shearX_ ;
208208 result .shearY_ = shearY_ ;
209209 result .scaleX_ = scaleX_ ;
@@ -229,7 +229,7 @@ public SVGMatrix inverse() {
229229 DOMException .INVALID_STATE_ERR );
230230 }
231231
232- final SVGMatrix result = new SVGMatrix (getWindow ());
232+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
233233 result .shearX_ = -shearX_ / determinant ;
234234 result .shearY_ = -shearY_ / determinant ;
235235 result .scaleX_ = scaleY_ / determinant ;
@@ -247,7 +247,7 @@ public SVGMatrix inverse() {
247247 */
248248 @ JsxFunction
249249 public SVGMatrix multiply (final SVGMatrix by ) {
250- final SVGMatrix result = new SVGMatrix (getWindow ());
250+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
251251
252252 result .shearX_ = by .shearX_ * scaleX_ + by .scaleY_ * shearX_ ;
253253 result .shearY_ = by .scaleX_ * shearY_ + by .shearY_ * scaleY_ ;
@@ -270,7 +270,7 @@ public SVGMatrix rotate(final double angle) {
270270 final double sin = Math .sin (theta );
271271 final double cos = Math .cos (theta );
272272
273- final SVGMatrix result = new SVGMatrix (getWindow ());
273+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
274274
275275 result .shearX_ = -sin * scaleX_ + cos * shearX_ ;
276276 result .shearY_ = cos * shearY_ + sin * scaleY_ ;
@@ -301,7 +301,7 @@ public SVGMatrix rotateFromVector(final double x, final double y) {
301301 final double sin = Math .sin (theta );
302302 final double cos = Math .cos (theta );
303303
304- final SVGMatrix result = new SVGMatrix (getWindow ());
304+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
305305
306306 result .shearX_ = -sin * scaleX_ + cos * shearX_ ;
307307 result .shearY_ = cos * shearY_ + sin * scaleY_ ;
@@ -331,7 +331,7 @@ public SVGMatrix scale(final double factor) {
331331 */
332332 @ JsxFunction
333333 public SVGMatrix scaleNonUniform (final double factorX , final double factorY ) {
334- final SVGMatrix result = new SVGMatrix (getWindow ());
334+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
335335
336336 result .shearX_ = factorY * shearX_ ;
337337 result .shearY_ = factorX * shearY_ ;
@@ -352,7 +352,7 @@ public SVGMatrix scaleNonUniform(final double factorX, final double factorY) {
352352 public SVGMatrix skewX (final double angle ) {
353353 final double shear = Math .tan (Math .toRadians (angle ));
354354
355- final SVGMatrix result = new SVGMatrix (getWindow ());
355+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
356356
357357 result .shearX_ = shear * scaleX_ + shearX_ ;
358358 result .shearY_ = shearY_ ;
@@ -373,7 +373,7 @@ public SVGMatrix skewX(final double angle) {
373373 public SVGMatrix skewY (final double angle ) {
374374 final double shear = Math .tan (Math .toRadians (angle ));
375375
376- final SVGMatrix result = new SVGMatrix (getWindow ());
376+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
377377
378378 result .shearX_ = shearX_ ;
379379 result .shearY_ = shearY_ + shear * scaleY_ ;
@@ -393,7 +393,7 @@ public SVGMatrix skewY(final double angle) {
393393 */
394394 @ JsxFunction
395395 public SVGMatrix translate (final double x , final double y ) {
396- final SVGMatrix result = new SVGMatrix (getWindow ());
396+ final SVGMatrix result = new SVGMatrix (getWindow (). getWebWindow (). getTopLevelScope () );
397397
398398 result .shearX_ = shearX_ ;
399399 result .shearY_ = shearY_ ;
0 commit comments