< prev index next >

modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragClientJava.cpp

Print this page

        

@@ -143,10 +143,11 @@
         "II"
         "II"
         "[Ljava/lang/String;"
         "[Ljava/lang/Object;"
         "Z"
+        "Ljava/lang/String;"
         ")V");
     ASSERT(mid);
 
     static JGClass clsString(env->FindClass("java/lang/String"));
     static JGClass clsObject(env->FindClass("java/lang/Object"));

@@ -197,10 +198,29 @@
         eventPos.y() - dragImageOrigin.y(),
         eventPos.x(),
         eventPos.y(),
         jobjectArray(jmimeTypes),
         jobjectArray(jvalues),
-        bool_to_jbool(isImageSource));
+        bool_to_jbool(isImageSource),
+        (jstring)m_fileExt.toJavaString(env));
     CheckAndClearException(env);
 }
 
+void DragClientJava::updateFileExtension(const URL& imageURL)
+{
+    if (imageURL.isNull() || imageURL.isEmpty()) {
+        m_fileExt = emptyString();
+        return;
+    }
+
+    String lastPathComponent = imageURL.lastPathComponent();
+    String extension;
+    size_t dotOffset = lastPathComponent.reverseFind('.');
+    if (dotOffset != notFound)
+        extension = lastPathComponent.substring(dotOffset + 1);
+    else
+        extension = "png"; // Fallback to png if image does not have an extension
+
+    m_fileExt = extension;
+}
+
 } // namespace WebCore
< prev index next >