<!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>[187298] branches/safari-601.1-branch</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/187298">187298</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2015-07-23 23:27:40 -0700 (Thu, 23 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/187116">r187116</a>.  rdar://problem/21110936</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsChangeLog">branches/safari-601.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorerenderingRenderBoxModelObjectcpp">branches/safari-601.1-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorerenderingRenderLayerBackingcpp">branches/safari-601.1-branch/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverexpectedhtml">branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverhtml">branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalexpectedhtml">branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalhtml">branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (187297 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-24 06:24:35 UTC (rev 187297)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2015-07-23  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187116
+
+    2015-07-21  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
+            https://bugs.webkit.org/show_bug.cgi?id=147049
+            &lt;rdar://problem/21110936&gt;
+
+            Reviewed by Simon Fraser.
+
+            fixedLayoutSize background-image rendering for root and non-root elements.
+
+            * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html: Added.
+            * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html: Added.
+            * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html: Added.
+            * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html: Added.
+
+2015-07-23  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r186994
</span><span class="cx"> 
</span><span class="cx">     2015-07-18  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverexpectedhtmlfromrev187116trunkLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html (from rev 187116, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html) (0 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+  body {
+    margin: 0;
+  }
+  .container {
+    height: 2000px;
+    overflow: hidden;
+    width: 50%;
+    height: 50%;
+    background-image: url('resources/green-blue.png');
+    background-attachment: fixed;
+    background-repeat: no-repeat;
+    background-size: 300px;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;div class=&quot;container&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverhtmlfromrev187116trunkLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentcoverhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html (from rev 187116, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html) (0 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+  body {
+    margin: 0;
+    height: 2000px;
+    overflow: hidden;
+    background: url('resources/green-blue.png') white;
+    background-attachment: fixed;
+    background-size: contain;
+    background-repeat: no-repeat;
+  }
+&lt;/style&gt;
+&lt;script&gt;
+  function runTest() {
+    if (window.internals) {
+      window.internals.setFixedLayoutSize(800, 600);
+      window.internals.setPageScaleFactor(0.5, 0, 0);
+      window.internals.setUseFixedLayout(true);
+    }
+  }
+  window.addEventListener('load', runTest, false);
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalexpectedhtmlfromrev187116trunkLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html (from rev 187116, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html) (0 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+  body {
+    margin: 0;
+  }
+  .container {
+    height: 2000px;
+    overflow: hidden;
+    width: 50%;
+    height: 50%;
+    background-image: url('resources/green-blue.png');
+    background-attachment: fixed;
+    background-repeat: no-repeat;
+    background-size: 300px;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;div class=&quot;container&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalhtmlfromrev187116trunkLayoutTestsplatformmacwk2tileddrawingfixedlayoutsizefixedattachmentlocalhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html (from rev 187116, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html) (0 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    html {
+      background: white;
+    }
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+      background: url(resources/green-blue.png);
+      background-attachment: fixed;
+      background-size: contain;
+      background-repeat: no-repeat;
+    }
+  &lt;/style&gt;
+  &lt;script&gt;
+  function runTest() {
+    if (window.internals) {
+      window.internals.setFixedLayoutSize(800, 600);
+      window.internals.setPageScaleFactor(0.5, 0, 0);
+      window.internals.setUseFixedLayout(true);
+    }
+  }
+  window.addEventListener('load', runTest, false);
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187297 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-24 06:24:35 UTC (rev 187297)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -1,5 +1,48 @@
</span><span class="cx"> 2015-07-23  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187116
+
+    2015-07-21  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
+            https://bugs.webkit.org/show_bug.cgi?id=147049
+            &lt;rdar://problem/21110936&gt;
+
+            Reviewed by Simon Fraser.
+
+            The fixed-attached background-image rendering is special. In general, to
+            display it, the destinationSize should be set to visibleContentSize. The
+            destinationLocation should be set such that the background-image does
+            not move with scrolling. The topContentInset should be subtracted from
+            the destinationLocation such that background-image can be rendered blurred
+            in the topContentArea. However there are cases in which these rules have to
+            be changed.
+
+            -- destinationSize: In the case of fixed layout size, the fixedLayoutSize
+            is bigger than the visibleContentSize. In this case, if the background-image
+            belongs to the root element, the destinationSize has to be set to fixedLayoutSize.
+            Otherwise it has to be set to the borderBoxSize unless the overflow is
+            hidden.
+
+            -- destinationLocation: If the background-image belongs to the root element, no
+            scroll offset to added to destinationLocation. For non-root element case,
+            FrameView::documentScrollOffsetRelativeToViewOrigin() should be used if no page
+            scaling is applied. Otherwise FrameView::scrollOffsetForFixedPosition() should be
+            used instead.
+
+            Tests: platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html
+                   platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html
+
+            * rendering/RenderBoxModelObject.cpp:
+            (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ensure
+            the geometry for the fixed-attached background-image is calculated correctly.
+
+            * rendering/RenderLayerBacking.cpp:
+            (WebCore::RenderLayerBacking::updateGeometry): Ensure the background layer
+            gets the correct size for the fixedLayoutSize mode.
+
+2015-07-23  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r186981
</span><span class="cx"> 
</span><span class="cx">     2015-07-17  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp (187297 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-07-24 06:24:35 UTC (rev 187297)
+++ branches/safari-601.1-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -1115,13 +1115,32 @@
</span><span class="cx">             viewportRect = view().unscaledDocumentRect();
</span><span class="cx">         else {
</span><span class="cx">             FrameView&amp; frameView = view().frameView();
</span><del>-            viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
-            topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
</del><ins>+            bool useFixedLayout = frameView.useFixedLayout() &amp;&amp; !frameView.fixedLayoutSize().isEmpty();
</ins><span class="cx"> 
</span><del>-            if (fixedBackgroundPaintsInLocalCoordinates())
-                viewportRect.setLocation(LayoutPoint(0, -topContentInset));
-            else
</del><ins>+            if (useFixedLayout) {
+                // Use the fixedLayoutSize() when useFixedLayout() because the rendering will scale
+                // down the frameView to to fit in the current viewport.
+                viewportRect.setSize(frameView.fixedLayoutSize());
+            } else
+                viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
+
+            if (fixedBackgroundPaintsInLocalCoordinates()) {
+                if (!useFixedLayout) {
+                    // Shifting location up by topContentInset is needed for layout tests which expect
+                    // layout to be shifted down when calling window.internals.setTopContentInset().
+                    topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
+                    viewportRect.setLocation(LayoutPoint(0, -topContentInset));
+                }
+            } else if (useFixedLayout || frameView.frameScaleFactor() != 1) {
+                // scrollOffsetForFixedPosition() is adjusted for page scale and it does not include
+                // topContentInset so do not add it to the calculation below.
+                viewportRect.setLocation(toLayoutPoint(frameView.scrollOffsetForFixedPosition()));
+            } else {
+                // documentScrollOffsetRelativeToViewOrigin() includes -topContentInset in its height
+                // so we need to account for that in calculating the phase size
+                topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
</ins><span class="cx">                 viewportRect.setLocation(toLayoutPoint(frameView.documentScrollOffsetRelativeToViewOrigin()));
</span><ins>+            }
</ins><span class="cx"> 
</span><span class="cx">             top += topContentInset;
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (187297 => 187298)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-07-24 06:24:35 UTC (rev 187297)
+++ branches/safari-601.1-branch/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-07-24 06:27:40 UTC (rev 187298)
</span><span class="lines">@@ -925,7 +925,7 @@
</span><span class="cx">         if (backgroundLayerPaintsFixedRootBackground()) {
</span><span class="cx">             const FrameView&amp; frameView = renderer().view().frameView();
</span><span class="cx">             backgroundPosition = toLayoutPoint(frameView.scrollOffsetForFixedPosition());
</span><del>-            backgroundSize = frameView.visibleContentRect().size();
</del><ins>+            backgroundSize = frameView.layoutSize();
</ins><span class="cx">         }
</span><span class="cx">         m_backgroundLayer-&gt;setPosition(backgroundPosition);
</span><span class="cx">         m_backgroundLayer-&gt;setSize(backgroundSize);
</span></span></pre>
</div>
</div>

</body>
</html>