Bug 21781

Summary: WebCore::Settings should have a maximum decoded image size setting
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: ImagesAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Severity: Normal CC: koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Description Flags
Patch v1 koivisto: review+

Description David Kilzer (:ddkilzer) 2008-10-21 19:14:05 PDT
It would be nice for WebCore::Settings to have a maximum image size setting to limit the size of images on some platforms.
Comment 1 David Kilzer (:ddkilzer) 2008-10-21 19:19:15 PDT
Created attachment 24549 [details]
Patch v1
Comment 2 Antti Koivisto 2008-10-22 12:17:47 PDT
Comment on attachment 24549 [details]
Patch v1

r=me, with some comments.

+        frame = docLoader() ? docLoader()->frame() : 0;

+    DocLoader* docLoader() const { return m_docLoader; }

The CachedResource::m_docLoader is non-zero only in some special cases (it should have a better name). Using m_request->docLoader() covers all cases we care about. These changes are probably not needed.

             // FIXME: I'm not convinced this case can even be hit.

I guess this FIXME can go now. We clearly can hit this case when maxImageSize is limited (plus it was not true even before). 

+        void setMaximumImageSize(size_t size) { m_maximumImageSize = size; }
+        size_t maximumImageSize() const { return m_maximumImageSize; }

How about maximumDecodedImageSize to avoid confusion between encoded and decoded size?
Comment 3 David Kilzer (:ddkilzer) 2008-10-22 19:53:20 PDT
Committed r37803
Comment 4 David Kilzer (:ddkilzer) 2008-10-22 19:54:09 PDT
(In reply to comment #2)
> (From update of attachment 24549 [details] [edit])
> r=me, with some comments.

I made all of these recommended changes before landing.