Title: [194206] trunk/Source
Revision
194206
Author
[email protected]
Date
2015-12-16 19:48:34 -0800 (Wed, 16 Dec 2015)

Log Message

ViewportConfiguration functions should return a bool to say if anything changed
https://bugs.webkit.org/show_bug.cgi?id=152353

Reviewed by Tim Horton.

Rather than callers all checking whether setting ViewportConfiguration values
changes state, have its functions return a bool if the values change.

Source/WebCore:

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::setContentsSize):
(WebCore::ViewportConfiguration::setMinimumLayoutSize):
(WebCore::ViewportConfiguration::setViewportArguments):
(WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints): Deleted.

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mainFrameDidLayout):
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportPropertiesDidChange):
(WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (194205 => 194206)


--- trunk/Source/WebCore/ChangeLog	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebCore/ChangeLog	2015-12-17 03:48:34 UTC (rev 194206)
@@ -1,3 +1,21 @@
+2015-12-16  Simon Fraser  <[email protected]>
+
+        ViewportConfiguration functions should return a bool to say if anything changed
+        https://bugs.webkit.org/show_bug.cgi?id=152353
+
+        Reviewed by Tim Horton.
+
+        Rather than callers all checking whether setting ViewportConfiguration values
+        changes state, have its functions return a bool if the values change.
+
+        * page/ViewportConfiguration.cpp:
+        (WebCore::ViewportConfiguration::setContentsSize):
+        (WebCore::ViewportConfiguration::setMinimumLayoutSize):
+        (WebCore::ViewportConfiguration::setViewportArguments):
+        (WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints):
+        * page/ViewportConfiguration.h:
+        (WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints): Deleted.
+
 2015-12-16  Andreas Kling  <[email protected]>
 
         Give kernel VM some hints about non-live memory-cached resources.

Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (194205 => 194206)


--- trunk/Source/WebCore/page/ViewportConfiguration.cpp	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp	2015-12-17 03:48:34 UTC (rev 194206)
@@ -66,33 +66,46 @@
     updateConfiguration();
 }
 
-void ViewportConfiguration::setContentsSize(const IntSize& contentSize)
+bool ViewportConfiguration::setContentsSize(const IntSize& contentSize)
 {
     if (m_contentSize == contentSize)
-        return;
+        return false;
 
     m_contentSize = contentSize;
     updateConfiguration();
+    return true;
 }
 
-void ViewportConfiguration::setMinimumLayoutSize(const FloatSize& minimumLayoutSize)
+bool ViewportConfiguration::setMinimumLayoutSize(const FloatSize& minimumLayoutSize)
 {
     if (m_minimumLayoutSize == minimumLayoutSize)
-        return;
+        return false;
 
     m_minimumLayoutSize = minimumLayoutSize;
     updateConfiguration();
+    return true;
 }
 
-void ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments)
+bool ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments)
 {
     if (m_viewportArguments == viewportArguments)
-        return;
+        return false;
 
     m_viewportArguments = viewportArguments;
     updateConfiguration();
+    return true;
 }
 
+bool ViewportConfiguration::setCanIgnoreScalingConstraints(bool canIgnoreScalingConstraints)
+{
+    if (canIgnoreScalingConstraints == m_canIgnoreScalingConstraints)
+        return false;
+    
+    m_canIgnoreScalingConstraints = canIgnoreScalingConstraints;
+    updateConfiguration();
+    return true;
+}
+
 IntSize ViewportConfiguration::layoutSize() const
 {
     return IntSize(layoutWidth(), layoutHeight());

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (194205 => 194206)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2015-12-17 03:48:34 UTC (rev 194206)
@@ -73,15 +73,15 @@
     WEBCORE_EXPORT void setDefaultConfiguration(const Parameters&);
 
     const IntSize& contentsSize() const { return m_contentSize; }
-    WEBCORE_EXPORT void setContentsSize(const IntSize&);
+    WEBCORE_EXPORT bool setContentsSize(const IntSize&);
 
     const FloatSize& minimumLayoutSize() const { return m_minimumLayoutSize; }
-    WEBCORE_EXPORT void setMinimumLayoutSize(const FloatSize&);
+    WEBCORE_EXPORT bool setMinimumLayoutSize(const FloatSize&);
 
     const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
-    WEBCORE_EXPORT void setViewportArguments(const ViewportArguments&);
+    WEBCORE_EXPORT bool setViewportArguments(const ViewportArguments&);
 
-    void setCanIgnoreScalingConstraints(bool canIgnoreScalingConstraints) { m_canIgnoreScalingConstraints = canIgnoreScalingConstraints; }
+    WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool);
     void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
 
     WEBCORE_EXPORT IntSize layoutSize() const;

