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.
|
// inside of the visible scroll area.
|
||||||
// NOTE: Lists have a property where only
|
// NOTE: Lists have a property where only
|
||||||
// the list items are obfuscated.
|
// 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) {
|
if (el && !noscroll) {
|
||||||
ppos = this.parent.lpos;
|
ppos = thisparent.lpos;
|
||||||
|
|
||||||
// The shrink option can cause a stack overflow
|
// The shrink option can cause a stack overflow
|
||||||
// by calling _getCoords on the child again.
|
// by calling _getCoords on the child again.
|
||||||
// if (!get && !this.parent.shrink) {
|
// if (!get && !thisparent.shrink) {
|
||||||
// ppos = this.parent._getCoords();
|
// ppos = thisparent._getCoords();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!ppos) return;
|
if (!ppos) return;
|
||||||
|
@ -2973,7 +2979,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
||||||
yi -= ppos.base;
|
yi -= ppos.base;
|
||||||
yl -= ppos.base;
|
yl -= ppos.base;
|
||||||
|
|
||||||
b = this.parent.border ? 1 : 0;
|
b = thisparent.border ? 1 : 0;
|
||||||
|
|
||||||
if (yi < ppos.yi + b) {
|
if (yi < ppos.yi + b) {
|
||||||
if (yl - 1 < ppos.yi + b) {
|
if (yl - 1 < ppos.yi + b) {
|
||||||
|
@ -2984,7 +2990,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
||||||
notop = true;
|
notop = true;
|
||||||
v = ppos.yi - yi;
|
v = ppos.yi - yi;
|
||||||
if (this.border) v--;
|
if (this.border) v--;
|
||||||
if (this.parent.border) v++;
|
if (thisparent.border) v++;
|
||||||
base += v;
|
base += v;
|
||||||
yi += v;
|
yi += v;
|
||||||
}
|
}
|
||||||
|
@ -2997,7 +3003,7 @@ Element.prototype._getCoords = function(get, noscroll) {
|
||||||
nobot = true;
|
nobot = true;
|
||||||
v = yl - ppos.yl;
|
v = yl - ppos.yl;
|
||||||
if (this.border) v--;
|
if (this.border) v--;
|
||||||
if (this.parent.border) v++;
|
if (thisparent.border) v++;
|
||||||
yl -= v;
|
yl -= v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3012,13 +3018,13 @@ Element.prototype._getCoords = function(get, noscroll) {
|
||||||
xi = el.lpos.xi;
|
xi = el.lpos.xi;
|
||||||
noleft = true;
|
noleft = true;
|
||||||
if (this.border) xi--;
|
if (this.border) xi--;
|
||||||
if (this.parent.border) xi++;
|
if (thisparent.border) xi++;
|
||||||
}
|
}
|
||||||
if (xl > el.lpos.xl) {
|
if (xl > el.lpos.xl) {
|
||||||
xl = el.lpos.xl;
|
xl = el.lpos.xl;
|
||||||
noright = true;
|
noright = true;
|
||||||
if (this.border) xl++;
|
if (this.border) xl++;
|
||||||
if (this.parent.border) xl--;
|
if (thisparent.border) xl--;
|
||||||
}
|
}
|
||||||
//if (xi > xl) return;
|
//if (xi > xl) return;
|
||||||
if (xi >= xl) return;
|
if (xi >= xl) return;
|
||||||
|
@ -3735,10 +3741,15 @@ ScrollableBox.prototype._scrollBottom = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var bottom = this.children.reduce(function(current, el) {
|
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) {
|
if (!el.detached) {
|
||||||
var l = el._getCoords(false, true);
|
var lpos = el._getCoords(false, true);
|
||||||
if (l) {
|
if (lpos) {
|
||||||
return Math.max(current, el.rtop + (l.yl - l.yi));
|
return Math.max(current, el.rtop + (lpos.yl - lpos.yi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Math.max(current, el.rtop + el.height);
|
return Math.max(current, el.rtop + el.height);
|
||||||
|
|
Loading…
Reference in New Issue