Ticket #7429: 7429.patch
File 7429.patch, 2.5 KB (added by , 13 years ago) |
---|
-
_source/core/dom/element.js
1347 1347 return { x : x, y : y }; 1348 1348 }, 1349 1349 1350 scrollIntoView : function( alignTop)1350 scrollIntoView : function() 1351 1351 { 1352 1352 // Get the element window. 1353 1353 var win = this.getWindow(), 1354 1354 winHeight = win.getViewPaneSize().height; 1355 1355 1356 // Starts from the offset that will be scrolled with the negative value of 1357 // the visible window height. 1358 var offset = winHeight * -1; 1356 var startOffset = this.getDocumentPosition().y, 1357 endOffset = startOffset + this.$.offsetHeight || 0 + parseInt( this.getComputedStyle( 'marginBottom' ) || 0, 10 ) || 0; 1359 1358 1360 // Append the view pane's height if align to top.1361 // Append element height if we are aligning to the bottom.1362 if ( alignTop )1363 offset += winHeight;1364 else1365 {1366 offset += this.$.offsetHeight || 0;1367 1368 // Consider the margin in the scroll, which is ok for our current needs, but1369 // needs investigation if we will be using this function in other places.1370 offset += parseInt( this.getComputedStyle( 'marginBottom' ) || 0, 10 ) || 0;1371 }1372 1373 // Append the offsets for the entire element hierarchy.1374 var elementPosition = this.getDocumentPosition();1375 offset += elementPosition.y;1376 1377 // offset value might be out of range(nagative), fix it(#3692).1378 offset = offset < 0 ? 0 : offset;1379 1380 1359 // Scroll the window to the desired position, if not already visible(#3795). 1381 1360 var currentScroll = win.getScrollPosition().y; 1382 if ( offset > currentScroll || offset < currentScroll - winHeight ) 1383 win.$.scrollTo( 0, offset ); 1361 1362 // Bring it to bottom if overflow forward. 1363 if ( endOffset > currentScroll + winHeight ) 1364 win.$.scrollTo( 0, endOffset - winHeight ); 1365 // Bring it to top if overflow backward. 1366 else if ( startOffset < currentScroll ) 1367 win.$.scrollTo( 0, startOffset ); 1384 1368 }, 1385 1369 1386 1370 setState : function( state ) -
_source/plugins/maximize/plugin.js
311 311 312 312 editor.getSelection().selectRanges(savedSelection); 313 313 var element = editor.getSelection().getStartElement(); 314 element && element.scrollIntoView( true);314 element && element.scrollIntoView(); 315 315 } 316 316 317 317 else