| 1090 | removeChildrenAndAdd(display.measure, pre); |
| 1091 | |
| 1092 | function measureRect(rect) { |
| 1093 | var top = rect.top - outer.top, bot = rect.bottom - outer.top; |
| 1094 | if (bot > maxBot) bot = maxBot; |
| 1095 | if (top < 0) top = 0; |
| 1096 | for (var i = vranges.length - 2; i >= 0; i -= 2) { |
| 1097 | var rtop = vranges[i], rbot = vranges[i+1]; |
| 1098 | if (rtop > bot || rbot < top) continue; |
| 1099 | if (rtop <= top && rbot >= bot || |
| 1100 | top <= rtop && bot >= rbot || |
| 1101 | Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) { |
| 1102 | vranges[i] = Math.min(top, rtop); |
| 1103 | vranges[i+1] = Math.max(bot, rbot); |
| 1104 | break; |
| 1105 | } |
| 1106 | } |
| 1107 | if (i < 0) { i = vranges.length; vranges.push(top, bot); } |
| 1108 | return {left: rect.left - outer.left, |
| 1109 | right: rect.right - outer.left, |
| 1110 | top: i, bottom: null}; |
| 1111 | } |
| 1112 | function finishRect(rect) { |
| 1113 | rect.bottom = vranges[rect.top+1]; |
| 1114 | rect.top = vranges[rect.top]; |