Reviewed by Maciej.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2006 05:36:46 +0000 (05:36 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2006 05:36:46 +0000 (05:36 +0000)
        Fixes PNGs with 8bit alpha on IE.

        * css/ie.css: attach the pngbehavior.htc to img tags
        * images/blank.png: Added.
        * index.html: add the width and height to the download img
        * pngbehavior.htc: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitSite/ChangeLog
WebKitSite/css/ie.css
WebKitSite/images/blank.png [new file with mode: 0644]
WebKitSite/index.html
WebKitSite/pngbehavior.htc [new file with mode: 0644]

index f766a38..7b76ea9 100644 (file)
@@ -1,3 +1,14 @@
+2006-02-16  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Maciej.
+        
+        Fixes PNGs with 8bit alpha on IE.
+
+        * css/ie.css: attach the pngbehavior.htc to img tags
+        * images/blank.png: Added.
+        * index.html: add the width and height to the download img
+        * pngbehavior.htc: Added.
+
 2006-02-16  Justin Garcia  <justin.garcia@apple.com>
 
         Changed by Darin on my machine.
index 072bcb3..ff06ccc 100644 (file)
@@ -1,18 +1,18 @@
 #title {
-       background-image: none !important;
+    background-image: none !important;
     right: 0px !important;
 }
 
 #title h1 {
-       background-image: none !important;
-       filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/middle.png');
+    background-image: none !important;
+    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/middle.png');
     margin-right: 0px !important;
     padding-right: 15px !important;
 }
 
 #icon {
-       background-image: none !important;
-       filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='/images/icon-gold.png');
+    background-image: none !important;
+    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='/images/icon-gold.png');
 }
 
 #nav {
@@ -20,7 +20,7 @@
 }
 
 #content ul {
-       margin-left: 2em !important;
+    margin-left: 2em !important;
 }
 
 #content li {
@@ -31,3 +31,7 @@
 #navlist .subtitle {
     font-weight: normal !important;
 }
+
+img {
+    behavior: url( /pngbehavior.htc );
+}
diff --git a/WebKitSite/images/blank.png b/WebKitSite/images/blank.png
new file mode 100644 (file)
index 0000000..e823108
Binary files /dev/null and b/WebKitSite/images/blank.png differ
index 0a08039..95205e0 100644 (file)
@@ -8,7 +8,7 @@ p { margin: 0px 0px 4px 0px; }
 <p>WebKit is the system framework used on Mac OS X by <a href="http://www.apple.com/safari/">Safari</a>, Dashboard, Mail.app, and many other OS X applications.  It is based on the <a href="http://khtml.info">KHTML</a> engine from <a href="http://kde.org/">KDE</a>.</p>
 
 <h2>Getting involved</h2>
-<a href="http://nightly.webkit.org/"><img src="images/download.png" id="download" alt="download nightly" /></a>
+<a href="http://nightly.webkit.org/"><img src="images/download.png" id="download" alt="download nightly" width="189" height="65" /></a>
 <p>There are many ways in which you can get involved with the project. You can:</p>
 <ul>
        <li><a href="building/checkout.html">check out</a> and <a href="building/build.html">build the source code</a></li>
diff --git a/WebKitSite/pngbehavior.htc b/WebKitSite/pngbehavior.htc
new file mode 100644 (file)
index 0000000..9b92b83
--- /dev/null
@@ -0,0 +1,86 @@
+<public:component>
+<public:attach event="onpropertychange" onevent="propertyChanged()" />
+<public:attach event="onbeforeprint" for="window" onevent="beforePrint()" />
+<public:attach event="onafterprint" for="window" onevent="afterPrint()" />
+<script>
+
+/*
+ * PNG Behavior
+ *
+ * This script was created by Erik Arvidsson (erik(at)eae.net)
+ * for WebFX (http://webfx.eae.net)
+ * Copyright 2002
+ * 
+ * For usage see license at http://webfx.eae.net/license.html  
+ *
+ * Version: 1.01a
+ * Created: 2001-??-?? First working version
+ * Updated: 2002-03-28 Fixed issue when starting with a non png image and
+ *                      switching between non png images
+ *          2003-01-06 Fixed RegExp to correctly work with IE 5.0x
+ *          2004-04-25  Fixed PNG image printing, eliminated need for external
+ *                      GIF file, fixed intermittent uninitialised variable
+ *                      error [by AG, <http://www.scss.com.au/family/andrew/> ]
+ *          2004-09-30  Reverted inline javascript image to transparent GIF. The
+ *                      new XP SP2 'security' measures prevented the JS image
+ *                      from working. [by AG]
+ *          2004-10-22  Rewrote fixImage() to try and work around some reported
+ *                      problems with PNGs vanishing! [by AG]
+ *          2004-12-12  Fixed problem with PNGs not being restored after
+ *                      printing. I have no idea how I missed this one! [by AG]
+ *          2005-03-26  Fixed supported RE mis-identifying IE 5.0/Win98 as
+ *                      'supported'.
+ *
+ */
+var IS_PNG = /\.png$/i;
+var supported = /MSIE (5\.[5-9]|[6]\.[0-9]*)/.test(navigator.userAgent) && navigator.platform == 'Win32';
+var realSrc;
+var blankSrc = '/images/blank.png';
+if (supported) fixImage();
+function propertyChanged() {
+  if (supported && event.propertyName == 'src') {
+    var i = element.src.lastIndexOf(blankSrc);
+    if (i == -1 || i != element.src.length - blankSrc.length) {
+      fixImage();
+    }
+  }
+}
+function fixImage() {
+  if (realSrc && element.src == realSrc) {
+    // this is an attempt to set the image to itself!
+    // pointless - leave the filter as-is, restore the blank image
+    element.src = blankSrc;
+  } else {
+    // set the image to something different
+    if (IS_PNG.test(element.src)) {
+      // fixable PNG
+      realSrc = element.src;
+      element.src = blankSrc;
+      element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + realSrc + "',sizingMethod='scale')";
+    } else {
+      // ordinary image - make sure the fix is removed
+      if (realSrc) {
+        realSrc = null;
+        element.runtimeStyle.filter = '';
+      }
+    }
+  }
+}
+function beforePrint() {
+  if (realSrc) {
+    supported = false;
+    element.src = realSrc;
+    element.runtimeStyle.filter = '';
+    supported = true;
+  }
+}
+function afterPrint() {
+  if (realSrc) {
+    var rs = realSrc;
+    realSrc = null;
+    element.src = rs;
+  }
+}
+</script>
+</public:component>