Fix layer ordering with multiple stacks on same auto z-index

This commit is contained in:
MoyuScript
2014-10-19 22:29:34 +03:00
parent 08e532eb6b
commit f0a3fa56e1
4 changed files with 91 additions and 8 deletions

8
dist/html2canvas.js vendored
View File

@ -1771,7 +1771,7 @@ NodeParser.prototype.isRootElement = function(container) {
};
NodeParser.prototype.sortStackingContexts = function(stack) {
stack.contexts.sort(zIndexSort);
stack.contexts.sort(zIndexSort(stack.contexts.slice(0)));
stack.contexts.forEach(this.sortStackingContexts, this);
};
@ -2281,8 +2281,10 @@ function isTextNode(container) {
return container.node.nodeType === Node.TEXT_NODE;
}
function zIndexSort(a, b) {
return a.cssInt("zIndex") - b.cssInt("zIndex");
function zIndexSort(contexts) {
return function(a, b) {
return (a.cssInt("zIndex") + (contexts.indexOf(a) / contexts.length)) - (b.cssInt("zIndex") + (contexts.indexOf(b) / contexts.length));
};
}
function hasOpacity(container) {

File diff suppressed because one or more lines are too long