[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:23:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d0babea3e0f7fd3cafc4027f1e4c50752a67caa0
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 26 22:20:58 2004 +0000

            Reviewed by Hyatt
    
            * khtml/rendering/render_line.h:
            (khtml::InlineBox::isFirstLineStyle): Helper to return whether
    	the line box has the first line style bit set.
            * khtml/rendering/render_text.cpp:
            (RenderText::caretPos): Noe correctly accounts for white space
    	which can precede an inline text box.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5976 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 63da022..ef91dfe 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,14 @@
+2004-01-26  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Hyatt
+
+        * khtml/rendering/render_line.h:
+        (khtml::InlineBox::isFirstLineStyle): Helper to return whether
+	the line box has the first line style bit set.
+        * khtml/rendering/render_text.cpp:
+        (RenderText::caretPos): Noe correctly accounts for white space
+	which can precede an inline text box.
+
 2004-01-26  David Hyatt  <hyatt at apple.com>
 
 	Remove incremental repainting ifdef.
diff --git a/WebCore/khtml/rendering/render_line.h b/WebCore/khtml/rendering/render_line.h
index 69b47b2..f1ee665 100644
--- a/WebCore/khtml/rendering/render_line.h
+++ b/WebCore/khtml/rendering/render_line.h
@@ -71,6 +71,7 @@ public:
     }
 
     void setFirstLineStyleBit(bool f) { m_firstLine = f; }
+    bool isFirstLineStyle() const { return m_firstLine; }
 
     InlineBox* nextOnLine() const { return m_next; }
     InlineBox* prevOnLine() const { return m_prev; }
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index bab1bdf..2246ff9 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -440,28 +440,41 @@ FindSelectionResult RenderText::checkSelectionPointIgnoringContinuations(int _x,
 
 void RenderText::caretPos(int offset, bool override, int &_x, int &_y, int &width, int &height)
 {
-  if (!firstTextBox()) {
-    _x = _y = height = -1;
-    return;
-  }
-
-  int pos;
-  InlineTextBox * s = findNextInlineTextBox( offset, pos );
-  _y = s->m_y;
-  height = s->m_height;
-
-  const QFontMetrics &fm = metrics( s->m_firstLine );
-  QString tekst(str->s + s->m_start, s->m_len);
-  _x = s->m_x + (fm.boundingRect(tekst, pos)).right();
+    if (!firstTextBox()) {
+        _x = _y = height = -1;
+        return;
+    }
+
+    // Find the text box for the given offset
+    InlineTextBox *box = 0;
+    for (box = firstTextBox(); box; box = box->nextTextBox()) {
+        if (offset <= box->m_start + box->m_len)
+            break;
+    }
+    
+    if (!box) {
+        _x = _y = height = -1;
+        return;
+    }
+
+    _y = box->m_y;
+    height = box->m_height;
+
+    const QFontMetrics &fm = metrics(box->isFirstLineStyle());
+    QString string(str->s + box->m_start, box->m_len);
+    long pos = offset - box->m_start; // the number of characters we are into the string
+    _x = box->m_x + (fm.boundingRect(string, pos)).right();
+
 #if 0
-  // EDIT FIXME
-  if(pos)
-      _x += fm.rightBearing( *(str->s + s->m_start + pos - 1 ) );
+    // EDIT FIXME
+    if (pos)
+        _x += fm.rightBearing(*(str->s + box->m_start + offset));
 #endif
-  int absx, absy;
-  absolutePosition(absx,absy);
-  _x += absx;
-  _y += absy;
+
+    int absx, absy;
+    absolutePosition(absx,absy);
+    _x += absx;
+    _y += absy;
 }
 
 void RenderText::posOfChar(int chr, int &x, int &y)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list