r92326 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92325‎ | r92326 | r92327 >
Date:22:18, 15 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Fixed fractional marking, so that only lines which begin in the middle of a word are marked as fractional.
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.TextFlow.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js
@@ -231,9 +231,11 @@
232232 */
233233 TextFlow.prototype.renderIteration = function() {
234234 var rs = this.renderState,
235 - iteration = 0;
 235+ iteration = 0,
 236+ fractional = false;
236237 while ( ++iteration <= rs.iterationLimit && rs.wordOffset < rs.wordCount - 1 ) {
237238 rs.wordFit = this.fitWords( rs.wordOffset, rs.wordCount - 1, rs.ruler, rs.width );
 239+ fractional = false;
238240 if ( rs.wordFit.width > rs.width ) {
239241 // The first word didn't fit, we need to split it up
240242 rs.charOffset = rs.lineStart;
@@ -252,14 +254,16 @@
253255 rs.charFit.end = rs.lineEnd = this.boundaries[rs.wordOffset];
254256 }
255257 }
256 - this.appendLine( rs.charOffset, rs.charFit.end, rs.wordOffset, true );
 258+ this.appendLine( rs.charOffset, rs.charFit.end, rs.wordOffset, fractional );
257259 // Move on to another line
258260 rs.charOffset = rs.charFit.end;
 261+ // Mark the next line as fractional
 262+ fractional = true;
259263 } while ( rs.charOffset < rs.lineEnd );
260264 } else {
261265 rs.wordOffset = rs.wordFit.end;
262266 rs.lineEnd = this.boundaries[rs.wordOffset];
263 - this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, false );
 267+ this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, fractional );
264268 }
265269 rs.lineStart = rs.lineEnd;
266270 }
@@ -348,8 +352,10 @@
349353 *
350354 * @param start {Integer} Beginning of text range for line
351355 * @param end {Integer} Ending of text range for line
 356+ * @param wordOffset {Integer} Index within this.words which the line begins with
 357+ * @param fractional {Boolean} If the line begins in the middle of a word
352358 */
353 -TextFlow.prototype.appendLine = function( start, end, word, fractional ) {
 359+TextFlow.prototype.appendLine = function( start, end, wordOffset, fractional ) {
354360 $line = this.$.find( '.editSurface-line[line-index=' + this.lines.length + ']' );
355361 if ( !$line.length ) {
356362 $line = $( '<div class="editSurface-line" line-index="' + this.lines.length + '"></div>' )
@@ -363,7 +369,7 @@
364370 'end': end,
365371 'width': $line.outerWidth(),
366372 'height': $line.outerHeight(),
367 - 'word': word,
 373+ 'word': wordOffset,
368374 'fractional': fractional
369375 });
370376 // Disable links within content

Status & tagging log