r101101 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101100‎ | r101101 | r101102 >
Date:00:34, 28 October 2011
Author:inez
Status:deferred
Tags:
Comment:
Avoid copy+paste code
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/bases/es.DocumentViewLeafNode.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ParagraphView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/bases/es.DocumentViewLeafNode.js
@@ -67,7 +67,12 @@
6868 * @returns {es.Position} Position of offset
6969 */
7070 es.DocumentViewLeafNode.prototype.getRenderedPositionFromOffset = function( offset ) {
71 - return this.contentView.getRenderedPositionFromOffset( offset );
 71+ var position = this.contentView.getRenderedPositionFromOffset( offset ),
 72+ offset = this.$content.offset();
 73+ position.top += offset.top;
 74+ position.left += offset.left;
 75+ position.bottom += offset.top;
 76+ return position;
7277 };
7378
7479 /**
Index: trunk/parsers/wikidom/lib/hype/views/es.ParagraphView.js
@@ -10,13 +10,4 @@
1111 var view = es.extendObject( new es.DocumentViewLeafNode( model ), this );
1212 view.$.addClass( 'editSurface-paragraphBlock' );
1313 return view;
14 -};
15 -
16 -es.ParagraphView.prototype.getRenderedPositionFromOffset = function( offset ) {
17 - var position = this.contentView.getRenderedPositionFromOffset( offset ),
18 - offset = this.$content.offset();
19 - position.top += offset.top;
20 - position.left += offset.left;
21 - position.bottom += offset.top;
22 - return position;
23 -};
 14+};
\ No newline at end of file
Index: trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js
@@ -10,13 +10,4 @@
1111 var view = es.extendObject( new es.DocumentViewLeafNode( model, $('<h' + model.getElementAttribute( 'level' ) +'/>') ), this );
1212 view.$.addClass( 'editSurface-headingBlock' );
1313 return view;
14 -};
15 -
16 -es.HeadingView.prototype.getRenderedPositionFromOffset = function( offset ) {
17 - var position = this.contentView.getRenderedPositionFromOffset( offset ),
18 - offset = this.$content.offset();
19 - position.top += offset.top;
20 - position.left += offset.left;
21 - position.bottom += offset.top;
22 - return position;
2314 };
\ No newline at end of file

Status & tagging log