Bug 59600

Summary: CSS option background-repeat ignored for flow elements
Product: [Applications] konqueror Reporter: Manafta <walter>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: major CC: bkeil, epost, fidox, jm, magnus.kessler, mss, suy21
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandrake RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: test case
test case 2

Description Manafta 2003-06-10 12:37:13 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Mandrake RPMs
OS:          Linux

If a text link is combined with a image link, the text is overwritten with images. The problem didn't occur in Konqueror 3.0.

Seen on:
http://web-graphics.com/
Comment 1 Daniel Naber 2003-06-14 16:37:20 UTC
see test case 
Comment 2 Daniel Naber 2003-06-14 16:37:48 UTC
Created attachment 1800 [details]
test case
Comment 3 Daniel Naber 2003-06-14 16:40:26 UTC
*** Bug 45323 has been marked as a duplicate of this bug. ***
Comment 4 fidox 2003-10-23 00:08:48 UTC
Using konkeror 3.1.4. See test case below:

In goto.gif put a image valid link to show the test.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

  <head>
    <title>KHTML test case</title>
    <style type="text/css">
       div.seeAlso {
          margin-top: 8px;
          margin-bottom: 12px;
       }
       a.seeAlso {
          background: url("goto.gif") 0px 4px no-repeat;
          padding-left: 10px;
          font-weight: normal;
          color: #101010;
       }
    </style>

  </head>

  <body>

     <div class="seeAlso">
        <a href="http://www.blahblah.com" class="seeAlso">
        CLICK HERE</a>
     </div>

  </body>
</html>
Comment 5 Sashmit Bhaduri 2003-10-26 23:01:18 UTC
still seems to occur in HEAD (few weeks old)
Comment 6 Stephan Kulow 2003-11-05 13:34:56 UTC
*** Bug 67291 has been marked as a duplicate of this bug. ***
Comment 7 Stephan Kulow 2003-12-05 13:25:33 UTC
*** Bug 69654 has been marked as a duplicate of this bug. ***
Comment 8 Malte S. Stretz 2003-12-05 15:36:30 UTC
Created attachment 3568 [details]
test case 2

yet another test case (from bug 69654), which shows that background-repeat
works for block elements but not for flow elements.
Comment 9 Malte S. Stretz 2003-12-05 15:40:39 UTC
applying Summary from bug 69654 which is more precise :)

please fix this bug for 3.2 (it's still reproducable with a build from 19.11.) as it renders quite some websites unreadable.
Comment 10 Stephan Kulow 2003-12-07 16:47:37 UTC
*** Bug 69791 has been marked as a duplicate of this bug. ***
Comment 11 Jesper Juhl 2004-01-01 21:33:50 UTC
still exists with konqueror from kde 3.2beta2
Comment 12 Germain Garand 2004-01-11 22:45:09 UTC
Subject: kdelibs/khtml

CVS commit by ggarand: 

make background images on inlines obey the full CSS specification

CCMAIL: 59600-done@bugs.kde.org


  M +10 -0     ChangeLog   1.151
  M +4 -0      rendering/render_line.cpp   1.11
  M +24 -5     rendering/render_text.cpp   1.236
  M +2 -2      rendering/render_text.h   1.104


--- kdelibs/khtml/ChangeLog  #1.150:1.151
@@ -1,2 +1,12 @@
+2004-01-11  Germain Garand  <germain@ebooksfrance.org>
+
+        * rendering/render_text.cpp (paintBoxDecorations):
+        make background images on inlines obbey the full CSS
+        spec (#59600)
+
+        * rendering/render_text.h (paintBoxDecorations): changed prototype
+
+        * rendering/render_line.cpp (paintDecorations): disable for now.
+
 2004-01-11  Dirk Mueller  <mueller@kde.org>
 

--- kdelibs/khtml/rendering/render_text.cpp  #1.235:1.236
@@ -268,5 +268,5 @@ void InlineTextBox::paintDecoration( QPa
 #endif
 
-void InlineTextBox::paintBoxDecorations(QPainter *pt, RenderStyle* style, RenderText *p, int _tx, int _ty, bool begin, bool end)
+void InlineTextBox::paintBoxDecorations(QPainter *pt, RenderStyle* style, RenderText *p, int _tx, int _ty, int curr, int count)
 {
     int topExtra = p->borderTop() + p->paddingTop();
@@ -279,4 +279,6 @@ void InlineTextBox::paintBoxDecorations(
 
     int width = m_width;
+    bool begin = !curr;
+    bool end = (curr == count-1);
 
     // the height of the decorations is:  topBorder + topPadding + CSS font-size + bottomPadding + bottomBorder
@@ -292,7 +294,24 @@ void InlineTextBox::paintBoxDecorations(
 
     if(i) {
-        // ### might need to add some correct offsets
-        // ### use paddingX/Y
-        pt->drawTiledPixmap(_tx, _ty, width, height, i->tiled_pixmap(c));
+        if (begin && end) {
+             p->parent()->paintBackgroundExtended(pt, c, i, _ty, height,
+                                _tx, _ty, width, height,
+                                p->borderLeft(), p->borderRight());
+        } else {
+            int mw = 0;
+            int startX = _tx;
+            for (int ix=0; ix<count; ix++) {
+                if(ix == curr) startX -= mw;
+                mw += static_cast<InlineBox*>(renderText()->m_lines[ix])->width();
+            }
+            QRect clipRect(_tx, _ty, width, height);
+            clipRect = pt->xForm(clipRect);
+            pt->save();
+            pt->setClipRect( clipRect );
+            p->parent()->paintBackgroundExtended(pt, c, i, _ty, height,
+                                startX, _ty, mw, height, 
+                                p->borderLeft(), p->borderRight());
+            pt->restore();
+        }
     }
 
@@ -963,5 +982,5 @@ void RenderText::paintObject( QPainter *
                 ((pseudoStyle && s->m_firstLine) ||
                 (!pseudoStyle && parent()->isInline())))
-                s->paintBoxDecorations(p, _style, this, tx, ty, si == 0, si == (int)m_lines.count()-1);
+                s->paintBoxDecorations(p, _style, this, tx, ty, si, (int)m_lines.count());
 
             if(_style->color() != p->pen().color())

--- kdelibs/khtml/rendering/render_text.h  #1.103:1.104
@@ -71,5 +71,5 @@ public:
 
     void paintDecoration( QPainter *pt, const Font *f, int _tx, int _ty, int decoration, bool begin, bool end);
-    void paintBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, bool begin, bool end);
+    void paintBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, int curr, int count);
     void paintSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos, int deco);
 

--- kdelibs/khtml/rendering/render_line.cpp  #1.10:1.11
@@ -566,4 +566,8 @@ void InlineFlowBox::paintDecorations(QPa
     // Now paint our text decorations. We only do this if we aren't in quirks mode (i.e., in
     // almost-strict mode or strict mode).
+    
+    // ### disabled for now
+    return;
+
     _tx += m_x;
     _ty += m_y;