fix for background bug

David Hyatt hyatt at apple.com
Mon Nov 10 00:57:00 CET 2003


Background images set their origin relative to the padding box, but 
they're supposed to paint in the border box.  Here's the fix:

-------------- next part --------------
Index: khtml/rendering/render_box.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.94
diff -u -p -r1.94 khtml/rendering/render_box.cpp
--- khtml/rendering/render_box.cpp	2003/11/03 18:35:52	1.94
+++ khtml/rendering/render_box.cpp	2003/11/07 07:18:34
@@ -349,18 +355,17 @@ void RenderBox::paintBackgroundExtended(
                         cw += xPosition;
                     }
                 }
+                cx += bleft;
             } else {
-                cw = w-vpab;
+                cw = w;
                 cx = _tx;
-                if(pixw == 0){
+                if (pixw == 0)
                     sx = 0;
-                }else{
+                else
                     sx =  pixw - ((sptr->backgroundXPosition().minWidth(pw-pixw)) % pixw );
-                }
+                sx -= bleft % pixw;
             }
 
-            cx += bleft;
-
             if( (bgr == NO_REPEAT || bgr == REPEAT_X) && h > pixh ) {
                 ch = pixh;
                 int yPosition = sptr->backgroundYPosition().minWidth(ph-pixh);
@@ -375,17 +380,18 @@ void RenderBox::paintBackgroundExtended(
                         ch += yPosition;
                     }
                 }
+                
+                cy += borderTop();
             } else {
-                ch = h-hpab;
+                ch = h;
                 cy = _ty;
                 if(pixh == 0){
                     sy = 0;
                 }else{
                     sy = pixh - ((sptr->backgroundYPosition().minWidth(ph-pixh)) % pixh );
                 }
+                sy -= borderTop() % pixh;
             }
-
-            cy += borderTop();
         }
         else
         {
@@ -424,7 +430,7 @@ void RenderBox::paintBackgroundExtended(
             }
 
             QRect fix(cx,cy,cw,ch);
-            QRect ele(_tx+bleft,_ty+borderTop(),w-vpab,h-hpab);
+            QRect ele(_tx,_ty,w,h);
             QRect b = fix.intersect(ele);
             sx+=b.x()-cx;
             sy+=b.y()-cy;
-------------- next part --------------


dave


More information about the Khtml-devel mailing list