<!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>[168761] trunk/Source</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/168761">168761</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-05-13 17:09:28 -0700 (Tue, 13 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Page scale update messages for media controls should only fire at the end of zooming
https://bugs.webkit.org/show_bug.cgi?id=132857
&lt;rdar://problem/16631009&gt;

Reviewed by Simon Fraser.

As the user was zooming, the media controls that responded
to the page scale (and resized themselves) would do so
slightly out of sync with the screen refreshes, and it looked

Source/WebCore:
terrible. They really only need to get told at the end
of the zoom that they need to relayout.

Allow setPageScaleFactor to accept another parameter
that indicates if the change is stable. That way, changes
during a user triggers zoom gesture can be ignored for
media controls.

* WebCore.exp.in: Page::setPageScaleFactor takes a new parameter.
* dom/Document.cpp:
(WebCore::Document::pageScaleFactorChangedAndStable): Renamed from pageScaleFactorChanged.
(WebCore::Document::pageScaleFactorChanged): Deleted.
* dom/Document.h:
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor): Accepts a new inStableState parameter,
and tells the main frame that the scale factor has changed if it's stable.
* page/Page.h:

Source/WebKit2:
terrible.

We already know if a pageScale change is happening inside
a gesture using the inStableState property of the visibleContentRectUpdateInfo.
Simply pass this along to WebCore::Page.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects): Pass inStableState onto the
WebCore::Page. Note that we have to send this message even if the
scale has not changed, since the last changing update might not have
been stable.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/ChangeLog        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-05-13  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [iOS] Page scale update messages for media controls should only fire at the end of zooming
+        https://bugs.webkit.org/show_bug.cgi?id=132857
+        &lt;rdar://problem/16631009&gt;
+
+        Reviewed by Simon Fraser.
+
+        As the user was zooming, the media controls that responded
+        to the page scale (and resized themselves) would do so
+        slightly out of sync with the screen refreshes, and it looked
+        terrible. They really only need to get told at the end
+        of the zoom that they need to relayout.
+
+        Allow setPageScaleFactor to accept another parameter
+        that indicates if the change is stable. That way, changes
+        during a user triggers zoom gesture can be ignored for
+        media controls.
+
+        * WebCore.exp.in: Page::setPageScaleFactor takes a new parameter.
+        * dom/Document.cpp:
+        (WebCore::Document::pageScaleFactorChangedAndStable): Renamed from pageScaleFactorChanged.
+        (WebCore::Document::pageScaleFactorChanged): Deleted.
+        * dom/Document.h:
+        * page/Page.cpp:
+        (WebCore::Page::setPageScaleFactor): Accepts a new inStableState parameter,
+        and tells the main frame that the scale factor has changed if it's stable.
+        * page/Page.h:
+
</ins><span class="cx"> 2014-05-13  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed build fix after r168755.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -1065,7 +1065,7 @@
</span><span class="cx"> __ZN7WebCore4Page16setCanStartMediaEb
</span><span class="cx"> __ZN7WebCore4Page16setDefersLoadingEb
</span><span class="cx"> __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
</span><del>-__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
</del><ins>+__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointEb
</ins><span class="cx"> __ZN7WebCore4Page18setTopContentInsetEf
</span><span class="cx"> __ZN7WebCore4Page19addLayoutMilestonesEj
</span><span class="cx"> __ZN7WebCore4Page19createPageThrottlerEv
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -4204,7 +4204,7 @@
</span><span class="cx">     m_pageScaleFactorChangedElements.remove(element);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::pageScaleFactorChanged()
</del><ins>+void Document::pageScaleFactorChangedAndStable()
</ins><span class="cx"> {
</span><span class="cx">     for (HTMLMediaElement* mediaElement : m_pageScaleFactorChangedElements)
</span><span class="cx">         mediaElement-&gt;pageScaleFactorChanged();
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/dom/Document.h        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -1046,7 +1046,7 @@
</span><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span><span class="cx">     void registerForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
</span><span class="cx">     void unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
</span><del>-    void pageScaleFactorChanged();
</del><ins>+    void pageScaleFactorChangedAndStable();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(PAGE_VISIBILITY_API)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/page/Page.cpp        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -707,7 +707,7 @@
</span><span class="cx">     mainFrame().deviceOrPageScaleFactorChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Page::setPageScaleFactor(float scale, const IntPoint&amp; origin)
</del><ins>+void Page::setPageScaleFactor(float scale, const IntPoint&amp; origin, bool inStableState)
</ins><span class="cx"> {
</span><span class="cx">     Document* document = mainFrame().document();
</span><span class="cx">     FrameView* view = document-&gt;view();
</span><span class="lines">@@ -724,6 +724,12 @@
</span><span class="cx">                 view-&gt;hostWindow()-&gt;delegatedScrollRequested(origin);
</span><span class="cx"> #endif
</span><span class="cx">         }
</span><ins>+#if ENABLE(MEDIA_CONTROLS_SCRIPT)
+        if (inStableState) {
+            for (Frame* frame = &amp;mainFrame(); frame; frame = frame-&gt;tree().traverseNext())
+                frame-&gt;document()-&gt;pageScaleFactorChangedAndStable();
+        }
+#endif
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -757,8 +763,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span><del>-    for (Frame* frame = &amp;mainFrame(); frame; frame = frame-&gt;tree().traverseNext())
-        frame-&gt;document()-&gt;pageScaleFactorChanged();
</del><ins>+    if (inStableState) {
+        for (Frame* frame = &amp;mainFrame(); frame; frame = frame-&gt;tree().traverseNext())
+            frame-&gt;document()-&gt;pageScaleFactorChangedAndStable();
+    }
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -783,7 +791,7 @@
</span><span class="cx">     pageCache()-&gt;markPagesForFullStyleRecalc(this);
</span><span class="cx">     GraphicsContext::updateDocumentMarkerResources();
</span><span class="cx"> }
</span><del>-    
</del><ins>+
</ins><span class="cx"> void Page::setTopContentInset(float contentInset)
</span><span class="cx"> {
</span><span class="cx">     if (m_topContentInset == contentInset)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebCore/page/Page.h        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -271,7 +271,7 @@
</span><span class="cx">     float mediaVolume() const { return m_mediaVolume; }
</span><span class="cx">     void setMediaVolume(float);
</span><span class="cx"> 
</span><del>-    void setPageScaleFactor(float scale, const IntPoint&amp; origin);
</del><ins>+    void setPageScaleFactor(float scale, const IntPoint&amp; origin, bool inStableState = true);
</ins><span class="cx">     float pageScaleFactor() const { return m_pageScaleFactor; }
</span><span class="cx"> 
</span><span class="cx">     void setZoomedOutPageScaleFactor(float);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-05-13  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [iOS] Page scale update messages for media controls should only fire at the end of zooming
+        https://bugs.webkit.org/show_bug.cgi?id=132857
+        &lt;rdar://problem/16631009&gt;
+
+        Reviewed by Simon Fraser.
+
+        As the user was zooming, the media controls that responded
+        to the page scale (and resized themselves) would do so
+        slightly out of sync with the screen refreshes, and it looked
+        terrible.
+
+        We already know if a pageScale change is happening inside
+        a gesture using the inStableState property of the visibleContentRectUpdateInfo.
+        Simply pass this along to WebCore::Page.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects): Pass inStableState onto the
+        WebCore::Page. Note that we have to send this message even if the
+        scale has not changed, since the last changing update might not have
+        been stable.
+
</ins><span class="cx"> 2014-05-13  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS][WK2] When the secondary UIScrollView delegates respond to callbacks, delay the state change until both delegates have finished
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (168760 => 168761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-05-14 00:08:00 UTC (rev 168760)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-05-14 00:09:28 UTC (rev 168761)
</span><span class="lines">@@ -2164,17 +2164,25 @@
</span><span class="cx">     IntPoint scrollPosition = roundedUnobscuredRect.location();
</span><span class="cx"> 
</span><span class="cx">     float floatBoundedScale = boundedScale;
</span><ins>+    bool hasSetPageScale = false;
</ins><span class="cx">     if (floatBoundedScale != m_page-&gt;pageScaleFactor()) {
</span><span class="cx">         m_scaleWasSetByUIProcess = true;
</span><span class="cx"> 
</span><span class="cx">         m_dynamicSizeUpdateHistory.clear();
</span><span class="cx"> 
</span><del>-        m_page-&gt;setPageScaleFactor(floatBoundedScale, scrollPosition);
</del><ins>+        m_page-&gt;setPageScaleFactor(floatBoundedScale, scrollPosition, visibleContentRectUpdateInfo.inStableState());
+        hasSetPageScale = true;
+
</ins><span class="cx">         if (LayerTreeHost* layerTreeHost = m_drawingArea-&gt;layerTreeHost())
</span><span class="cx">             layerTreeHost-&gt;deviceOrPageScaleFactorChanged();
</span><span class="cx">         send(Messages::WebPageProxy::PageScaleFactorDidChange(floatBoundedScale));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!hasSetPageScale &amp;&amp; visibleContentRectUpdateInfo.inStableState()) {
+        m_page-&gt;setPageScaleFactor(floatBoundedScale, scrollPosition, true);
+        hasSetPageScale = true;
+    }
+
</ins><span class="cx">     FrameView&amp; frameView = *m_page-&gt;mainFrame().view();
</span><span class="cx">     if (scrollPosition != IntPoint(frameView.scrollOffset()))
</span><span class="cx">         m_dynamicSizeUpdateHistory.clear();
</span></span></pre>
</div>
</div>

</body>
</html>