Bug 128024 - Alignment issues with generated content (:before and :after CSS pseudo-elements) in XHTML Strict mode
Summary: Alignment issues with generated content (:before and :after CSS pseudo-elemen...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-25 17:12 UTC by Laurent Pinchart
Modified: 2006-06-18 15:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case (1.80 KB, application/x-tbz)
2006-05-25 17:13 UTC, Laurent Pinchart
Details
patch... Qt does not support setting a QFont to size zero (be it pixels or points, though it's only explicitly said in documentation for the latter) (1.19 KB, patch)
2006-05-27 17:58 UTC, Germain Garand
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Pinchart 2006-05-25 17:12:39 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages
Compiler:          gcc 3.3.5 
OS:                Linux

:before and :after CSS pseudo-elements' content is incorrectly aligned in XHTML 1.0 Strict mode. XHTML 1.0 Transitional mode works fine.

See the attached test case: good.html is XHTML 1.0 Transitional, bad.html is XHTML 1.0 Strict. Notice the alignment issue in upper-left and lower-left corners.
Comment 1 Laurent Pinchart 2006-05-25 17:13:12 UTC
Created attachment 16267 [details]
Test case
Comment 2 Allan Sandfeld 2006-05-25 20:22:18 UTC
Confirmed. 

Notice however that there a several invalid statements in your CSS, which are ignored in both modes.
Comment 3 Germain Garand 2006-05-27 17:39:13 UTC
mmh, using font-size > 0 makes testcase work.
Investigating that...

Comment 4 Germain Garand 2006-05-27 17:58:55 UTC
Created attachment 16299 [details]
patch... Qt does not support setting a QFont to size zero (be it pixels or points, though it's only explicitly said in documentation for the latter)
Comment 5 Germain Garand 2006-06-18 15:27:01 UTC
SVN commit 552597 by ggarand:

QFont does not support setting a zero pixel size.

BUG:128024


 M  +3 -2      css/cssstyleselector.cpp  
 M  +3 -2      rendering/font.cpp  


--- branches/KDE/3.5/kdelibs/khtml/css/cssstyleselector.cpp #552596:552597
@@ -3167,10 +3167,11 @@
                 return;
         }
 
-        if(size < 1) return;
+        if (size < 0) return;
 
         // we never want to get smaller than the minimum font size to keep fonts readable
-        if(size < minFontSize ) size = minFontSize;
+        // do not however maximize zero as that is commonly used for fancy layouting purposes
+        if (size && size < minFontSize) size = minFontSize;
 
         //kdDebug( 6080 ) << "computed raw font size: " << size << endl;
 
--- branches/KDE/3.5/kdelibs/khtml/rendering/font.cpp #552596:552597
@@ -459,7 +459,8 @@
     }
 
     // make sure we don't bust up X11
-    size = KMAX(0, KMIN(255, size));
+    // Also, Qt does not support sizing a QFont to zero.
+    size = kMax(1, kMin(255, size));
 
 //       qDebug("setting font to %s, italic=%d, weight=%d, size=%d", fontDef.family.latin1(), fontDef.italic,
 //    	   fontDef.weight, size );
@@ -475,7 +476,7 @@
 
     if ( fontDef.smallCaps ) {
 	scFont = new QFont( f );
-	scFont->setPixelSize( f.pixelSize()*7/10 );
+	scFont->setPixelSize( kMax(1, f.pixelSize()*7/10) );
     }
 }