[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars
From:       Nir Lisker <nlisker () gmail ! com>
Date:       2023-04-30 17:04:15
Message-ID: CA+0ynh81rj8x8dgjpxnfEmh2Z3xUhs+1R1i3EpDs6wRtvFGsrw () mail ! gmail ! com
[Download RAW message or body]

Hi,

I took a quick jab at this issue [1]. Using the reproducer in the ticket,
launch and resize the stage vertically so that the buttons at the bottom
are only partially visible.

The current behavior is as follows:
When the scrollbar is not needed, toggling to the AS_NEEDED policy
reallocates the scrollbar space for the buttons (they move up).
When the scrollbar is needed, toggling to the AS_NEEDED policy still
reallocates space, and the scrollbar takes away space from the content
node. This is wrong.

I modified the method 'computeHsbSizeHint' to

private double computeHsbSizeHint(ScrollPane sp) {
    return determineHorizontalSBVisible() ?
hsb.prefHeight(ScrollBar.USE_COMPUTED_SIZE) : 0;
}

Now the policy toggling behavior is correct both when the scrollbar is
needed and when it's not - the space is reallocated not at the expense of
the content. However, enlarging the stage horizontally while AS_NEEDED is
selected does not reallocate the space (you need to toggle the policies).
I'm guessing there's a missing call to layoutChildren during this resizing.

Does anyone have any input here?


Thanks,
Nir

[1] https://bugs.openjdk.org/browse/JDK-8199934

[Attachment #3 (text/html)]

<div dir="ltr">Hi,<br><div><br></div><div>I took a quick jab at this issue [1]. Using \
the reproducer in the ticket, launch and resize the stage vertically so that the \
buttons at the bottom are only partially  visible.</div><div><br></div><div>The \
current behavior is as follows:</div><div>When the scrollbar is not needed, toggling \
to the AS_NEEDED policy reallocates the scrollbar space for the buttons (they move \
up).</div><div>When the scrollbar is needed, toggling to the AS_NEEDED policy still \
reallocates space, and the scrollbar takes away space from the content node. This is \
wrong.</div><div><br></div>I modified the method &#39;computeHsbSizeHint&#39; \
to<div><br><div>private double computeHsbSizeHint(ScrollPane sp) {<br>      return \
determineHorizontalSBVisible() ? hsb.prefHeight(ScrollBar.USE_COMPUTED_SIZE) : \
0;<br>}</div><div><br></div><div>Now the policy toggling behavior is correct both \
when the scrollbar is needed and when it&#39;s not - the space is reallocated not at \
the expense of the content. However, enlarging the stage horizontally while AS_NEEDED \
is selected does not reallocate the space (you need to toggle the policies). I&#39;m \
guessing there&#39;s a missing call to layoutChildren during this \
resizing.<br></div><div><br></div><div>Does anyone have any input here?<br><div \
style="background-color:rgb(47,47,47);padding:0px 2px"><div \
style="color:rgb(170,170,170);font-family:Consolas;font-size:11pt;white-space:pre"><p \
style="background-color:rgb(55,55,55);margin:0px"><span \
style="color:rgb(217,232,247)"></span></p></div></div><div><br></div><div>Thanks,</div><div>Nir</div><div><br></div><div>[1] \
<a href="https://bugs.openjdk.org/browse/JDK-8199934">https://bugs.openjdk.org/browse/JDK-8199934</a><br></div><div><br></div></div></div></div>




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic