r41720 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41719‎ | r41720 | r41721 >
Date:03:10, 6 October 2008
Author:tstarling
Status:old (Comments)
Tags:
Comment:
Proposed fix for bug 9126: use negative top margin. Like YouTube QuickList icons. Committing for cross-browser test.
Modified paths:
  • /trunk/extensions/ImageMap/ImageMap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
@@ -276,23 +276,27 @@
277277 $xpath = new DOMXPath( $domDoc );
278278 $magnify = $xpath->query( '//div[@class="magnify"]' );
279279 if ( !$magnify->length && $descType != self::NONE ) {
280 - $div->setAttribute( 'style', 'position: relative;' );
281 -
282280 # Add image description link
283281 if ( $descType == self::TOP_LEFT || $descType == self::BOTTOM_LEFT ) {
284 - $descLeft = 0;
 282+ $marginLeft = 0;
285283 } else {
286 - $descLeft = $thumbWidth - 20;
 284+ $marginLeft = $thumbWidth - 20;
287285 }
288286 if ( $descType == self::TOP_LEFT || $descType == self::TOP_RIGHT ) {
289 - $descTop = 0;
 287+ $marginTop = -$thumbHeight;
290288 } else {
291 - $descTop = $thumbHeight - 20;
 289+ $marginTop = -20;
292290 }
293 - $descAnchor = $div->appendChild( new DOMElement( 'a' ) );
 291+ $div->setAttribute( 'style', "height: {$thumbHeight}px" );
 292+ $descWrapper = $div->appendChild( new DOMElement( 'div' ) );
 293+ $descWrapper->setAttribute( 'style',
 294+ "margin-left: {$marginLeft}px; " .
 295+ "margin-top: {$marginTop}px; "
 296+ );
 297+
 298+ $descAnchor = $descWrapper->appendChild( new DOMElement( 'a' ) );
294299 $descAnchor->setAttribute( 'href', $imageTitle->escapeLocalURL() );
295300 $descAnchor->setAttribute( 'title', wfMsgForContent( 'imagemap_description' ) );
296 - $descAnchor->setAttribute( 'style', "position:absolute; top: {$descTop}px; left: {$descLeft}px;" );
297301 $descImg = $descAnchor->appendChild( new DOMElement( 'img' ) );
298302 $descImg->setAttribute( 'alt', wfMsgForContent( 'imagemap_description' ) );
299303 $descImg->setAttribute( 'src', "$wgScriptPath/extensions/ImageMap/desc-20.png" );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r40856[ImageMap] No position: relative if unneeded...simetrical15:26, 15 September 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   01:20, 24 October 2008

Assuming this is ok...

Status & tagging log