Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8171898: [WebView] ScrollBarWidget thickness calculation is not correct #197

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, 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
@@ -48,9 +48,6 @@

private final static PlatformLogger log = PlatformLogger.getLogger(ScrollBarThemeImpl.class.getName());

private WeakReference<ScrollBar> testSBRef = // used for scrollbar thickness calculation
new WeakReference<ScrollBar>(null);

private final Accessor accessor;

private final Pool<ScrollBarWidget> pool;
@@ -81,19 +78,14 @@ public ScrollBarThemeImpl(final Accessor accessor) {
accessor.addViewListener(new ViewListener(pool, accessor) {
@Override public void invalidated(Observable ov) {
super.invalidated(ov);
ScrollBar testSB = new ScrollBarWidget(ScrollBarThemeImpl.this);
ScrollBar testSB = new ScrollBarWidget();
// testSB should be added to the new WebView (if any)
accessor.addChild(testSB);
testSBRef = new WeakReference<ScrollBar>(testSB);
}
});

}

ScrollBar getTestSBRef() {
return testSBRef.get();
}

private static Orientation convertOrientation(int orientation) {
return orientation == VERTICAL_SCROLLBAR ? Orientation.VERTICAL : Orientation.HORIZONTAL;
}
@@ -156,7 +148,7 @@ private void adjustScrollBar(ScrollBar sb, int w, int h, int orientation,
{
ScrollBarWidget sb = pool.get(id);
if (sb == null) {
sb = new ScrollBarWidget(this);
sb = new ScrollBarWidget();
pool.put(id, sb, accessor.getPage().getUpdateContentCycleID());
accessor.addChild(sb);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -40,15 +40,12 @@ public void doUpdatePeer(Node node) {
});
}

private ScrollBarThemeImpl sbtImpl;

{
// To initialize the class helper at the begining each constructor of this class
ScrollBarWidgetHelper.initHelper(this);
}

public ScrollBarWidget(ScrollBarThemeImpl sbtImpl) {
this.sbtImpl = sbtImpl;
public ScrollBarWidget() {
setOrientation(Orientation.VERTICAL);
setMin(0);
setManaged(false);
@@ -72,14 +69,10 @@ protected void layoutChildren() {
initializeThickness();
}

private boolean thicknessInitialized = false;
private static boolean thicknessInitialized = false;
private void initializeThickness() {
if (!thicknessInitialized) {
ScrollBar testSB = sbtImpl.getTestSBRef();
if (testSB == null) {
return;
}
int thickness = (int) testSB.prefWidth(-1);
int thickness = (int) prefWidth(-1);
if (thickness != 0 && ScrollBarTheme.getThickness() != thickness) {
ScrollBarTheme.setThickness(thickness);
}
ProTip! Use n and p to navigate between commits in a pull request.