Bug 133626 - [test case] Negative background-position value spoils no-repeat
Summary: [test case] Negative background-position value spoils no-repeat
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-06 02:16 UTC by Wojciech Wierchoła
Modified: 2006-09-20 18:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
testcase (1.18 KB, text/html)
2006-09-06 02:17 UTC, Wojciech Wierchoła
Details
testcase screenshot (8.72 KB, image/png)
2006-09-06 22:10 UTC, Wojciech Wierchoła
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wojciech Wierchoła 2006-09-06 02:16:07 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Gentoo Packages
OS:                Linux

1. CSS: background-repeat: no-repeat
2. One of dimension of background-image is greatest than analogous dimension of container.
3. background-position is negative in "analogous dimension"
4. background-repeat: no-repeat has been spoiled

I apologize for my english.
Comment 1 Wojciech Wierchoła 2006-09-06 02:17:50 UTC
Created attachment 17647 [details]
testcase
Comment 2 Wojciech Wierchoła 2006-09-06 22:10:14 UTC
Created attachment 17652 [details]
testcase screenshot
Comment 3 Allan Sandfeld 2006-09-20 18:15:12 UTC
SVN commit 586793 by carewolf:

Clean-up background-paint so we don't forget the case of negative 
offset and no-repeat.
BUG:133626


 M  +11 -21    render_box.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #586792:586793
@@ -503,37 +503,32 @@
             calculateBackgroundSize(bgLayer, scaledImageWidth, scaledImageHeight);
 
             EBackgroundRepeat bgr = bgLayer->backgroundRepeat();
-            if ((bgr == NO_REPEAT || bgr == REPEAT_Y) && w > scaledImageWidth) {
+            if (bgr == NO_REPEAT || bgr == REPEAT_Y) {
                 cw = scaledImageWidth;
                 int xPosition = bgLayer->backgroundXPosition().minWidth(pw-scaledImageWidth);
                 if ( xPosition >= 0 ) {
                     cx = _tx + xPosition;
-                    cw = kMin(cw, pw - xPosition);
+                    cw = kMin(scaledImageWidth, pw - xPosition);
                 }
                 else {
                     cx = _tx;
                     if (scaledImageWidth > 0) {
                         sx = -xPosition;
-                        cw += xPosition;
+                        cw = kMin(scaledImageWidth+xPosition, pw);
                     }
                 }
                 cx += left;
             } else {
-                // repeat over x or background is wider than box
+                // repeat over x
                 cw = w;
                 cx = _tx;
                 if (scaledImageWidth > 0) {
                     int xPosition = bgLayer->backgroundXPosition().minWidth(pw-scaledImageWidth);
-                    if ((xPosition > 0) && (bgr == NO_REPEAT)) {
-                        cx += xPosition;
-                        cw -= xPosition;
-                    } else {
-                        sx = scaledImageWidth - (xPosition % scaledImageWidth);
-                        sx -= left % scaledImageWidth;
-                    }
+                    sx = scaledImageWidth - (xPosition % scaledImageWidth);
+                    sx -= left % scaledImageWidth;
                 }
             }
-            if( (bgr == NO_REPEAT || bgr == REPEAT_X) && ph > scaledImageHeight ) {
+            if (bgr == NO_REPEAT || bgr == REPEAT_X) {
                 ch = scaledImageHeight;
                 int yPosition = bgLayer->backgroundYPosition().minWidth(ph - scaledImageHeight);
                 if ( yPosition >= 0 ) {
@@ -544,24 +539,19 @@
                     cy = _ty;
                     if (scaledImageHeight > 0) {
                         sy = -yPosition;
-                        ch += yPosition;
+                        ch = kMin(scaledImageHeight+yPosition, ph);
                     }
                 }
 
                 cy += top;
             } else {
-                // repeat over y or background is taller than box
+                // repeat over y
                 ch = h;
                 cy = _ty;
                 if (scaledImageHeight > 0) {
                     int yPosition = bgLayer->backgroundYPosition().minWidth(ph - scaledImageHeight);
-                    if ((yPosition > 0) && (bgr == NO_REPEAT)) {
-                        cy += yPosition;
-                        ch -= yPosition;
-                    } else {
-                        sy = scaledImageHeight - (yPosition % scaledImageHeight);
-                        sy -= top % scaledImageHeight;
-                    }
+                    sy = scaledImageHeight - (yPosition % scaledImageHeight);
+                    sy -= top % scaledImageHeight;
                 }
             }
 	    if (layer())