changeset 9205:388cd9ee0bce 9-b75

8132149: [WebView] not reporting device scale factor to a web service Reviewed-by: flar
author ant <anton.tarasov@oracle.com>
date Fri, 24 Jul 2015 13:26:24 +0300
parents 2ada3c5cfd91
children 5a62e9d70fa0 8f40050a7ee7
files modules/web/src/main/java/com/sun/javafx/webkit/prism/PrismGraphicsManager.java modules/web/src/main/java/com/sun/webkit/WebPage.java modules/web/src/main/java/com/sun/webkit/graphics/WCGraphicsManager.java modules/web/src/main/native/Source/WebCore/platform/java/WebPage.cpp
diffstat 4 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/modules/web/src/main/java/com/sun/javafx/webkit/prism/PrismGraphicsManager.java	Thu Jul 23 07:32:50 2015 -0700
+++ b/modules/web/src/main/java/com/sun/javafx/webkit/prism/PrismGraphicsManager.java	Fri Jul 24 13:26:24 2015 +0300
@@ -54,6 +54,10 @@
     static BaseTransform getPixelScaleTransform() {
         return pixelScaleTransform;
     }
+    
+    @Override public float getDevicePixelScale() {
+        return highestPixelScale;
+    } 
 
     @Override protected WCImageDecoder getImageDecoder() {
         return new WCImageDecoderImpl();
--- a/modules/web/src/main/java/com/sun/webkit/WebPage.java	Thu Jul 23 07:32:50 2015 -0700
+++ b/modules/web/src/main/java/com/sun/webkit/WebPage.java	Fri Jul 24 13:26:24 2015 +0300
@@ -168,7 +168,7 @@
         hostWindow = new WCFrameView(this);
         pPage = twkCreatePage(editable);
 
-        twkInit(pPage, false);
+        twkInit(pPage, false, WCGraphicsManager.getGraphicsManager().getDevicePixelScale());
 
         if (pageClient != null && pageClient.isBackBufferSupported()) {
             backbuffer = pageClient.createBackBuffer();
@@ -2419,7 +2419,7 @@
     // *************************************************************************
 
     private native long twkCreatePage(boolean editable);
-    private native void twkInit(long pPage, boolean usePlugins);
+    private native void twkInit(long pPage, boolean usePlugins, float devicePixelScale);
     private native void twkDestroyPage(long pPage);
 
     private native long twkGetMainFrame(long pPage);
--- a/modules/web/src/main/java/com/sun/webkit/graphics/WCGraphicsManager.java	Thu Jul 23 07:32:50 2015 -0700
+++ b/modules/web/src/main/java/com/sun/webkit/graphics/WCGraphicsManager.java	Fri Jul 24 13:26:24 2015 +0300
@@ -56,6 +56,8 @@
     public static WCGraphicsManager getGraphicsManager() {
         return manager;
     }
+    
+    public abstract float getDevicePixelScale();
 
     protected abstract WCImageDecoder getImageDecoder();
 
--- a/modules/web/src/main/native/Source/WebCore/platform/java/WebPage.cpp	Thu Jul 23 07:32:50 2015 -0700
+++ b/modules/web/src/main/native/Source/WebCore/platform/java/WebPage.cpp	Fri Jul 24 13:26:24 2015 +0300
@@ -830,7 +830,7 @@
 }
 
 JNIEXPORT void JNICALL Java_com_sun_webkit_WebPage_twkInit
-    (JNIEnv* env, jobject self, jlong pPage, jboolean usePlugins)
+    (JNIEnv* env, jobject self, jlong pPage, jboolean usePlugins, jfloat devicePixelScale)
 {
     Page* page = WebPage::pageFromJLong(pPage);
 
@@ -856,14 +856,10 @@
     settings.setFixedFontFamily("Monospaced");
 //    settings->setShowsURLsInToolTips(true);
 
-//    JLObject jlself(self, true);
-//    FrameLoaderClientJava* frameLoaderClient = new FrameLoaderClientJava(jlself);
-//    RefPtr<Frame> frame = Frame::create(page, 0 /* ownerFrameElement */, frameLoaderClient);
-//    frameLoaderClient->setFrame(frame.get());
-
+    page->setDeviceScaleFactor(devicePixelScale);
+    
     dynamic_cast<FrameLoaderClientJava*>(&page->mainFrame().loader().client())->setFrame(&page->mainFrame());
 
-    //    frame->init();
     page->mainFrame().init();
 
     JSContextGroupRef contextGroup = toRef(mainThreadNormalWorld().vm());