Bug 169608 - Background-attachment: scroll should scroll within the containing block, not within the viewport
Summary: Background-attachment: scroll should scroll within the containing block, not ...
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 4.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
Depends on:
Reported: 2008-08-22 20:43 UTC by Gérard Talbot (no longer involved)
Modified: 2009-01-26 12:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Gérard Talbot (no longer involved) 2008-08-22 20:43:55 UTC
Version:            (using KDE 4.1.0)
Compiler:          cc 
OS:                Linux
Installed from:    Debian stable Packages

According to CSS 1, section 5.3.5 and CSS 2.1, section 14.2.1, when background-attachment is scroll, then an image should scroll within its containing block, not within the viewport.

Instructions: resize vertically the browser window to change the vertical dimension of the viewport.

Expected results: the lime squared + image should remain vertically in the middle of its containining block, which is the body which has a lime border. The lime squared + image should not scroll up and down.

Relevant URLs:




Regards, Gérard
Comment 1 Gérard Talbot (no longer involved) 2008-08-23 23:10:14 UTC
Konqueror 4.1 / Windows XP screenshot:




In such screenshot, the lime square [+] image should be vertically in the middle of the lime bordered <body> element, at all times, regardless of browser window viewport vertical dimension/height.
Comment 2 Gérard Talbot (no longer involved) 2008-08-31 18:48:01 UTC
CSS 2.1, section 14.2 The Background states:
The background of the root element becomes the background of the canvas and covers the entire canvas, anchored (for 'background-position') at the same point as it would be if it was painted only for the root element itself. The root element does not paint this background again. 

indicating that the background-origin to be considered for background-position is relative to the root element, not the canvas. 
Comment 3 Germain Garand 2008-09-01 02:07:34 UTC
SVN commit 855521 by ggarand:

Consider the real root background box when computing some background
properties - not the one that is extended on the whole canvas.

Patch based on work by Anatoli Papirovski <apapirovski mac dot com>

BUG: 169608

 M  +15 -2     render_box.cpp  

--- trunk/KDE/kdelibs/khtml/rendering/render_box.cpp #855520:855521
@@ -575,8 +575,21 @@
-            int pw = w - hpab;
-            int ph = h - vpab;
+            int pw, ph;
+            if (isRoot()) {
+                // the root's background box 'spills out' to cover the whole canvas, so we have to
+                // go back to its true edge for the purpose of computing background-size
+                // and honouring background-origin
+                pw = width() - hpab;
+                ph = height() - vpab; 
+                left += marginLeft();
+                hpab += marginLeft() + marginRight();
+                vpab += marginTop() + marginBottom();
+                top += marginTop();
+            } else {
+                pw = w - hpab;
+                ph = h - vpab;
+            }
             scaledImageWidth = pw;
             scaledImageHeight = ph;
             calculateBackgroundSize(bgLayer, scaledImageWidth, scaledImageHeight);
Comment 4 Gérard Talbot (no longer involved) 2009-01-26 12:19:52 UTC
I get expected results with Konqueror 4.1.3 for Windows.
Marking as VERIFIED