blob: a6e8d0eaa622697e7ed5ae0c8bae64e7f82cbf2e [file] [log] [blame]
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.user.client.impl;
import com.google.gwt.user.client.Element;
/**
* Opera implementation of {@link com.google.gwt.user.client.impl.WindowImpl}.
*/
public class WindowImplOpera extends WindowImpl {
@SuppressWarnings("unused")
private static Element body;
/**
* In standards mode, on Opera 9.5 (and presumably, above), the clientHeight
* and clientWidth are defined on doc.documentElement instead of doc.body.
*/
@SuppressWarnings("unused")
private static native Element getBodyElement() /*-{
if (@com.google.gwt.user.client.impl.WindowImplOpera::body == null) {
@com.google.gwt.user.client.impl.WindowImplOpera::body =
($doc.compatMode == 'CSS1Compat' && opera.version() >= 9.5) ?
$doc.documentElement : $doc.body;
}
return @com.google.gwt.user.client.impl.WindowImplOpera::body;
}-*/;
@Override
public native int getClientHeight() /*-{
return @com.google.gwt.user.client.impl.WindowImplOpera::getBodyElement()().clientHeight;
}-*/;
@Override
public native int getClientWidth() /*-{
return @com.google.gwt.user.client.impl.WindowImplOpera::getBodyElement()().clientWidth;
}-*/;
}