Bug 73920 - [testcase] CSS border-style unproperly rendered
Summary: [testcase] CSS border-style unproperly rendered
Status: RESOLVED DUPLICATE of bug 62296
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 3.2
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-31 22:28 UTC by Pedro Fayolle
Modified: 2004-02-17 02:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Fayolle 2004-01-31 22:28:26 UTC
Version:           3.2 (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources

The CSS property border-style values 'groove', 'ridge', 'inset' and 'outset' all fail to render, creating just simple solid lines.

The values 'dotted' and 'dashed' do work but are not rendered properly. The first one produces a dashed line as opposed to a dotted one (single pixel for 'border-width: 1px'). On the other hand, 'dashed' produces indeed a dashed line, but with long dashes (about 17 pixels long) instead of short ones as required by the CSS standard (from http://www.w3.org/TR/CSS21/box.html#border-style-properties - 'dashed: The border is a series of short line segments'). All other major browsers (Mozilla, Opera, IE) render 'dotted' as a series of dots and 'dashed' as a series of short dashes (similar to KHTML's current 'dotted' line). These last two make pages using them look very ugly, especially those using 'dashed' borders.

Here's a testcase:

<html>
<head>
  <style type="text/css">div{margin: 5px; border: 1px black;}</style>
</head>
<body>
  <div style="border-style: hidden">hidden</div>
  <div style="border-style: none">none</div>
  <div style="border-style: solid">solid</div>
  <div style="border-style: dotted">dotted</div>
  <div style="border-style: dashed">dashed</div>
  <div style="border-style: double; border-width: 3px">double</div>
  <div style="border-style: groove">groove</div>
  <div style="border-style: ridge">ridge</div>
  <div style="border-style: inset">inset</div>
  <div style="border-style: outset">outset</div>
</body>
</html>
Comment 1 Stephan Kulow 2004-02-01 12:54:06 UTC
http://doc.trolltech.com/3.3/qt.html#PenStyle-enum - that are the supported 
line types by Qt.

Drawing the lines you suggest, would mean drawing pixels and I doubt users would justify the slow down for painting the "perfect line". And the only way
to avoid that would mean adding a direct X11 call. Also not worth it I'd say.
Comment 2 Dirk Mueller 2004-02-13 00:39:28 UTC
its a Qt/X11 bug.. and the most annoying one too. it works with Qt/Win. so disgusting. 
Comment 3 Jan Schaefer 2004-02-13 15:43:49 UTC
> The CSS property border-style values 'groove', 'ridge', 'inset' and 'outset' > all fail to render, creating just simple solid lines.
This is correct as you specified the border-width of 1px
The dotted line bug is a duplicate of #62296.

*** This bug has been marked as a duplicate of 62296 ***
Comment 4 Dirk Mueller 2004-02-17 02:06:28 UTC
CVS commit by mueller: 

improved rendering of testcase in #73920
CCMAIL: 73920@bugs.kde.org


  M +12 -16    render_object.cpp   1.252


--- kdelibs/khtml/rendering/render_object.cpp  #1.251:1.252
@@ -558,17 +558,9 @@ void RenderObject::drawBorder(QPainter *
             case BSBottom:
             case BSTop:
-                p->drawRect(x1+1,y1,x2-x1-2,y2-y1);
-                if ( ( x2-x1 ) & 1 ) {
-                    p->setPen( QPen( c, 0 ) );
-                    p->drawPoint( x2-1, y2-1 );
-                }
+                p->drawRect(x1,y1,x2-x1,y2-y1);
                 break;
             case BSRight:
             case BSLeft:
-                p->drawRect(x1,y1+1,x2-x1,y2-y1-2);
-                if ( ( y2-y1 ) & 1 ) {
-                    p->setPen( QPen( c, 0 ) );
-                    p->drawPoint( x2-1, y2-1 );
-                }
+                p->drawRect(x1,y1,x2-x1,y2-y1);
             }
 
@@ -580,5 +572,5 @@ void RenderObject::drawBorder(QPainter *
     case DASHED:
         if(style == DASHED)
-            p->setPen(QPen(c, width == 1 ? 0 : width, Qt::DashLine));
+            p->setPen(QPen(c, width == 1 ? 0 : width, width == 1 ? Qt::DotLine : Qt::DashLine));
 
         if (width > 0)
@@ -702,11 +694,15 @@ void RenderObject::drawBorder(QPainter *
     }
     case INSET:
-        if(s == BSTop || s == BSLeft)
-            c = c.dark();
-
-        /* nobreak; */
     case OUTSET:
-        if(style == OUTSET && (s == BSBottom || s == BSRight))
+        // ### QColor::light/::dark are horribly slow. Cache this somewhere.
+        if ( (style == OUTSET && (s == BSBottom || s == BSRight)) ||
+             (style == INSET && ( s == BSTop || s == BSLeft ) ) )
             c = c.dark();
+        else {
+             int h, s, v;
+             c.getHsv( h, s, v );
+             c.setHsv( h, s, kMax( 100, v ) );
+             c = c.light();
+        }
         /* nobreak; */
     case SOLID: