r101170 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101169‎ | r101170 | r101171 >
Date:18:52, 28 October 2011
Author:inez
Status:deferred
Tags:
Comment:
Avoid calculation when not necessary.
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/views/es.ContentView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/views/es.ContentView.js
@@ -332,12 +332,14 @@
333333 ruler = $ruler[0],
334334 fit = this.fitCharacters( line.range, ruler, position.left );
335335 ruler.innerHTML = this.getHtml( new es.Range( line.range.start, fit.end ) );
336 - var left = ruler.clientWidth;
337336 if ( fit.end < this.model.getContentLength() ) {
 337+ var left = ruler.clientWidth;
338338 ruler.innerHTML = this.getHtml( new es.Range( line.range.start, fit.end + 1 ) );
 339+ var right = ruler.clientWidth;
 340+ var center = Math.round( left + ( ( right - left ) / 2 ) );
 341+ } else {
 342+ var center = ruler.clientWidth;
339343 }
340 - var right = ruler.clientWidth;
341 - var center = Math.round( left + ( ( right - left ) / 2 ) );
342344 $ruler.remove();
343345 // Reset RegExp object's state
344346 this.boundaryTest.lastIndex = 0;

Status & tagging log