From dfd5d4e28abb10434dba4ccd36bb31457558dadf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Mon, 15 Jun 2015 15:28:21 +0300 Subject: [PATCH] Don't recalculate columns if only height has changed (#18274) 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: I17aeb2eac9fe4ef72993eb0f9307c1d5a75653a2 --- client/src/com/vaadin/client/widgets/Grid.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index b3edca9140..fef6a01640 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -2585,6 +2585,7 @@ public class Grid 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 extends ResizeComposite implements } else { calculate(); } + lastCalculatedInnerWidth = escalator.getInnerWidth(); } }; @@ -7656,7 +7658,9 @@ public class Grid extends ResizeComposite implements @Override public void execute() { - recalculateColumnWidths(); + if (escalator.getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { + recalculateColumnWidths(); + } } }); } -- 2.39.5