Changeset 166665 in webkit
- Timestamp:
- Apr 2, 2014 2:06:33 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r166657 r166665 1 2014-04-02 Daniel Bates <dabates@apple.com> 2 3 Remove Settings::maximumDecodedImageSize() 4 https://bugs.webkit.org/show_bug.cgi?id=131057 5 <rdar://problem/15626368> 6 7 Reviewed by Darin Adler. 8 9 Remove test LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size.html as it 10 isn't applicable following the removal of the setting Settings::maximumDecodedImageSize(). 11 Additionally update the test fast/images/bag-png.html to ensure that we dispatch 12 a DOM Error event when we fail to decode a malformed image. 13 14 * fast/images/bad-png.html: 15 * fast/images/decoded-size-exceeds-max-decoded-size-expected.txt: Removed. 16 * fast/images/decoded-size-exceeds-max-decoded-size.html: Removed. 17 1 18 2014-04-02 Timothy Hatcher <timothy@apple.com> 2 19 -
trunk/LayoutTests/fast/images/bad-png.html
r121012 r166665 2 2 <head> 3 3 <script> 4 if (window.testRunner) 4 if (window.testRunner) { 5 testRunner.waitUntilDone(); 5 6 testRunner.dumpAsText(); 7 } 8 9 function testPassed() 10 { 11 document.getElementById("result").innerText = "PASS"; 12 if (window.testRunner) 13 testRunner.notifyDone(); 14 } 6 15 </script> 7 16 … … 11 20 corruption when trying to unwind the stack through a member of a 12 21 destroyed object. --> 13 <img src="resources/bad-png.png" >14 <p >PASS</p>22 <img src="resources/bad-png.png" onerror="testPassed()"> 23 <p id="result">FAIL</p> 15 24 </body> 16 25 </html> -
trunk/Source/WebCore/ChangeLog
r166661 r166665 1 2014-04-02 Daniel Bates <dabates@apple.com> 2 3 Remove Settings::maximumDecodedImageSize() 4 https://bugs.webkit.org/show_bug.cgi?id=131057 5 <rdar://problem/15626368> 6 7 Reviewed by Darin Adler. 8 9 The setting Settings::maximumDecodedImageSize() and its related logic have various 10 shortcomings, including the inability to cancel an image load when the estimated 11 decoded image size exceeds the maximum decoded image size. In the iOS port, this 12 setting is less useful given image subsampling support. For now, we remove this 13 setting and its related logic. Should it turn out that such a setting is useful 14 then we can implement it again taking care to address the shortcomings in the 15 original design. 16 17 * html/HTMLCanvasElement.cpp: For the iOS port, define MaxCanvasArea to be 4580 * 1145 18 pixels such that the maximum size of the image buffer is 20 MB (assumes 4 bytes per pixel). 19 (WebCore::HTMLCanvasElement::HTMLCanvasElement): 20 (WebCore::HTMLCanvasElement::createImageBuffer): 21 * html/HTMLCanvasElement.h: 22 * html/canvas/CanvasRenderingContext2D.cpp: 23 (WebCore::CanvasRenderingContext2D::createImageData): 24 (WebCore::CanvasRenderingContext2D::getImageData): 25 * loader/cache/CachedImage.cpp: 26 (WebCore::CachedImage::addIncrementalDataBuffer): 27 (WebCore::CachedImage::finishLoading): 28 * loader/cache/CachedImage.h: 29 * page/Settings.in: 30 1 31 2014-04-02 Martin Hock <mhock@apple.com> 2 32 -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r166491 r166665 68 68 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it 69 69 // reaches that limit. We limit by area instead, giving us larger maximum dimensions, 70 // in exchange for a smaller maximum canvas size. 71 #if !PLATFORM(IOS) 72 static const float MaxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels 70 // in exchange for a smaller maximum canvas size. The maximum canvas size is in CSS pixels. 71 #if PLATFORM(IOS) 72 static const float MaxCanvasArea = 4580 * 1145; // 20 MB assuming 4 bytes per pixel 73 #else 74 static const float MaxCanvasArea = 32768 * 8192; 73 75 #endif 74 76 … … 80 82 , m_deviceScaleFactor(targetDeviceScaleFactor()) 81 83 , m_originClean(true) 82 #if PLATFORM(IOS)83 // FIXME: We should look to reconcile usage of MaxCanvasArea and m_maximumDecodedImageSize.84 , m_maximumDecodedImageSize(document.settings() ? document.settings()->maximumDecodedImageSize() : 0)85 #endif86 84 , m_hasCreatedImageBuffer(false) 87 85 , m_didClearImageBuffer(false) … … 575 573 return; 576 574 577 #if PLATFORM(IOS)578 if (deviceSize.width() * deviceSize.height() * 4 > m_maximumDecodedImageSize)579 return;580 #else581 575 if (deviceSize.width() * deviceSize.height() > MaxCanvasArea) 582 576 return; 583 #endif584 577 585 578 IntSize bufferSize(deviceSize.width(), deviceSize.height()); -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r166491 r166665 129 129 bool originClean() const { return m_originClean; } 130 130 131 #if PLATFORM(IOS)132 // FIXME: Can we use unsigned data types, unsigned or size_t?133 void setMaximumDecodedImageSize(float maximumDecodedImageSize) { m_maximumDecodedImageSize = maximumDecodedImageSize; }134 float maximumDecodedImageSize() { return m_maximumDecodedImageSize; }135 #endif136 137 131 AffineTransform baseTransform() const; 138 132 … … 183 177 bool m_originClean; 184 178 185 #if PLATFORM(IOS)186 // FIXME: Can we use a unsigned data type, unsigned or size_t?187 float m_maximumDecodedImageSize;188 #endif189 190 179 // m_createdImageBuffer means we tried to malloc the buffer. We didn't necessarily get it. 191 180 mutable bool m_hasCreatedImageBuffer; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r166300 r166665 1858 1858 } 1859 1859 1860 #if PLATFORM(IOS)1861 // If the canvas element was created before Document had a Frame,1862 // then no maximumDecodedImageSize was set.1863 if (!canvas()->maximumDecodedImageSize()) {1864 if (Settings* settings = canvas()->document().settings())1865 canvas()->setMaximumDecodedImageSize(settings->maximumDecodedImageSize());1866 }1867 #endif1868 1869 1860 FloatSize logicalSize(fabs(sw), fabs(sh)); 1870 1861 if (!logicalSize.isExpressibleAsIntSize()) … … 1916 1907 sh = -sh; 1917 1908 } 1918 1919 #if PLATFORM(IOS)1920 // If the canvas element was created before Document had a Frame,1921 // then no maximumDecodedImageSize was set.1922 if (!canvas()->maximumDecodedImageSize()) {1923 if (Settings* settings = canvas()->document().settings())1924 canvas()->setMaximumDecodedImageSize(settings->maximumDecodedImageSize());1925 }1926 #endif1927 1909 1928 1910 FloatRect logicalRect(sx, sy, sw, sh); -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r166642 r166665 382 382 } 383 383 384 bool CachedImage::canBeDrawn() const385 {386 if (!m_image || m_image->isNull())387 return false;388 389 if (!m_loader || m_loader->reachedTerminalState())390 return true;391 392 size_t estimatedDecodedImageSize = m_image->width() * m_image->height() * 4; // no overflow check393 return estimatedDecodedImageSize <= m_loader->frameLoader()->frame().settings().maximumDecodedImageSize();394 }395 396 384 void CachedImage::addIncrementalDataBuffer(ResourceBuffer* data) 397 385 { … … 409 397 return; 410 398 411 if ( !canBeDrawn()) {412 // There's no image to draw or its decoded size is bigger than the maximum allowed.399 if (m_image->isNull()) { 400 // Image decoding failed. Either we need more image data or the image data is malformed. 413 401 error(errorOccurred() ? status() : DecodeError); 414 402 if (inCache()) … … 448 436 m_image->setData(m_data->sharedBuffer(), true); 449 437 450 if (! canBeDrawn()) {451 // There's no image to draw or its decoded size is bigger than the maximum allowed.438 if (!m_image || m_image->isNull()) { 439 // Image decoding failed; the image data is malformed. 452 440 error(errorOccurred() ? status() : DecodeError); 453 441 if (inCache()) -
trunk/Source/WebCore/loader/cache/CachedImage.h
r166642 r166665 100 100 void createImage(); 101 101 void clearImage(); 102 bool canBeDrawn() const;103 102 // If not null, changeRect is the changed part of the image. 104 103 void notifyObservers(const IntRect* changeRect = 0); -
trunk/Source/WebCore/page/Settings.in
r166516 r166665 26 26 27 27 layoutFallbackWidth type=int, initial=980 28 maximumDecodedImageSize type=size_t, initial=std::numeric_limits<size_t>::max()29 28 deviceWidth type=int, initial=0 30 29 deviceHeight type=int, initial=0 -
trunk/Source/WebKit/mac/ChangeLog
r166661 r166665 1 2014-04-02 Daniel Bates <dabates@apple.com> 2 3 Remove Settings::maximumDecodedImageSize() 4 https://bugs.webkit.org/show_bug.cgi?id=131057 5 <rdar://problem/15626368> 6 7 Reviewed by Darin Adler. 8 9 Remove preferences key WebKitMaximumImageSize. 10 11 * WebView/WebPreferenceKeysPrivate.h: 12 * WebView/WebPreferences.mm: 13 (+[WebPreferences initialize]): 14 (-[WebPreferences _maximumImageSize:]): Deleted. 15 * WebView/WebPreferencesPrivate.h: 16 * WebView/WebView.mm: 17 (-[WebView _preferencesChanged:]): 18 1 19 2014-04-02 Martin Hock <mhock@apple.com> 2 20 -
trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
r165753 r166665 181 181 182 182 #if TARGET_OS_IPHONE 183 #define WebKitMaximumImageSizePreferenceKey @"WebKitMaximumImageSize"184 183 #define WebKitStandalonePreferenceKey @"WebKitStandalonePreferenceKey" 185 184 #define WebKitTelephoneParsingEnabledPreferenceKey @"WebKitTelephoneParsingEnabledPreferenceKey" -
trunk/Source/WebKit/mac/WebView/WebPreferences.mm
r166614 r166665 395 395 RunLoop::initializeMainRunLoop(); 396 396 #endif 397 #if PLATFORM(IOS)398 static unsigned defaultMaximumImageSize = 20 * 1024 * 1024;399 #endif400 397 401 398 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: … … 558 555 559 556 #if PLATFORM(IOS) 560 [NSNumber numberWithUnsignedInt:defaultMaximumImageSize], WebKitMaximumImageSizePreferenceKey,561 557 [NSNumber numberWithBool:NO], WebKitTelephoneParsingEnabledPreferenceKey, 562 558 [NSNumber numberWithInt:-1], WebKitLayoutIntervalPreferenceKey, … … 1406 1402 1407 1403 #if PLATFORM(IOS) 1408 - (size_t)_maximumImageSize1409 {1410 return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitMaximumImageSizePreferenceKey];1411 }1412 1413 1404 - (BOOL)_standalone 1414 1405 { -
trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
r165979 r166665 293 293 // Other private methods 294 294 #if TARGET_OS_IPHONE 295 - (size_t)_maximumImageSize;296 295 - (BOOL)_standalone; 297 296 - (void)_setStandalone:(BOOL)flag; -
trunk/Source/WebKit/mac/WebView/WebView.mm
r166661 r166665 2289 2289 // iOS-specific settings 2290 2290 settings.setStandalone([preferences _standalone]); 2291 settings.setMaximumDecodedImageSize([preferences _maximumImageSize]);2292 2291 settings.setTelephoneNumberParsingEnabled([preferences _telephoneNumberParsingEnabled]); 2293 2292 settings.setAlwaysUseBaselineOfPrimaryFont([preferences _alwaysUseBaselineOfPrimaryFont]);
Note: See TracChangeset
for help on using the changeset viewer.