ellg / gwtquery-plugins

Automatically exported from code.google.com/p/gwtquery-plugins
0 stars 0 forks source link

DnD - Large tables slow in Chrome #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attach and display a DragAndDropCellTable 
2. Add a large number of rows (e.g. 2000)
3. Display it in Chrome

What is the expected output? What do you see instead?
It should be relatively quick (and is in Firefox)
But it's slow in Chrome (~20sec)

The cause is that DragAndDropAbstractCellTableDelegate triggers multiple Style 
Recalculations in Chrome.
In addDragAndDropBehaviour(), it calls maybeMakeDraggableOrDroppable for each 
cell in sequence.
That causes new CSS classes to be added to each cell, but also calls 
getOffsetHeight/getOffsetWidth (via Droppable.droppable which constructs a new 
Dimension object) 

In chrome this sequence of calls is slow, because requesting the height/width 
requires chrome to determine the affect of the applicable styles, but then the 
styles are changed again immediately after, so the next call to 
getOffsetHeight/getOffsetWidth has to recalculate everything again.

If DragAndDropAbstractCellTableDelegate.addDragAndDropBehaviour added the CSS 
classes first, and then added the handlers (which is what needs to know the 
dimensions) then it would be much faster.

What version of the product are you using? On what operating system?
DND plugin 0.6 ; Chrome 26 ; MacOS 10.8

Please provide any additional information below.

Original issue reported on code.google.com by tim.site...@gmail.com on 3 May 2013 at 5:06