< prev index next >

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

Print this page
rev 10218 : 8132675: VBox.setVgrow and HBox.setHgrow corrupt following controls when window resized
rev 10208 : 8166999: Update to newer version of WebKit
Summary: Merge with WebKit trunk r197500
Reviewed-by: ghb, arajkumar, asrivastava
Contributed-by: a.ankit.srivastava@oracle.com, arunprasad.rajkumar@oracle.com, guru.hb@oracle.com, murali.billa@oracle.com
rev 10087 : 8164177: Update copyright header for files modified in 2016
Reviewed-by: ckyang
rev 9951 : 8161705: Rename directories under modules to exactly match the module names
Reviewed-by: kcr, vadim

@@ -68,10 +68,11 @@
 {
     // platformContext() returns 0 when printing
     if (gc.paintingDisabled() || !gc.platformContext()) {
         return true;
     }
+
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return false;
     }
     JNIEnv* env = WebCore_GetJavaEnv();

@@ -108,32 +109,31 @@
     return false;
 }
 
 ScrollbarPart ScrollbarThemeJava::hitTest(Scrollbar& scrollbar, const IntPoint& pos)
 {
+    if (!scrollbar.enabled()) {
+        return (ScrollbarPart)0;
+    }
+
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return (ScrollbarPart)0;
     }
     JNIEnv* env = WebCore_GetJavaEnv();
 
     static jmethodID mid = env->GetMethodID(
         getJScrollBarThemeClass(),
         "hitTest",
-        "(IIIIIIII)I");
+        "(JII)I");
     ASSERT(mid);
 
     IntPoint p = scrollbar.convertFromContainingWindow(pos);
     int part = env->CallIntMethod(
         jtheme,
         mid,
-        (jint)scrollbar.width(),
-        (jint)scrollbar.height(),
-        (jint)scrollbar.orientation(),
-        (jint)scrollbar.value(),
-        (jint)scrollbar.visibleSize(),
-        (jint)scrollbar.totalSize(),
+        ptr_to_jlong(&scrollbar),
         (jint)p.x(),
         (jint)p.y());
     CheckAndClearException(env);
 
     return (ScrollbarPart)part;

@@ -145,109 +145,108 @@
     scrollbar.invalidate();
 }
 
 int ScrollbarThemeJava::thumbPosition(Scrollbar& scrollbar)
 {
+    if (!scrollbar.enabled()) {
+        return 0;
+    }
+
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return 0;
     }
     JNIEnv* env = WebCore_GetJavaEnv();
 
     static jmethodID mid = env->GetMethodID(
         getJScrollBarThemeClass(),
         "getThumbPosition",
-        "(IIIIII)I");
+        "(J)I");
     ASSERT(mid);
 
     int pos = env->CallIntMethod(
         jtheme,
         mid,
-        (jint)scrollbar.width(),
-        (jint)scrollbar.height(),
-        (jint)scrollbar.orientation(),
-        (jint)scrollbar.value(),
-        (jint)scrollbar.visibleSize(),
-        (jint)scrollbar.totalSize());
+        ptr_to_jlong(&scrollbar));
     CheckAndClearException(env);
 
     return pos;
 }
 
 int ScrollbarThemeJava::thumbLength(Scrollbar& scrollbar)
 {
+    if (!scrollbar.enabled()) {
+        return 0;
+    }
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return 0;
     }
     JNIEnv* env = WebCore_GetJavaEnv();
 
     static jmethodID mid = env->GetMethodID(
         getJScrollBarThemeClass(),
         "getThumbLength",
-        "(IIIIII)I");
+        "(J)I");
     ASSERT(mid);
 
     int len = env->CallIntMethod(
         jtheme,
         mid,
-        (jint)scrollbar.width(),
-        (jint)scrollbar.height(),
-        (jint)scrollbar.orientation(),
-        (jint)scrollbar.value(),
-        (jint)scrollbar.visibleSize(),
-        (jint)scrollbar.totalSize());
+        ptr_to_jlong(&scrollbar));
     CheckAndClearException(env);
 
     return len;
 }
 
 int ScrollbarThemeJava::trackPosition(Scrollbar& scrollbar)
 {
+    if (!scrollbar.enabled()) {
+        return 0;
+    }
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return 0;
     }
     JNIEnv* env = WebCore_GetJavaEnv();
 
     static jmethodID mid = env->GetMethodID(
         getJScrollBarThemeClass(),
         "getTrackPosition",
-        "(III)I");
+        "(J)I");
     ASSERT(mid);
 
     int pos = env->CallIntMethod(
         jtheme,
         mid,
-        (jint)scrollbar.width(),
-        (jint)scrollbar.height(),
-        (jint)scrollbar.orientation());
+        ptr_to_jlong(&scrollbar));
     CheckAndClearException(env);
 
     return pos;
 }
 
 int ScrollbarThemeJava::trackLength(Scrollbar& scrollbar)
 {
+    if (!scrollbar.enabled()) {
+        return 0;
+    }
     JLObject jtheme = getJScrollBarTheme(scrollbar);
     if (!jtheme) {
         return 0;
     }
     JNIEnv* env = WebCore_GetJavaEnv();
 
     static jmethodID mid = env->GetMethodID(
         getJScrollBarThemeClass(),
         "getTrackLength",
-        "(III)I");
+        "(J)I");
     ASSERT(mid);
 
     int len = env->CallIntMethod(
         jtheme,
         mid,
-        (jint)scrollbar.width(),
-        (jint)scrollbar.height(),
-        (jint)scrollbar.orientation());
+        ptr_to_jlong(&scrollbar));
     CheckAndClearException(env);
 
     return len;
 }
 
< prev index next >