r91573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91572‎ | r91573 | r91574 >
Date:18:07, 6 July 2011
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
refixing bug 27338 with all parser test fixes, reverts r91557
Modified paths:
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)
  • /trunk/phase3/skins/common/shared.css (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/shared.css
@@ -584,6 +584,11 @@
585585 margin: 2px;
586586 }
587587
 588+li.gallerybox div.thumb img {
 589+ display: block;
 590+ margin: 0 auto;
 591+}
 592+
588593 div.gallerytext {
589594 overflow: hidden;
590595 font-size: 94%;
Index: trunk/phase3/tests/parser/parserTests.txt
@@ -7410,7 +7410,7 @@
74117411 !! test
74127412 Gallery (with options)
74137413 !! input
7414 -<gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
 7414+<gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
74157415 File:Nonexistant.jpg|caption
74167416 File:Nonexistant.jpg
74177417 image:foobar.jpg|some '''caption''' [[Main Page]]
@@ -7418,34 +7418,34 @@
74197419 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
74207420 </gallery>
74217421 !! result
7422 -<ul class="gallery" style="max-width: 206px;_width: 206px;">
 7422+<ul class="gallery" style="max-width: 226px;_width: 226px;">
74237423 <li class='gallerycaption'>Foo <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></li>
7424 - <li class="gallerybox" style="width: 95px"><div style="width: 95px">
 7424+ <li class="gallerybox" style="width: 105px"><div style="width: 105px">
74257425 <div style="height: 70px;">Nonexistant.jpg</div>
74267426 <div class="gallerytext">
74277427 <p>caption
74287428 </p>
74297429 </div>
74307430 </div></li>
7431 - <li class="gallerybox" style="width: 95px"><div style="width: 95px">
 7431+ <li class="gallerybox" style="width: 105px"><div style="width: 105px">
74327432 <div style="height: 70px;">Nonexistant.jpg</div>
74337433 <div class="gallerytext">
74347434 </div>
74357435 </div></li>
7436 - <li class="gallerybox" style="width: 95px"><div style="width: 95px">
7437 - <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
 7436+ <li class="gallerybox" style="width: 105px"><div style="width: 105px">
 7437+ <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
74387438 <div class="gallerytext">
74397439 <p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
74407440 </p>
74417441 </div>
74427442 </div></li>
7443 - <li class="gallerybox" style="width: 95px"><div style="width: 95px">
7444 - <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
 7443+ <li class="gallerybox" style="width: 105px"><div style="width: 105px">
 7444+ <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
74457445 <div class="gallerytext">
74467446 </div>
74477447 </div></li>
7448 - <li class="gallerybox" style="width: 95px"><div style="width: 95px">
7449 - <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
 7448+ <li class="gallerybox" style="width: 105px"><div style="width: 105px">
 7449+ <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
74507450 <div class="gallerytext">
74517451 <p>Blabla|blabla.
74527452 </p>
@@ -7465,14 +7465,14 @@
74667466 !! result
74677467 <ul class="gallery">
74687468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7469 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7469+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
74707470 <div class="gallerytext">
74717471 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/3/3a/Foobar.jpg" width="20" height="2" /></a>
74727472 </p>
74737473 </div>
74747474 </div></li>
74757475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7476 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7476+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
74777477 <div class="gallerytext">
74787478 <p>This is a test template
74797479 </p>
@@ -7509,7 +7509,7 @@
75107510 </div>
75117511 </div></li>
75127512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7513 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7513+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
75147514 <div class="gallerytext">
75157515 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
75167516 some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
@@ -7517,7 +7517,7 @@
75187518 </div>
75197519 </div></li>
75207520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7521 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7521+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
75227522 <div class="gallerytext">
75237523 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
75247524 </p>
@@ -7549,12 +7549,12 @@
75507550 </div>
75517551 </div></li>
75527552 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7553 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7553+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
75547554 <div class="gallerytext">
75557555 </div>
75567556 </div></li>
75577557 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7558 - <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 7558+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
75597559 <div class="gallerytext">
75607560 </div>
75617561 </div></li>
Index: trunk/phase3/includes/ImageGallery.php
@@ -281,10 +281,7 @@
282282 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
283283 . htmlspecialchars( $img->getLastError() ) . '</div>';
284284 } else {
285 - # We get layout problems with the margin, if the image is smaller
286 - # than the line-height (17), so we add less margin in these cases.
287 - $minThumbHeight = $thumb->height > 17 ? $thumb->height : 17;
288 - $vpad = floor( ( self::THUMB_PADDING + $this->mHeights - $minThumbHeight ) /2 );
 285+ $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2;
289286
290287 $imageParameters = array(
291288 'desc-link' => true,

Follow-up revisions

RevisionCommit summaryAuthorDate
r91578fixing parser test per r91573kaldari18:26, 6 July 2011
r922941.17wmf1 MFT r91573reedy20:05, 15 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82181* (bug 27338) Gallery in 1.17 breaks for audio/video + ogghandler...mah19:39, 15 February 2011
r91427better fix for bug 27338 - doesnt rely on line-heightkaldari21:30, 4 July 2011
r91557Revert r91426 and followups r91427, r91430: Breaks Gallery-related parser testsdemon16:23, 6 July 2011

Comments

#Comment by 😂 (talk | contribs)   18:32, 6 July 2011

Tests all passing, awesome :D

Status & tagging log