Subramanya Sastry has submitted this change and it was merged.

Change subject: Fix bug with thumbnail widths.
......................................................................


Fix bug with thumbnail widths.

"width  + 5" yields surprising results if width is a string.

Document type of width/height and be consistent about 'px' suffixes.

Change-Id: Ia004f9fcd9c7a1d5b32ec3c674b0746f951f7701
---
M js/lib/ext.core.LinkHandler.js
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Subramanya Sastry: Verified; Looks good to me, approved



diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index 72bac31..50c5b48 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -410,8 +410,9 @@
                newAttribs = newAttribs.concat(rdfaAttrs.attribs);
 
                var width=null, height=null;
+               // local 'width' and 'height' vars will be strings (or null)
                if ( oHash.height===null && oHash.width===null ) {
-                       width = '200px';
+                       width = '200';
                } else {
                        width = oHash.width;
                        height = oHash.height;
@@ -553,7 +554,8 @@
 
        // Handle explicit width value
        if ( oHash.width ) {
-               width = oHash.width;
+               // keep local 'width' var numeric, not a string
+               width = parseInt(oHash.width, 10);
        }
 
        // Handle upright
@@ -565,7 +567,7 @@
                }
        }
 
-       var figurestyle = "width: " + (width + 5) + "px;",
+       var figurestyle = "width: " + (Math.round(width + 5)) + "px;",
                figureclass = "thumb tright thumbinner";
        // note that 'border', 'frameless', and 'frame' property is ignored
        // for thumbnails

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia004f9fcd9c7a1d5b32ec3c674b0746f951f7701
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <wikime...@cscott.net>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to