Index: widget/src/cocoa/nsChildView.mm
===================================================================
RCS file: /cvsroot/mozilla/widget/src/cocoa/nsChildView.mm,v
retrieving revision 1.120.2.14
diff -u -r1.120.2.14 nsChildView.mm
--- widget/src/cocoa/nsChildView.mm	20 Nov 2006 23:39:12 -0000	1.120.2.14
+++ widget/src/cocoa/nsChildView.mm	2 Jan 2008 22:24:46 -0000
@@ -1809,6 +1809,12 @@
     temp.origin.y = NSMaxY(mainScreenFrame) - temp.origin.y;
   }
   
+  // If this is rect has a size (and is not simply a point), it is important to account 
+  // for the fact that convertRect:toView:nil thought our passed-in point was in bottom-left 
+  // coords. Thus, we subtract the rect's height, to get the top-left rect's origin 
+  // where we want it.
+  temp.origin.y -= temp.size.height;
+
   ConvertCocoaToGeckoRect(temp, aGlobalRect);
   
   return NS_OK;
Index: extensions/java/xpcom/src/nsJavaInterfaces.h
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/src/nsJavaInterfaces.h,v
retrieving revision 1.2.4.4
diff -u -r1.2.4.4 nsJavaInterfaces.h
--- extensions/java/xpcom/src/nsJavaInterfaces.h	18 Jan 2007 19:36:13 -0000	1.2.4.4
+++ extensions/java/xpcom/src/nsJavaInterfaces.h	2 Jan 2008 22:24:30 -0000
@@ -46,6 +46,8 @@
 #define JAVAPROXY_NATIVE(func) \
           Java_org_mozilla_xpcom_internal_XPCOMJavaProxy_##func
 #define LOCKPROXY_NATIVE(func) Java_org_mozilla_xpcom_ProfileLock_##func
+#define JXUTILS_NATIVE(func) \
+          Java_org_mozilla_xpcom_internal_JavaXPCOMMethods_##func
 
 
 extern "C" NS_EXPORT void JNICALL
@@ -101,4 +103,12 @@
 extern "C" NS_EXPORT jlong JNICALL
 MOZILLA_NATIVE(getNativeHandleFromAWT) (JNIEnv* env, jobject, jobject widget);
 
+extern "C" NS_EXPORT jlong JNICALL
+JXUTILS_NATIVE(wrapJavaObject) (JNIEnv* env, jobject, jobject aJavaObject,
+                                jstring aIID);
+
+extern "C" NS_EXPORT jobject JNICALL
+JXUTILS_NATIVE(wrapXPCOMObject) (JNIEnv* env, jobject, jlong aXPCOMObject,
+                                 jstring aIID);
+
 #endif // _nsJavaInterfaces_h_
Index: extensions/java/xpcom/src/JavaXPCOMMethods.java
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/src/Attic/JavaXPCOMMethods.java,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 JavaXPCOMMethods.java
--- extensions/java/xpcom/src/JavaXPCOMMethods.java	3 Oct 2006 20:02:15 -0000	1.1.2.4
+++ extensions/java/xpcom/src/JavaXPCOMMethods.java	2 Jan 2008 22:24:30 -0000
@@ -38,8 +38,10 @@
 
 import java.io.File;
 
+import org.mozilla.xpcom.IJavaXPCOMUtils;
 
-public class JavaXPCOMMethods {
+
+public class JavaXPCOMMethods implements IJavaXPCOMUtils {
 
   public static void registerJavaXPCOMMethods(File aLibXULDirectory) {
     // load JNI library
@@ -85,5 +87,9 @@
     }
   }
 
+  public native long wrapJavaObject(Object aJavaObject, String aIID);
+
+  public native Object wrapXPCOMObject(long aXPCOMObject, String aIID);
+
 }
 
Index: extensions/java/xpcom/src/dlldeps-javaxpcom.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/src/dlldeps-javaxpcom.cpp,v
retrieving revision 1.2.4.4
diff -u -r1.2.4.4 dlldeps-javaxpcom.cpp
--- extensions/java/xpcom/src/dlldeps-javaxpcom.cpp	18 Jan 2007 19:36:13 -0000	1.2.4.4
+++ extensions/java/xpcom/src/dlldeps-javaxpcom.cpp	2 Jan 2008 22:24:30 -0000
@@ -70,5 +70,9 @@
   LOCKPROXY_NATIVE(release) (nsnull, nsnull, nsnull);
 
   MOZILLA_NATIVE(getNativeHandleFromAWT) (nsnull, nsnull, nsnull);