Modified: trunk/Source/WebKit2/ChangeLog (194205 => 194206)


--- trunk/Source/WebKit2/ChangeLog	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-17 03:48:34 UTC (rev 194206)
@@ -1,3 +1,20 @@
+2015-12-16  Simon Fraser  <[email protected]>
+
+        ViewportConfiguration functions should return a bool to say if anything changed
+        https://bugs.webkit.org/show_bug.cgi?id=152353
+
+        Reviewed by Tim Horton.
+
+        Rather than callers all checking whether setting ViewportConfiguration values
+        changes state, have its functions return a bool if the values change.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::mainFrameDidLayout):
+        (WebKit::WebPage::didCommitLoad):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::viewportPropertiesDidChange):
+        (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
+
 2015-12-16  Tim Horton  <[email protected]>
 
         REGRESSION (r191299): Zoom gestures are enabled even if allowsMagnification=NO

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (194205 => 194206)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-12-17 03:48:34 UTC (rev 194206)
@@ -3536,10 +3536,8 @@
 #if PLATFORM(IOS)
     if (FrameView* frameView = mainFrameView()) {
         IntSize newContentSize = frameView->contentsSizeRespectingOverflow();
-        if (m_viewportConfiguration.contentsSize() != newContentSize) {
-            m_viewportConfiguration.setContentsSize(newContentSize);
+        if (m_viewportConfiguration.setContentsSize(newContentSize))
             viewportConfigurationChanged();
-        }
     }
     m_findController.redraw();
 #endif
@@ -4685,9 +4683,16 @@
 
     resetViewportDefaultConfiguration(frame);
     const Frame* coreFrame = frame->coreFrame();
-    m_viewportConfiguration.setContentsSize(coreFrame->view()->contentsSize());
-    m_viewportConfiguration.setViewportArguments(coreFrame->document()->viewportArguments());
-    viewportConfigurationChanged();
+    
+    bool viewportChanged = false;
+    if (m_viewportConfiguration.setContentsSize(coreFrame->view()->contentsSize()))
+        viewportChanged = true;
+
+    if (m_viewportConfiguration.setViewportArguments(coreFrame->document()->viewportArguments()))
+        viewportChanged = true;
+
+    if (viewportChanged)
+        viewportConfigurationChanged();
 #endif
 
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (194205 => 194206)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-12-17 03:04:11 UTC (rev 194205)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-12-17 03:48:34 UTC (rev 194206)
@@ -228,11 +228,8 @@
 
 void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArguments)
 {
-    if (m_viewportConfiguration.viewportArguments() == viewportArguments)
-        return;
-
-    m_viewportConfiguration.setViewportArguments(viewportArguments);
-    viewportConfigurationChanged();
+    if (m_viewportConfiguration.setViewportArguments(viewportArguments))
+        viewportConfigurationChanged();
 }
 
 void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
@@ -2539,8 +2536,9 @@
 void WebPage::setViewportConfigurationMinimumLayoutSize(const FloatSize& size)
 {
     resetTextAutosizingBeforeLayoutIfNeeded(m_viewportConfiguration.minimumLayoutSize(), size);
-    m_viewportConfiguration.setMinimumLayoutSize(size);
-    viewportConfigurationChanged();
+    
+    if (m_viewportConfiguration.setMinimumLayoutSize(size))
+        viewportConfigurationChanged();
 }
 
 void WebPage::setMaximumUnobscuredSize(const FloatSize& maximumUnobscuredSize)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to