modules/web/src/main/java/com/sun/webkit/WebPage.java

Print this page

        

@@ -205,10 +205,13 @@
 
     private WCPageBackBuffer backbuffer;
     private List<WCRectangle> dirtyRects = new LinkedList<WCRectangle>();
 
     private void addDirtyRect(WCRectangle toPaint) {
+        if (toPaint.getWidth() <= 0 || toPaint.getHeight() <= 0) {
+            return;
+        }
         for (Iterator<WCRectangle> it = dirtyRects.iterator(); it.hasNext();) {
             WCRectangle rect = it.next();
             // if already covered
             if (rect.contains(toPaint)) {
                 return;

@@ -369,15 +372,15 @@
                     }
                 }
             }
         }
 
-        // Add the dirty (not copied) rect
-        addDirtyRect(new WCRectangle(dx >= 0 ? x : x + w + dx,
-                                     dy >= 0 ? y : y + h + dy,
-                                     dx == 0 ? w : Math.abs(dx),
-                                     dy == 0 ? h : Math.abs(dy)));
+        // Add the dirty (not copied) rects
+        addDirtyRect(new WCRectangle(x, dy >= 0 ? y : y + h + dy,
+                                     w, Math.abs(dy)));
+        addDirtyRect(new WCRectangle(dx >= 0 ? x : x + w + dx, y,
+                                     Math.abs(dx), h - Math.abs(dy)));
     }
 
     // Instances of this class may not be accessed and modified concurrently
     // by multiple threads
     private static final class RenderFrame {