Adopt is/toHTMLImageElement for code cleanup
[WebKit-https.git] / Source / WebCore / bridge / qt / qt_pixmapruntime.cpp
index 1ddf4fd..8689307 100644 (file)
@@ -137,7 +137,7 @@ static JSValueRef assignToHTMLImageElement(JSContextRef context, JSObjectRef fun
 
     // We now know that we have a valid <img> element as the argument, we can attach the pixmap to it.
     RefPtr<StillImage> stillImage = WebCore::StillImage::create(toPixmap(data));
-    HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(jsObject)->impl());
+    HTMLImageElement* imageElement = toHTMLImageElement(static_cast<JSHTMLImageElement*>(jsObject)->impl());
     imageElement->setCachedImage(new CachedImage(stillImage.get()));
     return JSValueMakeUndefined(context);
 }
@@ -218,7 +218,7 @@ QVariant QtPixmapRuntime::toQt(JSContextRef context, JSObjectRef obj, QMetaType:
         return emptyVariantForHint(hint);
 
     JSHTMLImageElement* elementJSWrapper = static_cast<JSHTMLImageElement*>(jsObject);
-    HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(elementJSWrapper->impl());
+    HTMLImageElement* imageElement = toHTMLImageElement(elementJSWrapper->impl());
 
     if (!imageElement)
         return emptyVariantForHint(hint);