+
+  JXUTILS_NATIVE(wrapJavaObject) (nsnull, nsnull, nsnull, nsnull);
+
+  JXUTILS_NATIVE(wrapXPCOMObject) (nsnull, nsnull, nsnull, nsnull);
 }
 
Index: Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/Makefile.in,v
retrieving revision 1.299.2.18
diff -u -r1.299.2.18 Makefile.in
--- Makefile.in	14 Sep 2006 18:07:02 -0000	1.299.2.18
+++ Makefile.in	2 Jan 2008 22:24:24 -0000
@@ -324,9 +324,9 @@
 endif
 
 # Java Embedding Plugin
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-tier_99_dirs += plugin/oji/JEP
-endif
+#ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
+#tier_99_dirs += plugin/oji/JEP
+#endif
 
 ifneq (,$(filter browser suite,$(MOZ_BUILD_APP)))
 tier_99_dirs += xpfe/components/search
@@ -380,9 +380,9 @@
 endif
 endif
 
-ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
-tier_99_dirs	+= embedding/browser/gtk
-endif
+#ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
+#tier_99_dirs	+= embedding/browser/gtk
+#endif
 
 # viewer
 ifneq (,$(ENABLE_TESTS))
Index: toolkit/mozapps/installer/packager.mk
===================================================================
RCS file: /cvsroot/mozilla/toolkit/mozapps/installer/packager.mk,v
retrieving revision 1.16.2.16
diff -u -r1.16.2.16 packager.mk
--- toolkit/mozapps/installer/packager.mk	28 Dec 2006 20:23:47 -0000	1.16.2.16
+++ toolkit/mozapps/installer/packager.mk	2 Jan 2008 22:24:36 -0000
@@ -125,8 +125,11 @@
 ifdef UNIVERSAL_BINARY
 STAGEPATH = universal/
 endif
+ifndef PKG_DMG_SOURCE
+PKG_DMG_SOURCE = $(STAGEPATH)$(MOZ_PKG_APPNAME)
+endif
 MAKE_PACKAGE	= $(_ABS_TOPSRCDIR)/build/package/mac_osx/pkg-dmg \
-  --source "$(STAGEPATH)$(MOZ_PKG_APPNAME)" --target "$(PACKAGE)" \
+  --source "$(PKG_DMG_SOURCE)" --target "$(PACKAGE)" \
   --volname "$(MOZ_APP_DISPLAYNAME)" $(PKG_DMG_FLAGS)
 UNMAKE_PACKAGE	= \
   set -ex; \
Index: extensions/java/xpcom/glue/nsJavaXPCOMGlue.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/glue/nsJavaXPCOMGlue.cpp,v
retrieving revision 1.3.4.8
diff -u -r1.3.4.8 nsJavaXPCOMGlue.cpp
--- extensions/java/xpcom/glue/nsJavaXPCOMGlue.cpp	1 Feb 2007 22:31:07 -0000	1.3.4.8
+++ extensions/java/xpcom/glue/nsJavaXPCOMGlue.cpp	2 Jan 2008 22:24:25 -0000
@@ -84,10 +84,12 @@
   kFunc_FinalizeProxy,
   kFunc_IsSameXPCOMObject,
   kFunc_ReleaseProfileLock,
-  kFunc_GetNativeHandleFromAWT
+  kFunc_GetNativeHandleFromAWT,
+  kFunc_WrapJavaObject,
+  kFunc_WrapXPCOMObject
 };
 
-#define JX_NUM_FUNCS 16
+#define JX_NUM_FUNCS 18
 
 
 // Get path string from java.io.File object.
@@ -166,6 +168,10 @@
             (NSFuncPtr*) &aFunctions[kFunc_ReleaseProfileLock] },
     { "_Java_org_mozilla_xpcom_internal_MozillaImpl_getNativeHandleFromAWT@12",
             (NSFuncPtr*) &aFunctions[kFunc_GetNativeHandleFromAWT] },
+    { "_Java_org_mozilla_xpcom_internal_JavaXPCOMMethods_wrapJavaObject@16",
+            (NSFuncPtr*) &aFunctions[kFunc_WrapJavaObject] },
+    { "_Java_org_mozilla_xpcom_internal_JavaXPCOMMethods_wrapXPCOMObject@20",
+            (NSFuncPtr*) &aFunctions[kFunc_WrapXPCOMObject] },
     { nsnull, nsnull }
   };
 #else
@@ -202,6 +208,10 @@
             (NSFuncPtr*) &aFunctions[kFunc_ReleaseProfileLock] },
     { "Java_org_mozilla_xpcom_internal_MozillaImpl_getNativeHandleFromAWT",
             (NSFuncPtr*) &aFunctions[kFunc_GetNativeHandleFromAWT] },
+    { "Java_org_mozilla_xpcom_internal_JavaXPCOMMethods_wrapJavaObject",
+            (NSFuncPtr*) &aFunctions[kFunc_WrapJavaObject] },
+    { "Java_org_mozilla_xpcom_internal_JavaXPCOMMethods_wrapXPCOMObject",
+            (NSFuncPtr*) &aFunctions[kFunc_WrapXPCOMObject] },
     { nsnull, nsnull }
   };
 #endif
@@ -303,11 +313,18 @@
       (void*) aFunctions[kFunc_IsSameXPCOMObject] }
   };
 
-   JNINativeMethod lockProxy_methods[] = {
+  JNINativeMethod lockProxy_methods[] = {
     { "releaseNative", "(J)V",
       (void*) aFunctions[kFunc_ReleaseProfileLock] }
   };
 
+  JNINativeMethod util_methods[] = {
+    { "wrapJavaObject", "(Ljava/lang/Object;Ljava/lang/String;)J",
+      (void*) aFunctions[kFunc_WrapJavaObject] },
+    { "wrapXPCOMObject", "(JLjava/lang/String;)Ljava/lang/Object;",
+      (void*) aFunctions[kFunc_WrapXPCOMObject] }
+  };
+
   jint rc = -1;
   jclass clazz = env->FindClass("org/mozilla/xpcom/internal/MozillaImpl");
   if (clazz) {
@@ -348,6 +365,14 @@
   }
   NS_ENSURE_TRUE(rc == 0, NS_ERROR_FAILURE);
 
+  rc = -1;
+  clazz = env->FindClass("org/mozilla/xpcom/internal/JavaXPCOMMethods");
+  if (clazz) {
+    rc = env->RegisterNatives(clazz, util_methods,
+                              sizeof(util_methods) / sizeof(util_methods[0]));
+  }
+  NS_ENSURE_TRUE(rc == 0, NS_ERROR_FAILURE);
+
   return NS_OK;
 }
 
Index: extensions/java/xpcom/interfaces/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/interfaces/Makefile.in,v
retrieving revision 1.5.4.11
diff -u -r1.5.4.11 Makefile.in
--- extensions/java/xpcom/interfaces/Makefile.in	18 Oct 2006 20:37:46 -0000	1.5.4.11
+++ extensions/java/xpcom/interfaces/Makefile.in	2 Jan 2008 22:24:25 -0000
@@ -50,6 +50,7 @@
 		$(srcdir)/IMozilla.java \
 		$(srcdir)/IGRE.java \
 		$(srcdir)/IXPCOM.java \
+		$(srcdir)/IJavaXPCOMUtils.java \
 		$(srcdir)/IAppFileLocProvider.java \
 		$(srcdir)/INIParser.java \
 		$(srcdir)/VersionComparator.java \
Index: extensions/java/xpcom/interfaces/Mozilla.java
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/interfaces/Attic/Mozilla.java,v
retrieving revision 1.3.4.7
diff -u -r1.3.4.7 Mozilla.java
--- extensions/java/xpcom/interfaces/Mozilla.java	1 Feb 2007 22:31:08 -0000	1.3.4.7
+++ extensions/java/xpcom/interfaces/Mozilla.java	2 Jan 2008 22:24:30 -0000
@@ -85,17 +85,17 @@
  * 
  * @see http://www.mozilla.org/projects/embedding/GRE.html
  */
