- Revision
- 168761
- Author
- [email protected]
- Date
- 2014-05-13 17:09:28 -0700 (Tue, 13 May 2014)
Log Message
[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
<rdar://problem/16631009>
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (168760 => 168761)
--- 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)
@@ -1,3 +1,32 @@
+2014-05-13 Dean Jackson <[email protected]>
+
+ [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
+ <rdar://problem/16631009>
+
+ 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:
+
2014-05-13 Eric Carlson <[email protected]>
Unreviewed build fix after r168755.
Modified: trunk/Source/WebCore/WebCore.exp.in (168760 => 168761)
--- 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)
@@ -1065,7 +1065,7 @@
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
-__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
+__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointEb
__ZN7WebCore4Page18setTopContentInsetEf
__ZN7WebCore4Page19addLayoutMilestonesEj
__ZN7WebCore4Page19createPageThrottlerEv
Modified: trunk/Source/WebCore/dom/Document.cpp (168760 => 168761)
--- 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)
@@ -4204,7 +4204,7 @@
m_pageScaleFactorChangedElements.remove(element);
}
-void Document::pageScaleFactorChanged()
+void Document::pageScaleFactorChangedAndStable()
{
for (HTMLMediaElement* mediaElement : m_pageScaleFactorChangedElements)
mediaElement->pageScaleFactorChanged();
Modified: trunk/Source/WebCore/dom/Document.h (168760 => 168761)
--- 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)
@@ -1046,7 +1046,7 @@
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
void registerForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
void unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
- void pageScaleFactorChanged();
+ void pageScaleFactorChangedAndStable();
#endif
#if ENABLE(PAGE_VISIBILITY_API)
Modified: trunk/Source/WebCore/page/Page.cpp (168760 => 168761)
--- 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)
@@ -707,7 +707,7 @@
mainFrame().deviceOrPageScaleFactorChanged();
}
-void Page::setPageScaleFactor(float scale, const IntPoint& origin)
+void Page::setPageScaleFactor(float scale, const IntPoint& origin, bool inStableState)
{
Document* document = mainFrame().document();
FrameView* view = document->view();
@@ -724,6 +724,12 @@
view->hostWindow()->delegatedScrollRequested(origin);
#endif
}
+#if ENABLE(MEDIA_CONTROLS_SCRIPT)
+ if (inStableState) {
+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
+ frame->document()->pageScaleFactorChangedAndStable();
+ }
+#endif
return;
}
@@ -757,8 +763,10 @@
}
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
- for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
- frame->document()->pageScaleFactorChanged();
+ if (inStableState) {
+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
+ frame->document()->pageScaleFactorChangedAndStable();
+ }
#endif
}
@@ -783,7 +791,7 @@
pageCache()->markPagesForFullStyleRecalc(this);
GraphicsContext::updateDocumentMarkerResources();
}
-
+
void Page::setTopContentInset(float contentInset)
{
if (m_topContentInset == contentInset)
Modified: trunk/Source/WebCore/page/Page.h (168760 => 168761)
--- 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)
@@ -271,7 +271,7 @@
float mediaVolume() const { return m_mediaVolume; }
void setMediaVolume(float);
- void setPageScaleFactor(float scale, const IntPoint& origin);
+ void setPageScaleFactor(float scale, const IntPoint& origin, bool inStableState = true);
float pageScaleFactor() const { return m_pageScaleFactor; }
void setZoomedOutPageScaleFactor(float);
Modified: trunk/Source/WebKit2/ChangeLog (168760 => 168761)
--- 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)
@@ -1,3 +1,26 @@
+2014-05-13 Dean Jackson <[email protected]>
+
+ [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
+ <rdar://problem/16631009>
+
+ 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.
+
2014-05-13 Benjamin Poulain <[email protected]>
[iOS][WK2] When the secondary UIScrollView delegates respond to callbacks, delay the state change until both delegates have finished
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (168760 => 168761)
--- 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)
@@ -2164,17 +2164,25 @@
IntPoint scrollPosition = roundedUnobscuredRect.location();
float floatBoundedScale = boundedScale;
+ bool hasSetPageScale = false;
if (floatBoundedScale != m_page->pageScaleFactor()) {
m_scaleWasSetByUIProcess = true;
m_dynamicSizeUpdateHistory.clear();
- m_page->setPageScaleFactor(floatBoundedScale, scrollPosition);
+ m_page->setPageScaleFactor(floatBoundedScale, scrollPosition, visibleContentRectUpdateInfo.inStableState());
+ hasSetPageScale = true;
+
if (LayerTreeHost* layerTreeHost = m_drawingArea->layerTreeHost())
layerTreeHost->deviceOrPageScaleFactorChanged();
send(Messages::WebPageProxy::PageScaleFactorDidChange(floatBoundedScale));
}
+ if (!hasSetPageScale && visibleContentRectUpdateInfo.inStableState()) {
+ m_page->setPageScaleFactor(floatBoundedScale, scrollPosition, true);
+ hasSetPageScale = true;
+ }
+
FrameView& frameView = *m_page->mainFrame().view();
if (scrollPosition != IntPoint(frameView.scrollOffset()))
m_dynamicSizeUpdateHistory.clear();