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

WebPage.addToDirty does not always merge mergeable rects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7u6
    • 7u6
    • javafx
    • None
    • web

      Consider the WebPage.addToDirty method source code:

          private void addToDirty(WCRectangle toPaint) {
              boolean add = true;
              for (int i = 0; i < dirtyRects.size(); i++) {
                  WCRectangle d = dirtyRects.get(i);
                  if (d.contains(toPaint)) {
                      add = false;
                      break;
                  }
                  if (toPaint.contains(d)) {
                      dirtyRects.remove(i);
                      continue;
                  }
                  WCRectangle u = d.createUnion(toPaint);
                  if (u.getIntWidth() * u.getIntHeight() <
                      d.getIntWidth() * d.getIntHeight() + toPaint.getIntWidth() * toPaint.getIntHeight())
                  {
                      dirtyRects.remove(i);
                      toPaint = u;
                      continue;
                  }
              }
              if (add) {
                  dirtyRects.add(toPaint);
              }
          }

      When the second "if" condition is true, the method removes the "current" item, thus making the next item "current", and then, as part of the next iteration, immediately shifts to the next item, effectively skipping the item next to the original "current" item.

      This breaks the merging logic and often causes WebPage to paint the entire page twice during one paint cycle.

            ant Anton Tarasov (Inactive)
            vbaranov Vasiliy Baranov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: