Browse Source

#7913 Removed IE7 related stuff

tags/7.0.0.alpha1
Artur Signell 12 years ago
parent
commit
8c2dc96621

+ 0
- 6
src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml View File

@@ -18,12 +18,6 @@
<when-type-is class="com.google.gwt.core.client.impl.SchedulerImpl" />
</replace-with>

<!-- Use our own history impl for IE7 to workaround #2931. -->
<replace-with class="com.vaadin.terminal.gwt.client.HistoryImplIEVaadin">
<when-type-is class="com.google.gwt.user.client.impl.HistoryImpl" />
<when-property-is name="user.agent" value="ie6" />
</replace-with>

<generate-with
class="com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator">
<when-type-is class="com.vaadin.terminal.gwt.client.WidgetMap" />

+ 0
- 4
src/com/vaadin/terminal/gwt/client/BrowserInfo.java View File

@@ -192,10 +192,6 @@ public class BrowserInfo {
return isSafari() && browserDetails.getBrowserMajorVersion() == 4;
}

public boolean isIE7() {
return isIE() && browserDetails.getBrowserMajorVersion() == 7;
}

public boolean isIE8() {
return isIE() && browserDetails.getBrowserMajorVersion() == 8;
}

+ 0
- 192
src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java View File

@@ -1,192 +0,0 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
/*
* 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.vaadin.terminal.gwt.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.impl.HistoryImpl;

/**
* A slightly modified version of GWT's HistoryImplIE6 to bypass bug #2931. Also
* combined with HistoryImplFrame.
*
* This class should be removed if GWT issue 3890 gets resolved. (Also remember
* to removed deferred binding rule from .gwt.xml file).
*/
public class HistoryImplIEVaadin extends HistoryImpl {

private static native Element findHistoryFrame()
/*-{
return $doc.getElementById('__gwt_historyFrame');
}-*/;

private static native Element getTokenElement(Element historyFrame)
/*-{
// Initialize the history iframe. If '__gwt_historyToken' already exists, then
// we're probably backing into the app, so _don't_ set the iframe's location.
if (historyFrame.contentWindow) {
var doc = historyFrame.contentWindow.document;
return doc.getElementById('__gwt_historyToken');
}
}-*/;

protected Element historyFrame;

@Override
protected final void nativeUpdate(String historyToken) {
/*
* Must update the location hash since it isn't already correct.
*/
updateHash(historyToken);
navigateFrame(historyToken);
}

@Override
protected final void nativeUpdateOnEvent(String historyToken) {
updateHash(historyToken);
}

/**
* Sanitizes an untrusted string to be used in an HTML context. NOTE: This
* method of escaping strings should only be used on Internet Explorer.
*
* @param maybeHtml
* untrusted string that may contain html
* @return sanitized string
*/
private static String escapeHtml(String maybeHtml) {
final Element div = DOM.createDiv();
DOM.setInnerText(div, maybeHtml);
return DOM.getInnerHTML(div);
}

/**
* For IE6, reading from $wnd.location.hash drops part of the fragment if
* the fragment contains a '?'. To avoid this bug, we use location.href
* instead.
*/
private static native String getLocationHash()
/*-{
var href = $wnd.location.href;
var hashLoc = href.lastIndexOf("#");
return (hashLoc > 0) ? href.substring(hashLoc) : "";
}-*/;

@Override
public boolean init() {
historyFrame = findHistoryFrame();
if (historyFrame == null) {
return false;
}

initHistoryToken();

// Initialize the history iframe. If a token element already exists,
// then
// we're probably backing into the app, so _don't_ create a new item.
Element tokenElement = getTokenElement(historyFrame);
if (tokenElement != null) {
setToken(getTokenElementContent(tokenElement));
} else {
navigateFrame(getToken());
}

injectGlobalHandler();

initUrlCheckTimer();
return true;
}

protected native String getTokenElementContent(Element tokenElement)
/*-{
return tokenElement.innerText;
}-*/;

protected native void initHistoryToken()
/*-{
// Assume an empty token.
var token = '';
// Get the initial token from the url's hash component.
var hash = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::getLocationHash()();
if (hash.length > 0) {
try {
token = this.@com.google.gwt.user.client.impl.HistoryImpl::decodeFragment(Ljava/lang/String;)(hash.substring(1));
} catch (e) {
// Clear the bad hash (this can't have been a valid token).
$wnd.location.hash = '';
}
}
@com.google.gwt.user.client.impl.HistoryImpl::setToken(Ljava/lang/String;)(token);
}-*/;

protected native void injectGlobalHandler()
/*-{
var historyImplRef = this;

$wnd.__gwt_onHistoryLoad = function(token) {
historyImplRef.@com.google.gwt.user.client.impl.HistoryImpl::newItemOnEvent(Ljava/lang/String;)(token);
};
}-*/;

protected native void navigateFrame(String token)
/*-{
var escaped = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::escapeHtml(Ljava/lang/String;)(token);
var doc = this.@com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::historyFrame.contentWindow.document;
doc.open();
doc.write('<html><body onload="if(parent.__gwt_onHistoryLoad)parent.__gwt_onHistoryLoad(__gwt_historyToken.innerText)"><div id="__gwt_historyToken">' + escaped + '</div></body></html>');
doc.close();
}-*/;

protected native void updateHash(String token)
/*-{
$wnd.location.hash = this.@com.google.gwt.user.client.impl.HistoryImpl::encodeFragment(Ljava/lang/String;)(token);
}-*/;

private native void initUrlCheckTimer()
/*-{
// This is the URL check timer. It detects when an unexpected change
// occurs in the document's URL (e.g. when the user enters one manually
// or selects a 'favorite', but only the #hash part changes). When this
// occurs, we _must_ reload the page. This is because IE has a really
// nasty bug that totally mangles its history stack and causes the location
// bar in the UI to stop working under these circumstances.
var historyImplRef = this;
var urlChecker = function() {
$wnd.setTimeout(urlChecker, 250);
var hash = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::getLocationHash()();
if (hash.length > 0) {
var token = '';
try {
token = historyImplRef.@com.google.gwt.user.client.impl.HistoryImpl::decodeFragment(Ljava/lang/String;)(hash.substring(1));
} catch (e) {
// If there's a bad hash, always reload. This could only happen if
// if someone entered or linked to a bad url.
$wnd.location.reload();
}

var historyToken = @com.google.gwt.user.client.impl.HistoryImpl::getToken()();
if (token != historyToken) {
$wnd.location.reload();
}
}
};
urlChecker();
}-*/;

}

+ 9
- 71
src/com/vaadin/terminal/gwt/client/Util.java View File

@@ -13,7 +13,6 @@ import java.util.Set;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Node;
@@ -195,36 +194,6 @@ public class Util {
return null;
}

/**
* Detects if current browser is IE.
*
* @deprecated use BrowserInfo class instead
*
* @return true if IE
*/
@Deprecated
public static boolean isIE() {
return BrowserInfo.get().isIE();
}

/**
* @deprecated use BrowserInfo class instead
* @return
*/
@Deprecated
public static boolean isIE7() {
return BrowserInfo.get().isIE7();
}

/**
* @deprecated use BrowserInfo class instead
* @return
*/
@Deprecated
public static boolean isFF2() {
return BrowserInfo.get().isFF2();
}

private static final Element escapeHtmlHelper = DOM.createDiv();

/**
@@ -236,8 +205,8 @@ public class Util {
public static String escapeHTML(String html) {
DOM.setInnerText(escapeHtmlHelper, html);
String escapedText = DOM.getInnerHTML(escapeHtmlHelper);
if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() < 9) {
// #7478 IE7-IE8 "incorrectly" returns "<br>" for newlines set using
if (BrowserInfo.get().isIE8()) {
// #7478 IE8 "incorrectly" returns "<br>" for newlines set using
// setInnerText. The same for " " which is converted to "&nbsp;"
escapedText = escapedText.replaceAll("<(BR|br)>", "\n");
escapedText = escapedText.replaceAll("&nbsp;", " ");
@@ -317,23 +286,19 @@ public class Util {

int offsetWidth = element.getOffsetWidth();
int offsetHeight = element.getOffsetHeight();
if (!BrowserInfo.get().isIE7()) {
if (offsetHeight < 1) {
offsetHeight = 1;
}
if (offsetWidth < 1) {
offsetWidth = 10;
}
element.getStyle().setPropertyPx("height", offsetHeight);
if (offsetHeight < 1) {
offsetHeight = 1;
}
if (offsetWidth < 1) {
offsetWidth = 10;
}
element.getStyle().setPropertyPx("height", offsetHeight);
element.getStyle().setPropertyPx("width", offsetWidth);

borders = element.getOffsetWidth() - element.getClientWidth();

element.getStyle().setProperty("width", width);
if (!BrowserInfo.get().isIE7()) {
element.getStyle().setProperty("height", height);
}
element.getStyle().setProperty("height", height);
} else {
borders = element.getOffsetWidth()
- element.getPropertyInt("clientWidth");
@@ -757,33 +722,6 @@ public class Util {

}-*/;

/**
* IE7 sometimes "forgets" to render content. This function runs a hack to
* workaround the bug if needed. This happens easily in framset. See #3295.
*/
public static void runIE7ZeroSizedBodyFix() {
if (BrowserInfo.get().isIE7()) {
int offsetWidth = RootPanel.getBodyElement().getOffsetWidth();
if (offsetWidth == 0) {
shakeBodyElement();
}
}
}

/**
* Does some very small adjustments to body element. We need this just to
* overcome some IE bugs.
*/
public static void shakeBodyElement() {
final DivElement shaker = Document.get().createDivElement();
RootPanel.getBodyElement().insertBefore(shaker,
RootPanel.getBodyElement().getFirstChildElement());
shaker.getStyle().setPropertyPx("height", 0);
shaker.setInnerHTML("&nbsp;");
RootPanel.getBodyElement().removeChild(shaker);

}

/**
* Locates the child component of <literal>parent</literal> which contains
* the element <literal>element</literal>. The child component is also

+ 1
- 0
src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java View File

@@ -404,6 +404,7 @@ public class VFormLayout extends SimplePanel implements Container {
// Workaround for IE weirdness, sometimes returns bad height in some
// circumstances when Caption is empty. See #1444
// IE7 bugs more often. I wonder what happens when IE8 arrives...
// FIXME: This could be unnecessary for IE8+
if (BrowserInfo.get().isIE()) {
if (isEmpty) {
setHeight("0px");

+ 2
- 2
src/com/vaadin/terminal/gwt/client/ui/VLabel.java View File

@@ -124,8 +124,8 @@ public class VLabel extends HTML implements Paintable {

@Override
public void setText(String text) {
if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() < 9) {
// #3983 - IE7,IE8 incorrectly replaces \n with <br> so we do the
if (BrowserInfo.get().isIE8()) {
// #3983 - IE8 incorrectly replaces \n with <br> so we do the
// escaping manually and set as HTML
super.setHTML(Util.escapeHTML(text));
} else {

+ 0
- 21
src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java View File

@@ -714,27 +714,6 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,

popup.setPopupPosition(left, top);

// IE7 really tests one's patience sometimes
// Part of a fix to correct #3850
if (BrowserInfo.get().isIE7()) {
popup.getElement().getStyle().setProperty("zoom", "");
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
if (popup == null) {
// The child menu can be hidden before this command is
// run.
return;
}

if (popup.getElement().getStyle().getProperty("width") == null
|| popup.getElement().getStyle()
.getProperty("width") == "") {
popup.setWidth(popup.getOffsetWidth() + "px");
}
popup.getElement().getStyle().setProperty("zoom", "1");
}
});
}
}

private int adjustPopupHeight(int top, final int shadowSpace) {

+ 0
- 40
src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java View File

@@ -4,7 +4,6 @@

package com.vaadin.terminal.gwt.client.ui;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
@@ -13,7 +12,6 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Button;
@@ -99,13 +97,6 @@ public class VNativeButton extends Button implements Paintable, ClickHandler,
}
getElement().insertBefore(errorIndicatorElement, captionElement);

// Fix for IE
// TODO This was originally for IE6 & IE7 and might not be needed
// any more
if (BrowserInfo.get().isIE()) {
errorIndicatorElement.setInnerText(" ");
}

} else if (errorIndicatorElement != null) {
getElement().removeChild(errorIndicatorElement);
errorIndicatorElement = null;
@@ -124,21 +115,6 @@ public class VNativeButton extends Button implements Paintable, ClickHandler,
}
}

if (BrowserInfo.get().isIE7()) {
/*
* Workaround for IE7 size calculation issues. Deferred because of
* issues with a button with an icon using the reindeer theme
*/
if (width.equals("")) {
Scheduler.get().scheduleDeferred(new Command() {

public void execute() {
setWidth("");
setWidth(getOffsetWidth() + "px");
}
});
}
}
}

