Bug 50683

Summary: Text underline not long enough (testcase)
Product: [Applications] konqueror Reporter: Jim Dabell <jim>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: CLOSED FIXED    
Severity: normal CC: bugzilla
Priority: NOR    
Version: 3.1.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Testcase

Description Jim Dabell 2002-11-14 00:57:33 UTC
Version:            (using KDE KDE 3.0.99)
Installed from:    Compiled From Sources
Compiler:          gcc 3.2 
OS:          Linux

A fairly simple list of links is set to only have underlined text on hover, however the underline stops too short, as if the underline is calculated for a line of text in a far smaller font size.
Comment 1 Jim Dabell 2002-11-14 00:58:42 UTC
Created attachment 432 [details]
Testcase

Notice how the underline is slightly longer on the third link; as if the length
of text is still a factor (looks like the underline is cut in half).
Comment 2 Moritz Moeller-Herrmann 2002-12-22 15:04:49 UTC
Yes, bug shows in KDE_3_1_BRANCH from December 20. 
Comment 3 mklencke 2003-05-17 10:47:45 UTC
This problem also occurs when justified text is used. KHTML (or QT probably) seems to 
calculate the normal text width, but then stretches the text to fit exactly in the 
horizontal space, which results in whitespace between the words. However, this is not 
taken into consideration when the link underline width is calculated. 
 
Also: when you try to select text in a justified space that is stretched, you have to 
position the cursor somewhat (depends on amount of whitespace inserted) left of the 
text you want to select when starting the selection. 
 
I'm using KDE 3.1.1 by the way. This bug has been in KDE for some time now, but now 
I realise what the problem is. Probably a matter of taking the whitespace into 
consideration when calculating the X-size. I don't know exactly where this code is 
located though? 
 
See also bug 46224 and 55495. 
 
Comment 4 Marc Mutz 2003-07-20 10:27:08 UTC
Another test case is 
 
<ins> 
<p style="text-align: justify">Some long text long text long text long text long text long text long 
text long text</p> 
</ins> 

*** This bug has been marked as a duplicate of 46224 ***
Comment 5 Leo Savernik 2003-08-22 01:53:08 UTC
46224 has been fixed, but this still doesn't work. Reopening. 
Comment 6 Leo Savernik 2003-10-08 23:49:49 UTC
*** Bug 62447 has been marked as a duplicate of this bug. ***
Comment 7 Leo Savernik 2003-10-09 16:22:38 UTC
Subject: kdelibs/khtml/rendering

CVS commit by savernik: 

fixed bug 50683: Text underline not long enough (testcase)

CCMAIL: 50683-done@bugs.kde.org


  M +3 -9      render_text.cpp   1.224
  M +2 -2      render_text.h   1.97


--- kdelibs/khtml/rendering/render_text.cpp  #1.223:1.224
@@ -219,5 +219,5 @@ void InlineTextBox::paintDecoration( QPa
 }
 #else
-void InlineTextBox::paintDecoration( QPainter *pt, const Font *f, int _tx, int _ty, int deco, bool begin, bool end)
+void InlineTextBox::paintDecoration( QPainter *pt, const Font *f, int _tx, int _ty, int deco)
 {
     _tx += m_x;
@@ -227,10 +227,4 @@ void InlineTextBox::paintDecoration( QPa
 
     RenderObject *p = object();
-    if( begin )
-        width -= p->paddingLeft() + p->borderLeft();
-
-    if ( end )
-        width -= p->paddingRight() + p->borderRight();
-
     QColor underline, overline, linethrough;
     p->getTextDecorationColors(deco, underline, overline, linethrough, p->style()->htmlHacks());
@@ -996,5 +990,5 @@ void RenderText::paintObject( QPainter *
             if(d != TDNONE)
             {
-                s->paintDecoration(p, font, tx, ty, d, si == 0, si == ( int ) m_lines.count()-1);
+                s->paintDecoration(p, font, tx, ty, d);
             }
 

--- kdelibs/khtml/rendering/render_text.h  #1.96:1.97
@@ -70,5 +70,5 @@ public:
     virtual bool isInlineTextBox() const { return true; }
 
-    void paintDecoration( QPainter *pt, const Font *f, int _tx, int _ty, int decoration, bool begin, bool end);
+    void paintDecoration( QPainter *pt, const Font *f, int _tx, int _ty, int decoration);
     void paintBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, bool begin, bool end);
     void paintSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos, int deco);