]> source.dussan.org Git - vaadin-framework.git/commitdiff
Don't recalculate columns if only height has changed (#18274)
authorLeif Åstrand <leif@vaadin.com>
Mon, 15 Jun 2015 12:28:21 +0000 (15:28 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Mon, 29 Jun 2015 08:45:37 +0000 (08:45 +0000)
This patch increases the reported fps in GridResizeTerror from 12 to 35
in my Chrome if only changing the height. No automatic test since
performance testing on our shared testing infrastructure would be quite
error-prone.

Change-Id: I327391dc04dde72a6e770df3b564ae8d4e3c15bb

client/src/com/vaadin/client/widgets/Grid.java

index b3edca9140cb1a81f3375fdf051f966076c53ac8..fef6a01640e34dc3ad493a58bcc29474e2367184 100644 (file)
@@ -2585,6 +2585,7 @@ public class Grid<T> extends ResizeComposite implements
 
     /** @see Grid#autoColumnWidthsRecalculator */
     private class AutoColumnWidthsRecalculator {
+        private double lastCalculatedInnerWidth = -1;
 
         private final ScheduledCommand calculateCommand = new ScheduledCommand() {
 
@@ -2619,6 +2620,7 @@ public class Grid<T> extends ResizeComposite implements
                 } else {
                     calculate();
                 }
+                lastCalculatedInnerWidth = escalator.getInnerWidth();
             }
         };
 
@@ -7656,7 +7658,9 @@ public class Grid<T> extends ResizeComposite implements
 
             @Override
             public void execute() {
-                recalculateColumnWidths();
+                if (escalator.getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) {
+                    recalculateColumnWidths();
+                }
             }
         });
     }