@Override
@@ -172,24 +148,8 @@ public class VNativeButton extends Button implements Paintable, ClickHandler,

@Override
public void setWidth(String width) {
/* Workaround for IE7 button size part 1 (#2014) */
if (BrowserInfo.get().isIE7() && this.width != null) {
if (this.width.equals(width)) {
return;
}

if (width == null) {
width = "";
}
}

this.width = width;
super.setWidth(width);

/* Workaround for IE7 button size part 2 (#2014) */
if (BrowserInfo.get().isIE7()) {
super.setWidth(width);
}
}

/*

+ 4
- 24
src/com/vaadin/terminal/gwt/client/ui/VOverlay.java View File

@@ -15,7 +15,6 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.Util;

/**
* In Vaadin UI this Overlay should always be used for all elements that
@@ -162,30 +161,18 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {

private static int adjustByRelativeTopBodyMargin() {
if (topFix == -1) {
topFix = detectRelativeBodyFixes("top", BrowserInfo.get().isIE7());
topFix = detectRelativeBodyFixes("top");
}
return topFix;
}

private native static int detectRelativeBodyFixes(String axis,
boolean removeClientLeftOrTop)
private native static int detectRelativeBodyFixes(String axis)
/*-{
try {
var b = $wnd.document.body;
var cstyle = b.currentStyle ? b.currentStyle : getComputedStyle(b);
if(cstyle && cstyle.position == 'relative') {
var offset = b.getBoundingClientRect()[axis];
if (removeClientLeftOrTop) {
// IE7 include the top left border of the client area into the boundingClientRect
var clientTopOrLeft = 0;
if (axis == "top")
clientTopOrLeft = $wnd.document.documentElement.clientTop;
else
clientTopOrLeft = $wnd.document.documentElement.clientLeft;

offset -= clientTopOrLeft;
}
return offset;
return b.getBoundingClientRect()[axis];
}
} catch(e){}
return 0;
@@ -193,7 +180,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {

private static int adjustByRelativeLeftBodyMargin() {
if (leftFix == -1) {
leftFix = detectRelativeBodyFixes("left", BrowserInfo.get().isIE7());
leftFix = detectRelativeBodyFixes("left");

}
return leftFix;
@@ -210,13 +197,6 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
updateShadowSizeAndPosition(1.0);
}
}
Util.runIE7ZeroSizedBodyFix();
}

@Override
public void hide(boolean autoClosed) {
super.hide(autoClosed);
Util.runIE7ZeroSizedBodyFix();
}

@Override

+ 0
- 5
src/com/vaadin/terminal/gwt/client/ui/VPanel.java View File

@@ -337,11 +337,6 @@ public class VPanel extends SimplePanel implements Container,
width = captionWidth;
}

if (BrowserInfo.get().isIE7()) {
Util.setWidthExcludingPaddingAndBorder(captionNode, width
- getCaptionMarginLeft(), 26, false);
}

super.setWidth(width + "px");
}


+ 10
- 15
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java View File

@@ -2749,8 +2749,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,

int hw = captionContainer.getOffsetWidth()
+ scrollBody.getCellExtraWidth();
if (BrowserInfo.get().isGecko()
|| BrowserInfo.get().isIE7()) {
if (BrowserInfo.get().isGecko()) {
hw += sortIndicator.getOffsetWidth();
}
if (columnIndex < 0) {
@@ -5924,19 +5923,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
*/
private int getContentAreaBorderHeight() {
if (contentAreaBorderHeight < 0) {
if (BrowserInfo.get().isIE7()) {
contentAreaBorderHeight = Util
.measureVerticalBorder(scrollBodyPanel.getElement());
} else {
DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
"hidden");
int oh = scrollBodyPanel.getOffsetHeight();
int ch = scrollBodyPanel.getElement().getPropertyInt(
"clientHeight");
contentAreaBorderHeight = oh - ch;
DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
"auto");
}

DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
"hidden");
int oh = scrollBodyPanel.getOffsetHeight();
int ch = scrollBodyPanel.getElement()
.getPropertyInt("clientHeight");
contentAreaBorderHeight = oh - ch;
DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
"auto");
}
return contentAreaBorderHeight;
}

+ 0
- 11
src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java View File

@@ -6,7 +6,6 @@ package com.vaadin.terminal.gwt.client.ui;

import java.util.Set;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Node;
import com.google.gwt.event.dom.client.DomEvent.Type;
@@ -20,7 +19,6 @@ import com.google.gwt.event.dom.client.TouchStartEvent;
import com.google.gwt.event.dom.client.TouchStartHandler;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
@@ -306,15 +304,6 @@ public class VSplitPanel extends ComplexPanel implements Container,

renderInformation.updateSize(getElement());

if (BrowserInfo.get().isIE7()) {
// Part III of IE7 hack
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
iLayout();
}
});
}

// This is needed at least for cases like #3458 to take
// appearing/disappearing scrollbars into account.
client.runDescendentsLayout(this);

+ 0
- 27
src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java View File

@@ -238,33 +238,6 @@ public class VTabsheet extends VTabsheetBase {
return tab;
}

@Override
public void setWidth(String width) {
super.setWidth(width);
if (BrowserInfo.get().isIE7()) {
/*
* IE7 apparently has problems with calculating width for
* floated elements inside a DIV with padding. Set the width
* explicitly for the caption.
*/
fixTextWidth();
}
}

private void fixTextWidth() {
Element captionText = getTextElement();
if (captionText == null) {
return;
}

int captionWidth = Util.getRequiredWidth(captionText);
int scrollWidth = captionText.getScrollWidth();
if (scrollWidth > captionWidth) {
captionWidth = scrollWidth;
}
captionText.getStyle().setPropertyPx("width", captionWidth);
}

public void setClosable(boolean closable) {
this.closable = closable;
if (closable && closeButton == null) {

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java View File

@@ -164,7 +164,7 @@ public class VTreeTable extends VScrollTable {

private boolean browserSupportsAnimation() {
BrowserInfo bi = BrowserInfo.get();
return !(bi.isIE7() || bi.isSafari4());
return !(bi.isSafari4());
}

class VTreeTableScrollBody extends VScrollTable.VScrollTableBody {

+ 2
- 13
src/com/vaadin/terminal/gwt/client/ui/VView.java View File

@@ -476,9 +476,8 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
* browser window. Constantly recalculating the layout causes the resize
* operation to be really slow with complex layouts.
*/
boolean lazy = resizeLazy
|| (BrowserInfo.get().isIE() && BrowserInfo.get()
.getIEVersion() <= 8) || BrowserInfo.get().isFF3();
boolean lazy = resizeLazy || BrowserInfo.get().isIE8()
|| BrowserInfo.get().isFF3();

if (lazy) {
delayedResizeExecutor.trigger();
@@ -563,16 +562,6 @@ public class VView extends SimplePanel implements Container, ResizeHandler,

@Override
public int getWidth() {
int w = getRealWidth();
if (w < 10 && BrowserInfo.get().isIE7()) {
// Overcome an IE7 bug #3295
Util.shakeBodyElement();
w = getRealWidth();
}
return w;
}

private int getRealWidth() {
if (connection.getConfiguration().isStandalone()) {
return getElement().getOffsetWidth() - getExcessWidth();
}

Loading…
Cancel
Save