rpms/thunderbird/FC-3 firefox-1.0-execshield-nspr.patch, NONE, 1.1 firefox-1.0-execshield-xpcom.patch, NONE, 1.1 firefox-1.0-gcc4-compile.patch, NONE, 1.1 firefox-1.0-nspr-s390.patch, NONE, 1.1 firefox-1.0-pango-selection.patch, NONE, 1.1 firefox-1.0-pango-space-width.patch, NONE, 1.1 firefox-1.0-prdtoa.patch, NONE, 1.1 firefox-1.0-recv-fortify.patch, NONE, 1.1 firefox-1.0-xptcall-s390.patch, NONE, 1.1
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Mar 23 16:47:04 UTC 2005
Update of /cvs/dist/rpms/thunderbird/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv31290
Added Files:
firefox-1.0-execshield-nspr.patch
firefox-1.0-execshield-xpcom.patch
firefox-1.0-gcc4-compile.patch firefox-1.0-nspr-s390.patch
firefox-1.0-pango-selection.patch
firefox-1.0-pango-space-width.patch firefox-1.0-prdtoa.patch
firefox-1.0-recv-fortify.patch firefox-1.0-xptcall-s390.patch
Log Message:
patches imported from devel
firefox-1.0-execshield-nspr.patch:
os_Linux_ia64.s | 3 +++
1 files changed, 3 insertions(+)
--- NEW FILE firefox-1.0-execshield-nspr.patch ---
Index: nsprpub/pr/src/md/unix/os_Linux_ia64.s
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/md/unix/os_Linux_ia64.s,v
retrieving revision 3.1
diff -d -u -p -r3.1 os_Linux_ia64.s
--- nsprpub/pr/src/md/unix/os_Linux_ia64.s 20 Jun 2000 22:22:23 -0000 3.1
+++ nsprpub/pr/src/md/unix/os_Linux_ia64.s 25 Feb 2005 22:35:49 -0000
@@ -78,3 +78,6 @@ _PR_ia64_AtomicSet:
xchg4 r8 = [r32], r33
br.ret.sptk.many b0
.endp _PR_ia64_AtomicSet#
+
+/* Magic indicating no need for an executable stack */
+.section .note.GNU-stack, "", @progbits ; .previous
firefox-1.0-execshield-xpcom.patch:
xptcinvoke_asm_ipf64.s | 3 ++-
xptcinvoke_asm_ppc_linux.s | 3 +++
xptcstubs_asm_ipf64.s | 3 ++-
xptcstubs_asm_ppc_linux.s | 2 ++
4 files changed, 9 insertions(+), 2 deletions(-)
--- NEW FILE firefox-1.0-execshield-xpcom.patch ---
Index: xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s
===================================================================
RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s,v
retrieving revision 1.1
diff -d -u -p -r1.1 xptcinvoke_asm_ipf64.s
--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s 19 Jun 2003 02:58:43 -0000 1.1
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s 26 Feb 2005 00:31:14 -0000
@@ -142,4 +142,5 @@ XPTC_InvokeByIndex::
.endp
-
+/* Magic indicating no need for an executable stack */
+.section .note.GNU-stack, "", @progbits ; .previous
Index: xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
===================================================================
RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s,v
retrieving revision 1.5
diff -d -u -p -r1.5 xptcinvoke_asm_ppc_linux.s
--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s 31 Aug 2002 19:08:57 -0000 1.5
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s 26 Feb 2005 00:31:14 -0000
@@ -111,3 +111,6 @@ XPTC_InvokeByIndex:
mtlr r0
mr sp,r11
blr
+
+/* Magic indicating no need for an executable stack */
+.section .note.GNU-stack, "", @progbits ; .previous
Index: xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s
===================================================================
RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s,v
retrieving revision 1.1
diff -d -u -p -r1.1 xptcstubs_asm_ipf64.s
--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s 19 Jun 2003 02:58:45 -0000 1.1
+++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s 26 Feb 2005 00:31:14 -0000
@@ -121,4 +121,5 @@ SharedStub::
.endp
-
+/* Magic indicating no need for an executable stack */
+.section .note.GNU-stack, "", @progbits ; .previous
Index: xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s
===================================================================
RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s,v
retrieving revision 1.5
diff -d -u -p -r1.5 xptcstubs_asm_ppc_linux.s
--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s 31 Aug 2002 19:08:57 -0000 1.5
+++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s 26 Feb 2005 00:31:14 -0000
@@ -87,3 +87,5 @@ SharedStub:
la sp,112(sp) // clean up the stack
blr
+/* Magic indicating no need for an executable stack */
+.section .note.GNU-stack, "", @progbits ; .previous
firefox-1.0-gcc4-compile.patch:
gfx/src/freetype/nsFreeType.cpp | 2 +-
netwerk/protocol/http/src/nsHttpConnectionMgr.cpp | 4 ++--
security/nss/lib/pki1/oiddata.h | 3 ---
security/nss/lib/pki1/pki1.h | 2 ++
widget/src/gtk2/nsDragService.cpp | 10 +++++-----
5 files changed, 10 insertions(+), 11 deletions(-)
--- NEW FILE firefox-1.0-gcc4-compile.patch ---
Index: gfx/src/freetype/nsFreeType.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/freetype/nsFreeType.cpp,v
retrieving revision 1.24
diff -u -r1.24 nsFreeType.cpp
--- gfx/src/freetype/nsFreeType.cpp 7 Feb 2004 15:22:30 -0000 1.24
+++ gfx/src/freetype/nsFreeType.cpp 4 Mar 2005 19:59:53 -0000
@@ -96,7 +96,7 @@
// Define the FreeType2 functions we resolve at run time.
// see the comment near nsFreeType2::DoneFace() for more info
//
-#define NS_FT2_OFFSET(f) (int)&((nsFreeType2*)0)->f
+#define NS_FT2_OFFSET(f) (NS_PTR_TO_INT32(&((nsFreeType2*)0)->f))
FtFuncList nsFreeType2::FtFuncs [] = {
{"FT_Done_Face", NS_FT2_OFFSET(nsFT_Done_Face), PR_TRUE},
{"FT_Done_FreeType", NS_FT2_OFFSET(nsFT_Done_FreeType), PR_TRUE},
Index: netwerk/protocol/http/src/nsHttpConnectionMgr.cpp
===================================================================
RCS file: /cvsroot/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp,v
retrieving revision 1.7.20.1
diff -u -r1.7.20.1 nsHttpConnectionMgr.cpp
--- netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 1 Sep 2004 23:31:03 -0000 1.7.20.1
+++ netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 4 Mar 2005 19:59:57 -0000
@@ -834,8 +834,8 @@
void
nsHttpConnectionMgr::OnMsgUpdateParam(nsresult status, void *param)
{
- PRUint16 name = (PRUint32(param) & 0xFFFF0000) >> 16;
- PRUint16 value = PRUint32(param) & 0x0000FFFF;
+ PRUint16 name = (NS_PTR_TO_INT32(param) & 0xFFFF0000) >> 16;
+ PRUint16 value = NS_PTR_TO_INT32(param) & 0x0000FFFF;
switch (name) {
case MAX_CONNECTIONS:
Index: security/nss/lib/pki1/oiddata.h
===================================================================
RCS file: /cvsroot/mozilla/security/nss/lib/pki1/oiddata.h,v
retrieving revision 1.1
diff -u -r1.1 oiddata.h
--- security/nss/lib/pki1/oiddata.h 4 Jan 2002 05:22:07 -0000 1.1
+++ security/nss/lib/pki1/oiddata.h 4 Mar 2005 19:59:58 -0000
@@ -43,9 +43,6 @@
#include "nsspki1t.h"
#endif /* NSSPKI1T_H */
-extern const NSSOID nss_builtin_oids[];
-extern const PRUint32 nss_builtin_oid_count;
-
/*extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];*/
/*extern const PRUint32 nss_attribute_type_alias_count;*/
Index: security/nss/lib/pki1/pki1.h
===================================================================
RCS file: /cvsroot/mozilla/security/nss/lib/pki1/pki1.h,v
retrieving revision 1.2
diff -u -r1.2 pki1.h
--- security/nss/lib/pki1/pki1.h 19 Jul 2001 20:40:42 -0000 1.2
+++ security/nss/lib/pki1/pki1.h 4 Mar 2005 19:59:59 -0000
@@ -58,6 +58,8 @@
/* fgmr 19990505 moved these here from oiddata.h */
extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];
extern const PRUint32 nss_attribute_type_alias_count;
+extern const NSSOID nss_builtin_oids[];
+extern const PRUint32 nss_builtin_oid_count;
/*
* NSSOID
Index: widget/src/gtk2/nsDragService.cpp
===================================================================
RCS file: /cvsroot/mozilla/widget/src/gtk2/nsDragService.cpp,v
retrieving revision 1.5
diff -u -r1.5 nsDragService.cpp
--- widget/src/gtk2/nsDragService.cpp 30 Oct 2003 01:48:41 -0000 1.5
+++ widget/src/gtk2/nsDragService.cpp 4 Mar 2005 20:00:01 -0000
@@ -838,7 +838,7 @@
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
listTarget->target = g_strdup(gMimeListType);
listTarget->flags = 0;
- listTarget->info = (guint)listAtom;
+ listTarget->info = (guint)(NS_PTR_TO_INT32(listAtom));
PR_LOG(sDragLm, PR_LOG_DEBUG,
("automatically adding target %s with id %ld\n",
listTarget->target, listAtom));
@@ -877,7 +877,7 @@
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
listTarget->target = g_strdup(gTextUriListType);
listTarget->flags = 0;
- listTarget->info = (guint)listAtom;
+ listTarget->info = (guint)NS_PTR_TO_INT32(listAtom);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("automatically adding target %s with \
id %ld\n", listTarget->target, listAtom));
@@ -914,7 +914,7 @@
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
target->target = g_strdup(flavorStr);
target->flags = 0;
- target->info = (guint)atom;
+ target->info = (guint)NS_PTR_TO_INT32(atom);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("adding target %s with id %ld\n",
target->target, atom));
@@ -931,7 +931,7 @@
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
plainTarget->target = g_strdup(kTextMime);
plainTarget->flags = 0;
- plainTarget->info = (guint)plainAtom;
+ plainTarget->info = (guint)NS_PTR_TO_INT32(plainAtom);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("automatically adding target %s with \
id %ld\n", plainTarget->target, plainAtom));
@@ -948,7 +948,7 @@
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
urlTarget->target = g_strdup(gMozUrlType);
urlTarget->flags = 0;
- urlTarget->info = (guint)urlAtom;
+ urlTarget->info = (guint)NS_PTR_TO_INT32(urlAtom);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("automatically adding target %s with \
id %ld\n", urlTarget->target, urlAtom));
firefox-1.0-nspr-s390.patch:
_linux.cfg | 54 +++++++++++++++++++++++++++---------------------------
_linux.h | 4 ++--
2 files changed, 29 insertions(+), 29 deletions(-)
--- NEW FILE firefox-1.0-nspr-s390.patch ---
Index: nsprpub/pr/include/md/_linux.cfg
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/include/md/_linux.cfg,v
retrieving revision 3.12.4.5
diff -u -r3.12.4.5 _linux.cfg
--- nsprpub/pr/include/md/_linux.cfg 9 Mar 2004 03:18:20 -0000 3.12.4.5
+++ nsprpub/pr/include/md/_linux.cfg 19 Nov 2004 01:36:07 -0000
@@ -505,95 +505,95 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__s390__)
+#elif defined(__s390x__)
#define IS_BIG_ENDIAN 1
#undef IS_LITTLE_ENDIAN
+#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
-#define PR_BYTES_PER_LONG 4
+#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
-#define PR_BYTES_PER_WORD 4
+#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
-#define PR_BITS_PER_LONG 32
+#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
-#define PR_BITS_PER_WORD 32
+#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
-#define PR_BITS_PER_LONG_LOG2 5
+#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
-#define PR_BITS_PER_WORD_LOG2 5
+#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
-#define PR_ALIGN_OF_LONG 4
-#define PR_ALIGN_OF_INT64 4
+#define PR_ALIGN_OF_LONG 8
+#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
-#define PR_ALIGN_OF_DOUBLE 4
-#define PR_ALIGN_OF_POINTER 4
-#define PR_ALIGN_OF_WORD 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD 8
-#define PR_BYTES_PER_WORD_LOG2 2
+#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__s390x__)
+#elif defined(__s390__)
#define IS_BIG_ENDIAN 1
#undef IS_LITTLE_ENDIAN
-#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
-#define PR_BYTES_PER_LONG 8
+#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
-#define PR_BYTES_PER_WORD 8
+#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
-#define PR_BITS_PER_LONG 64
+#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
-#define PR_BITS_PER_WORD 64
+#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
-#define PR_BITS_PER_LONG_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
-#define PR_BITS_PER_WORD_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
-#define PR_ALIGN_OF_LONG 8
-#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_LONG 4
+#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_FLOAT 4
-#define PR_ALIGN_OF_DOUBLE 8
-#define PR_ALIGN_OF_POINTER 8
-#define PR_ALIGN_OF_WORD 8
+#define PR_ALIGN_OF_DOUBLE 4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD 4
-#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#else
Index: nsprpub/pr/include/md/_linux.h
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/include/md/_linux.h,v
retrieving revision 3.34.2.8
diff -u -r3.34.2.8 _linux.h
--- nsprpub/pr/include/md/_linux.h 9 Mar 2004 03:18:20 -0000 3.34.2.8
+++ nsprpub/pr/include/md/_linux.h 19 Nov 2004 01:36:07 -0000
@@ -63,10 +63,10 @@
#define _PR_SI_ARCHITECTURE "arm"
#elif defined(__hppa__)
#define _PR_SI_ARCHITECTURE "hppa"
-#elif defined(__s390__)
-#define _PR_SI_ARCHITECTURE "s390"
#elif defined(__s390x__)
#define _PR_SI_ARCHITECTURE "s390x"
+#elif defined(__s390__)
+#define _PR_SI_ARCHITECTURE "s390"
#else
#error "Unknown CPU architecture"
#endif
firefox-1.0-pango-selection.patch:
gfx/public/nsIRenderingContext.h | 66 +++++++++
gfx/src/gtk/nsFontMetricsGTK.cpp | 28 +++
gfx/src/gtk/nsFontMetricsGTK.h | 15 ++
gfx/src/gtk/nsFontMetricsPango.cpp | 217 +++++++++++++++++++++++++++++-
gfx/src/gtk/nsFontMetricsPango.h | 15 ++
gfx/src/gtk/nsFontMetricsXft.cpp | 27 +++
gfx/src/gtk/nsFontMetricsXft.h | 15 ++
gfx/src/gtk/nsIFontMetricsGTK.h | 15 ++
gfx/src/gtk/nsRenderingContextGTK.cpp | 20 ++
gfx/src/gtk/nsRenderingContextGTK.h | 9 +
gfx/src/nsRenderingContextImpl.h | 13 +
gfx/src/shared/nsRenderingContextImpl.cpp | 29 ++++
layout/html/base/src/nsTextFrame.cpp | 150 +++++++++++++++++---
13 files changed, 590 insertions(+), 29 deletions(-)
--- NEW FILE firefox-1.0-pango-selection.patch ---
--- mozilla/gfx/src/gtk/nsFontMetricsXft.cpp.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsXft.cpp 2004-12-16 13:13:31.000000000 -0500
@@ -831,6 +831,33 @@
return NS_OK;
}
+nsresult
+nsFontMetricsXft::GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+nsresult
+nsFontMetricsXft::GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+nsresult
+nsFontMetricsXft::GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
PRUint32
nsFontMetricsXft::GetHints(void)
{
--- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2004-12-16 13:13:31.000000000 -0500
@@ -907,13 +907,222 @@
return NS_OK;
}
+nsresult
+nsFontMetricsPango::GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts)
+{
+ nsresult rv = NS_OK;
+ PangoLogAttr *attrs = NULL;
+ gint n_attrs = 0;
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+
+ // Convert the incoming UTF-16 to UTF-8
+ gchar *text = g_utf16_to_utf8(aText, aLength, NULL, NULL, NULL);
+
+ if (!text) {
+#ifdef DEBUG
+ NS_WARNING("nsFontMetricsPango::GetWidth invalid unicode to follow");
+ DUMP_PRUNICHAR(aText, aLength)
+#endif
+ rv = NS_ERROR_FAILURE;
+ goto loser;
+ }
+
+ // Set up the pango layout
+ pango_layout_set_text(layout, text, strlen(text));
+
+ // Convert back to UTF-16 while filling in the cluster info
+ // structure.
+ pango_layout_get_log_attrs(layout, &attrs, &n_attrs);
+
+ for (PRUint32 pos = 0; pos < aLength; pos++) {
+ if (IS_HIGH_SURROGATE(aText[pos])) {
+ aClusterStarts[pos] = 1;
+ pos++;
+ }
+ else {
+ aClusterStarts[pos] = attrs[pos].is_cursor_position;
+ }
+ }
+
+ loser:
+ if (attrs)
+ g_free(attrs);
+ if (text)
+ g_free(text);
+ if (layout)
+ g_object_unref(layout);
+
+ return rv;
+}
+
+nsresult
+nsFontMetricsPango::GetPosition(const PRUnichar *aText, PRUint32 aLength,
+ nscoord aCoord, PRUint32 &aInx)
+{
+ nsresult rv = NS_OK;
+ int trailing = 0;
+ int inx = 0;
+ gboolean found = FALSE;
+ const gchar *curChar;
+
+ float f = mDeviceContext->AppUnitsToDevUnits();
+
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+ PRUint32 localCoord = (PRUint32)(aCoord * PANGO_SCALE * f);
+
+ // Convert the incoming UTF-16 to UTF-8
+ gchar *text = g_utf16_to_utf8(aText, aLength, NULL, NULL, NULL);
+
+ if (!text) {
+#ifdef DEBUG
+ NS_WARNING("nsFontMetricsPango::GetWidth invalid unicode to follow");
+ DUMP_PRUNICHAR(aText, aLength)
+#endif
+ rv = NS_ERROR_FAILURE;
+ goto loser;
+ }
+
+ // Set up the pango layout
+ pango_layout_set_text(layout, text, strlen(text));
+
+ found = pango_layout_xy_to_index(layout, localCoord, 0,
+ &inx, &trailing);
+
+ // Convert the index back to the utf-16 index
+ curChar = text;
+ aInx = 0;
+
+ // Jump to the end if it's not found.
+ if (!found) {
+ if (inx = 0)
+ aInx = 0;
+ else if (trailing)
+ aInx = 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) {
+ aInx = curOffset;
+ break;
+ }
+
+ if (IS_HIGH_SURROGATE(aText[curOffset]))
+ curOffset++;
+ }
+
+ // If there was a trailing result, advance the index pointer the
+ // number of characters equal to the trailing result.
+ while (trailing) {
+ aInx++;
+ // Yes, this can make aInx > length to indicate the end of the
+ // string.
+ if (aInx < aLength && IS_HIGH_SURROGATE(aText[aInx]))
+ aInx++;
+ trailing--;
+ }
+
+ loser:
+ if (text)
+ g_free(text);
+ if (layout)
+ g_object_unref(layout);
+
+ return rv;
+}
+
+nsresult
+nsFontMetricsPango::GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth)
+{
+ nsresult rv = NS_OK;
+ int *ranges = NULL;
+ int n_ranges = 0;
+ PRUint32 utf8Start = 0;
+ PRUint32 utf8End = 0;
+ float f;
+
+ aWidth = 0;
+
+ // Convert the incoming UTF-16 to UTF-8
+ gchar *text = g_utf16_to_utf8(aText, aLength, NULL, NULL, NULL);
+ gchar *curChar = text;
+
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+
+ if (!text) {
+#ifdef DEBUG
+ NS_WARNING("nsFontMetricsPango::GetWidth invalid unicode to follow");
+ DUMP_PRUNICHAR(aText, aLength)
+#endif
+ rv = NS_ERROR_FAILURE;
+ goto loser;
+ }
+
+ // Convert the utf16 offsets into utf8 offsets
+ for (PRUint32 curOffset = 0; curOffset < aLength;
+ curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
+
+ if (curOffset == aStart)
+ utf8Start = curChar - text;
+
+ if (curOffset == aEnd)
+ utf8End = curChar - text;
+
+ if (IS_HIGH_SURROGATE(aText[curOffset]))
+ curOffset++;
+ }
+
+ // Special case where the end index is the same as the length
+ if (aLength == aEnd)
+ utf8End = strlen(text);
+
+ pango_layout_set_text(layout, text, strlen(text));
+
+ PangoLayoutLine *line;
+ if (pango_layout_get_line_count(layout) != 1) {
+ printf("Warning: more than one line!\n");
+ }
+ line = pango_layout_get_line(layout, 0);
+
+ pango_layout_line_get_x_ranges(line, utf8Start, utf8End, &ranges, &n_ranges);
+
+ // Convert the width into app units
+ for (int i = 0; i < n_ranges; i++) {
+ aWidth += (ranges[(i * 2) + 1] - ranges[(i * 2)]) / PANGO_SCALE;
+ }
+
+ f = mDeviceContext-> DevUnitsToAppUnits();
+ aWidth = nscoord(aWidth * f);
+
+ loser:
+ if (ranges)
+ g_free(ranges);
+ if (text)
+ g_free(text);
+ if (layout)
+ g_object_unref(layout);
+
+ return rv;
+}
+
/* static */
PRUint32
nsFontMetricsPango::GetHints(void)
{
return (NS_RENDERING_HINT_BIDI_REORDERING |
NS_RENDERING_HINT_ARABIC_SHAPING |
- NS_RENDERING_HINT_FAST_MEASURE);
+ NS_RENDERING_HINT_FAST_MEASURE |
+ NS_RENDERING_HINT_TEXT_CLUSTERS);
}
/* static */
@@ -1137,13 +1346,11 @@
}
/* printf(" rendering at X coord %d\n", aX + offset); */
-
- gdk_draw_glyphs(aDrawable, aGC, layoutRun->item->analysis.font,
- aX + (gint)(offset / PANGO_SCALE), aY, layoutRun->glyphs);
-
offset += tmpOffset;
}
+ gdk_draw_layout_line(aDrawable, aGC, aX, aY, aLine);
+
delete[] utf8spacing;
}
--- mozilla/gfx/src/gtk/nsRenderingContextGTK.h.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsRenderingContextGTK.h 2004-12-16 13:13:31.000000000 -0500
@@ -195,6 +195,15 @@
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
NS_IMETHOD SetRightToLeftText(PRBool aIsRTL);
+ NS_IMETHOD GetClusterInfo(const PRUnichar *aText, PRUint32 aLength,
+ PRUint32 *aClusterStarts);
+ NS_IMETHOD GetPosition(const PRUnichar *aText, PRUint32 aLength,
+ nscoord aCoord, PRUint32 &aInx);
+ NS_IMETHOD GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth);
NS_IMETHOD DrawImage(imgIContainer *aImage, const nsRect * aSrcRect, const nsPoint * aDestPoint);
NS_IMETHOD DrawScaledImage(imgIContainer *aImage, const nsRect * aSrcRect, const nsRect * aDestRect);
--- mozilla/gfx/src/gtk/nsFontMetricsPango.h.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsPango.h 2004-12-16 13:13:31.000000000 -0500
@@ -195,6 +195,21 @@
virtual nsresult SetRightToLeftText(PRBool aIsRTL);
+ virtual nsresult GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts);
+
+ virtual nsresult GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx);
+
+ virtual nsresult GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth);
+
// get hints for the font
static PRUint32 GetHints (void);
--- mozilla/gfx/src/gtk/nsIFontMetricsGTK.h.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsIFontMetricsGTK.h 2004-12-16 13:13:31.000000000 -0500
@@ -124,6 +124,21 @@
// Set the direction of the text rendering
virtual nsresult SetRightToLeftText(PRBool aIsRTL) = 0;
+ virtual nsresult GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts) = 0;
+
+ virtual nsresult GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx) = 0;
+
+ virtual nsresult GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth) = 0;
+
};
#endif /* __nsIFontMetricsGTK_h */
--- mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp 2004-12-16 13:13:31.000000000 -0500
@@ -1446,6 +1446,26 @@
return mFontMetrics->SetRightToLeftText(aIsRTL);
}
+NS_IMETHODIMP nsRenderingContextGTK::GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts)
+{
+ return mFontMetrics->GetClusterInfo(aText, aLength, aClusterStarts);
+}
+
+NS_IMETHODIMP nsRenderingContextGTK::GetPosition(const PRUnichar *aText, PRUint32 aLength,
+ nscoord aCoord, PRUint32 &aInx)
+{
+ return mFontMetrics->GetPosition(aText, aLength, aCoord, aInx);
+}
+
+NS_IMETHODIMP nsRenderingContextGTK::GetRangeWidth(const PRUnichar *aText, PRUint32 aLength,
+ PRUint32 aStart, PRUint32 aEnd,
+ PRUint32 &aWidth)
+{
+ return mFontMetrics->GetRangeWidth(aText, aLength, aStart, aEnd, aWidth);
+}
+
NS_IMETHODIMP nsRenderingContextGTK::DrawImage(imgIContainer *aImage, const nsRect * aSrcRect, const nsPoint * aDestPoint)
{
UpdateGC();
--- mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp 2004-12-16 13:13:31.000000000 -0500
@@ -4606,6 +4606,34 @@
return NS_OK;
}
+nsresult
+nsFontMetricsGTK::GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+nsresult
+nsFontMetricsGTK::GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+
+nsresult
+nsFontMetricsGTK::GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
PR_BEGIN_EXTERN_C
static int
CompareSizes(const void* aArg1, const void* aArg2, void *data)
--- mozilla/gfx/src/gtk/nsFontMetricsXft.h.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsXft.h 2004-12-16 13:13:31.000000000 -0500
@@ -204,6 +204,21 @@
virtual nsresult SetRightToLeftText(PRBool aIsRTL);
+ virtual nsresult GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts);
+
+ virtual nsresult GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx);
+
+ virtual nsresult GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth);
+
// get hints for the font
static PRUint32 GetHints (void);
--- mozilla/gfx/src/gtk/nsFontMetricsGTK.h.foo 2004-12-16 13:12:54.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsGTK.h 2004-12-16 13:13:31.000000000 -0500
@@ -346,6 +346,21 @@
virtual nsresult SetRightToLeftText(PRBool aIsRTL);
+ virtual nsresult GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts);
+
+ virtual nsresult GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx);
+
+ virtual nsresult GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth);
+
static nsresult FamilyExists(nsIDeviceContext *aDevice, const nsString& aName);
static PRUint32 GetHints(void);
--- mozilla/gfx/src/shared/nsRenderingContextImpl.cpp.foo 2004-10-08 12:57:19.000000000 -0400
+++ mozilla/gfx/src/shared/nsRenderingContextImpl.cpp 2004-12-16 13:13:31.000000000 -0500
@@ -938,3 +938,32 @@
{
return NS_OK;
}
+
+NS_IMETHODIMP
+nsRenderingContextImpl::GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsRenderingContextImpl::GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsRenderingContextImpl::GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+
--- mozilla/gfx/src/nsRenderingContextImpl.h.foo 2004-10-08 12:57:18.000000000 -0400
+++ mozilla/gfx/src/nsRenderingContextImpl.h 2004-12-16 13:13:31.000000000 -0500
@@ -138,6 +138,19 @@
NS_IMETHOD DrawScaledImage(imgIContainer *aImage, const nsRect * aSrcRect, const nsRect * aDestRect);
NS_IMETHOD DrawTile(imgIContainer *aImage, nscoord aXOffset, nscoord aYOffset, const nsRect * aTargetRect);
+ NS_IMETHOD GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts);
+ NS_IMETHOD GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx);
+ NS_IMETHOD GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth);
+
protected:
virtual ~nsRenderingContextImpl();
--- mozilla/gfx/public/nsIRenderingContext.h.foo 2004-10-08 12:57:18.000000000 -0400
+++ mozilla/gfx/public/nsIRenderingContext.h 2004-12-16 13:13:31.000000000 -0500
@@ -824,6 +824,66 @@
NS_IMETHOD DrawTile(imgIContainer *aImage,
nscoord aXImageStart, nscoord aYImageStart,
const nsRect * aTargetRect) = 0;
+
+ /**
+ * Get cluster details for a chunk of text.
+ *
+ * This will fill in the aClusterStarts array with information about
+ * what characters are the start of clusters for display.
+ *
+ * @param aText Text on which to get details.
+ * @param aLength Length of the text.
+ * @param aClusterStarts Array of ints that will be populated
+ * with information about which characters are the starts
+ * of clusters.
+ *
+ */
+ NS_IMETHOD GetClusterInfo(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 *aClusterStarts) = 0;
+
+ /**
+ * Find the closest cursor position for a given x coordinate.
+ *
+ * This will find the closest byte index for a given x coordinate.
+ * This takes into account grapheme clusters and bidi text.
+ *
+ * @param aText Text on which to operate.
+ * @param aLength Length of the text.
+ * @param aCoord The distance into the string to check.
+ * @param aInx Index of character where the cursor falls - note that
+ * this can be after the last character if the cursor happens to
+ * the right of the last character in the text!
+ *
+ */
+ NS_IMETHOD GetPosition(const PRUnichar *aText,
+ PRUint32 aLength,
+ nscoord aCoord,
+ PRUint32 &aInx) = 0;
+
+ /**
+ * Get the width for the specific range of a given string.
+ *
+ * This function is similar to other GetWidth functions, except that
+ * it gets the width for a part of the string instead of the entire
+ * string. This is useful when you're interested in finding out the
+ * length of a chunk in the middle of the string. Lots of languages
+ * require you to include surrounding information to accurately
+ * determine the length of a substring.
+ *
+ * @param aText Text on which to operate
+ * @param aLength Length of the text
+ * @param aStart Start index into the string
+ * @param aEnd End index into the string (inclusive)
+ * @param aWidth Returned with in app coordinates
+ *
+ */
+ NS_IMETHOD GetRangeWidth(const PRUnichar *aText,
+ PRUint32 aLength,
+ PRUint32 aStart,
+ PRUint32 aEnd,
+ PRUint32 &aWidth) = 0;
+
};
//modifiers for text rendering
@@ -866,6 +926,12 @@
*/
#define NS_RENDERING_HINT_FAST_MEASURE 0x10
+/**
+ * This bit, when set, indicates that the gfx supports describing
+ * cluster information in a string
+ */
+#define NS_RENDERING_HINT_TEXT_CLUSTERS 0x20
+
//flags for copy CopyOffScreenBits
//when performing the blit, use the region, if any,
--- mozilla/layout/html/base/src/nsTextFrame.cpp.foo 2004-10-08 09:39:27.000000000 -0400
+++ mozilla/layout/html/base/src/nsTextFrame.cpp 2004-12-16 13:14:23.000000000 -0500
@@ -2339,6 +2339,24 @@
#endif
sdptr = sdptr->mNext;
}
+
+ /*
+ * Text is drawn by drawing the entire string every time, but
+ * using clip regions to control which part of the text is shown
+ * (selected or unselected.) We do this because you can't
+ * assume that the layout of a part of text will be the same
+ * when it's drawn apart from the entire string. This is true
+ * in languages like arabic, where shaping affects entire words.
+ * Simply put: length("abcd") != length("ab") + length("cd") in
+ * some languages.
+ */
+
+ // See if this rendering backend supports getting cluster
+ // information.
+ PRUint32 clusterHint = 0;
+ aRenderingContext.GetHints(clusterHint);
+ clusterHint &= NS_RENDERING_HINT_TEXT_CLUSTERS;
+
//while we have substrings...
//PRBool drawn = PR_FALSE;
DrawSelectionIterator iter(content, details,text,(PRUint32)textLength,aTextStyle, selectionValue, aPresContext, mStyleContext);
@@ -2361,37 +2379,55 @@
nscolor currentBKColor;
PRBool isCurrentBKColorTransparent;
-#ifdef IBMBIDI
- if (currentlength > 0
- && NS_SUCCEEDED(aRenderingContext.GetWidth(currenttext, currentlength,newWidth)))//ADJUST FOR CHAR SPACING
+ if (currentlength > 0)
{
-
- if (isRightToLeftOnBidiPlatform)
- currentX -= newWidth;
-#else // not IBMBIDI
- if (NS_SUCCEEDED(aRenderingContext.GetWidth(currenttext, currentlength,newWidth)))//ADJUST FOR CHAR SPACING
- {
-#endif
- if (iter.CurrentBackGroundColor(currentBKColor, &isCurrentBKColorTransparent) && !isPaginated)
- {//DRAW RECT HERE!!!
- if (!isCurrentBKColorTransparent) {
- aRenderingContext.SetColor(currentBKColor);
- aRenderingContext.FillRect(currentX, dy, newWidth, mRect.height);
+ if (clusterHint) {
+ PRUint32 tmpWidth;
+ rv = aRenderingContext.GetRangeWidth(text, textLength, currenttext - text,
+ (currenttext - text) + currentlength,
+ tmpWidth);
+ newWidth = nscoord(tmpWidth);
+ }
+ else {
+ rv = aRenderingContext.GetWidth(currenttext, currentlength,newWidth); //ADJUST FOR CHAR SPACING
+ }
+ if (NS_SUCCEEDED(rv)) {
+ if (isRightToLeftOnBidiPlatform)
+ currentX -= newWidth;
+ if (iter.CurrentBackGroundColor(currentBKColor, &isCurrentBKColorTransparent) && !isPaginated)
+ {//DRAW RECT HERE!!!
+ if (!isCurrentBKColorTransparent) {
+ aRenderingContext.SetColor(currentBKColor);
+ aRenderingContext.FillRect(currentX, dy, newWidth, mRect.height);
+ }
+ currentFGColor = EnsureDifferentColors(currentFGColor, currentBKColor);
}
- currentFGColor = EnsureDifferentColors(currentFGColor, currentBKColor);
+ }
+ else {
+ newWidth = 0;
}
}
- else
- newWidth =0;
-
+ else {
+ newWidth = 0;
+ }
+
+ aRenderingContext.PushState();
+
+ nsRect rect(currentX, dy, newWidth, mRect.height);
+ PRBool ignore;
+ aRenderingContext.SetClipRect(rect, nsClipCombine_kIntersect,
+ ignore);
+
if (isPaginated && !iter.IsBeforeOrAfter()) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,canDarkenColor));
- aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
+ aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
} else if (!isPaginated) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(currentFGColor,canDarkenColor));
- aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
+ aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
}
+ aRenderingContext.PopState(ignore);
+
#ifdef IBMBIDI
if (!isRightToLeftOnBidiPlatform)
#endif
@@ -3429,6 +3465,16 @@
PRInt32 textWidth = 0;
PRUnichar* text = paintBuffer.mBuffer;
+ // See if the font backend will do all the hard work for us.
+ PRUint32 clusterHint = 0;
+ acx->GetHints(clusterHint);
+ clusterHint &= NS_RENDERING_HINT_TEXT_CLUSTERS;
+ if (clusterHint) {
+ PRUint32 tmpIndx = indx;
+ acx->GetPosition(text, textLength, aPoint.x - origin.x, tmpIndx);
+ indx = tmpIndx;
+ }
+ else {
#ifdef IBMBIDI
PRBool getReversedPos = PR_FALSE;
PRUint8 level = 0;
@@ -3465,6 +3511,7 @@
indx++;
}
}
+ }
aContentOffset = indx + mContentOffset;
//reusing wordBufMem
@@ -3916,6 +3963,12 @@
}
PRInt32* ip = indexBuffer.mBuffer;
+ nsAutoIndexBuffer clusterBuffer;
+ rv = clusterBuffer.GrowTo(mContentLength + 1);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
+
PRInt32 textLength;
nsresult result(NS_ERROR_FAILURE);
aPos->mResultContent = mContent;//do this right off
@@ -3981,8 +4034,32 @@
aPos->mContentOffset = 0;
PRInt32 i;
+ // Fill in the cluster hint information, if it's available.
+ nsCOMPtr<nsIRenderingContext> acx;
+ PRUint32 clusterHint = 0;
+
+ nsIPresShell *shell = aPresContext->GetPresShell();
+ if (shell) {
+ shell->CreateRenderingContext(this, getter_AddRefs(acx));
+
+ // Find the font metrics for this text
+ SetFontFromStyle(acx, mStyleContext);
+
+ if (acx)
+ acx->GetHints(clusterHint);
+ clusterHint &= NS_RENDERING_HINT_TEXT_CLUSTERS;
+ }
+
+ if (clusterHint) {
+ acx->GetClusterInfo(paintBuffer.mBuffer, (PRUint32)textLength, (PRUint32 *)clusterBuffer.mBuffer);
+ }
+ else {
+ memset(clusterBuffer.mBuffer, 1, sizeof(PRInt32) * textLength);
+ }
+
for (i = aPos->mStartOffset -1 - mContentOffset; i >=0; i--){
if ((ip[i] < ip[aPos->mStartOffset - mContentOffset]) &&
+ (clusterBuffer.mBuffer[ip[i] - mContentOffset]) &&
(! IS_LOW_SURROGATE(paintBuffer.mBuffer[ip[i]-mContentOffset])))
{
aPos->mContentOffset = i + mContentOffset;
@@ -4033,14 +4110,39 @@
PRInt32 i;
aPos->mContentOffset = mContentLength;
- for (i = aPos->mStartOffset +1 - mContentOffset; i <= mContentLength; i++){
+ // Fill in the cluster hint information, if it's available.
+ nsCOMPtr<nsIRenderingContext> acx;
+ PRUint32 clusterHint = 0;
+
+ nsIPresShell *shell = aPresContext->GetPresShell();
+ if (shell) {
+ shell->CreateRenderingContext(this, getter_AddRefs(acx));
+
+ // Find the font metrics for this text
+ SetFontFromStyle(acx, mStyleContext);
+
+ if (acx)
+ acx->GetHints(clusterHint);
+ clusterHint &= NS_RENDERING_HINT_TEXT_CLUSTERS;
+ }
+
+ if (clusterHint) {
+ acx->GetClusterInfo(paintBuffer.mBuffer, (PRUint32)textLength, (PRUint32 *)clusterBuffer.mBuffer);
+ }
+ else {
+ memset(clusterBuffer.mBuffer, 1, sizeof(PRInt32) * textLength);
+ }
+
+ for (i = aPos->mStartOffset - mContentOffset; i <= mContentLength; i++) {
if ((ip[i] > ip[aPos->mStartOffset - mContentOffset]) &&
- (! IS_LOW_SURROGATE(paintBuffer.mBuffer[ip[i]-mContentOffset])))
- {
+ ((i == mContentLength) ||
+ (!IS_LOW_SURROGATE(paintBuffer.mBuffer[ip[i] - mContentOffset])) &&
+ (clusterBuffer.mBuffer[ip[i] - mContentOffset]))) {
aPos->mContentOffset = i + mContentOffset;
break;
}
}
+
#ifdef SUNCTL
static NS_DEFINE_CID(kLECID, NS_ULE_CID);
firefox-1.0-pango-space-width.patch:
nsFontMetricsPango.cpp | 41 ++++++++++++++++++++++++++++++++++++++++-
nsFontMetricsPango.h | 3 +++
2 files changed, 43 insertions(+), 1 deletion(-)
--- NEW FILE firefox-1.0-pango-space-width.patch ---
--- mozilla/gfx/src/gtk/nsFontMetricsPango.h.foo 2004-12-10 18:18:18.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsPango.h 2004-12-10 18:19:16.000000000 -0500
@@ -256,6 +256,7 @@
nscoord mMaxDescent;
nscoord mMaxAdvance;
nscoord mSpaceWidth;
+ nscoord mPangoSpaceWidth;
nscoord mAveCharWidth;
// Private methods
@@ -282,6 +283,8 @@
PRInt32& aNumCharsFit,
nsTextDimensions& aLastWordDimensions,
nsRenderingContextGTK *aContext);
+
+ void FixupSpaceWidths (PangoLayout *aLayout, const char *aString);
};
class nsFontEnumeratorPango : public nsIFontEnumerator
--- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp.foo 2004-12-10 18:18:18.000000000 -0500
+++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2004-12-10 18:19:16.000000000 -0500
@@ -145,6 +145,7 @@
mRTLPangoContext = nsnull;
mPangoAttrList = nsnull;
mIsRTL = PR_FALSE;
+ mPangoSpaceWidth = 0;
static PRBool initialized = PR_FALSE;
if (initialized)
@@ -345,6 +346,14 @@
// mMaxAdvance
mMaxAdvance = nscoord(xftFont->max_advance_width * f);
+ // mPangoSpaceWidth
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+ pango_layout_set_text(layout, " ", 1);
+ int pswidth, psheight;
+ pango_layout_get_size(layout, &pswidth, &psheight);
+ mPangoSpaceWidth = pswidth;
+ g_object_unref(layout);
+
// mSpaceWidth (width of a space)
nscoord tmpWidth;
GetWidth(" ", 1, tmpWidth, NULL);
@@ -485,6 +494,9 @@
pango_layout_set_text(layout, aString, aLength);
+ if (mPangoSpaceWidth)
+ FixupSpaceWidths(layout, aString);
+
int width, height;
pango_layout_get_size(layout, &width, &height);
@@ -526,6 +538,7 @@
gint width, height;
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
pango_layout_get_size(layout, &width, &height);
width /= PANGO_SCALE;
@@ -573,6 +586,7 @@
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
// Get the logical extents
PangoLayoutLine *line;
@@ -715,6 +729,7 @@
PangoLayout *layout = pango_layout_new(mPangoContext);
pango_layout_set_text(layout, aString, aLength);
+ FixupSpaceWidths(layout, aString);
int x = aX;
int y = aY;
@@ -778,6 +793,7 @@
}
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
aContext->GetTranMatrix()->TransformCoord(&x, &y);
@@ -847,6 +863,7 @@
}
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
// Get the logical extents
PangoLayoutLine *line;
@@ -931,6 +948,7 @@
// Set up the pango layout
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
// Convert back to UTF-16 while filling in the cluster info
// structure.
@@ -986,6 +1004,7 @@
// Set up the pango layout
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
found = pango_layout_xy_to_index(layout, localCoord, 0,
&inx, &trailing);
@@ -1087,6 +1106,7 @@
utf8End = strlen(text);
pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
PangoLayoutLine *line;
if (pango_layout_get_line_count(layout) != 1) {
@@ -1502,6 +1522,26 @@
return NS_OK;
}
+void
+nsFontMetricsPango::FixupSpaceWidths (PangoLayout *aLayout,
+ const char *aString)
+{
+ PangoLayoutLine *line = pango_layout_get_line(aLayout, 0);
+
+ gint curRun = 0;
+
+ for (GSList *tmpList = line->runs; tmpList && tmpList->data;
+ tmpList = tmpList->next, curRun++) {
+ PangoLayoutRun *layoutRun = (PangoLayoutRun *)tmpList->data;
+
+ for (gint i=0; i < layoutRun->glyphs->num_glyphs; i++) {
+ gint thisOffset = (gint)layoutRun->glyphs->log_clusters[i] + layoutRun->item->offset;
+ if (aString[thisOffset] == ' ')
+ layoutRun->glyphs->glyphs[i].geometry.width = mPangoSpaceWidth;
+ }
+ }
+}
+
/* static */
PRBool
IsASCIIFontName(const nsString& aName)
@@ -1790,7 +1830,6 @@
return nsCRT::strcmp(str1, str2);
}
-
// nsFontEnumeratorPango class
nsFontEnumeratorPango::nsFontEnumeratorPango()
firefox-1.0-prdtoa.patch:
Makefile.in | 8 ++++++++
1 files changed, 8 insertions(+)
--- NEW FILE firefox-1.0-prdtoa.patch ---
Index: nsprpub/pr/src/misc/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/Makefile.in,v
retrieving revision 1.15.2.2
diff -u -r1.15.2.2 Makefile.in
--- nsprpub/pr/src/misc/Makefile.in 6 Jun 2003 03:09:17 -0000 1.15.2.2
+++ nsprpub/pr/src/misc/Makefile.in 19 Nov 2004 00:58:35 -0000
@@ -82,6 +82,14 @@
include $(topsrcdir)/config/rules.mk
+NONOPT_CFLAGS=$(filter-out -O%, $(CFLAGS))
+
+ifeq ($(OS_ARCH),Linux)
+$(OBJDIR)/prdtoa.$(OBJ_SUFFIX): prdtoa.c
+ @$(MAKE_OBJDIR)
+ $(CC) -o $@ -c $(NONOPT_CFLAGS) -ffloat-store $<
+endif
+
# Prevent floating point errors caused by MSVC 6.0 Processor Pack
# optimizations (bug 207421). This disables optimizations that
# could change the precision of floating-point calculations for
firefox-1.0-recv-fortify.patch:
prmwait.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE firefox-1.0-recv-fortify.patch ---
Index: nsprpub/pr/src/io/prmwait.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/io/prmwait.c,v
retrieving revision 3.14.2.1
diff -d -u -p -r3.14.2.1 prmwait.c
--- nsprpub/pr/src/io/prmwait.c 14 Mar 2002 23:20:41 -0000 3.14.2.1
+++ nsprpub/pr/src/io/prmwait.c 8 Mar 2005 20:53:36 -0000
@@ -649,7 +649,7 @@ static void _MW_InitialRecv(PRCList *io_
desc->bytesRecv = 0;
else
{
- desc->bytesRecv = desc->fd->methods->recv(
+ desc->bytesRecv = (desc->fd->methods->recv)(
desc->fd, desc->buffer.start,
desc->buffer.length, 0, desc->timeout);
if (desc->bytesRecv < 0) /* SetError should already be there */
firefox-1.0-xptcall-s390.patch:
Makefile.in | 2 ++
xptcinvoke_linux_s390.cpp | 8 +-------
xptcinvoke_linux_s390x.cpp | 9 ++-------
xptcstubs_linux_s390.cpp | 2 +-
xptcstubs_linux_s390x.cpp | 2 +-
5 files changed, 7 insertions(+), 16 deletions(-)
--- NEW FILE firefox-1.0-xptcall-s390.patch ---
diff -ur mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in mozilla-xx/xpcom/reflect/xptcall/src/md/unix/Makefile.in
--- mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2004-04-22 22:50:05.000000000 +0200
+++ mozilla-xx/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2004-12-03 11:19:41.560694658 +0100
@@ -341,10 +341,12 @@
#
ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390)
CPPSRCS := xptcinvoke_linux_s390.cpp xptcstubs_linux_s390.cpp
+CXXFLAGS += -fno-strict-aliasing -fno-inline -fomit-frame-pointer -mbackchain
endif
ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390x)
CPPSRCS := xptcinvoke_linux_s390x.cpp xptcstubs_linux_s390x.cpp
+CXXFLAGS += -fno-strict-aliasing -fno-inline -fomit-frame-pointer -mbackchain
endif
diff -ur mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp
--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp 2004-12-03 12:18:27.110694658 +0100
+++ mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp 2004-12-03 12:27:05.100694658 +0100
@@ -184,8 +184,6 @@
}
}
-volatile register void* r14 asm("r14");
-
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params)
@@ -199,8 +197,6 @@
PRUint32 overflow = invoke_count_words (paramCount, params);
PRUint32 result;
- volatile void* sav_r14 = r14;
-
__asm__ __volatile__
(
"lr 7,15\n\t"
@@ -235,10 +231,8 @@
"a" (invoke_copy_to_stack),
"a" (that),
"a" (method)
- : "2", "3", "4", "5", "6", "7", "memory"
+ : "2", "3", "4", "5", "6", "7", "14", "cc", "memory", "%f0", "%f2"
);
-
- r14 = sav_r14;
return result;
}
diff -ur mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp
--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp 2004-12-03 12:18:27.110694658 +0100
+++ mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp 2004-12-03 12:26:44.500694658 +0100
@@ -178,8 +178,6 @@
}
}
-volatile register void* r14 asm("r14");
-
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params)
@@ -193,8 +191,6 @@
PRUint64 overflow = invoke_count_words (paramCount, params);
PRUint64 result;
- volatile void* sav_r14 = r14;
-
__asm__ __volatile__
(
"lgr 7,15\n\t"
@@ -231,10 +227,9 @@
"a" (invoke_copy_to_stack),
"a" (that),
"a" (method)
- : "2", "3", "4", "5", "6", "7", "memory"
+ : "2", "3", "4", "5", "6", "7", "14", "cc", "memory",
+ "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7"
);
-
- r14 = sav_r14;
return result;
}
diff -ur mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp
--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp 2004-12-03 12:18:27.110694658 +0100
+++ mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp 2004-12-03 11:16:55.400694658 +0100
@@ -177,7 +177,7 @@
\
__asm__ __volatile__ \
( \
- "lr %0,15\n\t" \
+ "l %0,0(15)\n\t" \
"ahi %0,96\n\t" \
"stm 3,6,0(%3)\n\t" \
"std 0,%1\n\t" \
diff -ur mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp
--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp 2004-12-03 12:18:27.110694658 +0100
+++ mozilla-xx/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp 2004-12-03 11:17:16.360694658 +0100
@@ -177,7 +177,7 @@
\
__asm__ __volatile__ \
( \
- "lgr %0,15\n\t" \
+ "lg %0,0(15)\n\t" \
"aghi %0,160\n\t" \
"stmg 3,6,0(%5)\n\t"\
"std 0,%1\n\t" \
More information about the fedora-cvs-commits
mailing list