<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160873] branches/safari-537.74-branch/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160873">160873</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2013-12-19 16:23:43 -0800 (Thu, 19 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/159463">r159463</a>: &lt;rdar://problems/15701094&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53774branchSourceWebCoreChangeLog">branches/safari-537.74-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53774branchSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#branchessafari53774branchSourceWebCoreplatformgraphicscaGraphicsLayerCAh">branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h</a></li>
<li><a href="#branchessafari53774branchSourceWebCorerenderingRenderLayerBackingcpp">branches/safari-537.74-branch/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53774branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-537.74-branch/Source/WebCore/ChangeLog (160872 => 160873)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.74-branch/Source/WebCore/ChangeLog        2013-12-20 00:22:50 UTC (rev 160872)
+++ branches/safari-537.74-branch/Source/WebCore/ChangeLog        2013-12-20 00:23:43 UTC (rev 160873)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+ 2013-12-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r159463: &lt;rdar://problems/15701094&gt;
+
+    2013-11-18  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+            At some scales, opaque compositing layers have garbage pixels around the edges
+            â€‹https://bugs.webkit.org/show_bug.cgi?id=124541
+
+            Reviewed by Dean Jackson.
+
+            Layers get marked as having opaque contents when their background is
+            known to paint the entire layer. However, this failed to take into
+            account two reasons why every pixel may not get painted.
+
+            First, subpixel layout can result in non-integral RenderLayer
+            bounds, which will get rounded up to an integral GraphicsLayer
+            size. When this happens we may not paint edge pixels.
+
+            Second, at non-integral scale factors, graphics context scaling
+            may cause us to not paint edge pixels.
+
+            Fix by only marking PlatformCALayers as having opaque contents
+            when the contentsScale of the layer is integral.
+
+            Not testable, because we can't guarantee to get garbage pixels
+            in a ref test, and layer dumps show GraphicsLayer's notion of
+            content opaqueness, not the one we set on the PlatformCALayer.
+
+            * platform/graphics/ca/GraphicsLayerCA.cpp:
+            (WebCore::isIntegral):
+            (WebCore::clampedContentsScaleForScale):
+            (WebCore::GraphicsLayerCA::updateRootRelativeScale):
+            (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+            (WebCore::GraphicsLayerCA::updateContentsOpaque):
+            (WebCore::GraphicsLayerCA::getTransformFromAnimationsWithMaxScaleImpact):
+            Drive-by typo fix.
+            (WebCore::GraphicsLayerCA::noteChangesForScaleSensitiveProperties):
+            * platform/graphics/ca/GraphicsLayerCA.h:
+            * rendering/RenderLayerBacking.cpp:
+            (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+
</ins><span class="cx"> 2013-12-19  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r160791: &lt;rdar://problems/15694289&gt;
</span></span></pre></div>
<a id="branchessafari53774branchSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (160872 => 160873)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2013-12-20 00:22:50 UTC (rev 160872)
+++ branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2013-12-20 00:23:43 UTC (rev 160873)
</span><span class="lines">@@ -66,6 +66,20 @@
</span><span class="cx"> // of 250ms. So send a very small value instead.
</span><span class="cx"> static const float cAnimationAlmostZeroDuration = 1e-3f;
</span><span class="cx"> 
</span><ins>+static inline bool isIntegral(float value)
+{
+    return static_cast&lt;int&gt;(value) == value;
+}
+
+static float clampedContentsScaleForScale(float scale)
+{
+    // Define some limits as a sanity check for the incoming scale value
+    // those too small to see.
+    const float maxScale = 10.0f;
+    const float minScale = 0.01f;
+    return std::max(minScale, std::min(scale, maxScale));
+}
+
</ins><span class="cx"> static bool isTransformTypeTransformationMatrix(TransformOperation::OperationType transformType)
</span><span class="cx"> {
</span><span class="cx">     switch (transformType) {
</span><span class="lines">@@ -1178,8 +1192,9 @@
</span><span class="cx">     if (m_uncommittedChanges &amp; ContentsVisibilityChanged)
</span><span class="cx">         updateContentsVisibility();
</span><span class="cx"> 
</span><ins>+    // Note that contentsScale can affect whether the layer can be opaque.
</ins><span class="cx">     if (m_uncommittedChanges &amp; ContentsOpaqueChanged)
</span><del>-        updateContentsOpaque();
</del><ins>+        updateContentsOpaque(pageScaleFactor);
</ins><span class="cx"> 
</span><span class="cx">     if (m_uncommittedChanges &amp; BackfaceVisibilityChanged)
</span><span class="cx">         updateBackfaceVisibility();
</span><span class="lines">@@ -1436,14 +1451,21 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsLayerCA::updateContentsOpaque()
</del><ins>+void GraphicsLayerCA::updateContentsOpaque(float pageScaleFactor)
</ins><span class="cx"> {
</span><del>-    m_layer-&gt;setOpaque(m_contentsOpaque);
</del><ins>+    bool contentsOpaque = m_contentsOpaque;
+    if (contentsOpaque) {
+        float contentsScale = clampedContentsScaleForScale(pageScaleFactor * deviceScaleFactor());
+        if (!isIntegral(contentsScale))
+            contentsOpaque = false;
+    }
+    
+    m_layer-&gt;setOpaque(contentsOpaque);
</ins><span class="cx"> 
</span><span class="cx">     if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><span class="cx">         LayerMap::const_iterator end = layerCloneMap-&gt;end();
</span><span class="cx">         for (LayerMap::const_iterator it = layerCloneMap-&gt;begin(); it != end; ++it)
</span><del>-            it-&gt;value-&gt;setOpaque(m_contentsOpaque);
</del><ins>+            it-&gt;value-&gt;setOpaque(contentsOpaque);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2569,15 +2591,6 @@
</span><span class="cx">     return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayerClones.get() : primaryLayerClones();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static float clampedContentsScaleForScale(float scale)
-{
-    // Define some limits as a sanity check for the incoming scale value
-    // those too small to see.
-    const float maxScale = 10.0f;
-    const float minScale = 0.01f;
-    return max(minScale, min(scale, maxScale));
-}
-
</del><span class="cx"> void GraphicsLayerCA::updateContentsScale(float pageScaleFactor)
</span><span class="cx"> {
</span><span class="cx">     float contentsScale = clampedContentsScaleForScale(pageScaleFactor * deviceScaleFactor());
</span><span class="lines">@@ -2995,14 +3008,9 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsLayerCA::noteChangesForScaleSensitiveProperties()
</span><span class="cx"> {
</span><del>-    noteLayerPropertyChanged(GeometryChanged | ContentsScaleChanged);
</del><ins>+    noteLayerPropertyChanged(GeometryChanged | ContentsScaleChanged | ContentsOpaqueChanged);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool isIntegral(float value)
-{
-    return static_cast&lt;int&gt;(value) == value;
-}
-
</del><span class="cx"> void GraphicsLayerCA::computePixelAlignment(float pageScaleFactor, const FloatPoint&amp; positionRelativeToBase,
</span><span class="cx">     FloatPoint&amp; position, FloatSize&amp; size, FloatPoint3D&amp; anchorPoint, FloatSize&amp; alignmentOffset) const
</span><span class="cx"> {
</span></span></pre></div>
<a id="branchessafari53774branchSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (160872 => 160873)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2013-12-20 00:22:50 UTC (rev 160872)
+++ branches/safari-537.74-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2013-12-20 00:23:43 UTC (rev 160873)
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx">     void updateChildrenTransform();
</span><span class="cx">     void updateMasksToBounds();
</span><span class="cx">     void updateContentsVisibility();
</span><del>-    void updateContentsOpaque();
</del><ins>+    void updateContentsOpaque(float pageScaleFactor);
</ins><span class="cx">     void updateBackfaceVisibility();
</span><span class="cx">     void updateStructuralLayer();
</span><span class="cx">     void updateLayerDrawsContent();
</span></span></pre></div>
<a id="branchessafari53774branchSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.74-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (160872 => 160873)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.74-branch/Source/WebCore/rendering/RenderLayerBacking.cpp        2013-12-20 00:22:50 UTC (rev 160872)
+++ branches/safari-537.74-branch/Source/WebCore/rendering/RenderLayerBacking.cpp        2013-12-20 00:23:43 UTC (rev 160873)
</span><span class="lines">@@ -647,7 +647,8 @@
</span><span class="cx">         ancestorCompositingBounds = pixelSnappedIntRect(compAncestor-&gt;backing()-&gt;compositedBounds());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
</del><ins>+    LayoutRect localRawCompositingBounds = compositedBounds();
+    IntRect localCompositingBounds = pixelSnappedIntRect(localRawCompositingBounds);
</ins><span class="cx"> 
</span><span class="cx">     IntRect relativeCompositingBounds(localCompositingBounds);
</span><span class="cx">     IntPoint delta;
</span><span class="lines">@@ -714,7 +715,8 @@
</span><span class="cx">     if (!m_isMainFrameRenderViewLayer) {
</span><span class="cx">         // For non-root layers, background is always painted by the primary graphics layer.
</span><span class="cx">         ASSERT(!m_backgroundLayer);
</span><del>-        m_graphicsLayer-&gt;setContentsOpaque(m_owningLayer-&gt;backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
</del><ins>+        bool hadSubpixelRounding = LayoutSize(relativeCompositingBounds.size()) != localRawCompositingBounds.size();
+        m_graphicsLayer-&gt;setContentsOpaque(!hadSubpixelRounding &amp;&amp; m_owningLayer-&gt;backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // If we have a layer that clips children, position it.
</span></span></pre>
</div>
</div>

</body>
</html>