}
int offsetWidth = Style.DEFAULT;
int offsetHeight = Style.DEFAULT;
if (w == Style.DEFAULT && h == Style.DEFAULT) {
Size s = getSize(contentOnly);
offsetWidth = s.getWidth();
offsetHeight = s.getHeight();
if (s.getWidth() > 0) {
w = s.getWidth();
}
if (s.getHeight() > 0) {
h = s.getHeight();
}
} else if (w == Style.DEFAULT) {
offsetWidth = getWidth(contentOnly);
if (offsetWidth > 0) {
w = offsetWidth;
}
} else if (h == Style.DEFAULT) {
offsetHeight = getHeight(contentOnly);
if (offsetHeight > 0) {
h = offsetHeight;
}
}
List<String> l = new ArrayList<String>();
if (w == Style.DEFAULT) {
l.add("width");
}
if (h == Style.DEFAULT) {
l.add("height");
}
Map<String, String> map = getComputedStyle(l);
if (map != null) {
String wid = map.get("width");
if (wid != null) {
w = Util.parseInt(wid, Style.DEFAULT);
if (offsetWidth == 0 && isBorderBox && contentOnly && w != Style.DEFAULT && !GXT.isIE()) {
w -= getFrameWidth(Side.LEFT, Side.RIGHT);
} else if (GXT.isIE() && isBorderBox && w != Style.DEFAULT && contentOnly) {
w -= getFrameWidth(Side.LEFT, Side.RIGHT);
} else if (offsetWidth == 0 && !isBorderBox && !contentOnly && w != Style.DEFAULT) {
w += getFrameWidth(Side.LEFT, Side.RIGHT);
}
}
String hei = map.get("height");
if (hei != null) {
h = Util.parseInt(hei, Style.DEFAULT);
if (offsetHeight == 0 && isBorderBox && contentOnly && h != Style.DEFAULT && !GXT.isIE()) {
h -= getFrameWidth(Side.TOP, Side.BOTTOM);
} else if (GXT.isIE() && isBorderBox && h != Style.DEFAULT && contentOnly) {
h -= getFrameWidth(Side.TOP, Side.BOTTOM);
} else if (offsetHeight == 0 && !isBorderBox && !contentOnly && h != Style.DEFAULT) {
h += getFrameWidth(Side.TOP, Side.BOTTOM);
}
}
}
if (w == Style.DEFAULT && h == Style.DEFAULT) {
return new Size(offsetWidth, offsetHeight);
}
return new Size(w != Style.DEFAULT ? w : offsetWidth, h != Style.DEFAULT ? h : offsetHeight);
}