@@ -919,7 +919,7 @@ public int getPosX() {
919
919
webWindow .getComputedStyle (element .getDomNodeOrDie (), null );
920
920
cumulativeOffset += style .getBorderLeftValue ();
921
921
}
922
- element = element .getOffsetParentInternal (false ). getScriptableObject ( );
922
+ element = element .getOffestParentElement (false );
923
923
}
924
924
return cumulativeOffset ;
925
925
}
@@ -939,7 +939,7 @@ public int getPosY() {
939
939
webWindow .getComputedStyle (element .getDomNodeOrDie (), null );
940
940
cumulativeOffset += style .getBorderTopValue ();
941
941
}
942
- element = element .getOffsetParentInternal (false ). getScriptableObject ( );
942
+ element = element .getOffestParentElement (false );
943
943
}
944
944
return cumulativeOffset ;
945
945
}
@@ -1063,7 +1063,15 @@ public int getOffsetLeft() {
1063
1063
@ JsxGetter (propertyName = "offsetParent" )
1064
1064
public HtmlUnitScriptable getOffsetParent_js () {
1065
1065
final boolean feature = getBrowserVersion ().hasFeature (JS_OFFSET_PARENT_NULL_IF_FIXED );
1066
- return getOffsetParentInternal (feature ).getScriptableObject ();
1066
+ return getOffestParentElement (feature );
1067
+ }
1068
+
1069
+ private HTMLElement getOffestParentElement (final boolean returnNullIfFixed ) {
1070
+ final HtmlElement html = getOffsetParentInternal (returnNullIfFixed );
1071
+ if (html == null ) {
1072
+ return null ;
1073
+ }
1074
+ return html .getScriptableObject ();
1067
1075
}
1068
1076
1069
1077
private HtmlElement getOffsetParentInternal (final boolean returnNullIfFixed ) {
@@ -1120,7 +1128,7 @@ public ClientRect getBoundingClientRect() {
1120
1128
int top = getPosY ();
1121
1129
1122
1130
// account for any scrolled ancestors
1123
- Node parentNode = getOffsetParentInternal (false ). getScriptableObject ( );
1131
+ Node parentNode = getOffestParentElement (false );
1124
1132
while ((parentNode instanceof HTMLElement )
1125
1133
&& !(parentNode instanceof HTMLBodyElement )) {
1126
1134
final HTMLElement elem = (HTMLElement ) parentNode ;
0 commit comments