Inez has uploaded a new change for review.

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


Change subject: In case when MW does not scale images (down or up) do it in 
Parsoid (the same way Parser would).
......................................................................

In case when MW does not scale images (down or up) do it in Parsoid (the same 
way Parser would).

Change-Id: I9c91b1641a87693b160d64e8e39e0953a7d910be
---
M js/lib/ext.core.LinkHandler.js
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/66/67366/1

diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index 843116f..dfd9221 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -305,28 +305,34 @@
  * @returns {number} return.w
  */
 function handleDims( height, width, info, dataAttribs ) {
+       var out = {
+               h: height,
+               w: width
+       };
        if ( info.height ) {
-               height = info.height;
+               out.h = info.height;
                dataAttribs.img.h = height;
        }
 
        if ( info.width ) {
-               width = info.width;
+               out.w = info.width;
                dataAttribs.img.w = width;
        }
 
        if ( info.thumburl && info.thumbheight ) {
-               height = info.thumbheight;
+               out.h = info.thumbheight;
        }
 
        if ( info.thumburl && info.thumbwidth ) {
-               width = info.thumbwidth;
+               out.w = info.thumbwidth;
        }
 
-       return {
-               h: height,
-               w: width
+       if ( width !== info.width && info.width === info.thumbwidth ) {
+               out.w = width;
+               out.h = Math.floor( width * info.height / info.width );
        };
+
+       return out;
 }
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c91b1641a87693b160d64e8e39e0953a7d910be
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Inez <i...@wikia-inc.com>

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

Reply via email to