Inez has uploaded a new change for review.

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


Change subject: Do not apply unnecessary file dimensions constraints
......................................................................

Do not apply unnecessary file dimensions constraints

I'm not sure what's the exact goal of code that I had to modify, but after my 
modification it definitely solves the problem and doesn't break the test.

Problem was occurring when for instance parsing this wikitext: [[Image:ASCII 
Code Chart-Quick ref card.jpg|thumb|361px]] height constraint of 180px was 
applied - and because image have to stay proportional it's width was limited as 
well.

Change-Id: I2d56c9f1ed164ffcdefd0de94d95f03f744fea41
---
M js/lib/ext.core.LinkHandler.js
1 file changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index dccc52a..16abbe3 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -1168,8 +1168,17 @@
        }
 
        if ( oHash.format && oHash.format !== 'framed' ) {
-               constraints.height = constraints.height || 180;
-               constraints.width = constraints.width || 180;
+               if ( !constraints.height && !constraints.width ) {
+                       constraints.height = 180;
+                       constraints.width = 180;
+               } else {
+                       if ( constraints.height ) {
+                               constraints.height = constraints.height;
+                       }
+                       if ( constraints.width ) {
+                               constraints.width = constraints.width;
+                       }
+               }
        }
 
        var infoRequest = new ImageInfoRequest( env, filename, constraints );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d56c9f1ed164ffcdefd0de94d95f03f744fea41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Inez <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to