Direct pattern compositing breaks when no-repeat is set on a large layer
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 May 2013 09:51:25 +0000 (09:51 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 May 2013 09:51:25 +0000 (09:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116140

Source/WebCore:

Reviewed by Antti Koivisto.

In some cases the directly composited background color logic overrides the layer's
contentsRect, which results in wrong rendering of tiled images.
This patch makes sure that the background image is applied after the solid color,
which ensures the correct contentsRect.

Test: compositing/patterns/direct-pattern-compositing-contain-no-repeat.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDirectlyCompositedContents):

LayoutTests:

Added a ref-test to make sure that direct pattern compositing works well with no-repeat
in a particular geometry.

Reviewed by Antti Koivisto.

* compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html: Added.
* compositing/patterns/direct-pattern-compositing-contain-no-repeat.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html [new file with mode: 0644]
LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index be1b253..ee68ea2 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-25  Noam Rosenthal  <noam.rosenthal@nokia.com>
+
+        Direct pattern compositing breaks when no-repeat is set on a large layer
+        https://bugs.webkit.org/show_bug.cgi?id=116140
+
+        Added a ref-test to make sure that direct pattern compositing works well with no-repeat
+        in a particular geometry.
+
+        Reviewed by Antti Koivisto.
+
+        * compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html: Added.
+        * compositing/patterns/direct-pattern-compositing-contain-no-repeat.html: Added.
+
 2013-05-24  Brent Fulgham  <bfulgham@apple.com>
 
         Unreviewed change to get Windows bots green.  Disable a number
diff --git a/LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html b/LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html
new file mode 100644 (file)
index 0000000..7e2a3ee
--- /dev/null
@@ -0,0 +1,16 @@
+<html lang="en">
+<head>
+  <style>
+    .test {
+      height: 200px;
+      width: 300px;
+      background-image: url(../resources/simple_image.png);
+      -webkit-background-size: contain;
+      background-repeat: no-repeat;
+    }
+   </style>
+</head>
+<body>
+  <div class="test"></div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat.html b/LayoutTests/compositing/patterns/direct-pattern-compositing-contain-no-repeat.html
new file mode 100644 (file)
index 0000000..27f695f
--- /dev/null
@@ -0,0 +1,17 @@
+<html lang="en">
+<head>
+  <style>
+    .composited { -webkit-transform: translateZ(0); }
+    .test {
+      height: 200px;
+      width: 300px;
+      background-image: url(../resources/simple_image.png);
+      -webkit-background-size: contain;
+      background-repeat: no-repeat;
+    }
+   </style>
+</head>
+<body>
+  <div class="test composited"></div>
+</body>
+</html>
index 07f28e3..46b5f64 100644 (file)
@@ -1,3 +1,20 @@
+2013-05-25  Noam Rosenthal  <noam.rosenthal@nokia.com>
+
+        Direct pattern compositing breaks when no-repeat is set on a large layer
+        https://bugs.webkit.org/show_bug.cgi?id=116140
+
+        Reviewed by Antti Koivisto.
+
+        In some cases the directly composited background color logic overrides the layer's
+        contentsRect, which results in wrong rendering of tiled images.
+        This patch makes sure that the background image is applied after the solid color,
+        which ensures the correct contentsRect.
+
+        Test: compositing/patterns/direct-pattern-compositing-contain-no-repeat.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateDirectlyCompositedContents):
+
 2013-05-24  Andreas Kling  <akling@apple.com>
 
         Move "hover" state logic from Node to Element.
index a6138d3..6798d2f 100644 (file)
@@ -875,8 +875,10 @@ void RenderLayerBacking::updateDirectlyCompositedContents(bool isSimpleContainer
     if (!m_owningLayer->hasVisibleContent())
         return;
 
-    updateDirectlyCompositedBackgroundImage(isSimpleContainer, didUpdateContentsRect);
+    // The order of operations here matters, since the last valid type of contents needs
+    // to also update the contentsRect.
     updateDirectlyCompositedBackgroundColor(isSimpleContainer, didUpdateContentsRect);
+    updateDirectlyCompositedBackgroundImage(isSimpleContainer, didUpdateContentsRect);
 }
 
 void RenderLayerBacking::registerScrollingLayers()