<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>One more thing, ScrollPane is also missing an often seen use
      case:</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).</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 class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8091365">https://bugs.openjdk.org/browse/JDK-8091365</a></p>
    <p>--John<br>
    </p>
    <div class="moz-cite-prefix">On 01/05/2023 23:21, John Hendrikx
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:fe04c2f3-9f27-c0b2-efe6-f127111e8bc1@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>I think we need to be very careful in adjusting preferred size
        based on scrollbar visibility.</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.<br>
      </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.</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.</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.<br>
      </p>
      <p>There's also a similar issue: <a class="moz-txt-link-freetext"
          href="https://bugs.openjdk.org/browse/JDK-8095135"
          moz-do-not-send="true">https://bugs.openjdk.org/browse/JDK-8095135</a><br>
      </p>
      <p>--John<br>
      </p>
      <div class="moz-cite-prefix">On 01/05/2023 22:18, Andy Goryachev
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:DM5PR1001MB2172D6AEB286FDFF0A7B0B21E56E9@DM5PR1001MB2172.namprd10.prod.outlook.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
        <style>@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;}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;}span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:windowtext;}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;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
        <div class="WordSection1">
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New"">I think your diagnosis is right though:
              sometimes the layout is not triggered when a property is
              changed,<o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New"">the recent bug like that is <o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New""><o:p> </o:p></span></p>
          <p class="p1"><span class="s1"><a
                href="https://bugs.openjdk.org/browse/JDK-8307117"
                moz-do-not-send="true">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""><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New"">I wonder if some kind of a generic unit test
              could be developed to identify such cases.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New""><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New"">-andy<o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New""><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Courier
              New""><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">Nir Lisker <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:nlisker@gmail.com" moz-do-not-send="true"><nlisker@gmail.com></a><br>
                <b>Date: </b>Monday, May 1, 2023 at 13:09<br>
                <b>To: </b>Andy Goryachev <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:andy.goryachev@oracle.com"
                  moz-do-not-send="true"><andy.goryachev@oracle.com></a><br>
                <b>Cc: </b>openjfx-dev <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:openjfx-dev@openjdk.org"
                  moz-do-not-send="true"><openjfx-dev@openjdk.org></a><br>
                <b>Subject: </b>[External] : Re: JDK-8199934:
                ScrollPaneSkin incorrectly lays out its scrollbars<o:p></o:p></span></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.<o:p></o:p></span></p>
            </div>
            <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></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"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">andy.goryachev@oracle.com</a>>
                    wrote:<o:p></o:p></span></p>
              </div>
              <blockquote style="border:none;border-left:solid #CCCCCC
                1.0pt;padding:0in 0in 0in
                6.0pt;margin-left:4.8pt;margin-right:0in">
                <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"">Nir, would
                          you like to submit a pull request?</span><span
                          style="font-size:11.0pt"><o:p></o:p></span></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""> </span><span
                          style="font-size:11.0pt"><o:p></o:p></span></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"">Thank you</span><span
                          style="font-size:11.0pt"><o:p></o:p></span></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"">-andy</span><span
                          style="font-size:11.0pt"><o:p></o:p></span></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""> </span><span
                          style="font-size:11.0pt"><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="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" moz-do-not-send="true"
                              class="moz-txt-link-freetext">openjfx-dev-retn@openjdk.org</a>>
                            on behalf of Nir Lisker <<a
                              href="mailto:nlisker@gmail.com"
                              target="_blank" moz-do-not-send="true"
                              class="moz-txt-link-freetext">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" moz-do-not-send="true"
                              class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a>><br>
                            <b>Subject: </b>JDK-8199934: ScrollPaneSkin
                            incorrectly lays out its scrollbars</span><span
                            style="font-size:11.0pt"><o:p></o:p></span></p>
                      </div>
                      <div>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                            style="font-size:11.0pt">Hi,<o:p></o:p></span></p>
                        <div>
                          <p class="MsoNormal"
                            style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                              style="font-size:11.0pt"> <o:p></o:p></span></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.<o:p></o:p></span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"
                            style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                              style="font-size:11.0pt"> <o:p></o:p></span></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:<o:p></o:p></span></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).<o:p></o:p></span></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.<o:p></o:p></span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"
                            style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                              style="font-size:11.0pt"> <o:p></o:p></span></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<o:p></o:p></span></p>
                        <div>
                          <p class="MsoNormal"
                            style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                              style="font-size:11.0pt"> <o:p></o:p></span></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>
                                }<o:p></o:p></span></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                style="font-size:11.0pt"> <o:p></o:p></span></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.<o:p></o:p></span></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                style="font-size:11.0pt"> <o:p></o:p></span></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?<o:p></o:p></span></p>
                            <div>
                              <p class="MsoNormal"
                                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                  style="font-size:11.0pt"> <o:p></o:p></span></p>
                            </div>
                            <div>
                              <p class="MsoNormal"
                                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                  style="font-size:11.0pt">Thanks,<o:p></o:p></span></p>
                            </div>
                            <div>
                              <p class="MsoNormal"
                                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                  style="font-size:11.0pt">Nir<o:p></o:p></span></p>
                            </div>
                            <div>
                              <p class="MsoNormal"
                                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                  style="font-size:11.0pt"> <o:p></o:p></span></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"
                                    moz-do-not-send="true"
                                    class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8199934</a><o:p></o:p></span></p>
                            </div>
                            <div>
                              <p class="MsoNormal"
                                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                                  style="font-size:11.0pt"> <o:p></o:p></span></p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>
        </div>
      </blockquote>
    </blockquote>
  </body>
</html>