<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Helvetica Neue";
        panose-1:2 0 5 3 0 0 0 2 0 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.p1, li.p1, div.p1
        {mso-style-name:p1;
        margin:0in;
        font-size:10.0pt;
        font-family:"Helvetica Neue";}
span.s1
        {mso-style-name:s1;
        color:#DCA10D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Courier New",serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">This is a very interesting idea.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">iOS does something similar, but I always thought than discoverability should be a priority.  Perhaps if it would not fade to a complete transparency, but remained slightly visible. 
 Or it might depend on a (global) option.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">One thing you are right - it would require a different skin (skins, for all the components that use ScrollBars).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of John Hendrikx <john.hendrikx@gmail.com><br>
<b>Date: </b>Monday, May 1, 2023 at 14:43<br>
<b>To: </b>openjfx-dev@openjdk.org <openjfx-dev@openjdk.org><br>
<b>Subject: </b>Re: [External] : Re: JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars<o:p></o:p></span></p>
</div>
<p>One more thing, ScrollPane is also missing an often seen use case:<o:p></o:p></p>
<p>Transparent scrollbars, or scrollbars that fade out after use.  For one of my own panes, I've tweaked ScrollPane to have transparent scroll bars which overlaps the content always (ie. the content is visible below the scroll bar).  I do this with a new ScrollBarSkin
 that just puts the bar at a negative offset so it overlaps the content.  IntelliJ does this for example, as well as Visual Studio Code (for horizontal bar at least).<o:p></o:p></p>
<p>I think it already do this for touch platforms (embedded), but doesn't offer it for other platforms.  Someone filed a ticket for this:
<a href="https://bugs.openjdk.org/browse/JDK-8091365">https://bugs.openjdk.org/browse/JDK-8091365</a><o:p></o:p></p>
<p>--John<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On 01/05/2023 23:21, John Hendrikx wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>I think we need to be very careful in adjusting preferred size based on scrollbar visibility.<o:p></o:p></p>
<p>ScrollPane's are used to avoid putting pressure on the surrounding layout.  It's preferred size will often be ignored in most layouts because its preferred size is the size of its content, which is likely too large too fit (otherwise why use a ScrollPane).
 When a ScrollPane's bounds become smaller, it must be careful not to change its minimum space requirements, as that would be counter to its purpose.<o:p></o:p></p>
<p>However, even changing its preferred size when space is getting tighter may affect layouts in a way you really want to avoid.  BorderPane is one of many layouts, and even though what we're seeing may seem like a bug, changing this behavior may have consequences. 
 What if the ScrollPane is in a VBox with two elements set to Priority.ALWAYS, one being the ScrollPane?  When space gets tighter, changing the preferred size to allow for a scroll bar is going to make the layout jump a bit, because it will take away a bit
 of extra space from the other element with Priority.ALWAYS.  VBox uses the preferred sizes of all children as a starting point, and shrinks them to be smaller to fit -- changing the starting point (the preferred size) suddenly to make room for a scroll bar
 is not going to be smooth.<o:p></o:p></p>
<p>I suspect in a lot of layouts the values for viewport width/height will be set, as using the content as its preferred size for a ScrollPane seems like a bad choice to begin with.  In the VBox example, the preferred size would be so large when there is a
 lot of content that it would swallow most of the extra space from any other nodes set to Priority.ALWAYS.  Two ScrollPane's above each other would not be equal sized, as their preferred starting sizes would be based on their contents... it would look weird
 without setting viewport size hints.<o:p></o:p></p>
<p>I could imagine that there could be a different scroll bar policy, one where room is always reserved for scrollbars, but they still display only when needed.  This way, the ScrollPane, if it can be displayed at its preferred size, would have sufficient room
 for a horizontal scrollbar, and when it's horizontal size gets squished, it can display it without needing to adjust its minimum or preferred sizes. If there isn't enough room, it would pretty much function as before, where the scrollbar overlays content when
 it does need to be displayed -- that's unavoidable.<o:p></o:p></p>
<p>There's also a similar issue: <a href="https://bugs.openjdk.org/browse/JDK-8095135">
https://bugs.openjdk.org/browse/JDK-8095135</a><o:p></o:p></p>
<p>--John<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On 01/05/2023 22:18, Andy Goryachev wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">I think your diagnosis is right though: sometimes the layout is not triggered when a property is changed,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">the recent bug like that is
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<p class="p1"><span class="s1"><a href="https://bugs.openjdk.org/browse/JDK-8307117">JDK-8307117</a></span> TextArea: wrapText property ignored when changing font<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">I wonder if some kind of a generic unit test could be developed to identify such cases.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Nir Lisker <a href="mailto:nlisker@gmail.com">
<nlisker@gmail.com></a><br>
<b>Date: </b>Monday, May 1, 2023 at 13:09<br>
<b>To: </b>Andy Goryachev <a href="mailto:andy.goryachev@oracle.com"><andy.goryachev@oracle.com></a><br>
<b>Cc: </b>openjfx-dev <a href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>[External] : Re: JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">If I knew what the fix was I would have. Right now I'm not sure anymore what the correct behavior should be even.</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Mon, May 1, 2023 at 10:44 PM Andy Goryachev <<a href="mailto:andy.goryachev@oracle.com">andy.goryachev@oracle.com</a>> wrote:</span><o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Courier New",serif">Nir, would you like to submit a pull request?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Courier New",serif">Thank you</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Courier New",serif">-andy</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Courier New",serif"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-dev <<a href="mailto:openjfx-dev-retn@openjdk.org" target="_blank">openjfx-dev-retn@openjdk.org</a>> on behalf of Nir Lisker <<a href="mailto:nlisker@gmail.com" target="_blank">nlisker@gmail.com</a>><br>
<b>Date: </b>Sunday, April 30, 2023 at 10:04<br>
<b>To: </b>openjfx-dev <<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a>><br>
<b>Subject: </b>JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Hi,</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">The current behavior is as follows:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">When the scrollbar is not needed, toggling to the AS_NEEDED policy reallocates the scrollbar space for the buttons (they move up).</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">I modified the method 'computeHsbSizeHint' to</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">private double computeHsbSizeHint(ScrollPane sp) {<br>
    return determineHorizontalSBVisible() ? hsb.prefHeight(ScrollBar.USE_COMPUTED_SIZE) : 0;<br>
}</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Does anyone have any input here?</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Thanks,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Nir</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">[1]
<a href="https://bugs.openjdk.org/browse/JDK-8199934" target="_blank">https://bugs.openjdk.org/browse/JDK-8199934</a></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</blockquote>
</div>
</body>
</html>