Source/WebCore: Background Does Not Scale Correctly with Page
authorfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 22:00:19 +0000 (22:00 +0000)
committerfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 22:00:19 +0000 (22:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=65690

Reviewed by Simon Fraser.

Test: fast/repaint/background-scaling.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintRootBoxFillLayers):
* rendering/RenderView.cpp:
(WebCore::RenderView::unscaledDocumentRect):
(WebCore::RenderView::documentRect):
* rendering/RenderView.h:

LayoutTests: Background Does Not Scale Correctly with Page

Scaling is applied twice to the background (the paint area is doubly scaled).
This patch fixes this issue by passing the unscaled document rect to paintFillLayers
in paintRootBoxFillLayers.

https://bugs.webkit.org/show_bug.cgi?id=65690

Reviewed by Simon Fraser.

* fast/repaint/background-scaling-expected.png: Added.
* fast/repaint/background-scaling-expected.txt: Added.
* fast/repaint/background-scaling.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/background-scaling-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/background-scaling-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/background-scaling.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h

index ff82c8a75754afc0dee037057696df323af1c1f0..cc9f84d4070dd338cafb99990b0aef6a9b8428e9 100644 (file)
@@ -1,3 +1,19 @@
+2011-08-04  Fady Samuel  <fsamuel@chromium.org>
+
+        Background Does Not Scale Correctly with Page
+
+        Scaling is applied twice to the background (the paint area is doubly scaled).
+        This patch fixes this issue by passing the unscaled document rect to paintFillLayers
+        in paintRootBoxFillLayers.
+
+        https://bugs.webkit.org/show_bug.cgi?id=65690
+
+        Reviewed by Simon Fraser.
+
+        * fast/repaint/background-scaling-expected.png: Added.
+        * fast/repaint/background-scaling-expected.txt: Added.
+        * fast/repaint/background-scaling.html: Added.
+
 2011-08-04  Yael Aharon  <yael.aharon@nokia.com>
 
         [Qt] 69 tests failing after http://trac.webkit.org/changeset/92375
diff --git a/LayoutTests/fast/repaint/background-scaling-expected.png b/LayoutTests/fast/repaint/background-scaling-expected.png
new file mode 100644 (file)
index 0000000..c2f4c8f
Binary files /dev/null and b/LayoutTests/fast/repaint/background-scaling-expected.png differ
diff --git a/LayoutTests/fast/repaint/background-scaling-expected.txt b/LayoutTests/fast/repaint/background-scaling-expected.txt
new file mode 100644 (file)
index 0000000..00aa603
--- /dev/null
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600 [bgcolor=#008000]
+    RenderBody {BODY} at (0,0) size 800x600
+      RenderBlock {DIV} at (0,0) size 800x100 [bgcolor=#008000]
diff --git a/LayoutTests/fast/repaint/background-scaling.html b/LayoutTests/fast/repaint/background-scaling.html
new file mode 100644 (file)
index 0000000..ae553a1
--- /dev/null
@@ -0,0 +1,15 @@
+<html style="background-color: green;">
+<head> 
+<script src="resources/repaint.js" type="text/javascript" charset="utf-8"></script> 
+<script type="text/javascript"> 
+    function repaintTest()
+    {
+        if (window.layoutTestController)
+            eventSender.scalePageBy(0.2,0,0);
+    }
+</script> 
+</head> 
+<body style="margin:0;" onload="runRepaintTest();">
+  <div style="background-color: green; width: 100%; height: 100px;"></div>
+</body>
+</html>
index 22a8cf7e92cd9aea5c6e46b2d8404571ffd55c7d..1f5a48a38c8656ab83dd510a49f46372f96232b8 100644 (file)
@@ -1,3 +1,19 @@
+2011-08-04  Fady Samuel  <fsamuel@chromium.org>
+
+        Background Does Not Scale Correctly with Page
+        https://bugs.webkit.org/show_bug.cgi?id=65690
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/repaint/background-scaling.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintRootBoxFillLayers):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::unscaledDocumentRect):
+        (WebCore::RenderView::documentRect):
+        * rendering/RenderView.h:
+
 2011-08-04  Jochen Eisinger  <jochen@chromium.org>
 
         Introduce a new ResourceRequest::TargetType for XHRs
index 0b410711940f2b68c7ece68bb38e2b6c74245fa5..312137d008f92c6e33683d3aa70ac08144f8980a 100644 (file)
@@ -804,8 +804,8 @@ void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo)
     }
 
     // The background of the box generated by the root element covers the entire canvas, so just use
-    // the RenderView's documentRect accessor.
-    paintFillLayers(paintInfo, bgColor, bgLayer, view()->documentRect(), BackgroundBleedNone, CompositeSourceOver, bodyObject);
+    // the RenderView's unscaledDocumentRect accessor.
+    paintFillLayers(paintInfo, bgColor, bgLayer, view()->unscaledDocumentRect(), BackgroundBleedNone, CompositeSourceOver, bodyObject);
 }
 
 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsContext* context) const
index a95c49c94fa2aa623956798f89d50a2299a3399c..01da0bc345a9b6fa7479334b126b57e3ccdaf7f8 100644 (file)
@@ -659,10 +659,17 @@ IntRect RenderView::viewRect() const
     return IntRect();
 }
 
-IntRect RenderView::documentRect() const
+
+IntRect RenderView::unscaledDocumentRect() const
 {
     IntRect overflowRect(layoutOverflowRect());
     flipForWritingMode(overflowRect);
+    return overflowRect;
+}
+
+IntRect RenderView::documentRect() const
+{
+    IntRect overflowRect(unscaledDocumentRect());
     if (hasTransform())
         overflowRect = layer()->currentTransform().mapRect(overflowRect);
     return overflowRect;
index 77133c7e9f7608b1b100b630a44bb407e3506c42..a73ac8d79956d86880e61404a849730f18bab421 100644 (file)
@@ -165,6 +165,8 @@ public:
     bool usesCompositing() const;
 #endif
 
+    IntRect unscaledDocumentRect() const;
+
     IntRect documentRect() const;
 
 #if ENABLE(CSS_REGIONS)