Bug 119167

Summary: [test case] page rendered incorrectly at larger font sizes
Product: [Applications] konqueror Reporter: Rohan Dhruva <rohandhruva>
Component: khtml rendererAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: hkBst, kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: minimal page to reproduce the problem

Description Rohan Dhruva 2005-12-29 09:51:44 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Unlisted Binary Package
OS:                Linux

Hello,

I noticed that text on KDE myths section of kde.org was akward, and grammatically incorrect to read. After a sinlge word, there was a line break. On a whim, i opened the same site in firefox, where the missing text was shown correctly. 

The site is : http://kdemyths.urbanlizard.com/myth/59 ..
The bug is worked about by decreasing font size to a *very* small value, when all text is shown. Else, text is seen like this :

"While
the LGPL makes no such restrictions. "

This happens to my friend too. It is on Arch Linux 0.7.1 sync-ed to -current tree. Kde 3.5.0

Please tell me if i can help more, i will be glad to.

Regards,
Rohan.
Comment 1 Rohan Dhruva 2005-12-29 09:53:20 UTC
I am sorry i should have reported the component as khtml, not suyre how i can change it now. 
Comment 2 Thiago Macieira 2005-12-29 15:38:13 UTC
I can see the problem if I increase my font sizes. At 9pt, they show fine.
Comment 3 Rohan Dhruva 2005-12-30 04:04:33 UTC
Well, I noticed that the page renders correctly in kubuntu, using 3.5 packages available on kubuntu.org. Maybe they already have a patch/fix for this problem ?
Comment 4 Tommi Tervo 2006-03-01 19:38:06 UTC
Works fine with current konqi.
Comment 5 Rohan Dhruva 2006-03-01 20:02:35 UTC
No, i still need to zoom minus one on arch .. which has xorg7 and kde 3.5.1 now. So does another friend using the same distro. Going from size 13 to minus one zoom level fixes it.
Comment 6 Rohan Dhruva 2006-03-30 06:40:18 UTC
This problem still exists in kde 3.5.1. I have not tried kde 3.5.2, since it is still in arch -testing not -extra. I will try it soon, and report back.
Comment 7 Rohan Dhruva 2006-03-31 21:52:11 UTC
This bug remails unresolved in kde 3.5.2. Also, now, reducing font to very small size doesnt help either.
Comment 8 Rohan Dhruva 2006-04-03 08:31:58 UTC
Ok, I can confirm that this does not work on debian, arch, and frugalware. On ubuntu, it worked since kde 3.4.2. Can someone please integrate the patch ? I will do little hunting and speaking, and post a link to the patch here.
Comment 9 Tommi Tervo 2006-04-03 15:45:31 UTC
*** Bug 124831 has been marked as a duplicate of this bug. ***
Comment 10 Charles Samuels 2006-04-07 10:35:41 UTC
I've already corrected something like this before...
Comment 11 Marijn Schouten 2006-04-07 12:48:45 UTC
reducing font size in kde 3.5.2 still helps. Actually I had to increase font size to get the erroneous behaviour, but I guess it all depends on what your usual fontsize is.
Comment 12 Rohan Dhruva 2006-04-07 21:15:33 UTC
Ah, yes, the kde 3.5.2 was a mistake on my part. Charles, can you please correct it yet once more ? :) Ironic the fact that a kde site cant display proper in konqi ;) But I am sure there are more such sites ?
Comment 13 Rohan Dhruva 2006-06-20 21:42:26 UTC
Bug confirmed, the rendering is still incorrect on konqueror in kde 3.5.3 :(

Some love, please ? 
Comment 14 Christoph Burger-Scheidlin 2006-09-06 20:59:43 UTC
I get the same behavior in 3.5.4 built from gentoo packages.
I first noticed the bug on http://kdemyths.urbanlizard.com/myth/42 and it seems to present differently for different font size. In fact, I do not think that the text disappears, it is just put to the wrong position, well right of the box.
Comment 15 Christoph Burger-Scheidlin 2006-09-06 22:10:11 UTC
Created attachment 17651 [details]
minimal page to reproduce the problem

I ripped out everything from the webpage that did is not needed to reproduce on
my machine. What is left should be the minimum to reproduce the bug. Note that
by tuning the p:first-letter { margin-left: 1em; } parameter to a higher value,
the effect occurs on more than one paragraph, so if this does not reproduce the
bug try adjusting the font size or modifying this parameter.
Comment 16 Charles Samuels 2006-09-30 09:29:58 UTC
SVN commit 590440 by charles:

fix Bug 119167: page rendered incorrectly at larger font sizes

see the comment within for info

BUG:119167

now I'm gonna need to find some gauze and stop the blood from gushing out of my eyes and ears.



 M  +10 -3     render_block.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_block.cpp #590439:590440
@@ -223,15 +223,22 @@
         // punctuation and white-space
         if(oldText->l >= 1) {
             oldText->ref();
-            unsigned int length = 0;
+            // begin: we need skip leading whitespace so that RenderBlock::findNextLineBreak
+            // won't think we're continuing from a previous run 
+            unsigned int begin = 0; // the position that first-letter begins
+            unsigned int length = 0; // the position that "the rest" begins
+            while ( length < oldText->l && (oldText->s+length)->isSpace() )
+                length++;
+            begin = length;
             while ( length < oldText->l &&
-                    ( (oldText->s+length)->isSpace() || (oldText->s+length)->isPunct()) )
+                    ( (oldText->s+length)->isPunct()) || (oldText->s+length)->isSpace() )
                 length++;
             if ( length < oldText->l &&
                     !( (oldText->s+length)->isSpace() || (oldText->s+length)->isPunct() ))
                 length++;
             while ( length < oldText->l && (oldText->s+length)->isMark() )
                 length++;
+
             // we need to generated a remainingText object even if no text is left
             // because it holds the place and style for the old textObj
             RenderTextFragment* remainingText =
@@ -246,7 +253,7 @@
             firstLetterContainer->addChild(remainingText, nextObj);
 
             RenderTextFragment* letter =
-                new (renderArena()) RenderTextFragment(remainingText->node(), oldText, 0, length);
+                new (renderArena()) RenderTextFragment(remainingText->node(), oldText, begin, length-begin);
             letter->setIsAnonymous( remainingText->isAnonymous() );
             RenderStyle* newStyle = new RenderStyle();
             newStyle->inheritFrom(pseudoStyle);
Comment 17 Rohan Dhruva 2006-09-30 11:32:39 UTC
Thanks for fixing this long standing bug :)