[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:26:32 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 88cfc10d83af73e5a4ae7b00e12efecfc3760dd9
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jan 24 17:47:20 2010 +0000
2010-01-23 Simon Fraser <simon.fraser at apple.com>
Reviewed by Darin Adler.
Video that loads inside reflection doesn't get reflected
https://bugs.webkit.org/show_bug.cgi?id=34046
ensureCloneLayers() made an incorrect assumption that if a clone of the primaryLayer
exists already, then the structural layer and content layer can just be returned.
However, this doesn't account for the situation where a content layer may have
been create after the clone tree was last updated.
Fix by always creating the structural and clone layers on demand.
Test: compositing/reflections/load-video-in-reflection.html
* platform/graphics/mac/GraphicsLayerCA.h: Added utility method, findOrMakeClone().
* platform/graphics/mac/GraphicsLayerCA.mm:
(WebCore::GraphicsLayerCA::findOrMakeClone): Utility that efficiently finds
or creates a layer in a LayerMap.
(WebCore::GraphicsLayerCA::ensureCloneLayers): Always look for or clone the
structural and content layers, rather than relying on whether there's a primary
layer clone already.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 306bb2e..7b32abe 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-23 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Video that loads inside reflection doesn't get reflected
+ https://bugs.webkit.org/show_bug.cgi?id=34046
+
+ Testcase for a video loading inside a reflection.
+
+ * compositing/reflections/load-video-in-reflection.html: Added.
+ * platform/mac/compositing/reflections/load-video-in-reflection-expected.checksum: Added.
+ * platform/mac/compositing/reflections/load-video-in-reflection-expected.png: Added.
+ * platform/mac/compositing/reflections/load-video-in-reflection-expected.txt: Added.
+
2010-01-23 Oliver Hunt <oliver at apple.com>
Reviewed by Maciej Stachowiak.
diff --git a/LayoutTests/compositing/reflections/load-video-in-reflection.html b/LayoutTests/compositing/reflections/load-video-in-reflection.html
new file mode 100644
index 0000000..658e7a5
--- /dev/null
+++ b/LayoutTests/compositing/reflections/load-video-in-reflection.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style type="text/css" media="screen">
+
+ .container {
+ width: 300px;
+ -webkit-animation: spin 18s infinite linear;
+ }
+
+ video {
+ -webkit-box-reflect: below;
+ background-color: red;
+ }
+
+ @-webkit-keyframes spin {
+ from { -webkit-transform: rotate(0); }
+ to { -webkit-transform: rotate(0); }
+ }
+
+ </style>
+ <script type="text/javascript" charset="utf-8">
+
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+ function videoLoaded()
+ {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+
+ function runTest()
+ {
+ var video = document.getElementsByTagName('video')[0];
+ video.addEventListener('canplaythrough', videoLoaded, false);
+
+ window.setTimeout(function() {
+ video.src= "../resources/video.mp4"
+ }, 100);
+ }
+
+ window.addEventListener('load', runTest, false)
+ </script>
+</head>
+<body>
+ <p>You should see a reflected video below, rather than the red video background.</p>
+ <div class="container">
+ <video></video>
+ </div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.checksum b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.checksum
new file mode 100644
index 0000000..b83cdc8
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.checksum
@@ -0,0 +1 @@
+d4e4de9030019f1a5f9cace07fec130e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.png b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.png
new file mode 100644
index 0000000..2852454
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.txt b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.txt
new file mode 100644
index 0000000..c965887
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/reflections/load-video-in-reflection-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x350
+ RenderBlock {HTML} at (0,0) size 800x350
+ RenderBody {BODY} at (8,16) size 784x326
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 328x18
+ text run at (0,0) width 328: "You should see a reflected video below, and no red."
+layer at (8,50) size 352x292
+ RenderBlock {DIV} at (0,34) size 300x292
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,50) size 352x288
+ RenderVideo {VIDEO} at (0,0) size 352x288 [bgcolor=#FF0000]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a37371f..f5a3ea1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-01-23 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Video that loads inside reflection doesn't get reflected
+ https://bugs.webkit.org/show_bug.cgi?id=34046
+
+ ensureCloneLayers() made an incorrect assumption that if a clone of the primaryLayer
+ exists already, then the structural layer and content layer can just be returned.
+ However, this doesn't account for the situation where a content layer may have
+ been create after the clone tree was last updated.
+
+ Fix by always creating the structural and clone layers on demand.
+
+ Test: compositing/reflections/load-video-in-reflection.html
+
+ * platform/graphics/mac/GraphicsLayerCA.h: Added utility method, findOrMakeClone().
+ * platform/graphics/mac/GraphicsLayerCA.mm:
+ (WebCore::GraphicsLayerCA::findOrMakeClone): Utility that efficiently finds
+ or creates a layer in a LayerMap.
+ (WebCore::GraphicsLayerCA::ensureCloneLayers): Always look for or clone the
+ structural and content layers, rather than relying on whether there's a primary
+ layer clone already.
+
2010-01-23 Oliver Hunt <oliver at apple.com>
Reviewed by Maciej Stachowiak.
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
index b811984..bd14e55 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
@@ -228,8 +228,11 @@ private:
enum CloneLevel { RootCloneLevel, IntermediateCloneLevel };
CALayer *fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaState&, CloneLevel);
- void ensureCloneLayers(CloneID index, CALayer *& primaryLayer, CALayer *& structuralLayer, CALayer *& contentsLayer, CloneLevel);
+
CALayer *cloneLayer(CALayer *, CloneLevel);
+ CALayer *findOrMakeClone(CloneID, CALayer *, LayerMap*, CloneLevel);
+
+ void ensureCloneLayers(CloneID index, CALayer *& primaryLayer, CALayer *& structuralLayer, CALayer *& contentsLayer, CloneLevel);
bool hasCloneLayers() const { return m_layerClones; }
void removeCloneLayers();
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index a097972..27cf628 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -2244,6 +2244,31 @@ void GraphicsLayerCA::setupContentsLayer(CALayer* contentsLayer)
}
}
+CALayer *GraphicsLayerCA::findOrMakeClone(CloneID cloneID, CALayer *sourceLayer, LayerMap* clones, CloneLevel cloneLevel)
+{
+ if (!sourceLayer)
+ return 0;
+
+ CALayer *resultLayer;
+
+ // Add with a dummy value to get an iterator for the insertion position, and a boolean that tells
+ // us whether there's an item there. This technique avoids two hash lookups.
+ RetainPtr<CALayer> dummy;
+ pair<LayerMap::iterator, bool> addResult = clones->add(cloneID, dummy);
+ if (!addResult.second) {
+ // Value was not added, so it exists already.
+ resultLayer = addResult.first->second.get();
+ } else {
+ resultLayer = cloneLayer(sourceLayer, cloneLevel);
+#ifndef NDEBUG
+ [resultLayer setName:[NSString stringWithFormat:@"Clone %d of layer %@", cloneID[0U], sourceLayer]];
+#endif
+ addResult.first->second = resultLayer;
+ }
+
+ return resultLayer;
+}
+
void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, CALayer *& primaryLayer, CALayer *& structuralLayer, CALayer *& contentsLayer, CloneLevel cloneLevel)
{
structuralLayer = nil;
@@ -2258,44 +2283,9 @@ void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, CALayer *& primaryLayer
if (!m_contentsLayerClones && m_contentsLayer)
m_contentsLayerClones = new LayerMap;
- // If we have the layers already, return them.
- LayerMap::const_iterator it = m_layerClones->find(cloneID);
- LayerMap::const_iterator end = m_layerClones->end();
- if (it != end) {
- primaryLayer = it->second.get();
-
- if (m_structuralLayerClones)
- structuralLayer = m_structuralLayerClones->get(cloneID).get();
-
- if (m_contentsLayerClones)
- contentsLayer = m_contentsLayerClones->get(cloneID).get();
-
- return;
- }
-
- // Create clones of the primary layer, and the structural and contents layers if we have them.
- primaryLayer = cloneLayer(m_layer.get(), cloneLevel);
-
-#ifndef NDEBUG
- [primaryLayer setName:[NSString stringWithFormat:@"Clone %d of layer %@", cloneID[0U], m_layer.get()]];
-#endif
- m_layerClones->set(cloneID, primaryLayer);
-
- if (m_structuralLayer) {
- structuralLayer = cloneLayer(m_structuralLayer.get(), cloneLevel);
-#ifndef NDEBUG
- [structuralLayer setName:[NSString stringWithFormat:@"Clone %d of layer %@", cloneID[0U], m_structuralLayer.get()]];
-#endif
- m_structuralLayerClones->set(cloneID, structuralLayer);
- }
-
- if (m_contentsLayer) {
- contentsLayer = cloneLayer(m_contentsLayer.get(), cloneLevel);
-#ifndef NDEBUG
- [contentsLayer setName:[NSString stringWithFormat:@"Clone %d of layer %@", cloneID[0U], m_contentsLayer.get()]];
-#endif
- m_contentsLayerClones->set(cloneID, contentsLayer);
- }
+ primaryLayer = findOrMakeClone(cloneID, m_layer.get(), m_layerClones.get(), cloneLevel);
+ structuralLayer = findOrMakeClone(cloneID, m_structuralLayer.get(), m_structuralLayerClones.get(), cloneLevel);
+ contentsLayer = findOrMakeClone(cloneID, m_contentsLayer.get(), m_contentsLayerClones.get(), cloneLevel);
}
void GraphicsLayerCA::removeCloneLayers()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list