- Revision
- 132982
- Author
- [email protected]
- Date
- 2012-10-30 22:03:52 -0700 (Tue, 30 Oct 2012)
Log Message
Fix issues with filters and reflections
https://bugs.webkit.org/show_bug.cgi?id=100308
Reviewed by Dirk Schulze.
Source/WebCore:
Composited filters were being applied to the wrong CALayer. The code used
primaryLayer(), which may be a CATransformLayer (which filters cannot apply
to; doing so causes console spew), or a CALayer that is used for reflection
flattening, which again is the wrong layer.
Test: css3/filters/composited-reflected.html
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsVisibility): Replace .get()-> with ->
(WebCore::GraphicsLayerCA::updateContentsOpaque): Ditto.
(WebCore::GraphicsLayerCA::updateFilters): Apply filters to m_layer, not primaryLayer(),
and use m_layerClones, not primaryLayerClones().
(WebCore::GraphicsLayerCA::cloneLayer): When cloning a layer for reflections, copy filters
from the source layer.
* platform/graphics/ca/PlatformCALayer.h:
(PlatformCALayer): Add a member function to copy filters from a supplied layer.
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::setFilters): Remove blank line.
(PlatformCALayer::copyFiltersFrom): Copy CAFIlters from the given layer.
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayer::copyFiltersFrom): Stub; no filters on Windows.
LayoutTests:
Test composited filters inside a nested reflection.
* css3/filters/composited-reflected-expected.png: Added.
* css3/filters/composited-reflected-expected.txt: Added.
* css3/filters/composited-reflected.html: Added.
* platform/mac/css3/filters/composited-reflected-expected.png: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (132981 => 132982)
--- trunk/LayoutTests/ChangeLog 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/LayoutTests/ChangeLog 2012-10-31 05:03:52 UTC (rev 132982)
@@ -1,3 +1,17 @@
+2012-10-30 Simon Fraser <[email protected]>
+
+ Fix issues with filters and reflections
+ https://bugs.webkit.org/show_bug.cgi?id=100308
+
+ Reviewed by Dirk Schulze.
+
+ Test composited filters inside a nested reflection.
+
+ * css3/filters/composited-reflected-expected.png: Added.
+ * css3/filters/composited-reflected-expected.txt: Added.
+ * css3/filters/composited-reflected.html: Added.
+ * platform/mac/css3/filters/composited-reflected-expected.png: Added.
+
2012-10-30 Kenichi Ishibashi <[email protected]>
Unreviewed test expectations update
Added: trunk/LayoutTests/css3/filters/composited-reflected-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/css3/filters/composited-reflected-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/css3/filters/composited-reflected-expected.txt (0 => 132982)
--- trunk/LayoutTests/css3/filters/composited-reflected-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/filters/composited-reflected-expected.txt 2012-10-31 05:03:52 UTC (rev 132982)
@@ -0,0 +1 @@
+
Added: trunk/LayoutTests/css3/filters/composited-reflected.html (0 => 132982)
--- trunk/LayoutTests/css3/filters/composited-reflected.html (rev 0)
+++ trunk/LayoutTests/css3/filters/composited-reflected.html 2012-10-31 05:03:52 UTC (rev 132982)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 240px;
+ width: 300px;
+ border: 1px solid black;
+ -webkit-box-reflect: below 10px;
+ }
+ .box {
+ margin: 10px;
+ height: 100px;
+ width: 200px;
+ -webkit-filter: sepia(1);
+ -webkit-transform: translateZ(1px); /* Use composited filters */
+ -webkit-box-reflect: below 10px;
+ }
+
+ </style>
+ <script type="text/_javascript_">
+ if (window.testRunner) {
+ testRunner.dumpAsText(true);
+ }
+ </script>
+</head>
+<body>
+
+<div class="container">
+ <div class="sepia box">
+ <img src=""
+ </div>
+</div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (132981 => 132982)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 05:03:52 UTC (rev 132982)
@@ -1,3 +1,32 @@
+2012-10-30 Simon Fraser <[email protected]>
+
+ Fix issues with filters and reflections
+ https://bugs.webkit.org/show_bug.cgi?id=100308
+
+ Reviewed by Dirk Schulze.
+
+ Composited filters were being applied to the wrong CALayer. The code used
+ primaryLayer(), which may be a CATransformLayer (which filters cannot apply
+ to; doing so causes console spew), or a CALayer that is used for reflection
+ flattening, which again is the wrong layer.
+
+ Test: css3/filters/composited-reflected.html
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateContentsVisibility): Replace .get()-> with ->
+ (WebCore::GraphicsLayerCA::updateContentsOpaque): Ditto.
+ (WebCore::GraphicsLayerCA::updateFilters): Apply filters to m_layer, not primaryLayer(),
+ and use m_layerClones, not primaryLayerClones().
+ (WebCore::GraphicsLayerCA::cloneLayer): When cloning a layer for reflections, copy filters
+ from the source layer.
+ * platform/graphics/ca/PlatformCALayer.h:
+ (PlatformCALayer): Add a member function to copy filters from a supplied layer.
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayer::setFilters): Remove blank line.
+ (PlatformCALayer::copyFiltersFrom): Copy CAFIlters from the given layer.
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ (PlatformCALayer::copyFiltersFrom): Stub; no filters on Windows.
+
2012-10-30 Beth Dakin <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=100809
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (132981 => 132982)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-10-31 05:03:52 UTC (rev 132982)
@@ -1349,7 +1349,7 @@
if (m_drawsContent)
m_layer->setNeedsDisplay();
} else {
- m_layer.get()->setContents(0);
+ m_layer->setContents(0);
if (LayerMap* layerCloneMap = m_layerClones.get()) {
LayerMap::const_iterator end = layerCloneMap->end();
@@ -1361,7 +1361,7 @@
void GraphicsLayerCA::updateContentsOpaque()
{
- m_layer.get()->setOpaque(m_contentsOpaque);
+ m_layer->setOpaque(m_contentsOpaque);
if (LayerMap* layerCloneMap = m_layerClones.get()) {
LayerMap::const_iterator end = layerCloneMap->end();
@@ -1394,9 +1394,9 @@
#if ENABLE(CSS_FILTERS)
void GraphicsLayerCA::updateFilters()
{
- primaryLayer()->setFilters(m_filters);
+ m_layer->setFilters(m_filters);
- if (LayerMap* layerCloneMap = primaryLayerClones()) {
+ if (LayerMap* layerCloneMap = m_layerClones.get()) {
LayerMap::const_iterator end = layerCloneMap->end();
for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
if (m_replicaLayer && isReplicatedRootClone(it->key))
@@ -2834,6 +2834,7 @@
newLayer->setOpaque(layer->isOpaque());
newLayer->setBackgroundColor(layer->backgroundColor());
newLayer->setContentsScale(layer->contentsScale());
+ newLayer->copyFiltersFrom(layer);
if (cloneLevel == IntermediateCloneLevel) {
newLayer->setOpacity(layer->opacity());
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (132981 => 132982)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-10-31 05:03:52 UTC (rev 132982)
@@ -189,6 +189,7 @@
#if ENABLE(CSS_FILTERS)
void setFilters(const FilterOperations&);
static bool filtersCanBeComposited(const FilterOperations&);
+ void copyFiltersFrom(const PlatformCALayer*);
#endif
String name() const;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (132981 => 132982)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-10-31 05:03:52 UTC (rev 132982)
@@ -715,7 +715,6 @@
[m_layer.get() setShadowRadius:op->stdDeviation()];
[m_layer.get() setShadowOpacity:1];
-
break;
}
case FilterOperation::GRAYSCALE: {
@@ -838,6 +837,13 @@
END_BLOCK_OBJC_EXCEPTIONS
}
+void PlatformCALayer::copyFiltersFrom(const PlatformCALayer* sourceLayer)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [m_layer.get() setFilters:[sourceLayer->platformLayer() filters]];
+ END_BLOCK_OBJC_EXCEPTIONS
+}
+
bool PlatformCALayer::filtersCanBeComposited(const FilterOperations& filters)
{
// Return false if there are no filters to avoid needless work
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (132981 => 132982)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-10-31 04:54:56 UTC (rev 132981)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-10-31 05:03:52 UTC (rev 132982)
@@ -568,6 +568,10 @@
{
}
+void PlatformCALayer::copyFiltersFrom(const PlatformCALayer*)
+{
+}
+
bool PlatformCALayer::filtersCanBeComposited(const FilterOperations&)
{
return false;