-public class Mozilla implements IMozilla, IGRE, IXPCOM, IXPCOMError {
+public class Mozilla implements IMozilla, IGRE, IXPCOM, IJavaXPCOMUtils,
+IXPCOMError {
 
   private static Mozilla mozillaInstance = new Mozilla();
 
   private static final String JAVAXPCOM_JAR = "javaxpcom.jar";
 
   private IMozilla mozilla = null;
-
   private IGRE gre = null;
-
   private IXPCOM xpcom = null;
+  private IJavaXPCOMUtils jxutils = null;
 
   /**
    * @return
@@ -655,6 +655,11 @@
       Class xpcomClass = Class.forName("org.mozilla.xpcom.internal.XPCOMImpl",
                                        true, loader);
       xpcom = (IXPCOM) xpcomClass.newInstance();
+
+      Class javaXPCOMClass =
+    	  Class.forName("org.mozilla.xpcom.internal.JavaXPCOMMethods",
+    			  true, loader);
+      jxutils  = (IJavaXPCOMUtils) javaXPCOMClass.newInstance();
     } catch (Exception e) {
       throw new XPCOMInitializationException("Could not load " +
           "org.mozilla.xpcom.internal.* classes", e);
@@ -1041,4 +1046,22 @@
     }
   }
 
+	public long wrapJavaObject(Object aJavaObject, String aIID) {
+		try {
+			return jxutils.wrapJavaObject(aJavaObject, aIID);
+    } catch (NullPointerException e) {
+      throw new XPCOMInitializationException("Must call " +
+          "Mozilla.getInstance().initialize() before using this method", e);
+    }
+	}
+	
+	public Object wrapXPCOMObject(long aXPCOMObject, String aIID) {
+		try {
+			return jxutils.wrapXPCOMObject(aXPCOMObject, aIID);
+    } catch (NullPointerException e) {
+      throw new XPCOMInitializationException("Must call " +
+          "Mozilla.getInstance().initialize() before using this method", e);
+    }
+	}
+
 }
Index: xulrunner/installer/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/xulrunner/installer/Makefile.in,v
retrieving revision 1.1.4.5
diff -u -r1.1.4.5 Makefile.in
--- xulrunner/installer/Makefile.in	30 Nov 2006 21:36:24 -0000	1.1.4.5
+++ xulrunner/installer/Makefile.in	2 Jan 2008 22:24:46 -0000
@@ -62,6 +62,7 @@
 _APPNAME = $(PKG_BASENAME).pkg
 PKG_SKIP_STRIP = 1
 MOZ_PKG_SPECIAL = pkg
+PKG_DMG_SOURCE = $(STAGEPATH)xulrunner-pkg
 endif
 
 include $(topsrcdir)/config/rules.mk
Index: extensions/java/xpcom/nsJavaInterfaces.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/java/xpcom/Attic/nsJavaInterfaces.cpp,v
retrieving revision 1.26.2.5
diff -u -r1.26.2.5 nsJavaInterfaces.cpp
--- extensions/java/xpcom/nsJavaInterfaces.cpp	18 Jan 2007 19:36:12 -0000	1.26.2.5
+++ extensions/java/xpcom/nsJavaInterfaces.cpp	2 Jan 2008 22:24:25 -0000
@@ -430,3 +430,67 @@
 
   return handle;
 }
+
+extern "C" NS_EXPORT jlong JNICALL
+JXUTILS_NATIVE(wrapJavaObject) (JNIEnv* env, jobject, jobject aJavaObject,
+                                jstring aIID)
+{
+  nsresult rv;
+  nsISupports* xpcomObject = nsnull;
+
+  if (!aJavaObject || !aIID) {
+    rv = NS_ERROR_NULL_POINTER;
+  } else {
+    const char* str = env->GetStringUTFChars(aIID, nsnull);
+    if (!str) {
+      rv = NS_ERROR_OUT_OF_MEMORY;
+    } else {
+      nsID iid;
+      if (iid.Parse(str)) {
+        rv = GetNewOrUsedXPCOMObject(env, aJavaObject, iid, &xpcomObject);
+      } else {
+        rv = NS_ERROR_INVALID_ARG;
+      }
+
+      env->ReleaseStringUTFChars(aIID, str);
+    }
+  }
+
+  if (NS_FAILED(rv)) {
+    ThrowException(env, rv, "Failed to create XPCOM proxy for Java object");
+  }
+  return NS_REINTERPRET_CAST(jlong, xpcomObject);
+}
+
+extern "C" NS_EXPORT jobject JNICALL
+JXUTILS_NATIVE(wrapXPCOMObject) (JNIEnv* env, jobject, jlong aXPCOMObject,
+                                 jstring aIID)
+{
+  nsresult rv;
+  jobject javaObject = nsnull;
+  nsISupports* xpcomObject = NS_REINTERPRET_CAST(nsISupports*, aXPCOMObject);
+
+  if (!xpcomObject || !aIID) {
+    rv = NS_ERROR_NULL_POINTER;
+  } else {
+    const char* str = env->GetStringUTFChars(aIID, nsnull);
+    if (!str) {
+      rv = NS_ERROR_OUT_OF_MEMORY;
+    } else {
+      nsID iid;
+      if (iid.Parse(str)) {
+        // XXX Should we be passing something other than NULL for aObjectLoader?
+        rv = GetNewOrUsedJavaObject(env, xpcomObject, iid, nsnull, &javaObject);
+      } else {
+        rv = NS_ERROR_INVALID_ARG;
+      }
+
+      env->ReleaseStringUTFChars(aIID, str);
+    }
+  }
+
+  if (NS_FAILED(rv)) {
+    ThrowException(env, rv, "Failed to create XPCOM proxy for Java object");
+  }
+  return javaObject;
+}
Index: gfx/cairo/cairo/src/cairo-ft-font.c
===================================================================
RCS file: /cvsroot/mozilla/gfx/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.1.4.3
diff -u -r1.1.4.3 cairo-ft-font.c
--- gfx/cairo/cairo/src/cairo-ft-font.c	30 Nov 2006 02:10:53 -0000	1.1.4.3
+++ gfx/cairo/cairo/src/cairo-ft-font.c	2 Jan 2008 22:24:36 -0000
@@ -800,6 +800,7 @@
 		}
 		format = CAIRO_FORMAT_A8;
 	    } else {
+#if 0
 		int		    x, y;
 		unsigned char   *in_line, *out_line, *in;
 		unsigned int    *out;
@@ -887,6 +888,7 @@
 		data = data_rgba;
 		stride = stride_rgba;
 		format = CAIRO_FORMAT_ARGB32;
+#endif
 	    }
 	    break;
 	case FT_PIXEL_MODE_GRAY2:
@@ -984,6 +986,7 @@
 	    bitmap.num_grays  = 1;
 	    stride = ((width + 31) & -32) >> 3;
 	} else {
+#if 0
 	    /* XXX not a complete set of flags. This code
 	     * will go away when cworth rewrites the glyph
 	     * cache code */
@@ -1006,6 +1009,7 @@
 		subpixel = TRUE;
 		break;
 	    }
+#endif
 	    if (subpixel)
 		format = CAIRO_FORMAT_ARGB32;
 	    else
Index: extensions/java/xpcom/interfaces/IJavaXPCOMUtils.java
===================================================================
RCS file: extensions/java/xpcom/interfaces/IJavaXPCOMUtils.java
diff -N extensions/java/xpcom/interfaces/IJavaXPCOMUtils.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ extensions/java/xpcom/interfaces/IJavaXPCOMUtils.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Java XPCOM Bindings.
+ *
+ * The Initial Developer of the Original Code is IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * IBM Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Javier Pedemonte (jhpedemonte@gmail.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package org.mozilla.xpcom;
+
+public interface IJavaXPCOMUtils {
+
+	/**
+	 * Returns a pointer to a C++ proxy object for the given Java object.
+	 * 
+	 * @param aJavaObject   Java object to encapsulate in C++ proxy
+	 * @param aIID          interface ID for requested proxy
+	 * @return  C pointer (as long) of new proxy
+	 */
+	long wrapJavaObject(Object aJavaObject, String aIID);
+
+	/**
+	 * Returns a Java proxy for the given C++ XPCOM object
+	 * 
+	 * @param aXPCOMObject  C++ XPCOM object to encapsulate in Java proxy
+	 * @param aIID          interface ID for requested proxy
+	 * @return  new Proxy
+	 */
+	Object wrapXPCOMObject(long aXPCOMObject, String aIID);
+
+}
