public/ckeditor/4.4dev/plugins/magicline/plugin.js
function verticalSearch( that, stopCondition, selectCriterion, startElement ) {
		var upper = startElement,
			lower = startElement,
			mouseStep = 0,
			upperFound = false,
			lowerFound = false,
			viewPaneHeight = that.view.pane.height,
			mouse = that.mouse;

		while ( mouse.y + mouseStep < viewPaneHeight && mouse.y - mouseStep > 0 ) {
			if ( !upperFound )
				upperFound = stopCondition( upper, startElement );

			if ( !lowerFound )
				lowerFound = stopCondition( lower, startElement );

			// Still not found...
			if ( !upperFound && mouse.y - mouseStep > 0 )
				upper = selectCriterion( that, { x: mouse.x, y: mouse.y - mouseStep } );

			if ( !lowerFound && mouse.y + mouseStep < viewPaneHeight )
				lower = selectCriterion( that, { x: mouse.x, y: mouse.y + mouseStep } );

			if ( upperFound && lowerFound )
				break;

			// Instead of ++ to reduce the number of invocations by half.
			// It's trades off accuracy in some edge cases for improved performance.
			mouseStep += 2;
		}

		return new boxTrigger( [ upper, lower, null, null ] );
	}
function verticalSearch( that, stopCondition, selectCriterion, startElement ) {
		var upper = startElement,
			lower = startElement,
			mouseStep = 0,
			upperFound = false,
			lowerFound = false,
			viewPaneHeight = that.view.pane.height,
			mouse = that.mouse;

		while ( mouse.y + mouseStep < viewPaneHeight && mouse.y - mouseStep > 0 ) {
			if ( !upperFound )
				upperFound = stopCondition( upper, startElement );

			if ( !lowerFound )
				lowerFound = stopCondition( lower, startElement );

			// Still not found...
			if ( !upperFound && mouse.y - mouseStep > 0 )
				upper = selectCriterion( that, { x: mouse.x, y: mouse.y - mouseStep } );

			if ( !lowerFound && mouse.y + mouseStep < viewPaneHeight )
				lower = selectCriterion( that, { x: mouse.x, y: mouse.y + mouseStep } );

			if ( upperFound && lowerFound )
				break;

			// Instead of ++ to reduce the number of invocations by half.
			// It's trades off accuracy in some edge cases for improved performance.
			mouseStep += 2;
		}

		return new boxTrigger( [ upper, lower, null, null ] );
	}
function verticalSearch ( that , stopCondition , selectCriterion , startElement ) { var upper = startElement , lower = startElement , mouseStep = 0 , upperFound = false , lowerFound = false , viewPaneHeight = that . view . pane . height , mouse = that . mouse ; while ( mouse . y + mouseStep < viewPaneHeight && mouse . y - mouseStep > 0 ) { if ( ! upperFound ) upperFound = stopCondition ( upper , startElement ) ; if ( ! lowerFound ) lowerFound = stopCondition ( lower , startElement ) ; // Still not found...
 if ( ! upperFound && mouse . y - mouseStep > 0 ) upper = selectCriterion ( that , { x : mouse . x , y : mouse . y - mouseStep } ) ; if ( ! lowerFound && mouse . y + mouseStep < viewPaneHeight ) lower = selectCriterion ( that , { x : mouse . x , y : mouse . y + mouseStep } ) ; if ( upperFound && lowerFound ) break ; // Instead of ++ to reduce the number of invocations by half.
 // It's trades off accuracy in some edge cases for improved performance.
 mouseStep += 2 ; } return new boxTrigger ( [ upper , lower , null , null ] ) ; }
This method searches document vertically using given select criterion until stop criterion is fulfilled.
This method searches document vertically using given select criterion until stop criterion is fulfilled .