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

StrokeType.OUTSIDE causes lag when used on a label inside a ScrollPane

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, openjfx11, openjfx13
    • Fix Version/s: tbd
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Java & JavaFX 8/11/13 (happens with all of them)

      A DESCRIPTION OF THE PROBLEM :
      When using StrokeType.OUTSIDE on the text of a label inside a ScrollPane, scrolling vertically (and perhaps horizontally) causes stuttering and lag to the point where the application is barely usable.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Install JDK and JavaFX 8 or 11 or 13.
      Create Main.java inside packageName, style.css inside root of resources folder
      ```css
      .test.label .text {
      -fx-fill: white;
      -fx-stroke: red;
      -fx-stroke-type: outside;
      }
      ```
      And module-info.java
      ```java
      module m {
      requires javafx.base;
      requires javafx.controls;
      exports packageName;
      }
      ```

      The labels render just fine but when I try to scroll it lags really much.


      ```css
      .test.label .text {
      -fx-fill: white;
      -fx-stroke: red;
      /* */
      }
      ```


      I've tried running with JDK & JavaFX 8 and 11 as well but there was no difference.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected it to be as smooth as it is when used without `-fx-stroke-type: outside;`.
      ACTUAL -
      It causes high amounts of stuttering/lag when scrolling.

      ---------- BEGIN SOURCE ----------
      public class Main extends Application {
      @Override
      public void start(Stage primaryStage) {
      ScrollPane scrollPane = new ScrollPane();
      VBox vbox = new VBox();

      for (int i = 0; i < 50; i++) {
      Label label = new Label("Label " + i);
      label.getStyleClass().add("test");
      vbox.getChildren().add(label);
      }

      scrollPane.setContent(vbox);

      Scene scene = new Scene(scrollPane, 500, 500);
      primaryStage.setScene(scene);
      scene.getStylesheets().add("/style.css");
      primaryStage.show();
      }

      public static void main(String[] args) {
      launch(args);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Removing `-fx-stroke-type: outside;` fixes the lag but as the default is StrokeType.INSIDE the stroke overlaps the fill as it is drawn inside of the text and so this is not a viable solution.

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              arapte Ambarish Rapte
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: