Author: yradtsevich
Date: 2012-06-29 10:43:28 -0400 (Fri, 29 Jun 2012)
New Revision: 42305
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
Log:
https://issues.jboss.org/browse/JBIDE-12191 : BrowserSim: automatically hide/customize
scrollbars
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-06-29
13:07:32 UTC (rev 42304)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-06-29
14:43:28 UTC (rev 42305)
@@ -243,57 +243,60 @@
}
});
- browser.addLocationListener(new LocationAdapter() {
- @Override
- public void changed(LocationEvent event) {
- Browser browser = (Browser) event.widget;
- setCustomScrollbarStyles(browser);
- }
-
- @SuppressWarnings("nls")
- private void setCustomScrollbarStyles(Browser browser) {
- browser.execute(
- "if (window._browserSim_customScrollBarStylesSetter === undefined) {"
- +"window._browserSim_customScrollBarStylesSetter = function () {"
- + "document.removeEventListener('DOMSubtreeModified',
window._browserSim_customScrollBarStylesSetter, false);"
- + "var head = document.head;"
- + "var style = document.createElement('style');"
- + "style.type = 'text/css';"
- + "style.id='browserSimStyles';"
- + "head.appendChild(style);"
- + "style.innerText='"
- // The following two rules fix a problem with showing scrollbars in Google Mail and
similar,
- // but autohiding of navigation bar stops to work with it. That is why they are
commented.
- //+ "html {"
- //+ "overflow: hidden;"
- //+ "}"
- //+ "body {"
- //+ "position: absolute;"
- //+ "top: 0px;"
- //+ "left: 0px;"
- //+ "bottom: 0px;"
- //+ "right: 0px;"
- //+ "margin: 0px;"
- //+ "overflow-y: auto;"
- //+ "overflow-x: auto;"
- //+ "}"
- + "::-webkit-scrollbar {"
- + "width: 5px;"
- + "height: 5px;"
- + "}"
- + "::-webkit-scrollbar-thumb {"
- + "background: rgba(0,0,0,0.4); "
- + "}"
- + "::-webkit-scrollbar-corner, ::-webkit-scrollbar-thumb:window-inactive
{"
- + "background: rgba(0,0,0,0.0);"
- + "};"
- + "';"
- +"};"
- + "document.addEventListener('DOMSubtreeModified',
window._browserSim_customScrollBarStylesSetter, false);"
- + "}"
- );
- }
- });
+ //JBIDE-12191 - custom scrollbars work satisfactorily on windows only
+ if (PlatformUtil.OS_WIN32.equals(PlatformUtil.getOs())) {
+ browser.addLocationListener(new LocationAdapter() {
+ @Override
+ public void changed(LocationEvent event) {
+ Browser browser = (Browser) event.widget;
+ setCustomScrollbarStyles(browser);
+ }
+
+ @SuppressWarnings("nls")
+ private void setCustomScrollbarStyles(Browser browser) {
+ browser.execute(
+ "if (window._browserSim_customScrollBarStylesSetter === undefined) {"
+ +"window._browserSim_customScrollBarStylesSetter = function () {"
+ + "document.removeEventListener('DOMSubtreeModified',
window._browserSim_customScrollBarStylesSetter, false);"
+ + "var head = document.head;"
+ + "var style = document.createElement('style');"
+ + "style.type = 'text/css';"
+ + "style.id='browserSimStyles';"
+ + "head.appendChild(style);"
+ + "style.innerText='"
+ // The following two rules fix a problem with showing scrollbars in Google Mail
and similar,
+ // but autohiding of navigation bar stops to work with it. That is why they are
commented.
+ //+ "html {"
+ //+ "overflow: hidden;"
+ //+ "}"
+ //+ "body {"
+ //+ "position: absolute;"
+ //+ "top: 0px;"
+ //+ "left: 0px;"
+ //+ "bottom: 0px;"
+ //+ "right: 0px;"
+ //+ "margin: 0px;"
+ //+ "overflow-y: auto;"
+ //+ "overflow-x: auto;"
+ //+ "}"
+ + "::-webkit-scrollbar {"
+ + "width: 5px;"
+ + "height: 5px;"
+ + "}"
+ + "::-webkit-scrollbar-thumb {"
+ + "background: rgba(0,0,0,0.4); "
+ + "}"
+ + "::-webkit-scrollbar-corner, ::-webkit-scrollbar-thumb:window-inactive
{"
+ + "background: rgba(0,0,0,0.0);"
+ + "};"
+ + "';"
+ +"};"
+ + "document.addEventListener('DOMSubtreeModified',
window._browserSim_customScrollBarStylesSetter, false);"
+ + "}"
+ );
+ }
+ });
+ };
browser.addLocationListener(new LocationListener() {
private BrowserFunction scrollListener = null;