Changeset 194206 in webkit


Ignore:
Timestamp:
Dec 16, 2015 7:48:34 PM (8 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r194204 r194206  
     12015-12-16  Simon Fraser  <simon.fraser@apple.com>
     2
     3        ViewportConfiguration functions should return a bool to say if anything changed
     4        https://bugs.webkit.org/show_bug.cgi?id=152353
     5
     6        Reviewed by Tim Horton.
     7
     8        Rather than callers all checking whether setting ViewportConfiguration values
     9        changes state, have its functions return a bool if the values change.
     10
     11        * page/ViewportConfiguration.cpp:
     12        (WebCore::ViewportConfiguration::setContentsSize):
     13        (WebCore::ViewportConfiguration::setMinimumLayoutSize):
     14        (WebCore::ViewportConfiguration::setViewportArguments):
     15        (WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints):
     16        * page/ViewportConfiguration.h:
     17        (WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints): Deleted.
     18
    1192015-12-16  Andreas Kling  <akling@apple.com>
    220
  • trunk/Source/WebCore/page/ViewportConfiguration.cpp

    r193940 r194206  
    6767}
    6868
    69 void ViewportConfiguration::setContentsSize(const IntSize& contentSize)
     69bool ViewportConfiguration::setContentsSize(const IntSize& contentSize)
    7070{
    7171    if (m_contentSize == contentSize)
    72         return;
     72        return false;
    7373
    7474    m_contentSize = contentSize;
    7575    updateConfiguration();
    76 }
    77 
    78 void ViewportConfiguration::setMinimumLayoutSize(const FloatSize& minimumLayoutSize)
     76    return true;
     77}
     78
     79bool ViewportConfiguration::setMinimumLayoutSize(const FloatSize& minimumLayoutSize)
    7980{
    8081    if (m_minimumLayoutSize == minimumLayoutSize)
    81         return;
     82        return false;
    8283
    8384    m_minimumLayoutSize = minimumLayoutSize;
    8485    updateConfiguration();
    85 }
    86 
    87 void ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments)
     86    return true;
     87}
     88
     89bool ViewportConfiguration::setViewportArguments(const ViewportArguments& viewportArguments)
    8890{
    8991    if (m_viewportArguments == viewportArguments)
    90         return;
     92        return false;
    9193
    9294    m_viewportArguments = viewportArguments;
    9395    updateConfiguration();
     96    return true;
     97}
     98
     99bool ViewportConfiguration::setCanIgnoreScalingConstraints(bool canIgnoreScalingConstraints)
     100{
     101    if (canIgnoreScalingConstraints == m_canIgnoreScalingConstraints)
     102        return false;
     103   
     104    m_canIgnoreScalingConstraints = canIgnoreScalingConstraints;
     105    updateConfiguration();
     106    return true;
    94107}
    95108
  • trunk/Source/WebCore/page/ViewportConfiguration.h

    r191243 r194206  
    7474
    7575    const IntSize& contentsSize() const { return m_contentSize; }
    76     WEBCORE_EXPORT void setContentsSize(const IntSize&);
     76    WEBCORE_EXPORT bool setContentsSize(const IntSize&);
    7777
    7878    const FloatSize& minimumLayoutSize() const { return m_minimumLayoutSize; }
    79     WEBCORE_EXPORT void setMinimumLayoutSize(const FloatSize&);
     79    WEBCORE_EXPORT bool setMinimumLayoutSize(const FloatSize&);
    8080
    8181    const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
    82     WEBCORE_EXPORT void setViewportArguments(const ViewportArguments&);
     82    WEBCORE_EXPORT bool setViewportArguments(const ViewportArguments&);
    8383
    84     void setCanIgnoreScalingConstraints(bool canIgnoreScalingConstraints) { m_canIgnoreScalingConstraints = canIgnoreScalingConstraints; }
     84    WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool);
    8585    void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
    8686
  • trunk/Source/WebKit2/ChangeLog

    r194205 r194206  
     12015-12-16  Simon Fraser  <simon.fraser@apple.com>
     2
     3        ViewportConfiguration functions should return a bool to say if anything changed
     4        https://bugs.webkit.org/show_bug.cgi?id=152353
     5
     6        Reviewed by Tim Horton.
     7
     8        Rather than callers all checking whether setting ViewportConfiguration values
     9        changes state, have its functions return a bool if the values change.
     10
     11        * WebProcess/WebPage/WebPage.cpp:
     12        (WebKit::WebPage::mainFrameDidLayout):
     13        (WebKit::WebPage::didCommitLoad):
     14        * WebProcess/WebPage/ios/WebPageIOS.mm:
     15        (WebKit::WebPage::viewportPropertiesDidChange):
     16        (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
     17
    1182015-12-16  Tim Horton  <timothy_horton@apple.com>
    219
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r194108 r194206  
    35373537    if (FrameView* frameView = mainFrameView()) {
    35383538        IntSize newContentSize = frameView->contentsSizeRespectingOverflow();
    3539         if (m_viewportConfiguration.contentsSize() != newContentSize) {
    3540             m_viewportConfiguration.setContentsSize(newContentSize);
     3539        if (m_viewportConfiguration.setContentsSize(newContentSize))
    35413540            viewportConfigurationChanged();
    3542         }
    35433541    }
    35443542    m_findController.redraw();
     
    46864684    resetViewportDefaultConfiguration(frame);
    46874685    const Frame* coreFrame = frame->coreFrame();
    4688     m_viewportConfiguration.setContentsSize(coreFrame->view()->contentsSize());
    4689     m_viewportConfiguration.setViewportArguments(coreFrame->document()->viewportArguments());
    4690     viewportConfigurationChanged();
     4686   
     4687    bool viewportChanged = false;
     4688    if (m_viewportConfiguration.setContentsSize(coreFrame->view()->contentsSize()))
     4689        viewportChanged = true;
     4690
     4691    if (m_viewportConfiguration.setViewportArguments(coreFrame->document()->viewportArguments()))
     4692        viewportChanged = true;
     4693
     4694    if (viewportChanged)
     4695        viewportConfigurationChanged();
    46914696#endif
    46924697
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r194108 r194206  
    229229void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArguments)
    230230{
    231     if (m_viewportConfiguration.viewportArguments() == viewportArguments)
    232         return;
    233 
    234     m_viewportConfiguration.setViewportArguments(viewportArguments);
    235     viewportConfigurationChanged();
     231    if (m_viewportConfiguration.setViewportArguments(viewportArguments))
     232        viewportConfigurationChanged();
    236233}
    237234
     
    25402537{
    25412538    resetTextAutosizingBeforeLayoutIfNeeded(m_viewportConfiguration.minimumLayoutSize(), size);
    2542     m_viewportConfiguration.setMinimumLayoutSize(size);
    2543     viewportConfigurationChanged();
     2539   
     2540    if (m_viewportConfiguration.setMinimumLayoutSize(size))
     2541        viewportConfigurationChanged();
    25442542}
    25452543
Note: See TracChangeset for help on using the changeset viewer.