[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
darin at chromium.org
darin at chromium.org
Thu Feb 4 21:32:00 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 362337e52c88a9d3872283d78e60955dc9f5308f
Author: darin at chromium.org <darin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 29 08:43:28 2010 +0000
2010-01-29 Darin Fisher <darin at chromium.org>
Reviewed by Adam Barth.
Add FrameLoaderClient::allowImages method to allow the client to
overrule image loading policy on a per frame basis.
https://bugs.webkit.org/show_bug.cgi?id=34225
For completeness, this patch also adds Settings::areImagesEnabled.
This is different from loadsImagesAutomatically as is explained in
Settings.h.
* loader/DocLoader.cpp:
(WebCore::DocLoader::requestImage):
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::allowImages):
* loader/ImageDocument.cpp:
(WebCore::ImageTokenizer::writeRawData):
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setImagesEnabled):
* page/Settings.h:
(WebCore::Settings::areImagesEnabled):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index acb15a0..9bc095b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-01-29 Darin Fisher <darin at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add FrameLoaderClient::allowImages method to allow the client to
+ overrule image loading policy on a per frame basis.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34225
+
+ For completeness, this patch also adds Settings::areImagesEnabled.
+ This is different from loadsImagesAutomatically as is explained in
+ Settings.h.
+
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::requestImage):
+ * loader/FrameLoaderClient.h:
+ (WebCore::FrameLoaderClient::allowImages):
+ * loader/ImageDocument.cpp:
+ (WebCore::ImageTokenizer::writeRawData):
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setImagesEnabled):
+ * page/Settings.h:
+ (WebCore::Settings::areImagesEnabled):
+
2010-01-28 Nicholas Young <nicholas.young at nokia.com>
Reviewed by Eric Carlson.
diff --git a/WebCore/loader/DocLoader.cpp b/WebCore/loader/DocLoader.cpp
index c34f81b..0053e7b 100644
--- a/WebCore/loader/DocLoader.cpp
+++ b/WebCore/loader/DocLoader.cpp
@@ -40,6 +40,7 @@
#include "HTMLElement.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "loader.h"
#include "SecurityOrigin.h"
#include "Settings.h"
@@ -120,6 +121,11 @@ void DocLoader::checkForReload(const KURL& fullURL)
CachedImage* DocLoader::requestImage(const String& url)
{
+ if (Frame* f = frame()) {
+ Settings* settings = f->settings();
+ if (!f->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
+ return 0;
+ }
CachedImage* resource = static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, url, String()));
if (autoLoadImages() && resource && resource->stillNeedsLoad()) {
resource->setLoading(true);
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 642b701..4c121f4 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -258,6 +258,7 @@ namespace WebCore {
virtual bool allowJavaScript(bool enabledPerSettings) { return enabledPerSettings; }
virtual bool allowPlugins(bool enabledPerSettings) { return enabledPerSettings; }
+ virtual bool allowImages(bool enabledPerSettings) { return enabledPerSettings; }
};
} // namespace WebCore
diff --git a/WebCore/loader/ImageDocument.cpp b/WebCore/loader/ImageDocument.cpp
index 9b5598d..2f564cc 100644
--- a/WebCore/loader/ImageDocument.cpp
+++ b/WebCore/loader/ImageDocument.cpp
@@ -33,6 +33,7 @@
#include "EventNames.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "FrameView.h"
#include "HTMLImageElement.h"
#include "HTMLNames.h"
@@ -115,8 +116,13 @@ void ImageTokenizer::write(const SegmentedString&, bool)
bool ImageTokenizer::writeRawData(const char*, int)
{
+ Frame* frame = m_doc->frame();
+ Settings* settings = frame->settings();
+ if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
+ return false;
+
CachedImage* cachedImage = m_doc->cachedImage();
- cachedImage->data(m_doc->frame()->loader()->documentLoader()->mainResourceData(), false);
+ cachedImage->data(frame->loader()->documentLoader()->mainResourceData(), false);
m_doc->imageChanged();
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 3873c89..b5d5e04 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -68,6 +68,7 @@ Settings::Settings(Page* page)
, m_loadsImagesAutomatically(false)
, m_privateBrowsingEnabled(false)
, m_caretBrowsingEnabled(false)
+ , m_areImagesEnabled(true)
, m_arePluginsEnabled(false)
, m_databasesEnabled(false)
, m_localStorageEnabled(false)
@@ -242,6 +243,11 @@ void Settings::setJavaEnabled(bool isJavaEnabled)
m_isJavaEnabled = isJavaEnabled;
}
+void Settings::setImagesEnabled(bool areImagesEnabled)
+{
+ m_areImagesEnabled = areImagesEnabled;
+}
+
void Settings::setPluginsEnabled(bool arePluginsEnabled)
{
m_arePluginsEnabled = arePluginsEnabled;
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 9f00b0d..181eb50 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -98,6 +98,8 @@ namespace WebCore {
void setDefaultFixedFontSize(int);
int defaultFixedFontSize() const { return m_defaultFixedFontSize; }
+ // Unlike areImagesEnabled, this only suppresses the network load of
+ // the image URL. A cached image will still be rendered if requested.
void setLoadsImagesAutomatically(bool);
bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
@@ -116,6 +118,9 @@ namespace WebCore {
void setJavaEnabled(bool);
bool isJavaEnabled() const { return m_isJavaEnabled; }
+ void setImagesEnabled(bool);
+ bool areImagesEnabled() const { return m_areImagesEnabled; }
+
void setPluginsEnabled(bool);
bool arePluginsEnabled() const { return m_arePluginsEnabled; }
@@ -302,6 +307,7 @@ namespace WebCore {
bool m_loadsImagesAutomatically : 1;
bool m_privateBrowsingEnabled : 1;
bool m_caretBrowsingEnabled : 1;
+ bool m_areImagesEnabled : 1;
bool m_arePluginsEnabled : 1;
bool m_databasesEnabled : 1;
bool m_localStorageEnabled : 1;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 791b933..9c02fd9 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-29 Darin Fisher <darin at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add FrameLoaderClient::allowImages method to allow the client to
+ overrule image loading policy on a per frame basis.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34225
+
+ * public/WebFrameClient.h:
+ (WebKit::WebFrameClient::allowImages):
+ * public/WebSettings.h:
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::allowImages):
+ * src/FrameLoaderClientImpl.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setImagesEnabled):
+ * src/WebSettingsImpl.h:
+
2010-01-28 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h
index 5c12a57..4078151 100644
--- a/WebKit/chromium/public/WebFrameClient.h
+++ b/WebKit/chromium/public/WebFrameClient.h
@@ -83,6 +83,9 @@ public:
// Controls whether plugins are allowed for this frame.
virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
+ // Controls whether images are allowed for this frame.
+ virtual bool allowImages(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
+
// Load commands -------------------------------------------------------
diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h
index da36806..d75ccde 100644
--- a/WebKit/chromium/public/WebSettings.h
+++ b/WebKit/chromium/public/WebSettings.h
@@ -58,6 +58,7 @@ public:
virtual void setWebSecurityEnabled(bool) = 0;
virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0;
virtual void setLoadsImagesAutomatically(bool) = 0;
+ virtual void setImagesEnabled(bool) = 0;
virtual void setPluginsEnabled(bool) = 0;
virtual void setDOMPasteAllowed(bool) = 0;
virtual void setDeveloperExtrasEnabled(bool) = 0;
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 4333c5d..b984308 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -172,6 +172,14 @@ bool FrameLoaderClientImpl::allowPlugins(bool enabledPerSettings)
return enabledPerSettings;
}
+bool FrameLoaderClientImpl::allowImages(bool enabledPerSettings)
+{
+ if (m_webFrame->client())
+ return m_webFrame->client()->allowImages(m_webFrame, enabledPerSettings);
+
+ return enabledPerSettings;
+}
+
bool FrameLoaderClientImpl::hasWebView() const
{
return m_webFrame->viewImpl();
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h
index a273ce7..901600c 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -193,6 +193,7 @@ public:
virtual void didChangeScrollOffset();
virtual bool allowJavaScript(bool enabledPerSettings);
virtual bool allowPlugins(bool enabledPerSettings);
+ virtual bool allowImages(bool enabledPerSettings);
private:
void makeDocumentView();
diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp
index e019653..5cfbd4f 100644
--- a/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -130,6 +130,11 @@ void WebSettingsImpl::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
m_settings->setLoadsImagesAutomatically(loadsImagesAutomatically);
}
+void WebSettingsImpl::setImagesEnabled(bool enabled)
+{
+ m_settings->setImagesEnabled(enabled);
+}
+
void WebSettingsImpl::setPluginsEnabled(bool enabled)
{
m_settings->setPluginsEnabled(enabled);
diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h
index 9c0f9f4..3b69fe6 100644
--- a/WebKit/chromium/src/WebSettingsImpl.h
+++ b/WebKit/chromium/src/WebSettingsImpl.h
@@ -60,6 +60,7 @@ public:
virtual void setWebSecurityEnabled(bool);
virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
virtual void setLoadsImagesAutomatically(bool);
+ virtual void setImagesEnabled(bool);
virtual void setPluginsEnabled(bool);
virtual void setDOMPasteAllowed(bool);
virtual void setDeveloperExtrasEnabled(bool);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list