Skip to content

Commit acaeb9b

Browse files
committed
Remove outdated special handling for Internet Explorer version < 9
The code is completely unused as Internet Explorer versions below 9 are not in use anymore.
1 parent 8b62bbf commit acaeb9b

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

ua/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
import java.io.InputStreamReader;
1919
import java.io.PrintWriter;
2020
import java.io.StringWriter;
21-
import java.lang.reflect.Field;
2221
import java.net.URL;
2322
import java.nio.charset.Charset;
2423
import java.util.Map;
2524

26-
import org.eclipse.core.runtime.Platform;
2725
import org.eclipse.help.internal.util.ProductPreferences;
2826
import org.eclipse.swt.browser.Browser;
2927
import org.eclipse.ui.internal.intro.impl.FontSelection;
@@ -55,7 +53,6 @@ public class IntroHTMLGenerator {
5553
private AbstractIntroPage introPage;
5654

5755
private IIntroContentProviderSite providerSite;
58-
private boolean backgroundSizeWorks;
5956

6057
/**
6158
* Generates the HTML code that will be presented in the browser widget for the provided intro
@@ -70,31 +67,12 @@ public HTMLElement generateHTMLforPage(AbstractIntroPage page, IIntroContentProv
7067
this.introPage = page;
7168
this.providerSite = providerSite;
7269

73-
initializeBackgroundSizeWorks();
74-
7570
// generate and add the appropriate encoding to the top of the document
7671
// generateEncoding();
7772
// create the main HTML element, and all of its contents.
7873
return generateHTMLElement();
7974
}
8075

81-
private void initializeBackgroundSizeWorks() {
82-
// Internet Explorer <= 9 doesn't properly handle background-size
83-
backgroundSizeWorks = true;
84-
try {
85-
if (isIE()) {
86-
Class<?> ieClass = Class.forName("org.eclipse.swt.browser.IE"); //$NON-NLS-1$
87-
Field field = ieClass.getDeclaredField("IEVersion"); //$NON-NLS-1$
88-
field.setAccessible(true);
89-
int value = field.getInt(ieClass);
90-
// We specifically care about background-size which works in 9+
91-
backgroundSizeWorks = value <= 0 || value >= 9;
92-
}
93-
} catch(Exception e) {
94-
// IE not found
95-
}
96-
}
97-
9876
private boolean isIE() {
9977
return getBrowser() != null && "ie".equals(getBrowser().getBrowserType()); //$NON-NLS-1$
10078
}
@@ -443,14 +421,7 @@ private HTMLElement generateIntroDiv(IntroGroup element, int indentLevel) {
443421
String imageUrl = element.getBackgroundImage();
444422
imageUrl = BundleUtil.getResolvedResourceLocation(element.getBase(), imageUrl, element
445423
.getBundle());
446-
String style;
447-
if (Platform.getWS().equals(Platform.WS_WIN32) && !backgroundSizeWorks && imageUrl.toLowerCase().endsWith(".png")) { //$NON-NLS-1$
448-
// IE 5.5+ does not handle alphas in PNGs without
449-
// this hack. Remove when IE7 becomes widespread
450-
style = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imageUrl + "', sizingMethod='crop');"; //$NON-NLS-1$ //$NON-NLS-2$
451-
} else {
452-
style = "background-image : url(" + imageUrl + ")"; //$NON-NLS-1$ //$NON-NLS-2$
453-
}
424+
String style = "background-image : url(" + imageUrl + ")"; //$NON-NLS-1$ //$NON-NLS-2$
454425
divElement.addAttribute(IIntroHTMLConstants.ATTRIBUTE_STYLE, style);
455426
}
456427
// Add any children of the div, in the order they are defined
@@ -1018,21 +989,11 @@ private HTMLElement generateImageElement(String imageSrc, String altText, String
1018989
int indentLevel) {
1019990
HTMLElement image = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_IMG, indentLevel, true,
1020991
false);
1021-
boolean pngOnWin32 = imageSrc != null && Platform.getWS().equals(Platform.WS_WIN32)
1022-
&& !backgroundSizeWorks && imageSrc.toLowerCase().endsWith(".png"); //$NON-NLS-1$
1023-
if (imageSrc == null || pngOnWin32) {
1024-
// we must handle PNGs here - IE does not support alpha blanding well.
1025-
// We will set the alpha image loader and load the real image
1026-
// that way. The 'src' attribute in the image itself will
1027-
// get the blank image.
992+
if (imageSrc == null) {
1028993
String blankImageURL = BundleUtil.getResolvedResourceLocation(
1029994
IIntroHTMLConstants.IMAGE_SRC_BLANK, IIntroConstants.PLUGIN_ID);
1030995
if (blankImageURL != null) {
1031996
image.addAttribute(IIntroHTMLConstants.ATTRIBUTE_SRC, blankImageURL);
1032-
if (pngOnWin32) {
1033-
String style = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imageSrc + "', sizingMethod='image')"; //$NON-NLS-1$//$NON-NLS-2$
1034-
image.addAttribute(IIntroHTMLConstants.ATTRIBUTE_STYLE, style);
1035-
}
1036997
}
1037998
} else
1038999
image.addAttribute(IIntroHTMLConstants.ATTRIBUTE_SRC, imageSrc);

0 commit comments

Comments
 (0)