Body background with background-attachment:fixed stays in place during rubber-banding
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2013 23:46:01 +0000 (23:46 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2013 23:46:01 +0000 (23:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67894

Reviewed by Beth Dakin.

Use FrameView::scrollOffsetForFixedPosition() to compute the location of the rect
used to position fixed backgrounds, since it takes rubber-banding into account.

No test because rubber-banding isn't testtable in layout tests.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138757 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp

index 986c967..9089869 100644 (file)
@@ -1,3 +1,18 @@
+2013-01-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Body background with background-attachment:fixed stays in place during rubber-banding
+        https://bugs.webkit.org/show_bug.cgi?id=67894
+
+        Reviewed by Beth Dakin.
+
+        Use FrameView::scrollOffsetForFixedPosition() to compute the location of the rect
+        used to position fixed backgrounds, since it takes rubber-banding into account.
+        
+        No test because rubber-banding isn't testtable in layout tests.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+
 2013-01-03  Adam Klein  <adamk@chromium.org>
 
         [HTMLTemplateElement] When adopting a template element, also adopt its content into the appropriate document
index 47cc4f3..f06e126 100644 (file)
@@ -1223,7 +1223,10 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
         } else
             positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location());
     } else {
-        geometry.setDestRect(pixelSnappedIntRect(viewRect()));
+        IntRect viewportRect = pixelSnappedIntRect(viewRect());
+        if (FrameView* frameView = view()->frameView())
+            viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPosition()));
+        geometry.setDestRect(pixelSnappedIntRect(viewportRect));
         positioningAreaSize = geometry.destRect().size();
     }