r101431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101430‎ | r101431 | r101432 >
Date:23:10, 31 October 2011
Author:inez
Status:deferred
Tags:
Comment:
Implementation of getRenderedLineRange
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
@@ -271,6 +271,22 @@
272272 };
273273
274274 /**
 275+ * Gets the range of the rendered line a given offset is within.
 276+ *
 277+ * @method
 278+ * @param {Integer} offset Offset to get line for
 279+ * @returns {Range}
 280+ */
 281+es.ContentView.prototype.getRenderedLineRange = function( offset ) {
 282+ for ( var i = 0; i < this.lines.length; i++ ) {
 283+ if ( this.lines[i].range.containsOffset( offset ) ) {
 284+ return this.lines[i].range;
 285+ }
 286+ }
 287+ return null;
 288+};
 289+
 290+/**
275291 * Gets offset within content model closest to of a given position.
276292 *
277293 * Position is assumed to be local to the container the text is being flowed in.

Status & tagging log