]> source.dussan.org Git - vaadin-framework.git/commitdiff
Performance improvement for #2998 - Table rendering in Firefox is very slow when...
authorArtur Signell <artur.signell@itmill.com>
Tue, 1 Sep 2009 07:05:43 +0000 (07:05 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 1 Sep 2009 07:05:43 +0000 (07:05 +0000)
svn changeset:8600/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java

index 7396aa35c96763defcdeefafc306a2681e4fc65c..1409ae9b8f518bb1a22d5fa06e8edfb4b5c4a685 100644 (file)
@@ -286,6 +286,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
             if (isAttached()) {
                 sizeInit();
             }
+
+            restoreRowVisibility();
         }
 
         if (selectMode == Table.SELECT_MODE_NONE) {
@@ -300,6 +302,18 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
         headerChangedDuringUpdate = false;
     }
 
+    private void restoreRowVisibility() {
+        // Restore row visibility which is set to "none" when the row is
+        // rendered.
+        TableSectionElement tableBodyElement = scrollBody.tBodyElement;
+        final int rows = tableBodyElement.getChildCount();
+        for (int row = 0; row < rows; row++) {
+            final Element cell = tableBodyElement.getChild(row).cast();
+            cell.getStyle().setProperty("visibility", "");
+        }
+
+    }
+
     private void setCacheRate(double d) {
         if (cache_rate != d) {
             cache_rate = d;
@@ -413,6 +427,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
         }
         scrollBody.fixSpacers();
 
+        restoreRowVisibility();
     }
 
     /**
@@ -2211,6 +2226,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
             public VScrollTableRow(UIDL uidl, char[] aligns) {
                 this(uidl.getIntAttribute("key"));
 
+                /*
+                 * Rendering the rows as hidden improves Firefox and Safari
+                 * performance drastically.
+                 */
+                getElement().getStyle().setProperty("visibility", "hidden");
+
                 String rowStyle = uidl.getStringAttribute("rowstyle");
                 if (rowStyle != null) {
                     addStyleName(CLASSNAME + "-row-" + rowStyle);