- moved to XUL Runner and updated to 3.0b3pre

- removed firefox-devel package, gecko-libs is provided by xulrunner-devel
    now.
This commit is contained in:
Martin Stransky 2007-12-18 14:33:32 +00:00
parent b817622108
commit bede30df0b
21 changed files with 56 additions and 10565 deletions

View File

@ -1,2 +1,3 @@
firefox-2.0.0.10-source.tar.bz2
firefox-langpacks-2.0.0.10-20071123.tar.bz2
firefox-20071215.tar.bz2

View File

@ -1,28 +0,0 @@
--- mozilla/modules/libpref/src/init/all.js.foo 2004-06-18 13:16:32.000000000 -0400
+++ mozilla/modules/libpref/src/init/all.js 2004-06-18 13:17:28.000000000 -0400
@@ -1776,8 +1776,10 @@
pref("print.postscript.nativefont.ar", "");
pref("print.postscript.nativefont.el", "");
pref("print.postscript.nativefont.he", "");
-pref("print.postscript.nativefont.ja", "");
-pref("print.postscript.nativefont.ko", "");
+pref("print.postscript.nativecode.ja", "euc-jp");
+pref("print.postscript.nativefont.ja", "Ryumin-Light-EUC-H");
+pref("print.postscript.nativecode.ko", "euc-kr");
+pref("print.postscript.nativefont.ko", "Baekmuk-Gulim-KSC-EUC-H");
pref("print.postscript.nativefont.th", "");
pref("print.postscript.nativefont.tr", "");
pref("print.postscript.nativefont.x-baltic", "");
@@ -1786,8 +1788,10 @@
pref("print.postscript.nativefont.x-unicode", "");
pref("print.postscript.nativefont.x-user-def", "");
pref("print.postscript.nativefont.x-western", "");
-pref("print.postscript.nativefont.zh-CN", "");
-pref("print.postscript.nativefont.zh-TW", "");
+pref("print.postscript.nativecode.zh-CN", "gb18030");
+pref("print.postscript.nativefont.zh-CN", "MSungGBK-Light-GBK2K-H");
+pref("print.postscript.nativecode.zh-TW", "big5");
+pref("print.postscript.nativefont.zh-TW", "ShanHeiSun-Light-B5-H");
pref("print.postscript.nativefont.zh-HK", "");
# XP_UNIX

View File

@ -1,32 +0,0 @@
Index: browser/components/shell/src/nsGNOMEShellService.h
===================================================================
RCS file: /cvsroot/mozilla/browser/components/shell/src/nsGNOMEShellService.h,v
retrieving revision 1.2.4.1
diff -d -u -p -r1.2.4.1 nsGNOMEShellService.h
--- browser/components/shell/src/nsGNOMEShellService.h 15 Jul 2004 20:43:55 -0000 1.2.4.1
+++ browser/components/shell/src/nsGNOMEShellService.h 15 Oct 2004 20:39:56 -0000
@@ -43,7 +43,7 @@
class nsGNOMEShellService : public nsIShellService
{
public:
- nsGNOMEShellService() : mCheckedThisSession(PR_FALSE) { }
+ nsGNOMEShellService() : mCheckedThisSession(PR_TRUE) { }
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
Index: browser/components/preferences/main.xul
===================================================================
RCS file: /cvsroot/mozilla/browser/components/preferences/main.xul,v
retrieving revision 1.3.2.6
diff -d -u -p -r1.3.2.6 main.xul
--- browser/components/preferences/main.xul 13 Sep 2006 03:01:38 -0000 1.3.2.6
+++ browser/components/preferences/main.xul 7 Oct 2006 19:58:16 -0000
@@ -193,7 +193,7 @@
</radiogroup>
</groupbox>
-#ifdef HAVE_SHELL_SERVICE
+#if 0
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="horizontal">
<caption label="&systemDefaults.label;"/>

View File

@ -1,459 +0,0 @@
Index: uriloader/exthandler/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/Makefile.in,v
retrieving revision 1.60
diff -d -u -p -r1.60 Makefile.in
--- uriloader/exthandler/Makefile.in 2 May 2005 16:30:03 -0000 1.60
+++ uriloader/exthandler/Makefile.in 21 Jul 2005 03:07:39 -0000
@@ -102,7 +102,7 @@ endif
LOCAL_INCLUDES = -I$(srcdir)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
-OSHELPER += nsGNOMERegistry.cpp
+OSHELPER += nsMIMEInfoUnix.cpp nsGNOMERegistry.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
Index: uriloader/exthandler/unix/nsGNOMERegistry.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/unix/nsGNOMERegistry.cpp,v
retrieving revision 1.10
diff -d -u -p -r1.10 nsGNOMERegistry.cpp
--- uriloader/exthandler/unix/nsGNOMERegistry.cpp 16 Oct 2004 13:46:17 -0000 1.10
+++ uriloader/exthandler/unix/nsGNOMERegistry.cpp 21 Jul 2005 03:07:40 -0000
@@ -42,7 +42,7 @@
#include "nsString.h"
#include "nsIComponentManager.h"
#include "nsILocalFile.h"
-#include "nsMIMEInfoImpl.h"
+#include "nsMIMEInfoUnix.h"
#include "nsAutoPtr.h"
#include <glib.h>
@@ -56,12 +56,12 @@ typedef struct _GConfClient GConfClient;
typedef struct _GnomeProgram GnomeProgram;
typedef struct _GnomeModuleInfo GnomeModuleInfo;
-typedef struct {
+struct GnomeVFSMimeApplication {
char *id;
char *name;
char *command;
/* there is more here, but we don't need it */
-} GnomeVFSMimeApplication;
+};
typedef GConfClient * (*_gconf_client_get_default_fn)();
typedef gchar * (*_gconf_client_get_string_fn)(GConfClient *,
@@ -264,7 +264,7 @@ nsGNOMERegistry::GetAppDescForScheme(con
}
-/* static */ already_AddRefed<nsMIMEInfoBase>
+/* static */ already_AddRefed<nsMIMEInfoUnix>
nsGNOMERegistry::GetFromExtension(const char *aFileExt)
{
if (!gconfLib)
@@ -286,7 +286,7 @@ nsGNOMERegistry::GetFromExtension(const
return GetFromType(mimeType);
}
-/* static */ already_AddRefed<nsMIMEInfoBase>
+/* static */ already_AddRefed<nsMIMEInfoUnix>
nsGNOMERegistry::GetFromType(const char *aMIMEType)
{
if (!gconfLib)
@@ -296,9 +296,11 @@ nsGNOMERegistry::GetFromType(const char
if (!handlerApp)
return nsnull;
- nsRefPtr<nsMIMEInfoImpl> mimeInfo = new nsMIMEInfoImpl(aMIMEType);
+ nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix(aMIMEType);
NS_ENSURE_TRUE(mimeInfo, nsnull);
+ mimeInfo->SetDefaultGnomeVFSMimeApplication(handlerApp);
+
// Get the list of extensions and append then to the mimeInfo.
GList *extensions = _gnome_vfs_mime_get_extensions_list(aMIMEType);
for (GList *extension = extensions; extension; extension = extension->next)
@@ -320,11 +322,21 @@ nsGNOMERegistry::GetFromType(const char
return nsnull;
}
- gchar *commandPath = g_find_program_in_path(nativeCommand);
+ gchar **argv;
+ gboolean res = g_shell_parse_argv(nativeCommand, NULL, &argv, NULL);
+ if (!res) {
+ NS_ERROR("Could not convert helper app command to filesystem encoding");
+ _gnome_vfs_mime_application_free(handlerApp);
+ return nsnull;
+ }
+
+ gchar *commandPath = g_find_program_in_path(argv[0]);
g_free(nativeCommand);
+ g_strfreev(argv);
if (!commandPath) {
+ NS_WARNING("could not find command in path");
_gnome_vfs_mime_application_free(handlerApp);
return nsnull;
}
@@ -342,7 +354,7 @@ nsGNOMERegistry::GetFromType(const char
_gnome_vfs_mime_application_free(handlerApp);
- nsMIMEInfoBase* retval;
+ nsMIMEInfoUnix* retval;
NS_ADDREF((retval = mimeInfo));
return retval;
}
Index: uriloader/exthandler/unix/nsGNOMERegistry.h
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/unix/nsGNOMERegistry.h,v
retrieving revision 1.3
diff -d -u -p -r1.3 nsGNOMERegistry.h
--- uriloader/exthandler/unix/nsGNOMERegistry.h 16 Oct 2004 13:46:17 -0000 1.3
+++ uriloader/exthandler/unix/nsGNOMERegistry.h 21 Jul 2005 03:07:40 -0000
@@ -35,10 +35,13 @@
*
* ***** END LICENSE BLOCK ***** */
+#ifndef nsGNOMERegistry_h__
+#define nsGNOMERegistry_h__
+
#include "nsIURI.h"
#include "nsCOMPtr.h"
-class nsMIMEInfoBase;
+class nsMIMEInfoUnix;
class nsGNOMERegistry
{
@@ -52,7 +55,9 @@ class nsGNOMERegistry
static void GetAppDescForScheme(const nsACString& aScheme,
nsAString& aDesc);
- static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const char *aFileExt);
+ static already_AddRefed<nsMIMEInfoUnix> GetFromExtension(const char *aFileExt);
- static already_AddRefed<nsMIMEInfoBase> GetFromType(const char *aMIMEType);
+ static already_AddRefed<nsMIMEInfoUnix> GetFromType(const char *aMIMEType);
};
+
+#endif // nsGNOMERegistry_h__
Index: uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
===================================================================
RCS file: uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
diff -N uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ uriloader/exthandler/unix/nsMIMEInfoUnix.cpp 21 Jul 2005 03:07:40 -0000
@@ -0,0 +1,196 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.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 mozilla.org Code.
+ *
+ * The Initial Developer of the Original Code is
+ * Red Hat, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Christopher Aillon <caillon@redhat.com> (Original author)
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsMIMEInfoUnix.h"
+#include "prlink.h"
+#include "prmem.h"
+#include <glib.h>
+#include <glib-object.h>
+
+static PRLibrary *gnomeLib;
+static PRLibrary *vfsLib;
+
+typedef struct _GnomeProgram GnomeProgram;
+typedef struct _GnomeModuleInfo GnomeModuleInfo;
+
+typedef enum {
+ GNOME_VFS_OK // there's more but we don't care about them.
+} GnomeVFSResult;
+
+typedef GnomeVFSResult (*_gnome_vfs_mime_application_launch_fn)
+ (GnomeVFSMimeApplication *app,
+ GList *uris);
+typedef void (*_gnome_vfs_mime_application_free_fn)(GnomeVFSMimeApplication *);
+typedef GnomeVFSMimeApplication * (*_gnome_vfs_mime_application_copy_fn)(GnomeVFSMimeApplication *);
+typedef GnomeProgram * (*_gnome_program_init_fn)(const char *, const char *,
+ const GnomeModuleInfo *, int,
+ char **, const char *, ...);
+typedef const char * (*_gnome_vfs_mime_application_get_name_fn)(GnomeVFSMimeApplication *);
+typedef const GnomeModuleInfo * (*_libgnome_module_info_get_fn)();
+typedef GnomeProgram * (*_gnome_program_get_fn)();
+typedef char * (*_gnome_vfs_make_uri_from_input_fn)(const char *);
+
+#define DECL_FUNC_PTR(func) static _##func##_fn _##func
+
+DECL_FUNC_PTR(gnome_vfs_mime_application_launch);
+DECL_FUNC_PTR(gnome_vfs_mime_application_free);
+DECL_FUNC_PTR(gnome_vfs_mime_application_copy);
+DECL_FUNC_PTR(gnome_vfs_mime_application_get_name);
+DECL_FUNC_PTR(gnome_program_init);
+DECL_FUNC_PTR(gnome_program_get);
+DECL_FUNC_PTR(libgnome_module_info_get);
+DECL_FUNC_PTR(gnome_vfs_make_uri_from_input);
+
+static PRLibrary *
+LoadVersionedLibrary(const char* libName, const char* libVersion)
+{
+ char *platformLibName = PR_GetLibraryName(nsnull, libName);
+ nsCAutoString versionLibName(platformLibName);
+ versionLibName.Append(libVersion);
+ PR_Free(platformLibName);
+ return PR_LoadLibrary(versionLibName.get());
+}
+
+static void
+Cleanup()
+{
+ // Unload all libraries
+ if (gnomeLib)
+ PR_UnloadLibrary(gnomeLib);
+ if (vfsLib)
+ PR_UnloadLibrary(vfsLib);
+
+ gnomeLib = vfsLib = nsnull;
+}
+
+static void
+InitGnomeVFS()
+{
+ static PRBool initialized = PR_FALSE;
+
+ if (initialized)
+ return;
+
+ #define ENSURE_LIB(lib) \
+ PR_BEGIN_MACRO \
+ if (!lib) { \
+ Cleanup(); \
+ return; \
+ } \
+ PR_END_MACRO
+
+ #define GET_LIB_FUNCTION(lib, func, failure) \
+ PR_BEGIN_MACRO \
+ _##func = (_##func##_fn) PR_FindFunctionSymbol(lib##Lib, #func); \
+ if (!_##func) { \
+ failure; \
+ } \
+ PR_END_MACRO
+
+ // Attempt to open libgnome
+ gnomeLib = LoadVersionedLibrary("gnome-2", ".0");
+ ENSURE_LIB(gnomeLib);
+
+ GET_LIB_FUNCTION(gnome, gnome_program_init, return Cleanup());
+ GET_LIB_FUNCTION(gnome, libgnome_module_info_get, return Cleanup());
+ GET_LIB_FUNCTION(gnome, gnome_program_get, return Cleanup());
+
+ // Attempt to open libgnomevfs
+ vfsLib = LoadVersionedLibrary("gnomevfs-2", ".0");
+ ENSURE_LIB(vfsLib);
+
+ GET_LIB_FUNCTION(vfs, gnome_vfs_mime_application_launch, /* do nothing */);
+ GET_LIB_FUNCTION(vfs, gnome_vfs_make_uri_from_input, return Cleanup());
+ GET_LIB_FUNCTION(vfs, gnome_vfs_mime_application_get_name, return Cleanup());
+ GET_LIB_FUNCTION(vfs, gnome_vfs_mime_application_free, return Cleanup());
+ GET_LIB_FUNCTION(vfs, gnome_vfs_mime_application_copy, return Cleanup());
+
+ // Initialize GNOME, if it's not already initialized. It's not
+ // necessary to tell GNOME about our actual command line arguments.
+
+ if (!_gnome_program_get()) {
+ char *argv[1] = { "gecko" };
+ _gnome_program_init("Gecko", "1.0", _libgnome_module_info_get(),
+ 1, argv, NULL);
+ }
+
+ // Note: after GNOME has been initialized, do not ever unload these
+ // libraries. They register atexit handlers, so if they are unloaded, we'll
+ // crash on exit.
+}
+
+void
+nsMIMEInfoUnix::SetDefaultGnomeVFSMimeApplication(GnomeVFSMimeApplication* app)
+{
+ if (_gnome_vfs_mime_application_copy && _gnome_vfs_mime_application_free) {
+ mDefaultVFSApplication = _gnome_vfs_mime_application_copy(app);
+
+ mPreferredAction = nsIMIMEInfo::useSystemDefault;
+
+ const gchar * name = _gnome_vfs_mime_application_get_name(mDefaultVFSApplication);
+ if (name)
+ mDefaultAppDescription = NS_ConvertUTF8toUCS2(name);
+ }
+}
+
+nsMIMEInfoUnix::~nsMIMEInfoUnix()
+{
+ if (mDefaultVFSApplication)
+ _gnome_vfs_mime_application_free(mDefaultVFSApplication);
+}
+
+nsresult
+nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile* aFile)
+{
+ NS_ENSURE_ARG_POINTER(aFile);
+
+ InitGnomeVFS();
+
+ if (_gnome_vfs_mime_application_launch && mDefaultVFSApplication) {
+ nsCAutoString nativePath;
+ aFile->GetNativePath(nativePath);
+
+ gchar *uri = _gnome_vfs_make_uri_from_input(nativePath.get());
+
+ GList *uris = NULL;
+ uris = g_list_append(uris, uri);
+
+ GnomeVFSResult result = _gnome_vfs_mime_application_launch(mDefaultVFSApplication, uris);
+
+ g_free(uri);
+ g_list_free(uris);
+
+ if (result != GNOME_VFS_OK)
+ return NS_ERROR_FAILURE;
+
+ return NS_OK;
+ }
+
+ if (!mDefaultApplication)
+ return NS_ERROR_FILE_NOT_FOUND;
+
+ return LaunchWithIProcess(mDefaultApplication, aFile);
+}
Index: uriloader/exthandler/unix/nsMIMEInfoUnix.h
===================================================================
RCS file: uriloader/exthandler/unix/nsMIMEInfoUnix.h
diff -N uriloader/exthandler/unix/nsMIMEInfoUnix.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ uriloader/exthandler/unix/nsMIMEInfoUnix.h 21 Jul 2005 03:07:40 -0000
@@ -0,0 +1,50 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.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 mozilla.org Code.
+ *
+ * The Initial Developer of the Original Code is
+ * Red Hat, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Christopher Aillon <caillon@redhat.com> (Original author)
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsMimeInfoUnix_h__
+#define nsMimeInfoUnix_h__
+
+#include "nsMIMEInfoImpl.h"
+
+struct GnomeVFSMimeApplication;
+
+class nsMIMEInfoUnix : public nsMIMEInfoImpl
+{
+public:
+ nsMIMEInfoUnix(const char* aType = "") : nsMIMEInfoImpl(aType), mDefaultVFSApplication(nsnull) {}
+ nsMIMEInfoUnix(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {};
+
+ virtual ~nsMIMEInfoUnix();
+
+ void SetDefaultGnomeVFSMimeApplication(GnomeVFSMimeApplication *app);
+
+protected:
+ virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile* aFile);
+
+ GnomeVFSMimeApplication *mDefaultVFSApplication;
+};
+
+#endif // nsMimeInfoUnix_h__
Index: uriloader/exthandler/unix/nsOSHelperAppService.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp,v
retrieving revision 1.58
diff -d -u -p -r1.58 nsOSHelperAppService.cpp
--- uriloader/exthandler/unix/nsOSHelperAppService.cpp 25 Oct 2004 07:46:01 -0000 1.58
+++ uriloader/exthandler/unix/nsOSHelperAppService.cpp 21 Jul 2005 03:07:40 -0000
@@ -44,6 +44,7 @@
#include "nsOSHelperAppService.h"
#ifdef MOZ_WIDGET_GTK2
#include "nsGNOMERegistry.h"
+#include "nsMIMEInfoUnix.h"
#endif
#include "nsISupports.h"
#include "nsString.h"
@@ -1486,6 +1487,17 @@ nsOSHelperAppService::GetFromType(const
LOG(("Here we do a mimetype lookup for '%s'\n", aMIMEType.get()));
+#ifdef MOZ_WIDGET_GTK2
+ // Look in GNOME registry first since it is the preferred method in GNOME,
+ // should trump the mailcap entry
+ LOG(("Looking in GNOME registry\n"));
+ nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
+ if (gnomeInfo) {
+ LOG(("Got MIMEInfo from GNOME registry\n"));
+ return gnomeInfo;
+ }
+#endif
+
// extract the major and minor types
NS_ConvertASCIItoUTF16 mimeType(aMIMEType);
nsAString::const_iterator start_iter, end_iter,
@@ -1522,21 +1534,6 @@ nsOSHelperAppService::GetFromType(const
mozillaFlags,
PR_TRUE);
-
- if (handler.IsEmpty() && extensions.IsEmpty() &&
- mailcap_description.IsEmpty() && mime_types_description.IsEmpty()) {
- // No useful data yet
-
-#ifdef MOZ_WIDGET_GTK2
- LOG(("Looking in GNOME registry\n"));
- nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
- if (gnomeInfo) {
- LOG(("Got MIMEInfo from GNOME registry\n"));
- return gnomeInfo;
- }
-#endif
- }
-
if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
minorType,

View File

@ -1,23 +0,0 @@
Index: mozilla/editor/libeditor/text/nsTextEditRules.cpp
===================================================================
RCS file: /cvsroot/mozilla/editor/libeditor/text/nsTextEditRules.cpp,v
retrieving revision 1.195
diff -d -u -p -r1.195 nsTextEditRules.cpp
--- mozilla/editor/libeditor/text/nsTextEditRules.cpp 16 Jun 2005 13:10:56 -0000 1.195
+++ mozilla/editor/libeditor/text/nsTextEditRules.cpp 4 Oct 2006 16:02:19 -0000
@@ -1390,13 +1390,13 @@ nsTextEditRules::EchoInsertionToPWBuff(P
// manage the password buffer
mPasswordText.Insert(*aOutString, aStart);
- // change the output to '*' only
+ // change the output to 'U+2022' only
PRInt32 length = aOutString->Length();
PRInt32 i;
aOutString->Truncate();
for (i=0; i<length; i++)
{
- aOutString->Append(PRUnichar('*'));
+ aOutString->Append(PRUnichar(0x2022));
}
return NS_OK;

View File

@ -1,19 +0,0 @@
diff -pruN -x '.moz*' -x .deps -x 'firefox*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
--- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-08-26 13:33:35.000000000 +0900
+++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-13 20:54:32.000000000 +0900
@@ -4261,12 +4261,10 @@ nsTextFrame::GetPointFromOffset(nsPresCo
if (tc) {
totalLength = tc->Text()->GetLength(); // raw value which includes whitespace
}
- if ((hitLength == textLength) && (inOffset = mContentLength) &&
- (mContentOffset + mContentLength == totalLength)) {
- // no need to re-measure when at the end of the last-in-flow
- }
+ if (hitLength > 0)
+ inRendContext->GetRangeWidth(paintBuffer.mBuffer, textLength, 0, hitLength, (PRUint32&)width);
else
- inRendContext->GetWidth(paintBuffer.mBuffer, hitLength, width);
+ width = 0;
}
if ((hitLength == textLength) && (TEXT_TRIMMED_WS & mState)) {
//

View File

@ -1,52 +0,0 @@
Index: mozilla/gfx/src/gtk/nsFontMetricsPango.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsPango.cpp,v
retrieving revision 1.24
diff -d -u -p -6 -r1.24 nsFontMetricsPango.cpp
--- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 25 Aug 2006 01:02:34 -0000 1.24
+++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 6 Sep 2006 07:01:49 -0000
@@ -948,13 +948,12 @@ nsFontMetricsPango::GetClusterInfo(const
PRInt32
nsFontMetricsPango::GetPosition(const PRUnichar *aText, PRUint32 aLength,
nsPoint aPt)
{
int trailing = 0;
int inx = 0;
- gboolean found = FALSE;
const gchar *curChar;
PRInt32 retval = 0;
float f = mDeviceContext->AppUnitsToDevUnits();
PangoLayout *layout = pango_layout_new(mPangoContext);
@@ -974,28 +973,18 @@ nsFontMetricsPango::GetPosition(const PR
}
// Set up the pango layout
pango_layout_set_text(layout, text, strlen(text));
FixupSpaceWidths(layout, text);
- found = pango_layout_xy_to_index(layout, localX, localY,
- &inx, &trailing);
+ pango_layout_xy_to_index(layout, localX, localY,
+ &inx, &trailing);
// Convert the index back to the utf-16 index
curChar = text;
- // Jump to the end if it's not found.
- if (!found) {
- if (inx == 0)
- retval = 0;
- else if (trailing)
- retval = aLength;
-
- goto loser;
- }
-
for (PRUint32 curOffset=0; curOffset < aLength;
curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
// Check for a match before checking for a surrogate pair
if (curChar - text == inx) {
retval = curOffset;

View File

@ -1,53 +0,0 @@
diff -pruN -x '.moz*' -x .deps -x 'thunderbird*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' -x 'firefox*' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
--- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-12-20 12:15:38.000000000 +0900
+++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-20 21:29:39.000000000 +0900
@@ -2973,15 +2973,16 @@ nsTextFrame::RenderString(nsIRenderingCo
nsIFontMetrics* lastFont = aTextStyle.mLastFont;
PRInt32 pendingCount;
- PRUnichar* runStart = bp;
+ PRUnichar* runStart = bp, *top = aBuffer;
nscoord charWidth, width = 0;
PRInt32 countSoFar = 0;
+ PRUint32 offset;
// Save the color we want to use for the text, since calls to
// PaintTextDecorations in this method will call SetColor() on the rendering
// context.
nscolor textColor;
aRenderingContext.GetColor(textColor);
- for (; --aLength >= 0; aBuffer++) {
+ for (offset = 0; offset < aLength; aBuffer++, offset++) {
nsIFontMetrics* nextFont;
nscoord glyphWidth = 0;
PRUnichar ch = *aBuffer;
@@ -3038,7 +3039,7 @@ nsTextFrame::RenderString(nsIRenderingCo
else if (ch == ' ') {
glyphWidth += aTextStyle.mSpaceWidth + aTextStyle.mWordSpacing + aTextStyle.mLetterSpacing;
}
- else if (IS_HIGH_SURROGATE(ch) && aLength > 0 &&
+ else if (IS_HIGH_SURROGATE(ch) && (offset + 1) < aLength &&
IS_LOW_SURROGATE(*(aBuffer+1))) {
// special handling for surrogate pair
@@ -3046,7 +3047,7 @@ nsTextFrame::RenderString(nsIRenderingCo
glyphWidth += charWidth + aTextStyle.mLetterSpacing;
// copy the surrogate low
*bp++ = ch;
- --aLength;
+ offset++;
aBuffer++;
ch = *aBuffer;
// put the width into the space buffer
@@ -3058,10 +3059,10 @@ nsTextFrame::RenderString(nsIRenderingCo
glyphWidth = 0;
}
else {
- aRenderingContext.GetWidth(ch, charWidth);
+ aRenderingContext.GetRangeWidth(top, aLength, offset, offset + 1, (PRUint32&)charWidth);
glyphWidth += charWidth + aTextStyle.mLetterSpacing;
}
- if (justifying && (!isEndOfLine || aLength > 0)
+ if (justifying && (!isEndOfLine || (offset + 1) < aLength)
&& IsJustifiableCharacter(ch, isCJ)) {
glyphWidth += aTextStyle.mExtraSpacePerJustifiableCharacter;
if ((PRUint32)--aTextStyle.mNumJustifiableCharacterToRender

View File

@ -1,39 +0,0 @@
diff -pruN -x '.moz*' -x .deps -x 'thunderbird*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
--- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-12-20 12:53:26.000000000 +0900
+++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-20 15:43:14.000000000 +0900
@@ -2097,11 +2097,11 @@ nsTextFrame::PaintTextDecorations(nsIRen
nsRect rect = GetRect();
while(aDetails){
const nscoord* sp= aSpacing;
- PRInt32 startOffset = 0;
- PRInt32 textWidth = 0;
- PRInt32 start = PR_MAX(0,(aDetails->mStart - (PRInt32)aIndex));
- PRInt32 end = PR_MIN((PRInt32)aLength,(aDetails->mEnd - (PRInt32)aIndex));
- PRInt32 i;
+ PRUint32 startOffset = 0;
+ PRUint32 textWidth = 0;
+ PRInt32 start = PR_MAX(0,(aDetails->mStart - (PRInt32)aIndex));
+ PRInt32 end = PR_MIN((PRInt32)aLength,(aDetails->mEnd - (PRInt32)aIndex));
+ PRInt32 i;
if ((start < end) && ((aLength - start) > 0))
{
//aDetails allready processed to have offsets from frame start not content offsets
@@ -2117,7 +2117,7 @@ nsTextFrame::PaintTextDecorations(nsIRen
}
}
else
- aRenderingContext.GetWidth(aText, start, startOffset);
+ aRenderingContext.GetRangeWidth(aText, aLength, 0, start, startOffset);
}
if (sp){
for (i = start; i < end;i ++){
@@ -2125,8 +2125,7 @@ nsTextFrame::PaintTextDecorations(nsIRen
}
}
else
- aRenderingContext.GetWidth(aText + start,
- PRUint32(end - start), textWidth);
+ aRenderingContext.GetRangeWidth(aText, aLength, start, end, textWidth);
}
nscoord offset, size;

View File

@ -1,263 +0,0 @@
Index: layout/base/nsPresContext.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/base/nsPresContext.cpp,v
retrieving revision 3.288.12.2.4.1
diff -d -u -p -r3.288.12.2.4.1 nsPresContext.cpp
--- layout/base/nsPresContext.cpp 21 Apr 2006 23:30:50 -0000 3.288.12.2.4.1
+++ layout/base/nsPresContext.cpp 26 Sep 2006 19:26:40 -0000
@@ -73,6 +73,9 @@
#include "nsIDOMDocument.h"
#include "nsAutoPtr.h"
#include "nsEventStateManager.h"
+#include "nsIEventQueue.h"
+#include "nsIEventQueueService.h"
+
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
#endif // IBMBIDI
@@ -267,6 +270,7 @@ nsPresContext::~nsPresContext()
NS_IF_RELEASE(mDeviceContext);
NS_IF_RELEASE(mLookAndFeel);
NS_IF_RELEASE(mLangGroup);
+ NS_IF_RELEASE(mEventQueueService);
}
NS_IMPL_ISUPPORTS2(nsPresContext, nsPresContext, nsIObserver)
@@ -285,6 +289,17 @@ static const char* const kGenericFont[]
".fantasy."
};
+// Set to true when LookAndFeelChanged needs to be called. This is used
+// because the look and feel is a service, so there's no need to notify it from
+// more than one prescontext.
+static PRBool sLookAndFeelChanged;
+
+// Set to true when ThemeChanged needs to be called on mTheme. This is used
+// because mTheme is a service, so there's no need to notify it from more than
+// one prescontext.
+static PRBool sThemeChanged;
+
+
void
nsPresContext::GetFontPreferences()
{
@@ -709,6 +724,9 @@ nsPresContext::Init(nsIDeviceContext* aD
this);
#endif
+ rv = CallGetService(NS_EVENTQUEUESERVICE_CONTRACTID, &mEventQueueService);
+ NS_ENSURE_SUCCESS(rv, rv);
+
// Initialize our state from the user preferences
GetUserPreferences();
@@ -1180,33 +1198,126 @@ nsPresContext::GetTheme()
void
nsPresContext::ThemeChanged()
{
+ if (!mPendingThemeChanged) {
+ sLookAndFeelChanged = PR_TRUE;
+ sThemeChanged = PR_TRUE;
+
+ nsCOMPtr<nsIEventQueue> eventQ;
+ mEventQueueService->
+ GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
+ getter_AddRefs(eventQ));
+ if (!eventQ) {
+ return;
+ }
+
+ PLEvent* evt = new PLEvent();
+ if (!evt) {
+ return;
+ }
+
+ PL_InitEvent(evt, this, nsPresContext::ThemeChangedInternal,
+ nsPresContext::DestroyThemeChangeEvt);
+
+ // After this point, event destruction will release |this|
+ NS_ADDREF_THIS();
+
+ nsresult rv = eventQ->PostEvent(evt);
+ if (NS_FAILED(rv)) {
+ PL_DestroyEvent(evt);
+ } else {
+ mPendingThemeChanged = PR_TRUE;
+ }
+ }
+}
+
+void* PR_CALLBACK
+nsPresContext::ThemeChangedInternal(PLEvent *aEvent)
+{
+ nsPresContext* pc = NS_STATIC_CAST(nsPresContext*, aEvent->owner);
+
+ pc->mPendingThemeChanged = PR_FALSE;
+
// Tell the theme that it changed, so it can flush any handles to stale theme
// data.
- if (mTheme)
- mTheme->ThemeChanged();
+ if (pc->mTheme && sThemeChanged) {
+ pc->mTheme->ThemeChanged();
+ sThemeChanged = PR_FALSE;
+ }
// Clear all cached nsILookAndFeel colors.
- if (mLookAndFeel)
- mLookAndFeel->LookAndFeelChanged();
+ if (pc->mLookAndFeel && sLookAndFeelChanged) {
+ pc->mLookAndFeel->LookAndFeelChanged();
+ sLookAndFeelChanged = PR_FALSE;
+ }
// We have to clear style data because the assumption of style rule
// immutability has been violated since any style rule that uses
// system colors or fonts (and probably -moz-appearance as well) has
// changed.
- nsPresContext::ClearStyleDataAndReflow();
+ pc->ClearStyleDataAndReflow();
+
+ return nsnull;
+}
+
+
+void PR_CALLBACK
+nsPresContext::DestroyThemeChangeEvt(PLEvent* aEvent)
+{
+ nsPresContext* pc = NS_STATIC_CAST(nsPresContext*, aEvent->owner);
+ NS_RELEASE(pc);
+ delete aEvent;
}
void
nsPresContext::SysColorChanged()
{
- if (mLookAndFeel) {
+ if (!mPendingSysColorChanged) {
+ sLookAndFeelChanged = PR_TRUE;
+
+ nsCOMPtr<nsIEventQueue> eventQ;
+ mEventQueueService->
+ GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
+ getter_AddRefs(eventQ));
+ if (!eventQ) {
+ return;
+ }
+
+ PLEvent* evt = new PLEvent();
+ if (!evt) {
+ return;
+ }
+
+ PL_InitEvent(evt, this, nsPresContext::SysColorChangedInternal,
+ nsPresContext::DestroySysColorChangeEvt);
+
+ // After this point, event destruction will release |this|
+ NS_ADDREF_THIS();
+
+ nsresult rv = eventQ->PostEvent(evt);
+ if (NS_FAILED(rv)) {
+ PL_DestroyEvent(evt);
+ } else {
+ mPendingSysColorChanged = PR_TRUE;
+ }
+ }
+}
+
+void* PR_CALLBACK
+nsPresContext::SysColorChangedInternal(PLEvent *aEvent)
+{
+ nsPresContext* pc = NS_STATIC_CAST(nsPresContext*, aEvent->owner);
+
+ pc->mPendingSysColorChanged = PR_FALSE;
+
+ if (pc->mLookAndFeel && sLookAndFeelChanged) {
// Don't use the cached values for the system colors
- mLookAndFeel->LookAndFeelChanged();
+ pc->mLookAndFeel->LookAndFeelChanged();
+ sLookAndFeelChanged = PR_FALSE;
}
-
+
// Reset default background and foreground colors for the document since
// they may be using system colors
- GetDocumentColorPreferences();
+ pc->GetDocumentColorPreferences();
// Clear out all of the style data since it may contain RGB values
// which originated from system colors.
@@ -1222,7 +1333,17 @@ nsPresContext::SysColorChanged()
// data without reflowing/updating views will lead to incorrect change hints
// later, because when generating change hints, any style structs which have
// been cleared and not reread are assumed to not be used at all.
- ClearStyleDataAndReflow();
+ pc->ClearStyleDataAndReflow();
+
+ return nsnull;
+}
+
+void PR_CALLBACK
+nsPresContext::DestroySysColorChangeEvt(PLEvent* aEvent)
+{
+ nsPresContext* pc = NS_STATIC_CAST(nsPresContext*, aEvent->owner);
+ NS_RELEASE(pc);
+ delete aEvent;
}
void
Index: layout/base/nsPresContext.h
===================================================================
RCS file: /cvsroot/mozilla/layout/base/nsPresContext.h,v
retrieving revision 3.150.4.2
diff -d -u -p -r3.150.4.2 nsPresContext.h
--- layout/base/nsPresContext.h 29 Aug 2005 16:15:39 -0000 3.150.4.2
+++ layout/base/nsPresContext.h 26 Sep 2006 19:26:40 -0000
@@ -56,6 +56,7 @@
#include "nsCRT.h"
#include "nsIPrintSettings.h"
#include "nsPropertyTable.h"
+#include "plevent.h"
#ifdef IBMBIDI
class nsBidiPresUtils;
#endif // IBMBIDI
@@ -76,6 +77,7 @@ class nsIAtom;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
+class nsIEventQueueService;
class nsICSSPseudoComparator;
class nsIAtom;
struct nsStyleStruct;
@@ -627,6 +629,14 @@ public:
const nscoord* GetBorderWidthTable() { return mBorderWidthTable; }
protected:
+ static NS_HIDDEN_(void*) PR_CALLBACK ThemeChangedInternal(PLEvent* aEvent);
+ static NS_HIDDEN_(void*) PR_CALLBACK SysColorChangedInternal(PLEvent* aEvent);
+ static NS_HIDDEN_(void) PR_CALLBACK DestroyThemeChangeEvt(PLEvent* aEvent);
+ static NS_HIDDEN_(void) PR_CALLBACK DestroySysColorChangeEvt(PLEvent* aEvent);
+
+ friend void* PR_CALLBACK ThemeChangedInternal(PLEvent* aEvent);
+ friend void* PR_CALLBACK SysColorChangedInternal(PLEvent* aEvent);
+
NS_HIDDEN_(void) SetImgAnimations(nsIContent *aParent, PRUint16 aMode);
NS_HIDDEN_(void) GetDocumentColorPreferences();
@@ -654,6 +664,7 @@ protected:
// from gfx back to layout.
nsIEventStateManager* mEventManager; // [STRONG]
nsILookAndFeel* mLookAndFeel; // [STRONG]
+ nsIEventQueueService *mEventQueueService; // [STRONG]
nsIAtom* mMedium; // initialized by subclass ctors;
// weak pointer to static atom
@@ -724,6 +735,8 @@ protected:
unsigned mCanPaginatedScroll : 1;
unsigned mDoScaledTwips : 1;
unsigned mEnableJapaneseTransform : 1;
+ unsigned mPendingSysColorChanged : 1;
+ unsigned mPendingThemeChanged : 1;
#ifdef IBMBIDI
unsigned mIsVisual : 1;
unsigned mIsBidiSystem : 1;

View File

@ -1,283 +0,0 @@
diff -pruN -x '.moz*' -x .libs -x .deps -x dist -x 'config*' -x 'firefox*' -x '*a' -x '*so' -x '*o' -x build -x '*html' mozilla.orig/gfx/src/gtk/nsFontMetricsXft.cpp mozilla/gfx/src/gtk/nsFontMetricsXft.cpp
--- mozilla.orig/gfx/src/gtk/nsFontMetricsXft.cpp 2006-04-25 08:58:36.000000000 +0900
+++ mozilla/gfx/src/gtk/nsFontMetricsXft.cpp 2007-02-08 01:50:05.000000000 +0900
@@ -227,10 +227,14 @@ static nsresult EnumFontsXft (nsIAto
static void ConvertCharToUCS4 (const char *aString,
PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
nsAutoFcChar32Buffer &aOutBuffer,
PRUint32 *aOutLen);
static void ConvertUnicharToUCS4 (const PRUnichar *aString,
PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
nsAutoFcChar32Buffer &aOutBuffer,
PRUint32 *aOutLen);
static nsresult ConvertUCS4ToCustom (FcChar32 *aSrc, PRUint32 aSrcLen,
@@ -507,7 +511,7 @@ nsFontMetricsXft::GetWidth(const PRUnich
return NS_OK;
}
- gint rawWidth = RawGetWidth(aString, aLength);
+ gint rawWidth = RawGetWidth(aString, aLength, 0, aLength);
float f;
f = mDeviceContext->DevUnitsToAppUnits();
@@ -533,7 +537,7 @@ nsFontMetricsXft::GetTextDimensions(cons
return NS_OK;
nsresult rv;
- rv = EnumerateGlyphs(aString, aLength,
+ rv = EnumerateGlyphs(aString, aLength, 0, aLength,
&nsFontMetricsXft::TextDimensionsCallback,
&aDimensions);
@@ -608,7 +612,7 @@ nsFontMetricsXft::DrawString(const char
nsAutoDrawSpecBuffer drawBuffer(data.draw, &data.color);
data.drawBuffer = &drawBuffer;
- return EnumerateGlyphs(aString, aLength,
+ return EnumerateGlyphs(aString, aLength, 0, aLength,
&nsFontMetricsXft::DrawStringCallback, &data);
}
@@ -638,7 +642,7 @@ nsFontMetricsXft::DrawString(const PRUni
nsAutoDrawSpecBuffer drawBuffer(data.draw, &data.color);
data.drawBuffer = &drawBuffer;
- return EnumerateGlyphs(aString, aLength,
+ return EnumerateGlyphs(aString, aLength, 0, aLength,
&nsFontMetricsXft::DrawStringCallback, &data);
}
@@ -662,7 +666,7 @@ nsFontMetricsXft::GetBoundingMetrics(con
data.firstTime = PR_TRUE;
nsresult rv;
- rv = EnumerateGlyphs(aString, aLength,
+ rv = EnumerateGlyphs(aString, aLength, 0, aLength,
&nsFontMetricsXft::BoundingMetricsCallback, &data);
NS_ENSURE_SUCCESS(rv, rv);
@@ -700,7 +704,7 @@ nsFontMetricsXft::GetBoundingMetrics(con
data.firstTime = PR_TRUE;
nsresult rv;
- rv = EnumerateGlyphs(aString, aLength,
+ rv = EnumerateGlyphs(aString, aLength, 0, aLength,
&nsFontMetricsXft::BoundingMetricsCallback, &data);
NS_ENSURE_SUCCESS(rv, rv);
@@ -758,7 +762,17 @@ nsFontMetricsXft::GetRangeWidth(const PR
PRUint32 aEnd,
PRUint32 &aWidth)
{
- return NS_ERROR_NOT_IMPLEMENTED;
+ if (!aLength) {
+ aWidth = 0;
+ return NS_OK;
+ }
+
+ gint rawWidth = RawGetWidth(aText, aLength, aStart, aEnd);
+ float f = mDeviceContext->DevUnitsToAppUnits();
+
+ aWidth = NSToCoordRound(rawWidth * f);
+
+ return NS_OK;
}
nsresult
@@ -768,7 +782,17 @@ nsFontMetricsXft::GetRangeWidth(const ch
PRUint32 aEnd,
PRUint32 &aWidth)
{
- return NS_ERROR_NOT_IMPLEMENTED;
+ if (!aLength) {
+ aWidth = 0;
+ return NS_OK;
+ }
+
+ gint rawWidth = RawGetWidth(aText, aLength, aStart, aEnd);
+ float f = mDeviceContext->DevUnitsToAppUnits();
+
+ aWidth = NSToCoordRound(rawWidth * f);
+
+ return NS_OK;
}
PRUint32
@@ -850,12 +874,12 @@ nsFontMetricsXft::CacheFontMetrics(void)
// mSpaceWidth (width of a space)
gint rawWidth;
PRUnichar unispace(' ');
- rawWidth = RawGetWidth(&unispace, 1);
+ rawWidth = RawGetWidth(&unispace, 1, 0, 1);
mSpaceWidth = NSToCoordRound(rawWidth * f);
// mAveCharWidth (width of an 'average' char)
PRUnichar xUnichar('x');
- rawWidth = RawGetWidth(&xUnichar, 1);
+ rawWidth = RawGetWidth(&xUnichar, 1, 0, 1);
mAveCharWidth = NSToCoordRound(rawWidth * f);
// mXHeight (height of an 'x' character)
@@ -1226,12 +1250,27 @@ nsFontMetricsXft::DoMatch(PRBool aMatchA
}
gint
-nsFontMetricsXft::RawGetWidth(const PRUnichar* aString, PRUint32 aLength)
+nsFontMetricsXft::RawGetWidth(const PRUnichar* aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd)
+{
+ nscoord width = 0;
+ nsresult rv;
+
+ rv = EnumerateGlyphs(aString, aLength, aStart, aEnd,
+ &nsFontMetricsXft::GetWidthCallback, &width);
+
+ if (NS_FAILED(rv))
+ width = 0;
+
+ return width;
+}
+
+gint
+nsFontMetricsXft::RawGetWidth(const char* aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd)
{
nscoord width = 0;
nsresult rv;
- rv = EnumerateGlyphs(aString, aLength,
+ rv = EnumerateGlyphs(aString, aLength, aStart, aEnd,
&nsFontMetricsXft::GetWidthCallback, &width);
if (NS_FAILED(rv))
@@ -1457,6 +1496,8 @@ nsFontMetricsXft::EnumerateXftGlyphs(con
nsresult
nsFontMetricsXft::EnumerateGlyphs(const PRUnichar *aString,
PRUint32 aLen,
+ PRUint32 aStart,
+ PRUint32 aEnd,
GlyphEnumeratorCallback aCallback,
void *aCallbackData)
{
@@ -1465,7 +1506,7 @@ nsFontMetricsXft::EnumerateGlyphs(const
NS_ENSURE_TRUE(aLen, NS_OK);
- ConvertUnicharToUCS4(aString, aLen, charBuffer, &len);
+ ConvertUnicharToUCS4(aString, aLen, aStart, aEnd, charBuffer, &len);
if (!len)
return NS_ERROR_OUT_OF_MEMORY;
@@ -1475,6 +1516,8 @@ nsFontMetricsXft::EnumerateGlyphs(const
nsresult
nsFontMetricsXft::EnumerateGlyphs(const char *aString,
PRUint32 aLen,
+ PRUint32 aStart,
+ PRUint32 aEnd,
GlyphEnumeratorCallback aCallback,
void *aCallbackData)
{
@@ -1484,7 +1527,7 @@ nsFontMetricsXft::EnumerateGlyphs(const
NS_ENSURE_TRUE(aLen, NS_OK);
// Convert the incoming string into an array of UCS4 chars
- ConvertCharToUCS4(aString, aLen, charBuffer, &len);
+ ConvertCharToUCS4(aString, aLen, aStart, aEnd, charBuffer, &len);
if (!len)
return NS_ERROR_OUT_OF_MEMORY;
@@ -2343,7 +2386,7 @@ EnumFontsXft(nsIAtom* aLangGroup, const
/* static */
void
-ConvertCharToUCS4(const char *aString, PRUint32 aLength,
+ConvertCharToUCS4(const char *aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd,
nsAutoFcChar32Buffer &aOutBuffer, PRUint32 *aOutLen)
{
*aOutLen = 0;
@@ -2352,19 +2395,21 @@ ConvertCharToUCS4(const char *aString, P
if (!aOutBuffer.EnsureElemCapacity(aLength))
return;
outBuffer = aOutBuffer.get();
+ if (aEnd > aLength)
+ aEnd = aLength;
- for (PRUint32 i = 0; i < aLength; ++i) {
- outBuffer[i] = PRUint8(aString[i]); // to convert char >= 0x80 correctly
+ for (PRUint32 i = aStart; i < aLength && i < aEnd; ++i) {
+ outBuffer[i - aStart] = PRUint8(aString[i]); // to convert char >= 0x80 correctly
}
- *aOutLen = aLength;
+ *aOutLen = aEnd - aStart;
}
// Convert the incoming string into an array of UCS4 chars
/* static */
void
-ConvertUnicharToUCS4(const PRUnichar *aString, PRUint32 aLength,
+ConvertUnicharToUCS4(const PRUnichar *aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd,
nsAutoFcChar32Buffer &aOutBuffer, PRUint32 *aOutLen)
{
*aOutLen = 0;
@@ -2378,7 +2423,7 @@ ConvertUnicharToUCS4(const PRUnichar *aS
// Walk the passed in string looking for surrogates to convert to
// their full ucs4 representation.
- for (PRUint32 i = 0; i < aLength; ++i) {
+ for (PRUint32 i = aStart; i < aLength && i < aEnd; ++i) {
PRUnichar c = aString[i];
// Optimized for the non-surrogate case
@@ -2693,12 +2738,12 @@ ConvertUCS4ToCustom(FcChar32 *aSrc, PRU
#endif
// Convert 16bit custom font codes to UCS4
ConvertUnicharToUCS4(NS_REINTERPRET_CAST(PRUnichar *, med),
- medLen >> 1, aResult, &aDestLen);
+ medLen >> 1, 0, medLen >> 1, aResult, &aDestLen);
rv = aDestLen ? rv : NS_ERROR_OUT_OF_MEMORY;
}
else {
// Convert 8bit custom font codes to UCS4
- ConvertCharToUCS4(med, medLen, aResult, &aDestLen);
+ ConvertCharToUCS4(med, medLen, 0, medLen, aResult, &aDestLen);
rv = aDestLen ? rv : NS_ERROR_OUT_OF_MEMORY;
}
diff -pruN -x '.moz*' -x .libs -x .deps -x dist -x 'config*' -x 'firefox*' -x '*a' -x '*so' -x '*o' -x build -x '*html' mozilla.orig/gfx/src/gtk/nsFontMetricsXft.h mozilla/gfx/src/gtk/nsFontMetricsXft.h
--- mozilla.orig/gfx/src/gtk/nsFontMetricsXft.h 2005-05-03 05:48:30.000000000 +0900
+++ mozilla/gfx/src/gtk/nsFontMetricsXft.h 2007-02-08 01:38:27.000000000 +0900
@@ -259,7 +259,13 @@ private:
void DoMatch (PRBool aMatchAll);
gint RawGetWidth (const PRUnichar* aString,
- PRUint32 aLength);
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd);
+ gint RawGetWidth (const char* aString,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd);
nsresult SetupMiniFont (void);
nsresult DrawUnknownGlyph (FcChar32 aChar,
nscoord aX,
@@ -272,10 +278,14 @@ private:
void *aCallbackData);
nsresult EnumerateGlyphs (const char *aString,
PRUint32 aLen,
+ PRUint32 aStart,
+ PRUint32 aEnd,
GlyphEnumeratorCallback aCallback,
void *aCallbackData);
nsresult EnumerateGlyphs (const PRUnichar *aString,
PRUint32 aLen,
+ PRUint32 aStart,
+ PRUint32 aEnd,
GlyphEnumeratorCallback aCallback,
void *aCallbackData);
void PrepareToDraw (nsRenderingContextGTK *aContext,

View File

@ -1,949 +0,0 @@
Index: widget/src/gtk2/nsClipboard.cpp
===================================================================
RCS file: /export/src/cvs/mozilla1.7/mozilla/widget/src/gtk2/nsClipboard.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nsClipboard.cpp
--- widget/src/gtk2/nsClipboard.cpp 2004/04/13 06:46:17 1.1.1.1
+++ widget/src/gtk2/nsClipboard.cpp 2004/04/13 08:22:00
@@ -73,7 +73,7 @@
GdkEventSelection *aEvent,
nsClipboard *aClipboard);
-static void
+void
ConvertHTMLtoUCS2 (guchar *data,
PRInt32 dataLength,
PRUnichar **unicodeData,
@@ -473,7 +473,6 @@
// utf-8.
PRInt32 whichClipboard;
-
// which clipboard?
if (aSelectionData->selection == GDK_SELECTION_PRIMARY)
whichClipboard = kSelectionClipboard;
@@ -547,16 +546,8 @@
* Byte Order Mark (BOM)). Adding BOM can help other app to
* detect mozilla use UCS2 encoding when copy-paste.
*/
- guchar *buffer = (guchar *)
- nsMemory::Alloc((len * sizeof(guchar)) + sizeof(PRUnichar));
- if (!buffer)
- return;
- PRUnichar prefix = 0xFEFF;
- memcpy(buffer, &prefix, sizeof(prefix));
- memcpy(buffer + sizeof(prefix), primitive_data, len);
- nsMemory::Free((guchar *)primitive_data);
- primitive_data = (guchar *)buffer;
- len += sizeof(prefix);
+ addBOM(NS_REINTERPRET_CAST(guchar **, &primitive_data),
+ NS_REINTERPRET_CAST(gint *, &len));
}
gtk_selection_data_set(aSelectionData, aSelectionData->target,
@@ -736,6 +727,22 @@
return;
}
str.AssignLiteral("UNKNOWN");
+}
+
+void addBOM(guchar **data, gint *len)
+{
+ guchar* indata = *data;
+ gint inlen = *len;
+ guchar *buffer = (guchar *)
+ nsMemory::Alloc((inlen * sizeof(guchar)) + sizeof(PRUnichar));
+ if (!buffer)
+ return;
+ PRUnichar prefix = 0xFEFF;
+ memcpy(buffer, &prefix, sizeof(prefix));
+ memcpy(buffer + sizeof(prefix), indata, inlen);
+ nsMemory::Free((guchar *)indata);
+ *data = (guchar *)buffer;
+ *len += sizeof(prefix);
}
static void
Index: widget/src/gtk2/nsClipboard.h
===================================================================
RCS file: /export/src/cvs/mozilla1.7/mozilla/widget/src/gtk2/nsClipboard.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nsClipboard.h
--- widget/src/gtk2/nsClipboard.h 2004/04/13 06:46:17 1.1.1.1
+++ widget/src/gtk2/nsClipboard.h 2004/04/13 08:22:00
@@ -87,4 +87,6 @@
};
+void addBOM(guchar **data, gint *len);
+
#endif /* __nsClipboard_h_ */
Index: widget/src/gtk2/nsDragService.cpp
===================================================================
RCS file: /export/src/cvs/mozilla1.7/mozilla/widget/src/gtk2/nsDragService.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nsDragService.cpp
--- widget/src/gtk2/nsDragService.cpp 2004/04/13 06:46:17 1.1.1.1
+++ widget/src/gtk2/nsDragService.cpp 2004/04/13 08:22:00
@@ -41,6 +41,8 @@
#include <gtk/gtkinvisible.h>
#include <gdk/gdkx.h>
#include "nsCRT.h"
+#include "nsString.h"
+#include "nsReadableUtils.h"
static PRLogModuleInfo *sDragLm = NULL;
@@ -49,6 +51,9 @@
static const char gMozUrlType[] = "_NETSCAPE_URL";
static const char gTextUriListType[] = "text/uri-list";
+static const char gPlainTextUTF16[] = "text/plain;charset=utf-16";
+static const char gPlainTextUTF8[] = "text/plain;charset=utf-8";
+
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE4(nsDragService,
@@ -57,6 +62,10 @@
nsIDragSessionGTK,
nsIObserver)
+void addBOM(guchar **data, gint *len);
+void ConvertHTMLtoUCS2(guchar * data, PRInt32 dataLength,
+ PRUnichar** unicodeData, PRInt32& outUnicodeLen);
+
static void
invisibleSourceDragEnd(GtkWidget *aWidget,
GdkDragContext *aContext,
@@ -70,6 +79,38 @@
guint32 aTime,
gpointer aData);
+struct AutoConvertTargetPair {
+ const char * internal; // the drag data receiving side
+ const char * outside; // the drag data providing side
+ TargetConverter out2in;
+ TargetConverter in2out;
+};
+
+//converters
+static void utf8_to_ucs2 (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen);
+static void ucs2_to_text (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen);
+static void text_to_ucs2 (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen);
+
+// The table used to match an internal target to an outside target
+// the entry comes early has high priority in matching
+static const AutoConvertTargetPair autoConvertPair[] = {
+ {kUnicodeMime, "UTF8_STRING", utf8_to_ucs2, ucs2_to_text},
+ {kUnicodeMime, "COMPOUND_TEXT", utf8_to_ucs2, ucs2_to_text},
+ {kUnicodeMime, "TEXT", utf8_to_ucs2, ucs2_to_text},
+ {kUnicodeMime, "STRING", utf8_to_ucs2, ucs2_to_text},
+ {kUnicodeMime, kTextMime, text_to_ucs2, ucs2_to_text},
+ {kUnicodeMime, gPlainTextUTF16, NULL, NULL},
+ {kUnicodeMime, gPlainTextUTF8, text_to_ucs2, ucs2_to_text},
+
+ {kURLMime, gTextUriListType, NULL, ucs2_to_text},
+ {kURLMime, gMozUrlType, text_to_ucs2, ucs2_to_text},
+
+ {NULL, NULL, NULL, NULL},
+};
+
nsDragService::nsDragService()
{
// We have to destroy the hidden widget before the event loop stops
@@ -92,7 +133,7 @@
// set up our logging module
if (!sDragLm)
- sDragLm = PR_NewLogModule("nsDragService");
+ sDragLm = PR_NewLogModule("nsDragService");
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::nsDragService"));
mTargetWidget = 0;
mTargetDragContext = 0;
@@ -101,6 +142,8 @@
mTargetDragDataReceived = PR_FALSE;
mTargetDragData = 0;
mTargetDragDataLen = 0;
+ mTargetDragGdkAtom = 0;
+ mTargetConverter = NULL;
}
nsDragService::~nsDragService()
@@ -173,6 +216,16 @@
event.button.window = mHiddenWidget->window;
event.button.time = nsWindow::mLastButtonPressTime;
+ event.button.send_event = 0;
+ event.button.x = 0;
+ event.button.y = 0;
+ event.button.state = 0;
+ event.button.button = 0;
+ event.button.device = 0;
+ event.button.x_root = 0;
+ event.button.y_root = 0;
+
+
// start our drag.
GdkDragContext *context = gtk_drag_begin(mHiddenWidget,
sourceList,
@@ -291,7 +344,7 @@
NS_IMETHODIMP
nsDragService::GetNumDropItems(PRUint32 * aNumItems)
{
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems"));
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("==nsDragService::GetNumDropItems==\n"));
PRBool isList = IsTargetContextList();
if (isList)
mSourceDataItems->Count(aNumItems);
@@ -303,8 +356,9 @@
*aNumItems = CountTextUriListItems(data, mTargetDragDataLen);
} else
*aNumItems = 1;
+ TargetResetData();
}
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("%d items", *aNumItems));
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("%d items\n", *aNumItems));
return NS_OK;
}
@@ -360,7 +414,7 @@
PRUint32 tmpDataLen = 0;
PR_LOG(sDragLm, PR_LOG_DEBUG,
("trying to get transfer data for %s\n",
- (const char *)flavorStr));
+ (const char *)flavorStr));
rv = item->GetTransferData(flavorStr,
getter_AddRefs(data),
&tmpDataLen);
@@ -387,6 +441,7 @@
// Now walk down the list of flavors. When we find one that is
// actually present, copy out the data into the transferable in that
// format. SetTransferData() implicitly handles conversions.
+
for ( i = 0; i < cnt; ++i ) {
nsCOMPtr<nsISupports> genericWrapper;
flavorList->GetElementAt(i,getter_AddRefs(genericWrapper));
@@ -399,118 +454,58 @@
GdkAtom gdkFlavor = gdk_atom_intern(flavorStr, FALSE);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("looking for data in type %s, gdk flavor %ld\n",
- NS_STATIC_CAST(const char*,flavorStr), gdkFlavor));
+ NS_STATIC_CAST(const char*,flavorStr), gdkFlavor));
PRBool dataFound = PR_FALSE;
if (gdkFlavor) {
GetTargetDragData(gdkFlavor);
}
if (mTargetDragData) {
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_TRUE\n"));
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("dataFound = PR_TRUE for %s\n", gdk_atom_name(mTargetDragGdkAtom)));
dataFound = PR_TRUE;
- }
- else {
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_FALSE\n"));
- // if we are looking for text/unicode and we fail to find it
- // on the clipboard first, try again with text/plain. If that
- // is present, convert it to unicode.
- if ( strcmp(flavorStr, kUnicodeMime) == 0 ) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("we were looking for text/unicode... \
- trying again with text/plain\n"));
- gdkFlavor = gdk_atom_intern(kTextMime, FALSE);
- GetTargetDragData(gdkFlavor);
- if (mTargetDragData) {
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("Got textplain data\n"));
- const char* castedText =
- NS_REINTERPRET_CAST(char*, mTargetDragData);
- PRUnichar* convertedText = nsnull;
- PRInt32 convertedTextLen = 0;
- nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode(
- castedText, mTargetDragDataLen,
- &convertedText, &convertedTextLen);
- if ( convertedText ) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("successfully converted plain text \
- to unicode.\n"));
- // out with the old, in with the new
- g_free(mTargetDragData);
- mTargetDragData = convertedText;
- mTargetDragDataLen = convertedTextLen * 2;
- dataFound = PR_TRUE;
- } // if plain text data on clipboard
- } // if plain text flavor present
- } // if looking for text/unicode
-
- // if we are looking for text/x-moz-url and we failed to find
- // it on the clipboard, try again with text/uri-list, and then
- // _NETSCAPE_URL
- if (strcmp(flavorStr, kURLMime) == 0) {
+
+ // we need to do extra work for text/uri-list
+ if (mTargetDragGdkAtom ==
+ gdk_atom_intern(gTextUriListType, FALSE)) {
PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("we were looking for text/x-moz-url...\
- trying again with text/uri-list\n"));
- gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
- GetTargetDragData(gdkFlavor);
- if (mTargetDragData) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("Got text/uri-list data\n"));
- const char *data =
- NS_REINTERPRET_CAST(char*, mTargetDragData);
- PRUnichar* convertedText = nsnull;
- PRInt32 convertedTextLen = 0;
+ ("Converting text/uri-list data\n"));
+ const char *data =
+ NS_REINTERPRET_CAST(char*, mTargetDragData);
+ PRUnichar* convertedText = nsnull;
+ PRInt32 convertedTextLen = 0;
- GetTextUriListItem(data, mTargetDragDataLen, aItemIndex,
- &convertedText, &convertedTextLen);
+ GetTextUriListItem(data, mTargetDragDataLen, aItemIndex,
+ &convertedText, &convertedTextLen);
- if ( convertedText ) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("successfully converted \
- _NETSCAPE_URL to unicode.\n"));
- // out with the old, in with the new
- g_free(mTargetDragData);
- mTargetDragData = convertedText;
- mTargetDragDataLen = convertedTextLen * 2;
- dataFound = PR_TRUE;
- }
- }
- else {
+ if (convertedText) {
PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("failed to get text/uri-list data\n"));
+ ("successfully converted \
+ %s to unicode.\n", gTextUriListType));
+ // out with the old, in with the new
+ g_free(mTargetDragData);
+ mTargetDragData = convertedText;
+ mTargetDragDataLen = convertedTextLen * 2;
}
- if (!dataFound) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("we were looking for text/x-moz-url...\
- trying again with _NETSCAP_URL\n"));
- gdkFlavor = gdk_atom_intern(gMozUrlType, FALSE);
- GetTargetDragData(gdkFlavor);
- if (mTargetDragData) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("Got _NETSCAPE_URL data\n"));
- const char* castedText =
- NS_REINTERPRET_CAST(char*, mTargetDragData);
- PRUnichar* convertedText = nsnull;
- PRInt32 convertedTextLen = 0;
- nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode(castedText, mTargetDragDataLen, &convertedText, &convertedTextLen);
- if ( convertedText ) {
- PR_LOG(sDragLm,
- PR_LOG_DEBUG,
- ("successfully converted _NETSCAPE_URL \
- to unicode.\n"));
- // out with the old, in with the new
- g_free(mTargetDragData);
- mTargetDragData = convertedText;
- mTargetDragDataLen = convertedTextLen * 2;
- dataFound = PR_TRUE;
- }
- }
- else {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("failed to get _NETSCAPE_URL data\n"));
- }
- }
}
-
- } // else we try one last ditch effort to find our data
-
+ // Convert text/html into our unicode format
+ else if (mTargetDragGdkAtom ==
+ gdk_atom_intern(kHTMLMime, FALSE)) {
+ PRUnichar* htmlBody= nsnull;
+ PRInt32 htmlBodyLen = 0;
+
+ ConvertHTMLtoUCS2(NS_STATIC_CAST(guchar*, mTargetDragData),
+ mTargetDragDataLen,
+ &htmlBody, htmlBodyLen);
+ if (!htmlBodyLen)
+ break;
+ g_free(mTargetDragData);
+ mTargetDragData = (void *)htmlBody;
+ mTargetDragDataLen = htmlBodyLen * 2;
+ }
+ }
+ else {
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_FALSE\n"));
+ }
if (dataFound) {
// the DOM only wants LF, so convert from MacOS line endings
// to DOM line endings.
@@ -542,7 +537,7 @@
nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
PRBool *_retval)
{
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported %s",
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported %s\n",
aDataFlavor));
if (!_retval)
return NS_ERROR_INVALID_ARG;
@@ -595,7 +590,7 @@
currentFlavor->ToString(getter_Copies(flavorStr));
PR_LOG(sDragLm, PR_LOG_DEBUG,
("checking %s against %s\n",
- (const char *)flavorStr, aDataFlavor));
+ (const char *)flavorStr, aDataFlavor));
if (strcmp(flavorStr, aDataFlavor) == 0) {
PR_LOG(sDragLm, PR_LOG_DEBUG,
("boioioioiooioioioing!\n"));
@@ -609,50 +604,9 @@
return NS_OK;
}
- // check the target context vs. this flavor, one at a time
- GList *tmp;
- for (tmp = mTargetDragContext->targets; tmp; tmp = tmp->next) {
- GdkAtom atom = (GdkAtom)GPOINTER_TO_INT(tmp->data);
- gchar *name = NULL;
- name = gdk_atom_name(atom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("checking %s against %s\n", name, aDataFlavor));
- if (name && (strcmp(name, aDataFlavor) == 0)) {
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
- *_retval = PR_TRUE;
- }
- // check for automatic text/uri-list -> text/x-moz-url mapping
- if (*_retval == PR_FALSE &&
- name &&
- (strcmp(name, gTextUriListType) == 0) &&
- (strcmp(aDataFlavor, kURLMime) == 0)) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("good! ( it's text/uri-list and \
- we're checking against text/x-moz-url )\n"));
- *_retval = PR_TRUE;
- }
- // check for automatic _NETSCAPE_URL -> text/x-moz-url mapping
- if (*_retval == PR_FALSE &&
- name &&
- (strcmp(name, gMozUrlType) == 0) &&
- (strcmp(aDataFlavor, kURLMime) == 0)) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("good! ( it's _NETSCAPE_URL and \
- we're checking against text/x-moz-url )\n"));
- *_retval = PR_TRUE;
- }
- // check for auto text/plain -> text/unicode mapping
- if (*_retval == PR_FALSE &&
- name &&
- (strcmp(name, kTextMime) == 0) &&
- (strcmp(aDataFlavor, kUnicodeMime) == 0)) {
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("good! ( it's text plain and we're checking \
- against text/unicode )\n"));
- *_retval = PR_TRUE;
- }
- g_free(name);
- }
+ if (LookupFlavorInTargetList(aDataFlavor) ||
+ LookupMatchedOutsideTarget(aDataFlavor, NULL, NULL))
+ *_retval = PR_TRUE;
return NS_OK;
}
@@ -691,14 +645,14 @@
// notify the dragger if we can drop
switch (mDragAction) {
case DRAGDROP_ACTION_COPY:
- action = GDK_ACTION_COPY;
- break;
+ action = GDK_ACTION_COPY;
+ break;
case DRAGDROP_ACTION_LINK:
- action = GDK_ACTION_LINK;
- break;
+ action = GDK_ACTION_LINK;
+ break;
default:
- action = GDK_ACTION_MOVE;
- break;
+ action = GDK_ACTION_MOVE;
+ break;
}
gdk_drag_status(aContext, action, aTime);
}
@@ -719,12 +673,23 @@
guint32 aTime)
{
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetDataReceived"));
- TargetResetData();
+ NS_ASSERTION(mTargetDragData == 0, "Data area is NOT empty!!\n");
+ NS_ASSERTION(mTargetDragDataLen == 0, "Data area is NOT empty!!\n");
+
mTargetDragDataReceived = PR_TRUE;
if (aSelectionData->length > 0) {
- mTargetDragDataLen = aSelectionData->length;
- mTargetDragData = g_malloc(mTargetDragDataLen);
- memcpy(mTargetDragData, aSelectionData->data, mTargetDragDataLen);
+ if (mTargetDragGdkAtom && mTargetConverter) {
+ // need Converting
+ (*mTargetConverter)((const char*)aSelectionData->data,
+ aSelectionData->length,
+ (char **)&mTargetDragData,
+ &mTargetDragDataLen);
+ }
+ else {
+ mTargetDragDataLen = aSelectionData->length;
+ mTargetDragData = g_malloc(mTargetDragDataLen);
+ memcpy(mTargetDragData, aSelectionData->data, mTargetDragDataLen);
+ }
}
else {
PR_LOG(sDragLm, PR_LOG_DEBUG,
@@ -781,13 +746,31 @@
void
nsDragService::GetTargetDragData(GdkAtom aFlavor)
{
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("getting data flavor %d\n", aFlavor));
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("mLastWidget is %p and mLastContext is %p\n",
- mTargetWidget, mTargetDragContext));
+ const char *flavorStr = gdk_atom_name(aFlavor);
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("GetTargetData with flavor %s\n", flavorStr));
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("mLastWidget is %p, mLastContext is %p\n",
+ (void*)mTargetWidget, (void*)mTargetDragContext));
// reset our target data areas
TargetResetData();
- gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
-
+ // if it is a direct match
+ if (LookupFlavorInTargetList(flavorStr)) {
+ gtk_drag_get_data(mTargetWidget, mTargetDragContext,
+ aFlavor, mTargetTime);
+ mTargetDragGdkAtom = aFlavor;
+
+ }
+ // if it is a auto converting match
+ else if (LookupMatchedOutsideTarget(flavorStr,
+ &mTargetDragGdkAtom,
+ &mTargetConverter))
+ gtk_drag_get_data(mTargetWidget, mTargetDragContext,
+ mTargetDragGdkAtom, mTargetTime);
+ else {
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("Cannot request target %s\n",
+ flavorStr));
+ return;
+ }
PR_LOG(sDragLm, PR_LOG_DEBUG, ("about to start inner iteration."));
PRTime entryTime = PR_Now();
while (!mTargetDragDataReceived && mDoingDrag) {
@@ -807,9 +791,11 @@
mTargetDragDataReceived = PR_FALSE;
// make sure to free old data if we have to
if (mTargetDragData)
- g_free(mTargetDragData);
+ g_free(mTargetDragData);
mTargetDragData = 0;
mTargetDragDataLen = 0;
+ mTargetDragGdkAtom = 0;
+ mTargetConverter = NULL;
}
GtkTargetList *
@@ -841,7 +827,7 @@
listTarget->info = (guint)listAtom;
PR_LOG(sDragLm, PR_LOG_DEBUG,
("automatically adding target %s with id %ld\n",
- listTarget->target, listAtom));
+ listTarget->target, listAtom));
targetArray.AppendElement(listTarget);
// check what flavours are supported so we can decide what other
@@ -861,7 +847,7 @@
++flavorIndex ) {
nsCOMPtr<nsISupports> genericWrapper;
flavorList->GetElementAt(flavorIndex,
- getter_AddRefs(genericWrapper));
+ getter_AddRefs(genericWrapper));
nsCOMPtr<nsISupportsCString> currentFlavor;
currentFlavor = do_QueryInterface(genericWrapper);
if (currentFlavor) {
@@ -908,51 +894,27 @@
if (currentFlavor) {
nsXPIDLCString flavorStr;
currentFlavor->ToString(getter_Copies(flavorStr));
- // get the atom
- GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
- GtkTargetEntry *target =
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- target->target = g_strdup(flavorStr);
- target->flags = 0;
- target->info = GPOINTER_TO_UINT(atom);
+ //add the target itself
+ GtkTargetEntry *target = CreateGtkTargetFor(flavorStr);
PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("adding target %s with id %ld\n",
- target->target, atom));
+ ("+++adding importable target %s\n",
+ target->target));
targetArray.AppendElement(target);
- // Check to see if this is text/unicode.
- // If it is, add text/plain
- // since we automatically support text/plain
- // if we support text/unicode.
- if (strcmp(flavorStr, kUnicodeMime) == 0) {
- // get the atom for the unicode string
- GdkAtom plainAtom =
- gdk_atom_intern(kTextMime, FALSE);
- GtkTargetEntry *plainTarget =
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- plainTarget->target = g_strdup(kTextMime);
- plainTarget->flags = 0;
- plainTarget->info = GPOINTER_TO_UINT(plainAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", plainTarget->target, plainAtom));
- targetArray.AppendElement(plainTarget);
- }
- // Check to see if this is the x-moz-url type.
- // If it is, add _NETSCAPE_URL
- // this is a type used by everybody.
- if (strcmp(flavorStr, kURLMime) == 0) {
- // get the atom name for it
- GdkAtom urlAtom =
- gdk_atom_intern(gMozUrlType, FALSE);
- GtkTargetEntry *urlTarget =
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- urlTarget->target = g_strdup(gMozUrlType);
- urlTarget->flags = 0;
- urlTarget->info = GPOINTER_TO_UINT(urlAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", urlTarget->target, urlAtom));
- targetArray.AppendElement(urlTarget);
+
+ //add the auto convert targets
+ PRUint16 convIndex = 0;
+ while (autoConvertPair[convIndex].internal &&
+ autoConvertPair[convIndex].outside) {
+ if (!strcmp(autoConvertPair[convIndex].internal,
+ flavorStr)) {
+ target = CreateGtkTargetFor( \
+ autoConvertPair[convIndex].outside);
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ (" ++auto adding target %s\n",
+ target->target));
+ targetArray.AppendElement(target);
+ }
+ ++convIndex;
}
}
} // foreach flavor in item
@@ -965,11 +927,11 @@
if (targetCount) {
// allocate space to create the list of valid targets
targets =
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry) * targetCount);
+ (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry) * targetCount);
PRUint32 targetIndex;
for ( targetIndex = 0; targetIndex < targetCount; ++targetIndex) {
GtkTargetEntry *disEntry =
- (GtkTargetEntry *)targetArray.ElementAt(targetIndex);
+ (GtkTargetEntry *)targetArray.ElementAt(targetIndex);
// this is a string reference but it will be freed later.
targets[targetIndex].target = disEntry->target;
targets[targetIndex].flags = disEntry->flags;
@@ -979,7 +941,7 @@
// clean up the target list
for (PRUint32 cleanIndex = 0; cleanIndex < targetCount; ++cleanIndex) {
GtkTargetEntry *thisTarget =
- (GtkTargetEntry *)targetArray.ElementAt(cleanIndex);
+ (GtkTargetEntry *)targetArray.ElementAt(cleanIndex);
g_free(thisTarget->target);
g_free(thisTarget);
}
@@ -1067,7 +1029,7 @@
guint aInfo,
guint32 aTime)
{
- PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::SourceDataGet"));
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("\nnsDragService::SourceDataGet"));
GdkAtom atom = (GdkAtom)aInfo;
nsXPIDLCString mimeFlavor;
gchar *typeName = 0;
@@ -1104,22 +1066,18 @@
nsCOMPtr<nsITransferable> item;
item = do_QueryInterface(genericItem);
if (item) {
- // if someone was asking for text/plain, lookup unicode instead so
- // we can convert it.
- PRBool needToDoConversionToPlainText = PR_FALSE;
+ TargetConverter converter = NULL;
const char* actualFlavor = mimeFlavor;
- if (strcmp(mimeFlavor,kTextMime) == 0) {
- actualFlavor = kUnicodeMime;
- needToDoConversionToPlainText = PR_TRUE;
- }
- // if someone was asking for _NETSCAPE_URL we need to convert to
- // plain text but we also need to look for x-moz-url
- else if (strcmp(mimeFlavor, gMozUrlType) == 0) {
- actualFlavor = kURLMime;
- needToDoConversionToPlainText = PR_TRUE;
+ PRUint32 convIndex = 0;
+ while (autoConvertPair[convIndex].outside &&
+ autoConvertPair[convIndex].internal) {
+ if (!strcmp(mimeFlavor, autoConvertPair[convIndex].outside)) {
+ actualFlavor = autoConvertPair[convIndex].internal;
+ converter = autoConvertPair[convIndex].in2out;
+ break;
+ }
+ ++convIndex;
}
- else
- actualFlavor = mimeFlavor;
PRUint32 tmpDataLen = 0;
void *tmpData = NULL;
@@ -1131,18 +1089,24 @@
if (NS_SUCCEEDED(rv)) {
nsPrimitiveHelpers::CreateDataFromPrimitive (actualFlavor, data,
&tmpData, tmpDataLen);
+
+ if (strcmp(actualFlavor, kHTMLMime) == 0) {
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("add BOM prefix for %s\n",
+ kHTMLMime));
+ addBOM(NS_REINTERPRET_CAST(guchar **, &tmpData),
+ NS_REINTERPRET_CAST(gint *, &tmpDataLen));
+ }
+
// if required, do the extra work to convert unicode to plain
// text and replace the output values with the plain text.
- if (needToDoConversionToPlainText) {
+ if (converter) {
char* plainTextData = nsnull;
PRUnichar* castedUnicode = NS_REINTERPRET_CAST(PRUnichar*,
tmpData);
- PRInt32 plainTextLen = 0;
- nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText(
- castedUnicode,
- tmpDataLen / 2,
- &plainTextData,
- &plainTextLen);
+ PRUint32 plainTextLen = 0;
+ (*converter)((const char*)castedUnicode, tmpDataLen,
+ &plainTextData, &plainTextLen);
+
if (tmpData) {
// this was not allocated using glib
free(tmpData);
@@ -1190,3 +1154,149 @@
dragService->SourceEndDrag();
}
+PRBool
+nsDragService::LookupFlavorInTargetList(const char *aDataFlavor)
+{
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("nsDragService::LookupFlavorInTargetList,"
+ "checking %s \n", aDataFlavor));
+
+ if (!mTargetDragContext || !aDataFlavor)
+ return PR_FALSE;
+
+ GList *targetList = mTargetDragContext->targets;
+ while (targetList) {
+ GdkAtom atom = (GdkAtom)GPOINTER_TO_INT(targetList->data);
+ gchar *atomName = gdk_atom_name(atom);
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("checking %s against %s\n", aDataFlavor, atomName));
+ if (atomName && (strcmp(atomName, aDataFlavor) == 0)) {
+ PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
+ g_free(atomName);
+ return PR_TRUE;
+ }
+ targetList = targetList->next;
+ }
+ return PR_FALSE;
+}
+
+PRBool
+nsDragService::LookupMatchedOutsideTarget(const char *aDataFlavor,
+ GdkAtom *aAtom,
+ TargetConverter *aConverter)
+{
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("nsDragService::LookupMatchedOutsideTarget,"
+ "checking %s \n", aDataFlavor));
+
+ if (!mTargetDragContext || !aDataFlavor)
+ return PR_FALSE;
+
+ gint index = 0;
+ while (autoConvertPair[index].internal &&
+ autoConvertPair[index].outside) {
+ if (!strcmp(autoConvertPair[index].internal, aDataFlavor) &&
+ LookupFlavorInTargetList(autoConvertPair[index].outside)) {
+ if (aConverter)
+ *aConverter = autoConvertPair[index].out2in;
+ if (aAtom)
+ *aAtom = gdk_atom_intern(autoConvertPair[index].outside,
+ FALSE);
+ return PR_TRUE;
+ }
+ ++index;
+ }
+ return PR_FALSE;
+}
+
+PRBool
+nsDragService::LookupMatchedInternalTarget(const char *aDataFlavor,
+ GdkAtom *aAtom,
+ TargetConverter *aConverter)
+{
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("nsDragService::LookupMatchedInternalTarget,"
+ "checking %s \n", aDataFlavor));
+
+ if (!mTargetDragContext || !aDataFlavor)
+ return PR_FALSE;
+
+ gint index = 0;
+ while (autoConvertPair[index].internal &&
+ autoConvertPair[index].outside) {
+ if (!strcmp(autoConvertPair[index].outside, aDataFlavor) &&
+ LookupFlavorInTargetList(autoConvertPair[index].internal)) {
+ if (aConverter)
+ *aConverter = autoConvertPair[index].in2out;
+ if (aAtom)
+ *aAtom = gdk_atom_intern(autoConvertPair[index].internal,
+ FALSE);
+ return PR_TRUE;
+ }
+ ++index;
+ }
+ return PR_FALSE;
+}
+
+GtkTargetEntry *
+nsDragService::CreateGtkTargetFor(const char *aFlavorStr)
+{
+ // get the atom
+ GdkAtom atom = gdk_atom_intern(aFlavorStr, FALSE);
+ GtkTargetEntry *target =
+ (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
+ NS_ASSERTION(target, "No enough mem");
+
+ target->target = g_strdup(aFlavorStr);
+ target->flags = 0;
+ target->info = GPOINTER_TO_UINT(atom);
+
+ return target;
+}
+
+//converters
+
+// static
+void
+utf8_to_ucs2 (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen)
+{
+ nsAutoString ucs2string = NS_ConvertUTF8toUCS2(aDataIn);
+ *aDataOut = (char *)ToNewUnicode(ucs2string);
+ *aDataOutLen = ucs2string.Length() * 2;
+
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("AutoConverting: utf8 ---> unicode.\n"));
+
+}
+
+//static
+void
+ucs2_to_text (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen)
+{
+ nsPrimitiveHelpers::
+ ConvertUnicodeToPlatformPlainText((PRUnichar *)aDataIn,
+ int(aDataInLen / 2),
+ aDataOut, (PRInt32 *)aDataOutLen);
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("AutoConverting: ucs2 ---> platform text.\n"));
+}
+
+//static
+void
+text_to_ucs2 (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen)
+{
+ PRUnichar *convertedText = nsnull;
+ PRInt32 convertedTextLen = 0;
+ nsPrimitiveHelpers::
+ ConvertPlatformPlainTextToUnicode(aDataIn, aDataInLen,
+ &convertedText, &convertedTextLen);
+ if (convertedText) {
+ PR_LOG(sDragLm, PR_LOG_DEBUG,
+ ("AutoConverting: plain text ---> unicode.\n"));
+ *aDataOut = NS_REINTERPRET_CAST(char*, convertedText);
+ *aDataOutLen = convertedTextLen * 2;
+ }
+}
Index: widget/src/gtk2/nsDragService.h
===================================================================
RCS file: /export/src/cvs/mozilla1.7/mozilla/widget/src/gtk2/nsDragService.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nsDragService.h
--- widget/src/gtk2/nsDragService.h 2004/04/13 06:46:17 1.1.1.1
+++ widget/src/gtk2/nsDragService.h 2004/04/13 08:22:00
@@ -33,6 +33,8 @@
#include "nsIObserver.h"
#include <gtk/gtk.h>
+typedef void (*TargetConverter) (const char *aDataIn, unsigned int aDataInLen,
+ char **aDataOut, unsigned int *aDataOutLen);
/**
* Native GTK DragService wrapper
@@ -64,7 +66,8 @@
NS_IMETHOD GetNumDropItems (PRUint32 * aNumItems);
NS_IMETHOD GetData (nsITransferable * aTransferable,
PRUint32 aItemIndex);
- NS_IMETHOD IsDataFlavorSupported (const char *aDataFlavor, PRBool *_retval);
+ NS_IMETHOD IsDataFlavorSupported (const char *aDataFlavor,
+ PRBool *_retval);
// nsIDragSessionGTK
@@ -112,6 +115,9 @@
// last data received and its length
void *mTargetDragData;
PRUint32 mTargetDragDataLen;
+ GdkAtom mTargetDragGdkAtom; // the real target we asked for
+ TargetConverter mTargetConverter; //
+
// is the current target drag context contain a list?
PRBool IsTargetContextList(void);
// this will get the native data from the last target given a
@@ -129,7 +135,17 @@
// get a list of the sources in gtk's format
GtkTargetList *GetSourceList(void);
+ // check if a flavor supported by source target list
+ PRBool LookupFlavorInTargetList(const char *aDataFlavor);
+ PRBool LookupMatchedOutsideTarget(const char *aDataFlavor,
+ GdkAtom *aAtom,
+ TargetConverter *aConverter);
+ PRBool LookupMatchedInternalTarget(const char *aDataFlavor,
+ GdkAtom *aAtom,
+ TargetConverter *aConverter);
+
+ GtkTargetEntry *CreateGtkTargetFor(const char *aFlavorStr);
+
};
#endif // nsDragService_h__
-

View File

@ -1,12 +0,0 @@
diff -up mozilla/browser/app/Makefile.in.old mozilla/browser/app/Makefile.in
--- mozilla/browser/app/Makefile.in.old 2006-08-29 04:03:07.000000000 +0200
+++ mozilla/browser/app/Makefile.in 2007-09-26 15:08:35.000000000 +0200
@@ -238,7 +238,7 @@ libs:: firefox
$(INSTALL) $< $(DIST)/bin
install:: firefox
- $(SYSINSTALL) $< $(DESTDIR)$(bindir)
+ $(SYSINSTALL) $< $(DESTDIR)$(mozappdir)
GARBAGE += firefox
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +0,0 @@
Index: mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp,v
retrieving revision 1.58.20.1
retrieving revision 1.58
diff -d -u -p -r1.58.20.1 -r1.58
--- mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp 16 Apr 2007 18:54:53 -0000 1.58.20.1
+++ mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp 25 Oct 2004 07:46:01 -0000 1.58
@@ -1506,8 +1506,13 @@ nsOSHelperAppService::GetFromType(const
nsDependentSubstring majorType(majorTypeStart, majorTypeEnd);
nsDependentSubstring minorType(minorTypeStart, minorTypeEnd);
+ nsAutoString extensions, mime_types_description;
+ LookUpExtensionsAndDescription(majorType,
+ minorType,
+ extensions,
+ mime_types_description);
+
- // First check the user's private mailcap file
nsAutoString mailcap_description, handler, mozillaFlags;
DoLookUpHandlerAndDescription(majorType,
minorType,
@@ -1516,46 +1521,23 @@ nsOSHelperAppService::GetFromType(const
mailcap_description,
mozillaFlags,
PR_TRUE);
-
- LOG(("Private Handler/Description results: handler='%s', description='%s'\n",
- NS_LossyConvertUTF16toASCII(handler).get(),
- NS_LossyConvertUTF16toASCII(mailcap_description).get()));
+
+ if (handler.IsEmpty() && extensions.IsEmpty() &&
+ mailcap_description.IsEmpty() && mime_types_description.IsEmpty()) {
+ // No useful data yet
+
#ifdef MOZ_WIDGET_GTK2
- nsMIMEInfoBase *gnomeInfo = nsnull;
- if (handler.IsEmpty()) {
- // No useful data yet. Check the GNOME registry. Unfortunately, newer
- // GNOME versions no longer have type-to-extension mappings, so we might
- // get back a MIMEInfo without any extensions set. In that case we'll have
- // to look in our mime.types files for the extensions.
LOG(("Looking in GNOME registry\n"));
- gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
- if (gnomeInfo && gnomeInfo->HasExtensions()) {
- LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n"));
+ nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
+ if (gnomeInfo) {
+ LOG(("Got MIMEInfo from GNOME registry\n"));
return gnomeInfo;
}
- }
#endif
-
- // Now look up our extensions
- nsAutoString extensions, mime_types_description;
- LookUpExtensionsAndDescription(majorType,
- minorType,
- extensions,
- mime_types_description);
-
-#ifdef MOZ_WIDGET_GTK2
- if (gnomeInfo) {
- LOG(("Got MIMEInfo from GNOME registry without extensions; setting them "
- "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get()));
-
- NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
- gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
- return gnomeInfo;
}
-#endif
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
minorType,
typeOptions,
@@ -1565,7 +1547,7 @@ nsOSHelperAppService::GetFromType(const
PR_FALSE);
}
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
NS_LITERAL_STRING("*"),
typeOptions,
@@ -1575,7 +1557,7 @@ nsOSHelperAppService::GetFromType(const
PR_TRUE);
}
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
NS_LITERAL_STRING("*"),
typeOptions,

View File

@ -6,21 +6,23 @@ ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --with-system-png
#ac_add_options --with-system-png
ac_add_options --with-pthreads
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-installer
ac_add_options --enable-optimize="$RPM_OPT_FLAGS"
ac_add_options --enable-xinerama
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --disable-xprint
ac_add_options --disable-strip
ac_add_options --disable-system-cairo
ac_add_options --enable-pango
ac_add_options --enable-system-cairo
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --enable-startup-notification
ac_add_options --with-libxul-sdk=/usr/lib64/xulrunner-sdk-1.9pre
ac_add_options --enable-libxul
export BUILD_OFFICIAL=1
export MOZILLA_OFFICIAL=1

View File

@ -1,260 +0,0 @@
--- mozilla/toolkit/xre/nsAppRunner.h.old 2007-09-25 18:01:56.000000000 +0200
+++ mozilla/toolkit/xre/nsAppRunner.h 2007-09-25 18:02:23.000000000 +0200
@@ -48,7 +48,8 @@
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/toolkit/mozapps/update/src/updater/updater.cpp.old mozilla/toolkit/mozapps/update/src/updater/updater.cpp
--- mozilla/toolkit/mozapps/update/src/updater/updater.cpp.old 2007-09-25 18:00:26.000000000 +0200
+++ mozilla/toolkit/mozapps/update/src/updater/updater.cpp 2007-09-25 18:00:53.000000000 +0200
@@ -107,7 +107,8 @@ void LaunchChild(int argc, char **argv);
# elif defined(CCHMAXPATH)
# define MAXPATHLEN CCHMAXPATH
# else
-# define MAXPATHLEN 1024
+# include <limits.h>
+# define MAXPATHLEN PATH_MAX
# endif
#endif
diff -up mozilla/mailnews/import/comm4x/src/nsComm4xProfile.cpp.old mozilla/mailnews/import/comm4x/src/nsComm4xProfile.cpp
--- mozilla/mailnews/import/comm4x/src/nsComm4xProfile.cpp.old 2007-09-25 17:58:43.000000000 +0200
+++ mozilla/mailnews/import/comm4x/src/nsComm4xProfile.cpp 2007-09-25 17:59:22.000000000 +0200
@@ -70,7 +70,8 @@
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/xpcom/io/SpecialSystemDirectory.cpp.old mozilla/xpcom/io/SpecialSystemDirectory.cpp
--- mozilla/xpcom/io/SpecialSystemDirectory.cpp.old 2007-09-25 18:04:25.000000000 +0200
+++ mozilla/xpcom/io/SpecialSystemDirectory.cpp 2007-09-25 18:04:48.000000000 +0200
@@ -109,7 +109,8 @@
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/xpcom/obsolete/nsFileSpecUnix.cpp.old mozilla/xpcom/obsolete/nsFileSpecUnix.cpp
--- mozilla/xpcom/obsolete/nsFileSpecUnix.cpp.old 2006-11-28 01:18:37.000000000 +0100
+++ mozilla/xpcom/obsolete/nsFileSpecUnix.cpp 2007-09-25 18:05:49.000000000 +0200
@@ -79,7 +79,8 @@
#endif
#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024 /* Guessing this is okay. Works for SCO. */
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX /* Guessing this is okay. Works for SCO. */
#endif
#if defined(__QNX__)
diff -up mozilla/xpcom/build/nsXPCOMPrivate.h.old mozilla/xpcom/build/nsXPCOMPrivate.h
--- mozilla/xpcom/build/nsXPCOMPrivate.h.old 2007-09-25 18:02:58.000000000 +0200
+++ mozilla/xpcom/build/nsXPCOMPrivate.h 2007-09-25 18:03:15.000000000 +0200
@@ -252,7 +252,8 @@ NS_GetFrozenFunctions(XPCOMFunctions *en
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/dbm/include/mcom_db.h.old mozilla/dbm/include/mcom_db.h
--- mozilla/dbm/include/mcom_db.h.old 2007-09-25 17:57:09.000000000 +0200
+++ mozilla/dbm/include/mcom_db.h 2007-09-25 17:57:49.000000000 +0200
@@ -214,7 +214,8 @@
#endif /* __DBINTERFACE_PRIVATE */
#ifdef SCO
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#include <fcntl.h>
diff -up mozilla/browser/components/migration/src/nsProfileMigrator.cpp.old mozilla/browser/components/migration/src/nsProfileMigrator.cpp
--- mozilla/browser/components/migration/src/nsProfileMigrator.cpp.old 2007-09-25 17:55:11.000000000 +0200
+++ mozilla/browser/components/migration/src/nsProfileMigrator.cpp 2007-09-25 18:07:56.000000000 +0200
@@ -73,7 +73,8 @@
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/browser/components/migration/src/nsDogbertProfileMigrator.cpp.old mozilla/browser/components/migration/src/nsDogbertProfileMigrator.cpp
--- mozilla/browser/components/migration/src/nsDogbertProfileMigrator.cpp.old 2007-09-25 17:53:36.000000000 +0200
+++ mozilla/browser/components/migration/src/nsDogbertProfileMigrator.cpp 2007-09-25 18:07:37.000000000 +0200
@@ -35,6 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
+
#include "nsAppDirectoryServiceDefs.h"
#include "nsBrowserProfileMigratorUtils.h"
#include "nsCRT.h"
@@ -66,7 +67,8 @@
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
#endif
#endif
diff -up mozilla/nsprpub/config/nsinstall.c.old mozilla/nsprpub/config/nsinstall.c
diff -up mozilla/js/src/jsfile.c.old mozilla/js/src/jsfile.c
--- mozilla/js/src/jsfile.c.old 2006-07-26 20:55:08.000000000 +0200
+++ mozilla/js/src/jsfile.c 2007-09-25 18:22:52.000000000 +0200
@@ -105,7 +105,8 @@
#define utfstring "binary"
#define unicodestring "unicode"
-#define MAX_PATH_LENGTH 1024
+#include <limits.h>
+#define MAX_PATH_LENGTH PATH_MAX
#define MODE_SIZE 256
#define NUMBER_SIZE 32
#define MAX_LINE_LENGTH 256
diff -up mozilla/webshell/tests/viewer/nsViewerApp.cpp.old mozilla/webshell/tests/viewer/nsViewerApp.cpp
--- mozilla/webshell/tests/viewer/nsViewerApp.cpp.old 2007-09-25 18:34:51.000000000 +0200
+++ mozilla/webshell/tests/viewer/nsViewerApp.cpp 2007-09-25 18:35:33.000000000 +0200
@@ -692,7 +692,8 @@ nsViewerApp::OpenWindow(PRUint32 aNewChr
#if !defined(XP_WIN) && !defined(XP_OS2)
#ifndef XP_MAC
-#define _MAX_PATH 512
+#include <limits.h>
+#define _MAX_PATH PATH_MAX
#endif
#endif
diff -up mozilla/xpcom/typelib/xpidl/xpidl_java.c.old mozilla/xpcom/typelib/xpidl/xpidl_java.c
--- mozilla/xpcom/typelib/xpidl/xpidl_java.c.old 2007-09-25 18:38:52.000000000 +0200
+++ mozilla/xpcom/typelib/xpidl/xpidl_java.c 2007-09-25 18:39:17.000000000 +0200
@@ -44,6 +44,7 @@
#include "xpidl.h"
#include <ctype.h>
#include <glib.h>
+#include <limits.h>
#ifdef XP_WIN
#include <windef.h>
diff -up mozilla/widget/src/xremoteclient/XRemoteClient.cpp.old mozilla/widget/src/xremoteclient/XRemoteClient.cpp
--- mozilla/widget/src/xremoteclient/XRemoteClient.cpp.old 2007-09-25 18:14:08.000000000 +0200
+++ mozilla/widget/src/xremoteclient/XRemoteClient.cpp 2007-09-25 18:36:55.000000000 +0200
@@ -76,7 +76,8 @@
#endif
#ifndef MAX_PATH
-#define MAX_PATH 1024
+#include <limits.h>
+#define MAX_PATH PATH_MAX
#endif
#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0]))
diff -up mozilla/modules/libreg/src/reg.c.old mozilla/modules/libreg/src/reg.c
--- mozilla/modules/libreg/src/reg.c.old 2007-09-25 18:25:02.000000000 +0200
+++ mozilla/modules/libreg/src/reg.c 2007-09-25 18:27:46.000000000 +0200
@@ -96,7 +96,8 @@
#define MAX_PATH PATH_MAX
#elif defined(XP_UNIX)
#ifndef MAX_PATH
-#define MAX_PATH 1024
+#include <limits.h>
+#define MAX_PATH PATH_MAX
#endif
#elif defined(XP_OS2)
#ifndef MAX_PATH
diff -up mozilla/directory/c-sdk/config/pathsub.h.old mozilla/directory/c-sdk/config/pathsub.h
--- mozilla/directory/c-sdk/config/pathsub.h.old 2006-02-03 15:41:18.000000000 +0100
+++ mozilla/directory/c-sdk/config/pathsub.h 2007-09-25 18:48:58.000000000 +0200
@@ -50,7 +50,7 @@
#endif
#ifndef PATH_MAX
-#define PATH_MAX 1024
+#error "PATH_MAX is not defined!"
#endif
/*
diff -up mozilla/config/pathsub.h.old mozilla/config/pathsub.h
--- mozilla/config/pathsub.h.old 2004-04-18 16:17:25.000000000 +0200
+++ mozilla/config/pathsub.h 2007-09-25 18:48:13.000000000 +0200
@@ -46,7 +46,7 @@
#include <sys/types.h>
#ifndef PATH_MAX
-#define PATH_MAX 1024
+#error "PATH_MAX is not defined!"
#endif
/*
diff -up mozilla/modules/libjar/nsZipArchive.cpp.old mozilla/modules/libjar/nsZipArchive.cpp
--- mozilla/modules/libjar/nsZipArchive.cpp.old 2006-09-13 20:32:37.000000000 +0200
+++ mozilla/modules/libjar/nsZipArchive.cpp 2007-09-25 18:51:00.000000000 +0200
@@ -121,7 +121,7 @@ char * strdup(const char *src)
# define S_IFLNK 0120000
# endif
# ifndef PATH_MAX
-# define PATH_MAX 1024
+# include <limits.h>
# endif
#endif /* XP_UNIX */
diff -up mozilla/nsprpub/config/pathsub.h.old mozilla/nsprpub/config/pathsub.h
--- mozilla/nsprpub/config/pathsub.h.old 2004-04-25 17:00:34.000000000 +0200
+++ mozilla/nsprpub/config/pathsub.h 2007-09-25 18:57:51.000000000 +0200
@@ -50,7 +50,7 @@
#endif
#ifndef PATH_MAX
-#define PATH_MAX 1024
+#error "PATH_MAX is not defined!"
#endif
/*
diff -up mozilla/gfx/src/gtk/nsPrintdGTK.h.old mozilla/gfx/src/gtk/nsPrintdGTK.h
--- mozilla/gfx/src/gtk/nsPrintdGTK.h.old 2004-04-17 23:52:29.000000000 +0200
+++ mozilla/gfx/src/gtk/nsPrintdGTK.h 2007-09-25 18:56:48.000000000 +0200
@@ -63,7 +63,7 @@ PR_BEGIN_EXTERN_C
#ifdef _POSIX_PATH_MAX
#define PATH_MAX _POSIX_PATH_MAX
#else
-#define PATH_MAX 256
+#error "PATH_MAX is not defined!"
#endif
#endif
diff -up mozilla/security/coreconf/nsinstall/pathsub.h.old mozilla/security/coreconf/nsinstall/pathsub.h
--- mozilla/security/coreconf/nsinstall/pathsub.h.old 2004-04-25 17:02:18.000000000 +0200
+++ mozilla/security/coreconf/nsinstall/pathsub.h 2007-09-25 19:00:35.000000000 +0200
@@ -49,7 +49,7 @@
#endif
#ifndef PATH_MAX
-#define PATH_MAX 1024
+#error "PATH_MAX is not defined!"
#endif
/*

View File

@ -1,28 +1,25 @@
%define homepage http://start.fedoraproject.org/
%define default_bookmarks_file %{_datadir}/bookmarks/default-bookmarks.html
%define desktop_file_utils_version 0.9
%define nspr_version 4.6
%define nss_version 3.11.1
%define cairo_version 0.5
%define builddir %{_builddir}/mozilla
%define build_devel_package 1
%define mozappdir %{_libdir}/%{name}-3.0b3pre
%define official_branding 1
%define official_branding 0
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 2.0.0.10
Release: 5%{?dist}
Version: 3.0
Release: 0.beta2.1%{?dist}
URL: http://www.mozilla.org/projects/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
%if %{official_branding}
%define tarball firefox-%{version}-source.tar.bz2
%else
%define tarball firefox-2.0rc3-source.tar.bz2
%define tarball firefox-20071215.tar.bz2
%endif
Source0: %{tarball}
Source2: firefox-langpacks-%{version}-20071123.tar.bz2
Source2: firefox-langpacks-2.0.0.10-20071123.tar.bz2
Source10: firefox-mozconfig
Source11: firefox-mozconfig-branded
Source12: firefox-redhat-default-prefs.js
@ -36,35 +33,9 @@ Source101: add-gecko-provides.in
# build patches
Patch1: firefox-2.0-link-layout.patch
# customization patches
Patch21: firefox-0.7.3-psfonts.patch
Patch22: firefox-1.1-default-applications.patch
# local bugfixes
Patch40: firefox-1.5-bullet-bill.patch
Patch41: firefox-2.0.0.4-undo-uriloader.patch
Patch42: firefox-1.1-uriloader.patch
Patch43: firefox-2.0-getstartpage.patch
# font system fixes
Patch83: firefox-1.5-pango-cursor-position.patch
Patch84: firefox-2.0-pango-printing.patch
Patch85: firefox-2.0-pango-ligatures.patch
Patch86: firefox-1.5-pango-cursor-position-more.patch
Patch87: firefox-1.5-pango-justified-range.patch
Patch88: firefox-1.5-pango-underline.patch
Patch89: firefox-1.5-xft-rangewidth.patch
# Other
Patch102: firefox-1.5-theme-change.patch
Patch104: firefox-1.5-ppc64.patch
Patch105: firefox-2.0-dnd.patch
Patch110: firefox-2.0-startup-notify.patch
Patch111: firefox-path.patch
Patch112: firefox-2.0-enable-debug.patch
%if %{official_branding}
# Required by Mozilla Corporation
@ -79,11 +50,6 @@ Patch112: firefox-2.0-enable-debug.patch
# ---------------------------------------------------
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: nspr-devel >= %{nspr_version}
BuildRequires: nss-devel >= %{nss_version}
BuildRequires: cairo-devel >= %{cairo_version}
BuildRequires: libpng-devel, libjpeg-devel
BuildRequires: zlib-devel, zip
BuildRequires: libIDL-devel
BuildRequires: desktop-file-utils
BuildRequires: gtk2-devel
@ -97,70 +63,30 @@ BuildRequires: libXt-devel
BuildRequires: libXrender-devel
BuildRequires: system-bookmarks
BuildRequires: startup-notification-devel
BuildRequires: xulrunner-devel >= 1.9-0.beta2
Requires: nspr >= %{nspr_version}
Requires: nss >= %{nss_version}
Requires: desktop-file-utils >= %{desktop_file_utils_version}
Requires: system-bookmarks
Requires: xulrunner, system-bookmarks
Obsoletes: mozilla <= 37:1.7.13
Provides: webclient
%define mozappdir %{_libdir}/firefox-%{version}
%define _use_internal_dependency_generator 0
%if %{build_devel_package}
%define __find_provides %{_builddir}/add-gecko-provides
%else
%define __find_requires %{SOURCE100}
%endif
%description
Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance and portability.
%if %{build_devel_package}
%package devel
Summary: Development files for Firefox
Group: Development/Libraries
Obsoletes: mozilla-devel
Requires: firefox = %{version}-%{release}
Requires: nspr-devel >= %{nspr_version}
Requires: nss-devel >= %{nss_version}
%description devel
Development files for Firefox. This package exists temporarily.
When xulrunner has reached version 1.0, firefox-devel will be
removed in favor of xulrunner-devel.
%endif
#---------------------------------------------------------------------
%prep
%setup -q -n mozilla
%patch1 -p1 -b .link-layout
%patch21 -p1 -b .psfonts
%patch22 -p0 -b .default-applications
%patch43 -p1 -b .getstartpage
%patch40 -p1 -b .bullet-bill
%patch41 -p1 -b .undo-uriloader
%patch42 -p0 -b .uriloader
%patch43 -p1 -b .getstartpage
%patch83 -p1 -b .pango-cursor-position
%patch84 -p0 -b .pango-printing
%patch85 -p1 -b .pango-ligatures
%patch86 -p1 -b .pango-cursor-position-more
%patch87 -p1 -b .pango-justified-range
%patch88 -p1 -b .pango-underline
%patch89 -p1 -b .nopangoxft2
%patch102 -p0 -b .theme-change
%patch104 -p1 -b .ppc64
%patch105 -p0 -b .dnd
#%patch110 -p0 -b .startup-notify
%patch111 -p1 -b .path
%patch112 -p1 -b .debug
# For branding specific patches.
@ -182,7 +108,7 @@ removed in favor of xulrunner-devel.
%endif
# set up our default bookmarks
%{__cp} %{default_bookmarks_file} $RPM_BUILD_DIR/mozilla/profile/defaults/bookmarks.html
#%{__cp} %{default_bookmarks_file} $RPM_BUILD_DIR/mozilla/profile/defaults/bookmarks.html
#---------------------------------------------------------------------
@ -202,7 +128,10 @@ export LIBDIR='%{_libdir}'
%define moz_make_flags %{?_smp_mflags}
%endif
export LDFLAGS="-Wl,-rpath,%{mozappdir}"
INTERNAL_GECKO="3.0b3pre"
MOZ_APP_DIR=%{_libdir}/%{name}-${INTERNAL_GECKO}
export LDFLAGS="-Wl,-rpath,$MOZ_APP_DIR"
export MAKE="gmake %{moz_make_flags}"
make -f client.mk build
@ -211,7 +140,6 @@ make -f client.mk build
%install
%{__rm} -rf $RPM_BUILD_ROOT
DESTDIR=$RPM_BUILD_ROOT make install
%{__mkdir_p} $RPM_BUILD_ROOT{%{_libdir},%{_bindir},%{_datadir}/applications,%{_datadir}/icons/hicolor/48x48/apps},
@ -225,6 +153,7 @@ desktop-file-install --vendor mozilla \
%{SOURCE20}
# set up the firefox start script
%{__rm} -rf $RPM_BUILD_ROOT%{_bindir}/firefox
%{__cat} %{SOURCE21} | %{__sed} -e 's,FIREFOX_VERSION,%{version},g' > \
$RPM_BUILD_ROOT%{_bindir}/firefox
%{__chmod} 755 $RPM_BUILD_ROOT%{_bindir}/firefox
@ -240,46 +169,43 @@ pref("startup.homepage_welcome_url", "%{homepage}");
EOF
# place the preferences
%{__cp} rh-default-prefs $RPM_BUILD_ROOT/%{mozappdir}/greprefs/all-redhat.js
%{__cp} rh-default-prefs $RPM_BUILD_ROOT/%{mozappdir}/defaults/pref/all-redhat.js
%{__rm} rh-default-prefs
#%{__cp} rh-default-prefs $RPM_BUILD_ROOT/%{mozappdir}/greprefs/all-redhat.js
#%{__cp} rh-default-prefs $RPM_BUILD_ROOT/%{mozappdir}/defaults/pref/all-redhat.js
#%{__rm} rh-default-prefs
# set up our default bookmarks
%{__rm} -f $RPM_BUILD_ROOT%{mozappdir}/defaults/profile/bookmarks.html
ln -s %{default_bookmarks_file} $RPM_BUILD_ROOT%{mozappdir}/defaults/profile/bookmarks.html
%{__rm} -f $RPM_BUILD_ROOT/%{mozappdir}/defaults/profile/bookmarks.html
ln -s %{default_bookmarks_file} $RPM_BUILD_ROOT/%{mozappdir}/defaults/profile/bookmarks.html
%{__cat} %{SOURCE50} | %{__sed} -e 's,FFDIR,%{mozappdir},g' -e 's,LIBDIR,%{_libdir},g' > \
$RPM_BUILD_ROOT%{mozappdir}/firefox-xremote-client
$RPM_BUILD_ROOT/%{mozappdir}/firefox-xremote-client
%{__chmod} 755 $RPM_BUILD_ROOT%{mozappdir}/firefox-xremote-client
%{__chmod} 755 $RPM_BUILD_ROOT/%{mozappdir}/firefox-xremote-client
%{__install} -p -D -m 644 %{SOURCE23} $RPM_BUILD_ROOT%{_mandir}/man1/firefox.1
%{__rm} -f $RPM_BUILD_ROOT%{mozappdir}/firefox-config
%{__rm} -f $RPM_BUILD_ROOT/%{mozappdir}/firefox-config
cd $RPM_BUILD_ROOT%{mozappdir}/chrome
find . -name "*" -type d -maxdepth 1 -exec %{__rm} -rf {} \;
cd -
#cd $RPM_BUILD_ROOT/%{mozappdir}/chrome
#find . -name "*" -type d -maxdepth 1 -exec %{__rm} -rf {} \;
#cd -
%{__cat} > $RPM_BUILD_ROOT%{mozappdir}/defaults/pref/firefox-l10n.js << EOF
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
EOF
%{__chmod} 644 $RPM_BUILD_ROOT%{mozappdir}/defaults/pref/firefox-l10n.js
#%{__cat} > $RPM_BUILD_ROOT/%{mozappdir}/defaults/pref/firefox-l10n.js << EOF
#pref("general.useragent.locale", "chrome://global/locale/intl.properties");
#EOF
#%{__chmod} 644 $RPM_BUILD_ROOT/%{mozappdir}/defaults/pref/firefox-l10n.js
%{__mkdir_p} $RPM_BUILD_ROOT%{mozappdir}/chrome/icons/default/
%{__mkdir_p} $RPM_BUILD_ROOT/%{mozappdir}/chrome/icons/default/
%{__cp} other-licenses/branding/%{name}/default.xpm \
$RPM_BUILD_ROOT%{mozappdir}/chrome/icons/default/
$RPM_BUILD_ROOT/%{mozappdir}/chrome/icons/default/
%{__cp} other-licenses/branding/%{name}/default.xpm \
$RPM_BUILD_ROOT%{mozappdir}/icons/
# own mozilla plugin dir (#135050)
%{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins
$RPM_BUILD_ROOT/%{mozappdir}/icons/
# Install langpacks
%{__mkdir_p} $RPM_BUILD_ROOT%{mozappdir}/extensions
%{__mkdir_p} $RPM_BUILD_ROOT/%{mozappdir}/extensions
%{__tar} xjf %{SOURCE2}
for langpack in `ls firefox-langpacks/*.xpi`; do
language=`basename $langpack .xpi`
extensiondir=$RPM_BUILD_ROOT%{mozappdir}/extensions/langpack-$language@firefox.mozilla.org
extensiondir=$RPM_BUILD_ROOT/%{mozappdir}/extensions/langpack-$language@firefox.mozilla.org
%{__mkdir_p} $extensiondir
unzip $langpack -d $extensiondir
find $extensiondir -type f | xargs chmod 644
@ -303,48 +229,17 @@ for langpack in `ls firefox-langpacks/*.xpi`; do
done
%{__rm} -rf firefox-langpacks
# Prepare our devel package
%if %{build_devel_package}
%{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/firefox-%{version}
%{__mkdir_p} $RPM_BUILD_ROOT/%{_datadir}/idl/firefox-%{version}
%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
%{__cp} -rL dist/include/* \
$RPM_BUILD_ROOT/%{_includedir}/firefox-%{version}
%{__cp} -rL dist/idl/* \
$RPM_BUILD_ROOT/%{_datadir}/idl/firefox-%{version}
install -c -m 755 dist/bin/xpcshell \
dist/bin/xpidl \
dist/bin/xpt_dump \
dist/bin/xpt_link \
$RPM_BUILD_ROOT/%{mozappdir}
install -c -m 644 build/unix/*.pc \
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig
%endif
# GRE stuff
#%ifarch x86_64 ia64 ppc64 s390x
#%define gre_conf_file gre64.conf
#%else
#%define gre_conf_file gre.conf
#%endif
#
#%{__mkdir_p} $RPM_BUILD_ROOT/etc/gre.d/
#%{__cat} > $RPM_BUILD_ROOT/etc/gre.d/%{gre_conf_file} << EOF
#[%{version}]
#GRE_PATH=%{mozappdir}
#EOF
GECKO_VERSION=$(./config/milestone.pl --topsrcdir='.')
%{__cat} %{SOURCE101} | %{__sed} -e "s/@GECKO_VERSION@/$GECKO_VERSION/g" > \
%{_builddir}/add-gecko-provides
chmod 700 %{_builddir}/add-gecko-provides
# Copy over the LICENSE
install -c -m 644 LICENSE $RPM_BUILD_ROOT%{mozappdir}
install -c -m 644 LICENSE $RPM_BUILD_ROOT/%{mozappdir}
# ghost files
touch $RPM_BUILD_ROOT%{mozappdir}/components/compreg.dat
touch $RPM_BUILD_ROOT%{mozappdir}/components/xpti.dat
touch $RPM_BUILD_ROOT/%{mozappdir}/components/compreg.dat
touch $RPM_BUILD_ROOT/%{mozappdir}/components/xpti.dat
#---------------------------------------------------------------------
@ -379,20 +274,14 @@ fi
%files
%defattr(-,root,root,-)
%{_bindir}/firefox
%exclude %{_bindir}/firefox-config
#%exclude %{_bindir}/firefox-config
%{_mandir}/man1/*
%{_datadir}/applications/mozilla-%{name}.desktop
%{_datadir}/icons/hicolor/48x48/apps/firefox.png
%{_libdir}/mozilla
#%dir /etc/gre.d
#/etc/gre.d/%{gre_conf_file}
%dir %{mozappdir}
%doc %{mozappdir}/LICENSE
%{mozappdir}/*.properties
%{mozappdir}/chrome
%{mozappdir}/chrome.manifest
%{mozappdir}/dictionaries
%dir %{mozappdir}/components
%ghost %{mozappdir}/components/compreg.dat
%ghost %{mozappdir}/components/xpti.dat
@ -401,44 +290,26 @@ fi
%attr(644, root, root) %{mozappdir}/components/*.js
%{mozappdir}/defaults
%{mozappdir}/extensions
%{mozappdir}/greprefs
%{mozappdir}/icons
%{mozappdir}/init.d
%{mozappdir}/plugins
%{mozappdir}/res
%{mozappdir}/searchplugins
%{mozappdir}/*.so
%{mozappdir}/firefox
%{mozappdir}/firefox-bin
%{mozappdir}/firefox-xremote-client
%{mozappdir}/mozilla-xremote-client
%{mozappdir}/run-mozilla.sh
%{mozappdir}/regxpcom
%{mozappdir}/application.ini
%{mozappdir}/modules/distribution.js
%{mozappdir}/removed-files
%{mozappdir}/.autoreg
# XXX See if these are needed still
%{mozappdir}/updater*
%if %{build_devel_package}
%files devel
%defattr(-,root,root)
%{_datadir}/idl/firefox-%{version}
%{_includedir}/firefox-%{version}
%{mozappdir}/TestGtkEmbed
%{mozappdir}/xpcshell
%{mozappdir}/xpicleanup
%{mozappdir}/xpidl
%{mozappdir}/xpt_dump
%{mozappdir}/xpt_link
%{_libdir}/pkgconfig/firefox-xpcom.pc
%{_libdir}/pkgconfig/firefox-plugin.pc
%{_libdir}/pkgconfig/firefox-js.pc
%{_libdir}/pkgconfig/firefox-gtkmozembed.pc
%exclude %{_libdir}/pkgconfig/firefox-nspr.pc
%exclude %{_libdir}/pkgconfig/firefox-nss.pc
%endif
#---------------------------------------------------------------------
%changelog
* Tue Dec 18 2007 Martin Stransky <stransky@redhat.com> 3.0-0.beta2.1
- moved to XUL Runner and updated to 3.0b3pre
- removed firefox-devel package, gecko-libs is provided
by xulrunner-devel now.
* Thu Dec 13 2007 Christopher Aillon <caillon@redhat.com> 2.0.0.10-5
- Fix the getStartPage method to not return blank.
Patch by pspencer@fields.utoronto.ca

View File

@ -1,2 +1,2 @@
5c2f13d6a27f462ec6b862dafca22e7b firefox-2.0.0.10-source.tar.bz2
368295c3958e2f8f7e7d404b9876f43f firefox-langpacks-2.0.0.10-20071123.tar.bz2
8ad6a163eeb962482130cbcfaf891e26 firefox-20071215.tar.bz2