Make Page::setDefersLoading() have a call count so that each time
loading is deferred, it must be balanced with a call to resume.
https://bugs.webkit.org/show_bug.cgi?id=84522

Reviewed by Andy Estes.

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::Page):
Initialize new call count member.
(WebCore::Page::setDefersLoading):
Check whether the callers wants balanced defer/resume loading behavior.
If the call count is not changing from 0 to 1 or 1 to 0, return early.
Otherwise, defer or resume loading for frames in this page.

* page/Page.h:
(WebCore::Page::defersLoading):
Added a member to hold the call count.

* page/Settings.cpp:
(WebCore::Settings::Settings):
Initialized new member m_wantsBalancedSetDefersLoadingBehavior.

* page/Settings.h:
(Settings):
Added new member m_wantsBalancedSetDefersLoadingBehavior.
(WebCore::Settings::setWantsBalancedSetDefersLoadingBehavior):
Setter.
(WebCore::Settings::wantsBalancedSetDefersLoadingBehavior):
Getter.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
Declare a new key for this preference.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
Initialize new preference to NO.
(-[WebPreferences setWantsBalancedSetDefersLoadingBehavior:]):
Setter.
(-[WebPreferences wantsBalancedSetDefersLoadingBehavior]):
Getter.

* WebView/WebPreferencesPrivate.h:
Declare setter and getter.

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Set the setting from the WebPreferences object's value.

Source/WebKit2:

* Shared/WebPreferencesStore.h:
Use the macro to declare the new preference.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Set the setting from the WebPreferencesStore's value.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@115925 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed