Skip to content
Permalink
Browse files
Add local storage support for WebKit2
https://bugs.webkit.org/show_bug.cgi?id=42584

Reviewed by Darin Adler.

* Shared/WebPreferencesStore.cpp:
(WebKit::WebPreferencesStore::WebPreferencesStore):
(WebKit::WebPreferencesStore::swap):
* Shared/WebPreferencesStore.h:
(WebKit::WebPreferencesStore::encode):
(WebKit::WebPreferencesStore::decode):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetLocalStorageEnabled):
(WKPreferencesGetLocalStorageEnabled):
* UIProcess/API/C/WKPreferences.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::setLocalStorageEnabled):
(WebKit::WebPreferences::localStorageEnabled):
* UIProcess/WebPreferences.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::preferencesDidChange):



Canonical link: https://commits.webkit.org/54522@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Jul 19, 2010
1 parent 3f9953a commit cef1445f83f07548b437a5271be543549e2e38a6
@@ -1,3 +1,28 @@
2010-07-19 Sam Weinig <sam@webkit.org>

Reviewed by Darin Adler.

Add local storage support for WebKit2
https://bugs.webkit.org/show_bug.cgi?id=42584

* Shared/WebPreferencesStore.cpp:
(WebKit::WebPreferencesStore::WebPreferencesStore):
(WebKit::WebPreferencesStore::swap):
* Shared/WebPreferencesStore.h:
(WebKit::WebPreferencesStore::encode):
(WebKit::WebPreferencesStore::decode):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetLocalStorageEnabled):
(WKPreferencesGetLocalStorageEnabled):
* UIProcess/API/C/WKPreferences.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::setLocalStorageEnabled):
(WebKit::WebPreferences::localStorageEnabled):
* UIProcess/WebPreferences.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::preferencesDidChange):

2010-07-19 Simon Fraser <simon.fraser@apple.com>

Reviewed by Anders Carlsson.
@@ -31,6 +31,8 @@ WebPreferencesStore::WebPreferencesStore()
: javaScriptEnabled(true)
, loadsImagesAutomatically(true)
, pluginsEnabled(true)
, offlineWebApplicationCacheEnabled(false)
, localStorageEnabled(true)
, minimumFontSize(9)
, minimumLogicalFontSize(9)
, defaultFontSize(16)
@@ -48,7 +50,9 @@ WebPreferencesStore::WebPreferencesStore(const WebPreferencesStore& other)
{
javaScriptEnabled = other.javaScriptEnabled;
loadsImagesAutomatically = other.loadsImagesAutomatically;

pluginsEnabled = other.pluginsEnabled;
offlineWebApplicationCacheEnabled = other.offlineWebApplicationCacheEnabled;
localStorageEnabled = other.localStorageEnabled;
minimumFontSize = other.minimumFontSize;
minimumLogicalFontSize = other.minimumLogicalFontSize;
defaultFontSize = other.defaultFontSize;
@@ -73,6 +77,9 @@ void WebPreferencesStore::swap(WebPreferencesStore& other)
{
std::swap(javaScriptEnabled, other.javaScriptEnabled);
std::swap(loadsImagesAutomatically, other.loadsImagesAutomatically);
std::swap(pluginsEnabled, other.pluginsEnabled);
std::swap(offlineWebApplicationCacheEnabled, other.offlineWebApplicationCacheEnabled);
std::swap(localStorageEnabled, other.localStorageEnabled);
std::swap(minimumFontSize, other.minimumFontSize);
std::swap(minimumLogicalFontSize, other.minimumLogicalFontSize);
std::swap(defaultFontSize, other.defaultFontSize);
@@ -45,6 +45,7 @@ struct WebPreferencesStore {
encoder.encode(loadsImagesAutomatically);
encoder.encode(pluginsEnabled);
encoder.encode(offlineWebApplicationCacheEnabled);
encoder.encode(localStorageEnabled);
encoder.encode(minimumFontSize);
encoder.encode(minimumLogicalFontSize);
encoder.encode(defaultFontSize);
@@ -67,6 +68,8 @@ struct WebPreferencesStore {
return false;
if (!decoder.decode(s.offlineWebApplicationCacheEnabled))
return false;
if (!decoder.decode(s.localStorageEnabled))
return false;
if (!decoder.decode(s.minimumFontSize))
return false;
if (!decoder.decode(s.minimumLogicalFontSize))
@@ -94,6 +97,7 @@ struct WebPreferencesStore {
bool loadsImagesAutomatically;
bool pluginsEnabled;
bool offlineWebApplicationCacheEnabled;
bool localStorageEnabled;

uint32_t minimumFontSize;
uint32_t minimumLogicalFontSize;
@@ -74,6 +74,16 @@ bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferen
return toWK(preferencesRef)->offlineWebApplicationCacheEnabled();
}

void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferencesRef, bool localStorageEnabled)
{
toWK(preferencesRef)->setLocalStorageEnabled(localStorageEnabled);
}

bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferencesRef)
{
return toWK(preferencesRef)->localStorageEnabled();
}

WKPreferencesRef WKPreferencesRetain(WKPreferencesRef preferencesRef)
{
toWK(preferencesRef)->ref();
@@ -39,13 +39,22 @@ extern "C" {
WK_EXPORT WKPreferencesRef WKPreferencesCreate();
WK_EXPORT WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef);

// Defaults to true.
WK_EXPORT void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferences, bool javaScriptEnabled);
WK_EXPORT bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferences);

// Defaults to true.
WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically);
WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences);

// Defaults to false.
WK_EXPORT void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences, bool offlineWebApplicationCacheEnabled);
WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences);

// Defaults to true.
WK_EXPORT void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferences, bool localStorageEnabled);
WK_EXPORT bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferences);

WK_EXPORT WKPreferencesRef WKPreferencesRetain(WKPreferencesRef preferences);
WK_EXPORT void WKPreferencesRelease(WKPreferencesRef preferences);

@@ -97,4 +97,15 @@ bool WebPreferences::offlineWebApplicationCacheEnabled() const
return m_store.offlineWebApplicationCacheEnabled;
}

void WebPreferences::setLocalStorageEnabled(bool b)
{
m_store.localStorageEnabled = b;
update();
}

bool WebPreferences::localStorageEnabled() const
{
return m_store.localStorageEnabled;
}

} // namespace WebKit
@@ -64,6 +64,9 @@ class WebPreferences : public RefCounted<WebPreferences> {
void setOfflineWebApplicationCacheEnabled(bool);
bool offlineWebApplicationCacheEnabled() const;

void setLocalStorageEnabled(bool);
bool localStorageEnabled() const;

private:
WebPreferences();
WebPreferences(WebPreferences*);
@@ -89,6 +89,8 @@ WebPage::WebPage(uint64_t pageID, const IntSize& viewSize, const WebPreferencesS
m_page->settings()->setJavaScriptEnabled(store.javaScriptEnabled);
m_page->settings()->setLoadsImagesAutomatically(store.loadsImagesAutomatically);
m_page->settings()->setPluginsEnabled(store.pluginsEnabled);
m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
m_page->settings()->setLocalStorageEnabled(store.localStorageEnabled);
m_page->settings()->setMinimumFontSize(store.minimumFontSize);
m_page->settings()->setMinimumLogicalFontSize(store.minimumLogicalFontSize);
m_page->settings()->setDefaultFontSize(store.defaultFontSize);
@@ -328,6 +330,7 @@ void WebPage::preferencesDidChange(const WebPreferencesStore& store)
m_page->settings()->setJavaScriptEnabled(store.javaScriptEnabled);
m_page->settings()->setLoadsImagesAutomatically(store.loadsImagesAutomatically);
m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
m_page->settings()->setLocalStorageEnabled(store.localStorageEnabled);
}

bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)

0 comments on commit cef1445

Please sign in to comment.