changeset 11007:31ed6f47fe5d

8208114: Drag and drop of text contents and URL links functionalities are broken in Webview Reviewed-by: mbilla, kcr
author arajkumar
date Fri, 27 Jul 2018 09:53:16 +0530
parents 89537cb225f8
children 987a6417e320
files modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragClientJava.cpp
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragClientJava.cpp	Thu Jul 26 22:44:48 2018 +0530
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/java/DragClientJava.cpp	Fri Jul 27 09:53:16 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,6 +99,11 @@
     static JGClass clsString(env->FindClass("java/lang/String"));
     static JGClass clsObject(env->FindClass("java/lang/Object"));
 
+    // we are temporary changing dataTransfer security context
+    // for transfer-to-Java purposes.
+    auto actualStoreMode = dataTransfer.storeMode();
+    dataTransfer.setStoreMode(DataTransfer::StoreMode::Readonly);
+
     Vector<String> mimeTypes(dataTransfer.types());
     JLObjectArray jmimeTypes(env->NewObjectArray(mimeTypes.size(), clsString, NULL));
     JLObjectArray jvalues(env->NewObjectArray(mimeTypes.size(), clsObject, NULL));
@@ -106,12 +111,6 @@
 
     auto document = WebPage::pageFromJObject(m_webPage)->mainFrame().document();
     if (document) {
-        // we are temporary changing dataTransfer security context
-        // for transfer-to-Java purposes.
-
-        auto actualStoreMode = dataTransfer.storeMode();
-        dataTransfer.setStoreMode(DataTransfer::StoreMode::Readonly);
-
         int index = 0;
         for(const auto& mime : mimeTypes) {
             String value = dataTransfer.getData(*document, mime);
@@ -127,9 +126,9 @@
                 (jstring)value.toJavaString(env));
             index++;
         }
-
-        dataTransfer.setStoreMode(actualStoreMode);
     }
+    // restore the original store mode
+    dataTransfer.setStoreMode(actualStoreMode);
 
     // Attention! [jimage] can be the instance of WCImage or WCImageFrame class.
     // The nature of raster is too different to make a conversion inside the native code.