updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / xulrunner-thai / firefox-1.5-pango-cursor-position.patch
blobd287fd349e4bf0d746e024f546c27851ebae025a
1 Index: mozilla/gfx/src/gtk/nsFontMetricsPango.cpp
2 ===================================================================
3 RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsPango.cpp,v
4 retrieving revision 1.24
5 diff -d -u -p -6 -r1.24 nsFontMetricsPango.cpp
6 --- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 25 Aug 2006 01:02:34 -0000 1.24
7 +++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 6 Sep 2006 07:01:49 -0000
8 @@ -948,13 +948,12 @@ nsFontMetricsPango::GetClusterInfo(const
9 PRInt32
10 nsFontMetricsPango::GetPosition(const PRUnichar *aText, PRUint32 aLength,
11 nsPoint aPt)
13 int trailing = 0;
14 int inx = 0;
15 - gboolean found = FALSE;
16 const gchar *curChar;
17 PRInt32 retval = 0;
19 float f = mDeviceContext->AppUnitsToDevUnits();
21 PangoLayout *layout = pango_layout_new(mPangoContext);
22 @@ -974,28 +973,18 @@ nsFontMetricsPango::GetPosition(const PR
25 // Set up the pango layout
26 pango_layout_set_text(layout, text, strlen(text));
27 FixupSpaceWidths(layout, text);
29 - found = pango_layout_xy_to_index(layout, localX, localY,
30 - &inx, &trailing);
31 + pango_layout_xy_to_index(layout, localX, localY,
32 + &inx, &trailing);
34 // Convert the index back to the utf-16 index
35 curChar = text;
37 - // Jump to the end if it's not found.
38 - if (!found) {
39 - if (inx == 0)
40 - retval = 0;
41 - else if (trailing)
42 - retval = aLength;
44 - goto loser;
45 - }
47 for (PRUint32 curOffset=0; curOffset < aLength;
48 curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
50 // Check for a match before checking for a surrogate pair
51 if (curChar - text == inx) {
52 retval = curOffset;