Title: [108100] trunk/Source/WebCore
- Revision
- 108100
- Author
- [email protected]
- Date
- 2012-02-17 11:45:14 -0800 (Fri, 17 Feb 2012)
Log Message
2012-02-17 Nate Chapin <[email protected]>
[Chromium mac] Cursors and background images disappear.
https://bugs.webkit.org/show_bug.cgi?id=78834
The issue occurs because a CachedImage sees that it has no clients
and decide it is safe to purge its m_data buffer. However,
StyleCachedImage is holding a CachedResourceHandle to the
CachedImage, and it can still add a client later. If it does so,
the CachedImage says everything is loaded but has no data.
Reviewed by Adam Barth.
No new tests, since the known repros have resisted reduction.
Tested manually with chrome.angrybirds.com, redfin.com and a
couple of other sites.
* rendering/style/StyleCachedImage.cpp:
* rendering/style/StyleCachedImage.h: Ensure the underlying
CachedImage has a client for the lifetime of the
StyleCachedImage and doesn't purge its buffer. Call
addClient(this) in the constructor and removeClient(this) in
the destructor, then ignore all cache callbacks.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (108099 => 108100)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 19:08:24 UTC (rev 108099)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 19:45:14 UTC (rev 108100)
@@ -1,3 +1,27 @@
+2012-02-17 Nate Chapin <[email protected]>
+
+ [Chromium mac] Cursors and background images disappear.
+ https://bugs.webkit.org/show_bug.cgi?id=78834
+
+ The issue occurs because a CachedImage sees that it has no clients
+ and decide it is safe to purge its m_data buffer. However,
+ StyleCachedImage is holding a CachedResourceHandle to the
+ CachedImage, and it can still add a client later. If it does so,
+ the CachedImage says everything is loaded but has no data.
+
+ Reviewed by Adam Barth.
+
+ No new tests, since the known repros have resisted reduction.
+ Tested manually with chrome.angrybirds.com, redfin.com and a
+ couple of other sites.
+
+ * rendering/style/StyleCachedImage.cpp:
+ * rendering/style/StyleCachedImage.h: Ensure the underlying
+ CachedImage has a client for the lifetime of the
+ StyleCachedImage and doesn't purge its buffer. Call
+ addClient(this) in the constructor and removeClient(this) in
+ the destructor, then ignore all cache callbacks.
+
2012-02-17 Julien Chaffraix <[email protected]>
Table cell's anonymous wrappers are left in the tree, impacting our layout
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp (108099 => 108100)
--- trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp 2012-02-17 19:08:24 UTC (rev 108099)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp 2012-02-17 19:45:14 UTC (rev 108100)
@@ -24,11 +24,22 @@
#include "config.h"
#include "StyleCachedImage.h"
-#include "CachedImage.h"
#include "RenderObject.h"
namespace WebCore {
+StyleCachedImage::StyleCachedImage(CachedImage* image)
+ : m_image(image)
+{
+ m_isCachedImage = true;
+ m_image->addClient(this);
+}
+
+StyleCachedImage::~StyleCachedImage()
+{
+ m_image->removeClient(this);
+}
+
PassRefPtr<CSSValue> StyleCachedImage::cssValue() const
{
return CSSPrimitiveValue::create(m_image->url(), CSSPrimitiveValue::CSS_URI);
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.h (108099 => 108100)
--- trunk/Source/WebCore/rendering/style/StyleCachedImage.h 2012-02-17 19:08:24 UTC (rev 108099)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.h 2012-02-17 19:45:14 UTC (rev 108100)
@@ -24,16 +24,18 @@
#ifndef StyleCachedImage_h
#define StyleCachedImage_h
+#include "CachedImage.h"
#include "CachedResourceHandle.h"
#include "StyleImage.h"
namespace WebCore {
-class CachedImage;
-
-class StyleCachedImage : public StyleImage {
+class StyleCachedImage : public StyleImage, private CachedImageClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleCachedImage> create(CachedImage* image) { return adoptRef(new StyleCachedImage(image)); }
+ virtual ~StyleCachedImage();
+
virtual WrappedImagePtr data() const { return m_image.get(); }
virtual PassRefPtr<CSSValue> cssValue() const;
@@ -54,11 +56,7 @@
virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const;
private:
- StyleCachedImage(CachedImage* image)
- : m_image(image)
- {
- m_isCachedImage = true;
- }
+ explicit StyleCachedImage(CachedImage*);
CachedResourceHandle<CachedImage> m_image;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes