1 16 package com.google.gwt.user.client.ui.impl; 17 18 import com.google.gwt.user.client.DOM; 19 import com.google.gwt.user.client.Element; 20 21 28 public class ClippedImageImplIE6 extends ClippedImageImpl { 29 30 private static native void injectGlobalHandler() ; 36 37 public ClippedImageImplIE6() { 38 injectGlobalHandler(); 39 } 40 41 public void adjust(Element clipper, String url, int left, int top, int width, 42 int height) { 43 44 DOM.setStyleAttribute(clipper, "width", width + "px"); 45 DOM.setStyleAttribute(clipper, "height", height + "px"); 46 47 Element img = DOM.getFirstChild(clipper); 49 DOM.setStyleAttribute(img, "filter", 50 "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url 51 + "',sizingMethod='crop')"); 52 DOM.setStyleAttribute(img, "marginLeft", -left + "px"); 53 DOM.setStyleAttribute(img, "marginTop", -top + "px"); 54 55 int imgWidth = left + width; 58 int imgHeight = top + height; 59 DOM.setElementPropertyInt(img, "width", imgWidth); 60 DOM.setElementPropertyInt(img, "height", imgHeight); 61 } 62 63 public String getHTML(String url, int left, int top, int width, int height) { 64 String clipperStyle = "overflow: hidden; width: " + width + "px; height: " 65 + height + "px; padding: 0px"; 66 67 String imgStyle = 68 "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" 69 + url + "',sizingMethod='crop'); margin-left: " 70 + -left + "px; margin-top: " + -top + "px; border: none"; 71 72 String clippedImgHtml = "<gwt:clipper style=\"" 73 + clipperStyle 74 + "\"><img SRC='about:blank' onerror='if(window.__gwt_transparentImgHandler)window.__gwt_transparentImgHandler(this);else this.src=\"clear.cache.gif\"' style=\"" 75 + imgStyle + "\" width=" + (left + width) + " height=" + (top + height) 76 + " border='0'></gwt:clipper>"; 77 78 return clippedImgHtml; 79 } 80 } 81 | Popular Tags |