Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8108648

ScrollBar implements min/max/value constraints improperly

    XMLWordPrintable

Details

    Description

      Position of thumb in scrollbar is calculated as
      def trackPos:Number = bind ((trackLength - thumbLength) * ((bar.value - bar.min) / (bar.max - bar.min)));
      But sometimes bar.max == bar.min (e.g. for invisible scrollbar inside textbox where max = min = 0). This leads to division by 0 causing trackPos to be NaN.
      This breaks dirty area management in mobile runtime and makes multiline textbox unusable.

      Defining track pos as
       def trackPos:Number = bind if (bar.max - bar.min > 0) ((trackLength - thumbLength) * ((bar.value - bar.min) / (bar.max - bar.min))) else 0
      fixes the problem for me.
      There are more unchecked occurrences of division by (bar.max - bar.min) throughout the scrollbar code, some of them may cause similar problems later on.

      Attachments

        Activity

          People

            miflemi Mick Fleming
            ekrejcir Eva Krejčířová (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: