From 2845964ff845a871db2a8968d52669bddb4bd02f Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Tue, 5 Oct 2021 12:45:12 -0400 Subject: [PATCH] Fix height of traditional galleries in new media dom Follow up to Iff2bdc3aa02f84f0bf4ca55d177706823934cc08 This corrects an omission from the previous patch, aligning it with Parsoid's output. Change-Id: Ic64af85f5969717a4ea536a695874359a13645c5 --- includes/gallery/TraditionalImageGallery.php | 5 +- tests/parser/mediaParserTests.txt | 82 ++++++++++---------- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php index 770efee4232..3340963b3e7 100644 --- a/includes/gallery/TraditionalImageGallery.php +++ b/includes/gallery/TraditionalImageGallery.php @@ -188,9 +188,12 @@ class TraditionalImageGallery extends ImageGalleryBase { # Set both fixed width and min-height. $width = $this->getThumbDivWidth( $thumb->getWidth() ); + $height = $this->getThumbPadding() + $this->mHeights; $thumbhtml = "\n\t\t\t" . Html::rawElement( 'div', [ 'class' => 'thumb', - 'style' => "width: {$width}px;", + 'style' => "width: {$width}px;" . + ( !$enableLegacyMediaDOM && $this->mMode === 'traditional' ? + " height: {$height}px;" : '' ), ], $thumbhtml ); // Call parser transform hook diff --git a/tests/parser/mediaParserTests.txt b/tests/parser/mediaParserTests.txt index 5ed93f4c0f8..d42c711db3a 100644 --- a/tests/parser/mediaParserTests.txt +++ b/tests/parser/mediaParserTests.txt @@ -701,7 +701,7 @@ File:Foobar.jpg|alt=&