Introduce IMAGE_TYPE_CASTS, and use it

https://bugs.webkit.org/show_bug.cgi?id=125330

Reviewed by Ryosuke Niwa.

Source/WebCore:

As a step to use TYPE_CASTS_BASE, this cl introduce IMAGE_TYPE_CASTS.
BitmapImage and SVGImage can use it to generate toFoo() type case helper functions.

No new tests, no behavior changes.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::imageSizeForRenderer):
(WebCore::CachedImage::resumeAnimatingImagesForLoader):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage):
* svg/graphics/SVGImage.h:

Source/WebKit2:

As a step to use TYPE_CASTS_BASE, this cl introduce IMAGE_TYPE_CASTS.
BitmapImage, SVGImage can use it to generate toFoo() type case helper functions.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::pluginSnapshotTimerFired):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f6c72967
2013-12-05 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Introduce IMAGE_TYPE_CASTS, and use it
https://bugs.webkit.org/show_bug.cgi?id=125330
Reviewed by Ryosuke Niwa.
As a step to use TYPE_CASTS_BASE, this cl introduce IMAGE_TYPE_CASTS.
BitmapImage and SVGImage can use it to generate toFoo() type case helper functions.
No new tests, no behavior changes.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::imageSizeForRenderer):
(WebCore::CachedImage::resumeAnimatingImagesForLoader):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage):
* svg/graphics/SVGImage.h:
2013-12-05 Zoltan Horvath <zoltan@webkit.org>
Clean up the forwarding headers of RenderBlock.h
......@@ -263,11 +263,11 @@ LayoutSize CachedImage::imageSizeForRenderer(const RenderObject* renderer, float
if (renderer && m_image->isBitmapImage()) {
ImageOrientationDescription orientationDescription(renderer->shouldRespectImageOrientation(), renderer->style().imageOrientation());
if (orientationDescription.respectImageOrientation() == RespectImageOrientation)
imageSize = static_cast<BitmapImage*>(m_image.get())->sizeRespectingOrientation(orientationDescription);
imageSize = toBitmapImage(m_image.get())->sizeRespectingOrientation(orientationDescription);
}
#else
if (m_image->isBitmapImage() && (renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation))
imageSize = static_cast<BitmapImage*>(m_image.get())->sizeRespectingOrientation();
imageSize = toBitmapImage(m_image.get())->sizeRespectingOrientation();
#endif
#if ENABLE(SVG)
......@@ -529,7 +529,7 @@ void CachedImage::resumeAnimatingImagesForLoader(CachedResourceLoader* loader)
Image* image = cachedImage->image();
if (!image->isBitmapImage())
continue;
BitmapImage* bitmapImage = static_cast<BitmapImage*>(image);
BitmapImage* bitmapImage = toBitmapImage(image);
if (!bitmapImage->canAnimate())
continue;
cachedImage->animationAdvanced(bitmapImage);
......
......@@ -300,6 +300,8 @@ private:
RefPtr<Image> m_cachedImage;
};
IMAGE_TYPE_CASTS(BitmapImage)
}
#endif
......@@ -209,6 +209,9 @@ private:
FloatSize m_space;
};
#define IMAGE_TYPE_CASTS(ToClassName) \
TYPE_CASTS_BASE(ToClassName, Image, image, image->is##ToClassName(), image.is##ToClassName())
}
#endif
......@@ -86,7 +86,7 @@ RetainPtr<NSImage> createDragImageFromImage(Image* image, ImageOrientationDescri
if (image->isBitmapImage()) {
ImageOrientation orientation;
BitmapImage* bitmapImage = static_cast<BitmapImage *>(image);
BitmapImage* bitmapImage = toBitmapImage(image);
IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation(description);
if (description.respectImageOrientation() == RespectImageOrientation)
......
......@@ -102,7 +102,10 @@ private:
bool isInSVGImage(const Element*);
IMAGE_TYPE_CASTS(SVGImage)
}
#endif // ENABLE(SVG)
#endif // SVGImage_h
2013-12-05 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Introduce IMAGE_TYPE_CASTS, and use it
https://bugs.webkit.org/show_bug.cgi?id=125330
Reviewed by Ryosuke Niwa.
As a step to use TYPE_CASTS_BASE, this cl introduce IMAGE_TYPE_CASTS.
BitmapImage, SVGImage can use it to generate toFoo() type case helper functions.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::pluginSnapshotTimerFired):
2013-12-05 Mark Lam <mark.lam@apple.com>
C Loop LLINT layout test regressions.
......
......@@ -1683,7 +1683,7 @@ void PluginView::pluginSnapshotTimerFired(DeferrableOneShotTimer<PluginView>*)
#if PLATFORM(MAC)
unsigned maximumSnapshotRetries = frame() ? frame()->settings().maximumPlugInSnapshotAttempts() : 0;
if (snapshotImage && isAlmostSolidColor(static_cast<BitmapImage*>(snapshotImage.get())) && m_countSnapshotRetries < maximumSnapshotRetries) {
if (snapshotImage && isAlmostSolidColor(toBitmapImage(snapshotImage.get())) && m_countSnapshotRetries < maximumSnapshotRetries) {
++m_countSnapshotRetries;
m_pluginSnapshotTimer.restart();
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment