<!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>[188082] 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/188082">188082</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2015-08-06 16:22:38 -0700 (Thu, 06 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/187930">r187930</a>. rdar://problem/21870332</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="#branchessafari6011branchSourceWebCorepagemacEventHandlerMacmm">branches/safari-601.1-branch/Source/WebCore/page/mac/EventHandlerMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacfastscrollingresourcesbackgroundhtml">branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/resources/background.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacfastscrollingscrolldivwithnestednonscrollableiframeexpectedtxt">branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacfastscrollingscrolldivwithnestednonscrollableiframehtml">branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.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 (188081 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-08-06 23:21:04 UTC (rev 188081)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2015-08-06  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187930. rdar://problem/21870332
+
+    2015-08-04  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            REGRESSION (r173784): [Mac] Correct latching error for non-scrollable iframe nested inside scrollable div.
+            https://bugs.webkit.org/show_bug.cgi?id=147668
+            &lt;rdar://problem/21870332&gt;
+
+            Reviewed by Simon Fraser.
+
+            * platform/mac/fast/scrolling/resources/background.html: Added.
+            * platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe-expected.txt: Added.
+            * platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.html: Added.
+
+2015-08-06  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merge r187886. rdar://problem/15779101
</span><span class="cx"> 
</span><span class="cx">     2015-08-04  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacfastscrollingresourcesbackgroundhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/resources/background.html (0 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/resources/background.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/resources/background.html        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+    div {
+        position: relative;
+        width: 400px;
+        height: 2000px;
+        padding: 0;
+        background-image: repeating-linear-gradient(to bottom, white, silver 200px);
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div&gt;This content is displayed in an iframe. The iframe should be sized such that it does not need to scroll.&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacfastscrollingscrolldivwithnestednonscrollableiframeexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe-expected.txt (0 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe-expected.txt        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Put mouse inside the iframe (below) and flick downwards
+
+Tests that iframe does scroll when inner iframe is NOT scrollable.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS div did scroll.
+PASS Page did NOT scroll.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacfastscrollingscrolldivwithnestednonscrollableiframehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.html (0 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.html        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -0,0 +1,118 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent&quot;&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+var divTarget;
+var pageScrollPositionBefore;
+var divScrollPositionBefore;
+
+var continueCount = 5;
+
+function locationInWindowCoordinates(element)
+{
+    var position = {};
+    position.x = element.offsetLeft;
+    position.y = element.offsetTop;
+
+    while (element.offsetParent) {
+        position.x = position.x + element.offsetParent.offsetLeft;
+        position.y = position.y + element.offsetParent.offsetTop;
+        if (element == document.getElementsByTagName(&quot;body&quot;)[0])
+            break;
+
+        element = element.offsetParent;
+    }
+
+    return position;
+}
+
+function finishTest()
+{
+    finishJSTest();
+    testRunner.notifyDone();            
+}
+
+function checkForScroll() {
+    var pageScrollPositionAfter = document.body.scrollTop;
+    var divScrollPositionAfter = divTarget.scrollTop;
+
+    if (divScrollPositionBefore != divScrollPositionAfter)
+        testPassed(&quot;div did scroll.&quot;);
+    else
+        testFailed(&quot;div did NOT scroll.&quot;);
+
+    if (pageScrollPositionBefore == pageScrollPositionAfter)
+        testPassed(&quot;Page did NOT scroll.&quot;);
+    else
+        testFailed(&quot;Page DID scroll.&quot;);
+
+    finishTest();
+}
+
+function scrollTest() {
+    pageScrollPositionBefore = document.body.scrollTop;
+
+    divTarget = document.getElementById('scrollable_div');
+
+    var windowPosition = locationInWindowCoordinates(divTarget);
+
+    var startPosX = windowPosition.x + 0.5 * divTarget.clientWidth;
+    var startPosY = windowPosition.y + 0.5 * divTarget.clientHeight;
+
+    divScrollPositionBefore = divTarget.scrollTop;
+
+    // Scroll the #source until we reach the #target.
+    eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
+    eventSender.callAfterScrollingCompletes(checkForScroll);
+}
+
+function setupTopLevel() {
+
+    if (window.eventSender) {
+        testRunner.waitUntilDone();
+
+        eventSender.monitorWheelEvents();
+        setTimeout(scrollTest, 0);
+    } else {
+        var messageLocation = document.getElementById('parent');
+        var message = document.createElement('div');
+        message.innerHTML = &quot;&lt;p&gt;This test is better run under DumpRenderTree. To manually test it, place the mouse pointer&lt;br/&gt;&quot;
+            + &quot;inside the IFrame, then use the mouse wheel or a two-finger swipe to scroll the IFrame to the bottom (and beyond).&lt;br/&gt;&quot;
+            + &quot;&lt;br/&gt;&lt;br/&gt;&quot;
+            + &quot;The test passes if you scroll far enough to see the row of END labels but the main page does not scroll.&lt;/p&gt;&quot;;
+        messageLocation.appendChild(message);
+    }
+}
+
+&lt;/script&gt;
+&lt;div id=&quot;parent&quot; style=&quot;height: 2000px&quot;&gt;
+    &lt;div id=&quot;source&quot; style=&quot;height: 20px&quot;&gt;
+        Put mouse inside the iframe (below) and flick downwards
+    &lt;/div&gt;
+    &lt;div id=&quot;scrollable_div&quot; style=&quot;height: 400px; width: 430px; overflow-y:auto; padding: 0;&quot;&gt;
+        &lt;iframe id=&quot;non_scrollable_iframe&quot; src=&quot;resources/background.html&quot; style=&quot;height: 2100px; width:410px; overflow:hidden; scrolling: no&quot; onload=&quot;setupTopLevel();&quot;&gt;
+        &lt;/iframe&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Tests that iframe does scroll when inner iframe is NOT scrollable.&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&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 (188081 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-08-06 23:21:04 UTC (rev 188081)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2015-08-06  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187930. rdar://problem/21870332
+
+    2015-08-04  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            REGRESSION (r173784): [Mac] Correct latching error for non-scrollable iframe nested inside scrollable div.
+            https://bugs.webkit.org/show_bug.cgi?id=147668
+            &lt;rdar://problem/21870332&gt;
+
+            Reviewed by Simon Fraser.
+
+            Test: platform/mac/fast/scrolling/scroll-div-with-nested-nonscrollable-iframe.html
+
+            When we are wrapping up processing of the wheel event for a given frame, if the current latching context
+            does NOT apply to the current frame (e.g., because it's latched to an enclosing frame) we should not pass
+            wheel events directly to the latched elements scrollable container. Instead, we should just give the current
+            frame an opportunity to perform any custom wheel event handling and return, so that the enclosing (latched)
+            frame can do the rest of its event handling.
+
+            If we don't do this, we incorrectly ask the enclosing frame to process the event, then return claiming that
+            we handled the event, preventing the enclosing frame from doing its part of the processing.
+
+            * page/mac/EventHandlerMac.mm:
+            (WebCore::EventHandler::platformCompleteWheelEvent):
+
+2015-08-06  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merge r187892. rdar://problem/21932187
</span><span class="cx"> 
</span><span class="cx">     2015-08-04  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorepagemacEventHandlerMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/page/mac/EventHandlerMac.mm (188081 => 188082)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/page/mac/EventHandlerMac.mm        2015-08-06 23:21:04 UTC (rev 188081)
+++ branches/safari-601.1-branch/Source/WebCore/page/mac/EventHandlerMac.mm        2015-08-06 23:22:38 UTC (rev 188082)
</span><span class="lines">@@ -1009,7 +1009,7 @@
</span><span class="cx">     FrameView* view = m_frame.view();
</span><span class="cx"> 
</span><span class="cx">     ScrollLatchingState* latchingState = m_frame.mainFrame().latchingState();
</span><del>-    if (wheelEvent.useLatchedEventElement() &amp;&amp; latchingState &amp;&amp; latchingState-&gt;scrollableContainer()) {
</del><ins>+    if (wheelEvent.useLatchedEventElement() &amp;&amp; !latchingIsLockedToAncestorOfThisFrame(m_frame) &amp;&amp; latchingState &amp;&amp; latchingState-&gt;scrollableContainer()) {
</ins><span class="cx"> 
</span><span class="cx">         m_isHandlingWheelEvent = false;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>