[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
simon.fraser at apple.com
simon.fraser at apple.com
Thu Feb 4 21:24:07 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit cf256db2aed4d202e9a608cfc08d3eab14bd4758
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 22 01:28:07 2010 +0000
2010-01-21 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein.
-webkit-mask-box-image draws a box while loading
https://bugs.webkit.org/show_bug.cgi?id=33979
<rdar://problem/7378662>
Don't render masked elements until the mask images are fully loaded.
Test: http/tests/misc/slow-loading-mask.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintMaskImages): Check that all mask images (both the single mask-box-image,
and the possibly multiple mask-image) are fully loaded before allowing the masked content to render.
If they are not fully loaded, use a fully transparent transparency layer.
* rendering/style/FillLayer.h:
* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::imagesAreLoaded): New utility function that returns true if the image
in every FillLayer is loaded.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53663 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 98d3bf1..06279c3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -56,6 +56,23 @@
2010-01-21 Simon Fraser <simon.fraser at apple.com>
+ Reviewed by Dan Bernstein.
+
+ -webkit-mask-box-image draws a box while loading
+ https://bugs.webkit.org/show_bug.cgi?id=33979
+ <rdar://problem/7378662>
+
+ http test that uses a CGI to trickle in a mask image.
+
+ * http/tests/misc/resources/slow-png-load.pl: Added.
+ * http/tests/misc/resources/mask.png: Added.
+ * http/tests/misc/slow-loading-mask.html: Added.
+ * platform/mac/http/tests/misc/slow-loading-mask-expected.checksum: Added.
+ * platform/mac/http/tests/misc/slow-loading-mask-expected.png: Added.
+ * platform/mac/http/tests/misc/slow-loading-mask-expected.txt: Added.
+
+2010-01-21 Simon Fraser <simon.fraser at apple.com>
+
No review
Skip plugins/mouse-events-fixedpos.html on gtk, since it requires a special test plugin.
diff --git a/LayoutTests/compositing/resources/alpha-gradient.png b/LayoutTests/http/tests/misc/resources/mask.png
similarity index 100%
copy from LayoutTests/compositing/resources/alpha-gradient.png
copy to LayoutTests/http/tests/misc/resources/mask.png
diff --git a/LayoutTests/http/tests/misc/resources/slow-png-load.pl b/LayoutTests/http/tests/misc/resources/slow-png-load.pl
new file mode 100755
index 0000000..fdc6d9d
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/slow-png-load.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use CGI;
+use File::stat;
+
+use constant CHUNK_SIZE_BYTES => 256;
+
+my $query = new CGI;
+my $filename = $query->param('name');
+my $filesize = stat($filename)->size;
+my $loadtime = $query->param('loadtime'); # in seconds
+my $chunkcount = $filesize / CHUNK_SIZE_BYTES;
+my $chunkdelay = $loadtime / $chunkcount;
+
+# flush the buffers after each print
+select (STDOUT);
+$| = 1;
+
+print "Content-Type: image/png\r\n";
+print "Expires: Thu, 01 Dec 2003 16:00:00 GMT\r\n";
+print "Cache-Control: no-store, no-cache, must-revalidate\r\n";
+print "Pragma: no-cache\r\n";
+print "\r\n";
+
+open(FILE, $filename) or die;
+binmode FILE;
+my ($data, $n);
+my $total = 0;
+
+while (($n = read FILE, $data, CHUNK_SIZE_BYTES) != 0) {
+ print $data;
+
+ $total += $n;
+ if ($total >= $filesize) {
+ last;
+ }
+
+ # Throttle if there is some.
+ if ($chunkdelay > 0) {
+ select(undef, undef, undef, $chunkdelay);
+ }
+}
+close(FILE);
diff --git a/LayoutTests/http/tests/misc/slow-loading-mask.html b/LayoutTests/http/tests/misc/slow-loading-mask.html
new file mode 100644
index 0000000..7aa4275
--- /dev/null
+++ b/LayoutTests/http/tests/misc/slow-loading-mask.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style type="text/css" media="screen">
+
+ div {
+ margin: 10px;
+ }
+
+ .test {
+ height: 200px;
+ width: 200px;
+ background-color: blue;
+ }
+ .slow {
+ -webkit-mask-image: url('resources/slow-png-load.pl?name=mask.png&loadtime=1'); /* takes 1 second to load */
+ }
+
+ .slow-box {
+ -webkit-mask-image: url('resources/slow-png-load.pl?name=mask.png&loadtime=1'); /* takes 1 second to load */
+ }
+
+ </style>
+</head>
+<body>
+ <p>Tests that masked elements do not render until their mask images are fully loaded. You should not see any blue boxes below.</p>
+ <div class="slow test"></div>
+ <div class="slow-box test"></div>
+
+ <script type="text/javascript" charset="utf-8">
+ window.setTimeout(function() {
+ window.stop();
+ }, 100);
+ </script>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.checksum b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.checksum
new file mode 100644
index 0000000..21a4c80
--- /dev/null
+++ b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.checksum
@@ -0,0 +1 @@
+1fa28cf47307d6650e57239614915b77
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.png b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.png
new file mode 100644
index 0000000..3435e60
Binary files /dev/null and b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.png differ
diff --git a/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.txt b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.txt
new file mode 100644
index 0000000..9f6adf0
--- /dev/null
+++ b/LayoutTests/platform/mac/http/tests/misc/slow-loading-mask-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x488
+ RenderBlock {HTML} at (0,0) size 800x488
+ RenderBody {BODY} at (8,16) size 784x462
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 739x36
+ text run at (0,0) width 739: "Tests that masked elements do not render until their mask images are fully loaded. You should not see any blue boxes"
+ text run at (0,18) width 43: "below."
+layer at (18,68) size 200x200
+ RenderBlock {DIV} at (10,52) size 200x200 [bgcolor=#0000FF]
+layer at (18,278) size 200x200
+ RenderBlock {DIV} at (10,262) size 200x200 [bgcolor=#0000FF]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f2618ae..7b1db12 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-01-21 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ -webkit-mask-box-image draws a box while loading
+ https://bugs.webkit.org/show_bug.cgi?id=33979
+ <rdar://problem/7378662>
+
+ Don't render masked elements until the mask images are fully loaded.
+
+ Test: http/tests/misc/slow-loading-mask.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::paintMaskImages): Check that all mask images (both the single mask-box-image,
+ and the possibly multiple mask-image) are fully loaded before allowing the masked content to render.
+ If they are not fully loaded, use a fully transparent transparency layer.
+
+ * rendering/style/FillLayer.h:
+ * rendering/style/FillLayer.cpp:
+ (WebCore::FillLayer::imagesAreLoaded): New utility function that returns true if the image
+ in every FillLayer is loaded.
+
2010-01-21 Darin Adler <darin at apple.com>
Reviewed by Mark Rowe.
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index b57121b..0a38eab 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -666,9 +666,25 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int
bool compositedMask = hasLayer() && layer()->hasCompositedMask();
CompositeOperator compositeOp = CompositeSourceOver;
+ bool allMaskImagesLoaded = true;
+
if (!compositedMask) {
StyleImage* maskBoxImage = style()->maskBoxImage().image();
- if (maskBoxImage && style()->maskLayers()->hasImage()) {
+ const FillLayer* maskLayers = style()->maskLayers();
+
+ // Don't render a masked element until all the mask images have loaded, to prevent a flash of unmasked content.
+ if (maskBoxImage)
+ allMaskImagesLoaded &= maskBoxImage->isLoaded();
+
+ if (maskLayers)
+ allMaskImagesLoaded &= maskLayers->imagesAreLoaded();
+
+ // Before all images have loaded, just use an empty transparency layer as the mask.
+ if (!allMaskImagesLoaded)
+ pushTransparencyLayer = true;
+
+ if (maskBoxImage && maskLayers->hasImage()) {
+ // We have a mask-box-image and mask-image, so need to composite them together before using the result as a mask.
pushTransparencyLayer = true;
} else {
// We have to use an extra image buffer to hold the mask. Multiple mask images need
@@ -678,7 +694,7 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int
// and composite that buffer as the mask.
// We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering
// before pushing the transparency layer.
- for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) {
+ for (const FillLayer* fillLayer = maskLayers->next(); fillLayer; fillLayer = fillLayer->next()) {
if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) {
pushTransparencyLayer = true;
// We found one image that can be used in rendering, exit the loop
@@ -695,8 +711,10 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int
}
}
- paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, compositeOp);
- paintNinePieceImage(paintInfo.context, tx, ty, w, h, style(), style()->maskBoxImage(), compositeOp);
+ if (allMaskImagesLoaded) {
+ paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, compositeOp);
+ paintNinePieceImage(paintInfo.context, tx, ty, w, h, style(), style()->maskBoxImage(), compositeOp);
+ }
if (pushTransparencyLayer)
paintInfo.context->endTransparencyLayer();
diff --git a/WebCore/rendering/style/FillLayer.cpp b/WebCore/rendering/style/FillLayer.cpp
index ec910c9..597e919 100644
--- a/WebCore/rendering/style/FillLayer.cpp
+++ b/WebCore/rendering/style/FillLayer.cpp
@@ -270,4 +270,15 @@ bool FillLayer::containsImage(StyleImage* s) const
return false;
}
+bool FillLayer::imagesAreLoaded() const
+{
+ const FillLayer* curr;
+ for (curr = this; curr; curr = curr->next()) {
+ if (curr->m_image && !curr->m_image->isLoaded())
+ return false;
+ }
+
+ return true;
+}
+
} // namespace WebCore
diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h
index 9c615b4..cef6b19 100644
--- a/WebCore/rendering/style/FillLayer.h
+++ b/WebCore/rendering/style/FillLayer.h
@@ -126,6 +126,7 @@ public:
}
bool containsImage(StyleImage*) const;
+ bool imagesAreLoaded() const;
bool hasImage() const
{
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list