| 11 | var parts = [ "margin-top","margin-bottom","border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ]; |
| 12 | |
| 13 | function nonContentHeight( element ) |
| 14 | { |
| 15 | var adjustment = 0; |
| 16 | for ( var i = 0, len = parts.length; i < len; i++ ) |
| 17 | adjustment += parseInt( element.getComputedStyle( parts[ i ] ) || 0, 10 ) || 0; |
| 18 | return adjustment; |
| 19 | } |
| 20 | |
| 21 | // Spaces outside of the actual content. |
| 22 | function extra( element ) |
| 23 | { |
| 24 | var margin = 0; |
| 25 | margin += nonContentHeight( element); |
| 26 | if ( element.is( 'html' ) ) |
| 27 | margin += nonContentHeight( element.getDocument().getBody() ); |
| 28 | return margin; |
| 29 | } |
| 30 | |
| 31 | // Height of the actual content size within body, |
| 32 | // figured out by simply check the last element. |
| 33 | function docContentHeight( doc ) |
| 34 | { |
| 35 | var lastElement = doc.getBody().getLast( function( node ) |
| 36 | { |
| 37 | return node.type == CKEDITOR.NODE_ELEMENT; |
| 38 | }); |
| 39 | |
| 40 | return lastElement.getDocumentPosition( doc ).y + lastElement.$.offsetHeight |
| 41 | } |
| 42 | |
28 | | // Quirks mode overflows body, standards oveflows document element. |
29 | | var delta, |
30 | | scrollable = doc.$.compatMode == 'BackCompat' ? body : htmlElement, |
31 | | increase = scrollable.scrollHeight - scrollable.clientHeight, |
32 | | decrease = body.offsetHeight - scrollable.scrollHeight + contentMargin; |
| 60 | // Quirks mode overflows body except for IE9, standards overflows document element. |
| 61 | var scrollable = !CKEDITOR.env.ie9Compat && doc.$.compatMode == 'BackCompat' ? body : htmlElement, |
| 62 | contentHeight = docContentHeight( doc ), |
| 63 | delta = contentHeight - scrollable.$.clientHeight + extra( scrollable ); |