Title: [225441] trunk/Source
- Revision
- 225441
- Author
- [email protected]
- Date
- 2017-12-01 19:19:16 -0800 (Fri, 01 Dec 2017)
Log Message
Reduce the number of calls to ViewportConfiguration::updateConfiguration()
https://bugs.webkit.org/show_bug.cgi?id=180299
Reviewed by Zalan Bujtas.
There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
early if the configuration hasn't changed.
Source/WebCore:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::setDefaultConfiguration):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::Parameters::operator== const):
Source/WebKit:
Also move the fetching of ViewportConfiguration::xhtmlMobileParameters() from didReceiveMobileDocType()
into resetViewportDefaultConfiguration() where we grab all the other default configs.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didReceiveMobileDocType):
(WebKit::WebPage::resetViewportDefaultConfiguration):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (225440 => 225441)
--- trunk/Source/WebCore/ChangeLog 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebCore/ChangeLog 2017-12-02 03:19:16 UTC (rev 225441)
@@ -1,3 +1,19 @@
+2017-12-01 Simon Fraser <[email protected]>
+
+ Reduce the number of calls to ViewportConfiguration::updateConfiguration()
+ https://bugs.webkit.org/show_bug.cgi?id=180299
+
+ Reviewed by Zalan Bujtas.
+
+ There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
+ with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
+ early if the configuration hasn't changed.
+
+ * page/ViewportConfiguration.cpp:
+ (WebCore::ViewportConfiguration::setDefaultConfiguration):
+ * page/ViewportConfiguration.h:
+ (WebCore::ViewportConfiguration::Parameters::operator== const):
+
2017-12-01 Aishwarya Nirmal <[email protected]>
[Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (225440 => 225441)
--- trunk/Source/WebCore/page/ViewportConfiguration.cpp 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp 2017-12-02 03:19:16 UTC (rev 225441)
@@ -62,6 +62,9 @@
ASSERT(defaultConfiguration.minimumScale > 0);
ASSERT(defaultConfiguration.maximumScale >= defaultConfiguration.minimumScale);
+ if (m_defaultConfiguration == defaultConfiguration)
+ return;
+
m_defaultConfiguration = defaultConfiguration;
updateConfiguration();
}
Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (225440 => 225441)
--- trunk/Source/WebCore/page/ViewportConfiguration.h 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h 2017-12-02 03:19:16 UTC (rev 225441)
@@ -56,6 +56,14 @@
bool widthIsSet { false };
bool heightIsSet { false };
bool initialScaleIsSet { false };
+
+ bool operator==(const Parameters& other) const
+ {
+ return width == other.width && height == other.height
+ && initialScale == other.initialScale && minimumScale == other.minimumScale && maximumScale == other.maximumScale
+ && allowsUserScaling == other.allowsUserScaling && allowsShrinkToFit == other.allowsShrinkToFit && avoidsUnsafeArea == other.avoidsUnsafeArea
+ && widthIsSet == other.widthIsSet && heightIsSet == other.heightIsSet && initialScaleIsSet == other.initialScaleIsSet;
+ }
};
WEBCORE_EXPORT ViewportConfiguration();
Modified: trunk/Source/WebKit/ChangeLog (225440 => 225441)
--- trunk/Source/WebKit/ChangeLog 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebKit/ChangeLog 2017-12-02 03:19:16 UTC (rev 225441)
@@ -1,3 +1,22 @@
+2017-12-01 Simon Fraser <[email protected]>
+
+ Reduce the number of calls to ViewportConfiguration::updateConfiguration()
+ https://bugs.webkit.org/show_bug.cgi?id=180299
+
+ Reviewed by Zalan Bujtas.
+
+ There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
+ with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
+ early if the configuration hasn't changed.
+
+ Also move the fetching of ViewportConfiguration::xhtmlMobileParameters() from didReceiveMobileDocType()
+ into resetViewportDefaultConfiguration() where we grab all the other default configs.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::didReceiveMobileDocType):
+ (WebKit::WebPage::resetViewportDefaultConfiguration):
+
2017-12-01 Aishwarya Nirmal <[email protected]>
[Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (225440 => 225441)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-12-02 03:19:16 UTC (rev 225441)
@@ -1056,7 +1056,7 @@
void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
#if PLATFORM(IOS)
- void resetViewportDefaultConfiguration(WebFrame* mainFrame);
+ void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
void viewportConfigurationChanged();
void updateViewportSizeForCSSViewportUnits();
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (225440 => 225441)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2017-12-02 01:56:40 UTC (rev 225440)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2017-12-02 03:19:16 UTC (rev 225441)
@@ -252,10 +252,7 @@
void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
{
- if (isMobileDoctype)
- m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::xhtmlMobileParameters());
- else
- resetViewportDefaultConfiguration(m_mainFrame.get());
+ resetViewportDefaultConfiguration(m_mainFrame.get(), isMobileDoctype);
}
void WebPage::savePageState(HistoryItem& historyItem)
@@ -2595,7 +2592,7 @@
nextValidLayerTreeTransactionID = downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID();
}
-void WebPage::resetViewportDefaultConfiguration(WebFrame* frame)
+void WebPage::resetViewportDefaultConfiguration(WebFrame* frame, bool hasMobileDocType)
{
if (m_useTestingViewportConfiguration) {
m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::testingParameters());
@@ -2607,6 +2604,11 @@
return;
}
+ if (hasMobileDocType) {
+ m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::xhtmlMobileParameters());
+ return;
+ }
+
Document* document = frame->coreFrame()->document();
if (document->isImageDocument())
m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::imageDocumentParameters());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes