summaryrefslogtreecommitdiffstats
path: root/tdehtml/rendering/render_text.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-02 18:38:22 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-02 18:40:04 -0500
commitcc5fd88be313142d3996c81f8bdfc1290485858c (patch)
tree36c6e1eef900d0ef1aa05e96d786194b4c5674d9 /tdehtml/rendering/render_text.cpp
parent2c850d93a7803e435504fe9c982cb974695d7a3b (diff)
downloadtdelibs-cc5fd88be313142d3996c81f8bdfc1290485858c.tar.gz
tdelibs-cc5fd88be313142d3996c81f8bdfc1290485858c.zip
Don't use insane (negative) layout values if layout engine does not allocate sufficient space for a text string
This resolves Bug 1950 Make most debugging statements work again Add new debugging statements Fix several annoying build warnings
Diffstat (limited to 'tdehtml/rendering/render_text.cpp')
-rw-r--r--tdehtml/rendering/render_text.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/tdehtml/rendering/render_text.cpp b/tdehtml/rendering/render_text.cpp
index 411f3f221..cd9fc554f 100644
--- a/tdehtml/rendering/render_text.cpp
+++ b/tdehtml/rendering/render_text.cpp
@@ -23,8 +23,8 @@
*
*/
-//#define DEBUG_LAYOUT
-//#define BIDI_DEBUG
+// #define DEBUG_LAYOUT
+// #define BIDI_DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -295,7 +295,7 @@ void InlineTextBox::paintDecoration( TQPainter *pt, const Font *f, int _tx, int
pt->setPen(linethrough);
f->drawDecoration(pt, _tx, _ty, baseline(), width, height(), Font::LINE_THROUGH);
}
- // NO! Do NOT add BLINK! It is the most annouing feature of Netscape, and IE has a reason not to
+ // NO! Do NOT add BLINK! It is the most annoying feature of Netscape, and IE has a reason not to
// support it. Lars
}
@@ -1305,7 +1305,9 @@ unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *
int w = f->width(str->s, str->l, from, len );
- //kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
+#ifdef DEBUG_LAYOUT
+ kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
+#endif
return w;
}
@@ -1315,16 +1317,19 @@ short RenderText::width() const
int minx = 100000000;
int maxx = 0;
// slooow
- for(unsigned int si = 0; si < m_lines.count(); si++) {
+ for (unsigned int si = 0; si < m_lines.count(); si++) {
InlineTextBox* s = m_lines[si];
- if(s->m_x < minx)
+ if (s->m_x < minx)
minx = s->m_x;
- if(s->m_x + s->m_width > maxx)
+ if (s->m_x + s->m_width > maxx)
maxx = s->m_x + s->m_width;
}
w = kMax(0, maxx-minx);
+#ifdef DEBUG_LAYOUT
+ kdDebug( 6040 ) << "RenderText::width() = " << w << endl;
+#endif
return w;
}
@@ -1486,7 +1491,7 @@ static TQString quoteAndEscapeNonPrintables(const TQString &s)
static void writeTextRun(TQTextStream &ts, const RenderText &o, const InlineTextBox &run)
{
- ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.m_width << ": "
+ ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.width() << ": "
<< quoteAndEscapeNonPrintables(o.data().string().mid(run.m_start, run.m_len));
}