Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/228777

Change subject: Align the sections based on integer value of section heights
......................................................................

Align the sections based on integer value of section heights

Arabic wiki has local style override resulting a floating point line
height and font size. This causes our alignment algorithm comparing
floating point heighs and end up with aborting alignment after 10 attempts.

Integer conversion of heights should fix the issue.

Bug: T105938
Change-Id: Ie8384a1e32b5225fa05ee1a4f3d3fb8ae2338ff2
---
M modules/translation/ext.cx.translation.aligner.js
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/77/228777/1

diff --git a/modules/translation/ext.cx.translation.aligner.js 
b/modules/translation/ext.cx.translation.aligner.js
index 143beae..6393812 100644
--- a/modules/translation/ext.cx.translation.aligner.js
+++ b/modules/translation/ext.cx.translation.aligner.js
@@ -68,8 +68,8 @@
                }
 
                $sourceSection.css( 'min-height', '' );
-               sourceSectionHeight = $sourceSection.height();
-               sectionHeight = $section.height();
+               sourceSectionHeight = parseInt( $sourceSection.height(), 10 );
+               sectionHeight = parseInt( $section.height(), 10 );
 
                if ( !sourceSectionHeight ) {
                        return this;
@@ -77,8 +77,8 @@
 
                if ( sourceSectionHeight < sectionHeight ) {
                        $sourceSection.css( 'min-height', sectionHeight );
-                       sourceSectionHeight = $sourceSection.height();
-                       sectionHeight = $section.height();
+                       sourceSectionHeight = parseInt( 
$sourceSection.height(), 10 );
+                       sectionHeight = parseInt( $section.height(), 10 );
 
                        // Fun stuff - setting a calculated min-height will not 
guarantee
                        // equal height for all kinds of section pairs.
@@ -88,8 +88,8 @@
                                sectionHeight = sectionHeight + 10;
                                $sourceSection.css( 'min-height', sectionHeight 
);
                                $section.css( 'min-height', sectionHeight );
-                               sectionHeight = $section.height();
-                               sourceSectionHeight = $sourceSection.height();
+                               sectionHeight = parseInt( $section.height(), 10 
);
+                               sourceSectionHeight = parseInt( 
$sourceSection.height(), 10 );
 
                                if ( steps++ === 10 ) {
                                        mw.track( 'Alignment attempt is not 
succeeding. Aborting.' );

-- 
To view, visit https://gerrit.wikimedia.org/r/228777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8384a1e32b5225fa05ee1a4f3d3fb8ae2338ff2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to