r100452 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100451‎ | r100452 | r100453 >
Date:20:36, 21 October 2011
Author:inez
Status:deferred
Tags:
Comment:
Small refactoring
Modified paths:
  • /trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js
@@ -286,16 +286,22 @@
287287 this.cursor.initialLeft = currentPosition.left;
288288 }
289289 var fakePosition = new es.Position( this.cursor.initialLeft, currentPosition.top ),
290 - edgeCondition = ( direction == 'up' ) ? 0 : this.documentView.getLength(),
 290+ edgeCondition = ( direction === 'up' ) ? 0 : this.documentView.getLength(),
291291 offset,
292292 i = 1;
293 -
294293 do {
295 - ( direction == 'up' ) ? fakePosition.top -= i++ * 10 : fakePosition.top += i++ * 10;
 294+ if ( direction == 'up' ) {
 295+ fakePosition.top -= i++ * 5;
 296+ } else {
 297+ fakePosition.top += i++ * 5;
 298+ }
296299 offset = this.documentView.getOffsetFromPosition( fakePosition );
 300+ if ( offset === edgeCondition ) {
 301+ return;
 302+ }
297303 fakePosition = this.documentView.getRenderedPosition( offset );
298304 fakePosition.left = this.cursor.initialLeft;
299 - } while ( currentPosition.top === fakePosition.top && offset !== edgeCondition )
 305+ } while ( currentPosition.top === fakePosition.top );
300306 this.showCursor( this.documentView.getOffsetFromPosition( fakePosition ) );
301307 }
302308 return;

Status & tagging log