Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp (revision 555414)
+++ khtml_part.cpp (working copy)
@@ -5957,7 +5957,7 @@
for (khtml::RenderObject *n = renderNode; n; n = n->nextSibling()) {
if (n->isText()) {
khtml::RenderText* const textRenderer = static_cast(n);
- const khtml::InlineTextBoxArray &runs = textRenderer->inlineTextBoxes();
+ const khtml::RenderText::InlineTextBoxArray &runs = textRenderer->inlineTextBoxes();
const unsigned lim = runs.count();
for (unsigned i = 0; i != lim; ++i) {
if (runs[i]->m_y == y && textRenderer->element()) {
@@ -5999,7 +5999,7 @@
if (n->isText()) {
khtml::RenderText* const textRenderer = static_cast(n);
- const khtml::InlineTextBoxArray &runs = textRenderer->inlineTextBoxes();
+ const khtml::RenderText::InlineTextBoxArray &runs = textRenderer->inlineTextBoxes();
for (int i = (int)runs.count()-1; i >= 0; --i) {
if (runs[i]->m_y == y && textRenderer->element()) {
endNode = textRenderer->element();
Index: rendering/render_text.h
===================================================================
--- rendering/render_text.h (revision 555414)
+++ rendering/render_text.h (working copy)
@@ -30,7 +30,7 @@
#include "rendering/render_object.h"
#include "rendering/render_line.h"
-#include
+#include
#include
class QPainter;
@@ -133,17 +133,6 @@
friend class RenderText;
};
-class InlineTextBoxArray : public Q3PtrVector
-{
-public:
- InlineTextBoxArray();
-
- InlineTextBox* first();
-
- int findFirstMatching( Item ) const;
- virtual int compareItems( Item, Item );
-};
-
class RenderText : public RenderObject
{
friend class InlineTextBox;
@@ -255,10 +244,15 @@
/** returns the number of inline text boxes
*/
unsigned inlineTextBoxCount() const { return m_lines.count(); }
+
+ typedef QVector InlineTextBoxArray;
+
/** returns the array of inline text boxes for this render text.
*/
const InlineTextBoxArray &inlineTextBoxes() const { return m_lines; }
+ static int findFirstMatching(InlineTextBoxArray* array, InlineTextBox* d);
+
#ifdef ENABLE_DUMP
virtual void dump(QTextStream &stream, const QString &ind) const;
#endif
@@ -273,7 +267,7 @@
*/
InlineTextBox * findInlineTextBox( int offset, int &pos,
bool checkFirstLetter = false );
-
+
protected: // members
InlineTextBoxArray m_lines;
DOM::DOMStringImpl *str; //
Index: rendering/render_text.cpp
===================================================================
--- rendering/render_text.cpp (revision 555414)
+++ rendering/render_text.cpp (working copy)
@@ -485,23 +485,10 @@
// -----------------------------------------------------------------------------
-InlineTextBoxArray::InlineTextBoxArray()
-{
- setAutoDelete(false);
-}
-
-int InlineTextBoxArray::compareItems( Item d1, Item d2 )
-{
- assert(d1);
- assert(d2);
-
- return static_cast(d1)->m_y - static_cast(d2)->m_y;
-}
-
// remove this once QVector::bsearch is fixed
-int InlineTextBoxArray::findFirstMatching(Item d) const
+int RenderText::findFirstMatching(InlineTextBoxArray* array, InlineTextBox* d)
{
- int len = count();
+ int len = array->count();
if ( !len )
return -1;
@@ -514,10 +501,10 @@
while ( n1 <= n2 ) {
int res;
mid = (n1 + n2)/2;
- if ( (*this)[mid] == 0 ) // null item greater
+ if ( (*array)[mid] == 0 ) // null item greater
res = -1;
else
- res = ((Q3GVector*)this)->compareItems( d, (*this)[mid] );
+ res = d != (*array)[mid] ;
if ( res < 0 )
n2 = mid - 1;
else if ( res > 0 )
@@ -530,12 +517,11 @@
/* if ( !found )
return -1; */
// search to first one equal or bigger
- while ( found && (mid > 0) && !((Q3GVector*)this)->compareItems(d, (*this)[mid-1]) )
+ while ( found && (mid > 0) && !( d != (*array)[mid-1]) )
mid--;
return mid;
}
-// -------------------------------------------------------------------------------------
RenderText::RenderText(DOM::NodeImpl* node, DOMStringImpl *_str)
: RenderObject(node)
@@ -890,7 +876,7 @@
int ow = style()->outlineWidth();
RenderStyle* pseudoStyle = hasFirstLine() ? style()->getPseudoStyle(RenderStyle::FIRST_LINE) : 0;
InlineTextBox f(0, pI.r.top()-ty);
- int si = m_lines.findFirstMatching(&f);
+ int si = RenderText::findFirstMatching(&m_lines, &f);
// something matching found, find the first one to paint
bool isStatic = canvas()->staticMode();
if (isStatic && pI.phase == PaintActionSelection) return;