Opened 11 years ago

Closed 8 years ago

#8313 closed defect (worksforme)

dijit.layout._LayoutWidget should cache more

Reported by: alex Owned by: dylan
Priority: high Milestone: future
Component: Dijit Version: 1.2.3
Keywords: dijit, layout, caching Cc:
Blocked By: Blocking:

Description

dijit.layout._LayoutWidget always does the work of re-calculating sizes and setting them, even when the current size calculation matches the previous sizes exactly. _LayoutWidget should cache the last size and compare before setting new sizes.

Also, inefficient mixin()-based copying should be moved to use delegate to reduce the # of iterations being performed.

Change History (5)

comment:1 Changed 11 years ago by bill

Milestone: tbdfuture

comment:2 Changed 11 years ago by bill

(In [16917]) Prevent spurious resizing on IE due to resize events on the browser window even though the viewport hasn't changed size. Fixes nestedStack.html test case on IE (refs #8799) and helps reduce redundant resizing in general (refs #8313).

In the future, it would be more efficient to have a single listener for viewport onresize events, detecting which ones are real size changes and then publishing a topic to notify top level widgets that they may need to resize.

comment:3 Changed 11 years ago by bill

(In [17255]) A viewport size change doesn't necessarily mean that a widget's DOM node changed size (the size of the DOM node may be fixed, like style="width: 100px; height: 100px"), so when possible (unfortunately only on IE), monitor when the DOM node itself changes size.

Refs #8313 !strict


Was going to add this code to have a viewport resize topic, but not it doesn't seem necessary:

// Global notification whenever the viewport changes size.
// IE has spurious 'onresize' events so we filter them out at a global level.
dojo.connect(dojo.global, 'onresize', function(){
	var o = dijit._viewport,
		n = dijit.getViewport();
	if(!o || n.w != o.w || n.h != o.h){
		dijit._viewport = n;
		dojo.publish("/dijit/viewportResize", [n]);
	}
});

comment:4 Changed 9 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:5 Changed 8 years ago by bill

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.