Diff
Modified: branches/safari-536.30-branch/LayoutTests/ChangeLog (145616 => 145617)
--- branches/safari-536.30-branch/LayoutTests/ChangeLog 2013-03-12 23:50:08 UTC (rev 145616)
+++ branches/safari-536.30-branch/LayoutTests/ChangeLog 2013-03-12 23:52:16 UTC (rev 145617)
@@ -1,5 +1,35 @@
2013-03-12 Lucas Forschler <[email protected]>
+ Merge r133686
+
+ 2012-11-06 Simon Fraser <[email protected]>
+
+ -webkit-background-clip:text produces artifacts when applied to the body and the browser is resized
+ https://bugs.webkit.org/show_bug.cgi?id=89287
+
+ Reviewed by Beth Dakin.
+
+ Test with -webkit-background-clip: text on the body, which scrolls.
+
+ Some additional tests that exercise different combinations of html and
+ body transform and background.
+
+ * compositing/repaint/composited-document-element.html:
+ * fast/backgrounds/background-clip-text-on-body-expected.png: Added.
+ * fast/backgrounds/background-clip-text-on-body-expected.txt: Added.
+ * fast/backgrounds/background-clip-text-on-body.html: Added.
+ * fast/backgrounds/transformed-body-background-expected.png: Added.
+ * fast/backgrounds/transformed-body-background-expected.txt: Added.
+ * fast/backgrounds/transformed-body-background.html: Added.
+ * fast/backgrounds/transformed-body-html-background-expected.png: Added.
+ * fast/backgrounds/transformed-body-html-background-expected.txt: Added.
+ * fast/backgrounds/transformed-body-html-background.html: Added.
+ * fast/backgrounds/transformed-html-body-background-expected.png: Added.
+ * fast/backgrounds/transformed-html-body-background-expected.txt: Added.
+ * fast/backgrounds/transformed-html-body-background.html: Added.
+
+2013-03-12 Lucas Forschler <[email protected]>
+
Merge r133155
2012-11-01 Stephen Chenney <[email protected]>
Modified: branches/safari-536.30-branch/LayoutTests/compositing/repaint/composited-document-element.html (145616 => 145617)
--- branches/safari-536.30-branch/LayoutTests/compositing/repaint/composited-document-element.html 2013-03-12 23:50:08 UTC (rev 145616)
+++ branches/safari-536.30-branch/LayoutTests/compositing/repaint/composited-document-element.html 2013-03-12 23:52:16 UTC (rev 145617)
@@ -2,7 +2,7 @@
<html>
<head>
- <style type="text/css">
+ <style>
html {
-webkit-perspective: 1200px;
background-color: red;
@@ -11,7 +11,7 @@
background-color: transparent;
}
body {
- -webkit-transform-style: preserve-3d;
+ -webkit-transform: translateZ(0);
}
.box {
width: 100px;
@@ -19,7 +19,7 @@
background-color: blue;
}
</style>
- <script type="text/_javascript_" charset="utf-8">
+ <script>
if (window.layoutTestController)
layoutTestController.waitUntilDone();
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.png (from rev 133686, trunk/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.png)
(Binary files differ)
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.txt (from rev 133686, trunk/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.txt) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.txt (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body-expected.txt 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1 @@
+Text should remain legible when window is resized. No background artifacts should appear.
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body.html (from rev 133686, trunk/LayoutTests/fast/backgrounds/background-clip-text-on-body.html) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body.html (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/background-clip-text-on-body.html 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+ body {
+ font-size: 5em;
+ -webkit-background-clip: text;
+ height: 2000px;
+ overflow: hidden;
+ }
+</style>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText(true);
+
+ function doTest()
+ {
+ window.scrollTo(0, 600);
+ }
+ window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+
+Text should remain legible when window is resized. No background artifacts should appear.
+
+</body>
+</html>
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background-expected.png (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-background-expected.png)
(Binary files differ)
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background-expected.txt (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-background-expected.txt) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background-expected.txt (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background-expected.txt 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1 @@
+
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background.html (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-background.html) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background.html (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-background.html 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ -webkit-transform: rotate(20deg);
+ -webkit-transform-origin: top left;
+ background-color: silver;
+ overflow: hidden;
+ }
+
+ .contents {
+ height: 1200px;
+ width: 100%;
+ border: 1px solid black;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText(true);
+ </script>
+</head>
+<body>
+ <div class="contents"></div>
+</body>
+</html>
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.png (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.png)
(Binary files differ)
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.txt (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.txt) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.txt (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background-expected.txt 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1 @@
+
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background.html (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-body-html-background.html) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background.html (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-body-html-background.html 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ html {
+ background: gray;
+ }
+
+ body {
+ -webkit-transform: rotate(20deg);
+ -webkit-transform-origin: top left;
+ background-color: silver;
+ overflow: hidden;
+ }
+
+ .contents {
+ height: 1200px;
+ width: 100%;
+ border: 1px solid black;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText(true);
+ </script>
+</head>
+<body>
+ <div class="contents"></div>
+</body>
+</html>
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.png (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.png)
(Binary files differ)
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.txt (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.txt) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.txt (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background-expected.txt 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1 @@
+
Copied: branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background.html (from rev 133686, trunk/LayoutTests/fast/backgrounds/transformed-html-body-background.html) (0 => 145617)
--- branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background.html (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/backgrounds/transformed-html-body-background.html 2013-03-12 23:52:16 UTC (rev 145617)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ html {
+ -webkit-transform: rotate(20deg);
+ -webkit-transform-origin: top left;
+ }
+
+ body {
+ background-color: silver;
+ overflow: hidden;
+ }
+
+ .contents {
+ height: 1200px;
+ width: 100%;
+ border: 1px solid black;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText(true);
+ </script>
+</head>
+<body>
+ <div class="contents"></div>
+</body>
+</html>
Modified: branches/safari-536.30-branch/Source/WebCore/ChangeLog (145616 => 145617)
--- branches/safari-536.30-branch/Source/WebCore/ChangeLog 2013-03-12 23:50:08 UTC (rev 145616)
+++ branches/safari-536.30-branch/Source/WebCore/ChangeLog 2013-03-12 23:52:16 UTC (rev 145617)
@@ -1,5 +1,39 @@
2013-03-12 Lucas Forschler <[email protected]>
+ Merge r133686
+
+ 2012-11-06 Simon Fraser <[email protected]>
+
+ -webkit-background-clip:text produces artifacts when applied to the body and the browser is resized
+ https://bugs.webkit.org/show_bug.cgi?id=89287
+
+ Reviewed by Beth Dakin.
+
+ If the body had -webkit-background-clip: text, we'd fail to paint
+ anything behind it, so would see garbage pixels.
+
+ Fix by having RenderView::paintBoxDecorations() check for a background-clip of "text"
+ on the renderer that paints the root background.
+
+ Added some new pixel tests for combinations of html and body transform
+ and backgrounds; earlier versions of the patch broke some of these tests.
+
+ Tests: fast/backgrounds/background-clip-text-on-body.html
+ fast/backgrounds/transformed-body-background.html
+ fast/backgrounds/transformed-body-html-background.html
+ fast/backgrounds/transformed-html-body-background.html
+
+ * rendering/RenderView.cpp:
+ (WebCore::rendererObscuresBackground): Broke up the single condition
+ into early 'false' returns when possible. We need to also check whether
+ the renderer that actually paints the background (which might be the body)
+ will fill it; background-clip: text does not.
+ (WebCore::RenderView::paintBoxDecorations): Rather than checking firstChild(),
+ actually check the root renderer, so that we can reliably get to the renderer
+ that mains the root background.
+
+2013-03-12 Lucas Forschler <[email protected]>
+
Merge r133155
2012-11-01 Stephen Chenney <[email protected]>
Modified: branches/safari-536.30-branch/Source/WebCore/rendering/RenderView.cpp (145616 => 145617)
--- branches/safari-536.30-branch/Source/WebCore/rendering/RenderView.cpp 2013-03-12 23:50:08 UTC (rev 145616)
+++ branches/safari-536.30-branch/Source/WebCore/rendering/RenderView.cpp 2013-03-12 23:52:16 UTC (rev 145617)
@@ -251,14 +251,27 @@
return object->hasLayer() && toRenderBoxModelObject(object)->layer()->isComposited();
}
-static inline bool rendererObscuresBackground(RenderObject* object)
+static inline bool rendererObscuresBackground(RenderObject* rootObject)
{
- return object && object->style()->visibility() == VISIBLE
- && object->style()->opacity() == 1
- && !object->style()->hasTransform()
- && !isComposited(object);
+ if (!rootObject)
+ return false;
+
+ RenderStyle* style = rootObject->style();
+ if (style->visibility() != VISIBLE
+ || style->opacity() != 1
+ || style->hasTransform())
+ return false;
+
+ if (isComposited(rootObject))
+ return false;
+
+ const RenderObject* rootRenderer = rootObject->rendererForRootBackground();
+ if (rootRenderer->style()->backgroundClip() == TextFillBox)
+ return false;
+
+ return true;
}
-
+
void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&)
{
// Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit
@@ -288,18 +301,20 @@
return;
bool rootFillsViewport = false;
+ bool rootObscuresBackground = false;
Node* documentElement = document()->documentElement();
if (RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0) {
// The document element's renderer is currently forced to be a block, but may not always be.
RenderBox* rootBox = rootRenderer->isBox() ? toRenderBox(rootRenderer) : 0;
rootFillsViewport = rootBox && !rootBox->x() && !rootBox->y() && rootBox->width() >= width() && rootBox->height() >= height();
+ rootObscuresBackground = rendererObscuresBackground(rootRenderer);
}
Page* page = document()->page();
float pageScaleFactor = page ? page->pageScaleFactor() : 1;
// If painting will entirely fill the view, no need to fill the background.
- if (rootFillsViewport && rendererObscuresBackground(firstChild()) && pageScaleFactor >= 1)
+ if (rootFillsViewport && rootObscuresBackground && pageScaleFactor >= 1)
return;
// This code typically only executes if the root element's visibility has been set to hidden,