potentially fix shrunken + scrollable elements.
This commit is contained in:
parent
6a959074a4
commit
0228b28cc4
|
@ -2956,13 +2956,19 @@ Element.prototype._getCoords = function(get, noscroll) {
|
|||
// inside of the visible scroll area.
|
||||
// NOTE: Lists have a property where only
|
||||
// the list items are obfuscated.
|
||||
|
||||
// Old way of doing things, this would not render right if a shrunken element
|
||||
// with lots of boxes in it was within a scrollable element.
|
||||
// var thisparent = this.parent;
|
||||
|
||||
var thisparent = el;
|
||||
if (el && !noscroll) {
|
||||
ppos = this.parent.lpos;
|
||||
ppos = thisparent.lpos;
|
||||
|
||||
// The shrink option can cause a stack overflow
|
||||
// by calling _getCoords on the child again.
|
||||
// if (!get && !this.parent.shrink) {
|
||||
// ppos = this.parent._getCoords();
|
||||
// if (!get && !thisparent.shrink) {
|
||||
// ppos = thisparent._getCoords();
|
||||
// }
|
||||
|
||||
if (!ppos) return;
|
||||
|
@ -2973,7 +2979,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
|||
yi -= ppos.base;
|
||||
yl -= ppos.base;
|
||||
|
||||
b = this.parent.border ? 1 : 0;
|
||||
b = thisparent.border ? 1 : 0;
|
||||
|
||||
if (yi < ppos.yi + b) {
|
||||
if (yl - 1 < ppos.yi + b) {
|
||||
|
@ -2984,7 +2990,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
|||
notop = true;
|
||||
v = ppos.yi - yi;
|
||||
if (this.border) v--;
|
||||
if (this.parent.border) v++;
|
||||
if (thisparent.border) v++;
|
||||
base += v;
|
||||
yi += v;
|
||||
}
|
||||
|
@ -2997,7 +3003,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
|||
nobot = true;
|
||||
v = yl - ppos.yl;
|
||||
if (this.border) v--;
|
||||
if (this.parent.border) v++;
|
||||
if (thisparent.border) v++;
|
||||
yl -= v;
|
||||
}
|
||||
}
|
||||
|
@ -3012,13 +3018,13 @@ Element.prototype._getCoords = function(get, noscroll) {
|
|||
xi = el.lpos.xi;
|
||||
noleft = true;
|
||||
if (this.border) xi--;
|
||||
if (this.parent.border) xi++;
|
||||
if (thisparent.border) xi++;
|
||||
}
|
||||
if (xl > el.lpos.xl) {
|
||||
xl = el.lpos.xl;
|
||||
noright = true;
|
||||
if (this.border) xl++;
|
||||
if (this.parent.border) xl--;
|
||||
if (thisparent.border) xl--;
|
||||
}
|
||||
//if (xi > xl) return;
|
||||
if (xi >= xl) return;
|
||||
|
@ -3735,10 +3741,15 @@ ScrollableBox.prototype._scrollBottom = function() {
|
|||
}
|
||||
|
||||
var bottom = this.children.reduce(function(current, el) {
|
||||
// el.height alone does not calculate the shrunken height, we need to use
|
||||
// getCoords. A shrunken box inside a scrollable element will not grow any
|
||||
// larger than the scrollable element's context regardless of how much
|
||||
// content is in the shrunken box, unless we do this (call getCoords
|
||||
// without the scrollable calculation):
|
||||
if (!el.detached) {
|
||||
var l = el._getCoords(false, true);
|
||||
if (l) {
|
||||
return Math.max(current, el.rtop + (l.yl - l.yi));
|
||||
var lpos = el._getCoords(false, true);
|
||||
if (lpos) {
|
||||
return Math.max(current, el.rtop + (lpos.yl - lpos.yi));
|
||||
}
|
||||
}
|
||||
return Math.max(current, el.rtop + el.height);
|
||||
|
|
Loading…
Reference in New Issue