r91557 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91556‎ | r91557 | r91558 >
Date:16:23, 6 July 2011
Author:demon
Status:ok
Tags:
Comment:
Revert r91426 and followups r91427, r91430: Breaks Gallery-related parser tests
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,11 +584,6 @@
585585 margin: 2px;
586586 }
587587
588 -li.gallerybox div.thumb img {
589 - display: block;
590 - margin: 0 auto;
591 -}
592 -
593588 div.gallerytext {
594589 overflow: hidden;
595590 font-size: 94%;
Index: trunk/phase3/tests/parser/parserTests.txt
@@ -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: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>
 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>
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: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>
 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>
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: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>
 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>
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: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>
 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>
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: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>
 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>
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: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>
 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>
75597559 <div class="gallerytext">
75607560 </div>
75617561 </div></li>
Index: trunk/phase3/includes/ImageGallery.php
@@ -281,7 +281,10 @@
282282 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
283283 . htmlspecialchars( $img->getLastError() ) . '</div>';
284284 } else {
285 - $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2;
 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 );
286289
287290 $imageParameters = array(
288291 'desc-link' => true,

Follow-up revisions

RevisionCommit summaryAuthorDate
r91573refixing bug 27338 with all parser test fixes, reverts r91557kaldari18:07, 6 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91426fixing rounding problem, per comment at r82309kaldari21:05, 4 July 2011
r91427better fix for bug 27338 - doesnt rely on line-heightkaldari21:30, 4 July 2011
r91430using proper margin heights: 14 + 68 * 2 = 150kaldari23:43, 4 July 2011

Status & tagging log