followup r82181 and r82215 to fix the FIXME and botched fix for FIXME.
authorMark A. Hershberger <mah@users.mediawiki.org>
Wed, 16 Feb 2011 23:21:19 +0000 (23:21 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Wed, 16 Feb 2011 23:21:19 +0000 (23:21 +0000)
Patch supplied by DieBuche (bug #27338) along with screenshot
demonstrating fix.

Took out fix for bug #27458 (“<gallery> has a white background now”)
since bug it conflicts with a fix for bug #26470.

includes/ImageGallery.php
skins/common/shared.css

index 7d161e0..7290e59 100644 (file)
@@ -275,7 +275,11 @@ class ImageGallery
                                $thumbhtml = "\n\t\t\t".'<div style="height: '.(30 + $this->mHeights).'px;">'
                                        . htmlspecialchars( $img->getLastError() ) . '</div>';
                        } else {
-                               $vpad = floor(( 30 + $this->mHeights - $thumb->height ) /2);
+                               //We get layout problems with the margin, if the image is smaller 
+                               //than the line-height, so we less margin in these cases.
+                               $minThumbHeight =  $thumb->height > 17 ? $thumb->height : 17;
+                               $vpad = floor(( 30 + $this->mHeights - $minThumbHeight ) /2);
+                               
 
                                $imageParameters = array(
                                        'desc-link' => true,
@@ -288,11 +292,11 @@ class ImageGallery
 
                                # Set both fixed width and min-height.
                                $thumbhtml = "\n\t\t\t".
-                                       '<div class="thumb" style="width: ' .($this->mWidths+30).'px; height: ' .($this->mHeights+30).'px;">'
+                                       '<div class="thumb" style="width: ' .($this->mWidths+30).'px;">'
                                        # Auto-margin centering for block-level elements. Needed now that we have video
                                        # handlers since they may emit block-level elements as opposed to simple <img> tags.
                                        # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
-                                       . '<div style="margin:'.$vpad.'px auto 0;">'
+                                       . '<div style="margin:'.$vpad.'px auto;">'
                                        . $thumb->toHtml( $imageParameters ) . '</div></div>';
 
                                // Call parser transform hook
index c613e29..0f15395 100644 (file)
@@ -780,10 +780,6 @@ li.gallerybox div.thumb {
        margin: 2px;
 }
 
-li.gallerybox div.thumb a.image img {
-       vertical-align: text-top;
-}
-
 div.gallerytext {
        overflow: hidden;
        font-size: 94%;