< prev index next >
modules/javafx.web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp
Print this page
*** 105,118 ****
bool_to_jbool(canSmartCopyOrDelete),
(jstring)plainText.toJavaString(env),
(jstring)markup.toJavaString(env));
}
! void jWriteImage(const Image& image)
{
! DEFINE_PB_STATIC_METHOD("writeImage", "(Lcom/sun/webkit/graphics/WCImageFrame;)V");
! CALL_PB_STATIC_VOID_METHOD(jobject(*const_cast<Image&>(image).javaImage()));
}
void jWriteURL(const String& url, const String& markup)
{
DEFINE_PB_STATIC_METHOD("writeUrl", "(Ljava/lang/String;Ljava/lang/String;)V");
--- 105,120 ----
bool_to_jbool(canSmartCopyOrDelete),
(jstring)plainText.toJavaString(env),
(jstring)markup.toJavaString(env));
}
! void jWriteImage(const Image& image, const String& fileType)
{
! DEFINE_PB_STATIC_METHOD("writeImage", "(Lcom/sun/webkit/graphics/WCImageFrame;Ljava/lang/String;)V");
! CALL_PB_STATIC_VOID_METHOD(
! jobject(*const_cast<Image&>(image).javaImage()),
! (jstring)fileType.toJavaString(env));
}
void jWriteURL(const String& url, const String& markup)
{
DEFINE_PB_STATIC_METHOD("writeUrl", "(Ljava/lang/String;Ljava/lang/String;)V");
*** 324,338 ****
// Write the bytes of the image to the file format
writeImageToDataObject(m_dataObject, node, url);
AtomicString imageURL = node.getAttribute(HTMLNames::srcAttr);
if (!imageURL.isEmpty()) {
! String fullURL = node.document().completeURL(stripLeadingAndTrailingHTMLSpaces(imageURL));
if (!fullURL.isEmpty()) {
m_dataObject->setHTML(
! imageToMarkup(fullURL, node),
node.document().url());
}
}
if (m_copyPasteMode) {
CachedImage* cachedImage = getCachedImage(node);
--- 326,341 ----
// Write the bytes of the image to the file format
writeImageToDataObject(m_dataObject, node, url);
AtomicString imageURL = node.getAttribute(HTMLNames::srcAttr);
+ URL fullURL;
if (!imageURL.isEmpty()) {
! fullURL = node.document().completeURL(stripLeadingAndTrailingHTMLSpaces(imageURL));
if (!fullURL.isEmpty()) {
m_dataObject->setHTML(
! imageToMarkup(fullURL.string(), node),
node.document().url());
}
}
if (m_copyPasteMode) {
CachedImage* cachedImage = getCachedImage(node);
*** 351,361 ****
// based on url and its markup
if (image->isSVGImage()) {
jWriteURL(url.string(), createMarkup(node));
}
else {
! jWriteImage(*image);
}
}
}
void Pasteboard::writeString(const String& type, const String& data)
--- 354,372 ----
// based on url and its markup
if (image->isSVGImage()) {
jWriteURL(url.string(), createMarkup(node));
}
else {
! String lastPathComponent = fullURL.lastPathComponent();
! String extension;
! size_t dotOffset = lastPathComponent.reverseFind('.');
! if (dotOffset != notFound)
! extension = lastPathComponent.substring(dotOffset + 1);
! else
! extension = "png";
!
! jWriteImage(*image, extension);
}
}
}
void Pasteboard::writeString(const String& type, const String& data)
< prev index next >