Replace SVG bitmap cache with directly-rendered SVG
https://bugs.webkit.org/show_bug.cgi?id=106159
Reviewed by Tim Horton.
Source/WebCore:
This patch removes the caching of SVG bitmaps so SVG images are rendered directly. This
enables WebKit to pass the IE Chalkboard demo in 10s on a Z620:
http://ie.microsoft.com/testdrive/Performance/Chalkboard/
On a simple scaled SVG benchmark similar to the IE10 Chalkboard demo
(http://philbit.com/SvgImagePerformance/viewport.html):
without patch: ~20FPS
with patch: ~55FPS
The bitmap SVG image cache had several shortcomings:
- The bitmap cache prevented viewport rendering. (WK104693)
- Bitmap memory usage was high. (WK106484)
- Caching animating images was expensive.
This change removes almost all of the SVGImageCache implementation, replacing it with
directly-rendered SVG. Instead of caching bitmaps, an SVGImageForContainer is cached which
is a thin wrapper around an SVG image with the associated container size and scale.
When rendering patterns (e.g., tiled backgrounds), a temporary bitmap is used for
performance. This change also removes the redraw timer of the old cache, instead relying
on the SVG image to notify clients if the image changes (e.g., during animations).
This patch fixes two existing bugs (WK99481 and WK104189) that were due to caching bitmaps
at a fixed size. A test has been added for each of these bugs.
Tests: svg/as-image/svg-image-scaled.html
svg/as-image/svg-image-viewbox.html
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::lookupOrCreateImageForRenderer):
(WebCore::CachedImage::setContainerSizeForRenderer):
(WebCore::CachedImage::clear):
(WebCore::CachedImage::changedInRect):
SVG images are no longer special-cased here. When the SVG image changes, users are
notified through this function, and users can then request th