r41720 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r41719 | r41720 (on ViewVC) | r41721 >
Date:03:10, 6 October 2008
Author:tstarling
Status:deferred (Comments)
Tags:
Comment:Proposed fix for bug 9126: use negative top margin. Like YouTube QuickList icons. Committing for cross-browser test.
Modified paths:

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
===================================================================
--- trunk/extensions/ImageMap/ImageMap_body.php	(revision 41719)
+++ trunk/extensions/ImageMap/ImageMap_body.php	(revision 41720)
@@ -276,23 +276,27 @@
 		$xpath = new DOMXPath( $domDoc );
 		$magnify = $xpath->query( '//div[@class="magnify"]' );
 		if ( !$magnify->length && $descType != self::NONE ) {
-			$div->setAttribute( 'style', 'position: relative;' );
-
 			# Add image description link
 			if ( $descType == self::TOP_LEFT || $descType == self::BOTTOM_LEFT ) {
-				$descLeft = 0;
+				$marginLeft = 0;
 			} else {
-				$descLeft = $thumbWidth - 20;
+				$marginLeft = $thumbWidth - 20;
 			}
 			if ( $descType == self::TOP_LEFT || $descType == self::TOP_RIGHT ) {
-				$descTop = 0;
+				$marginTop = -$thumbHeight;
 			} else {
-				$descTop = $thumbHeight - 20;
+				$marginTop = -20;
 			}
-			$descAnchor = $div->appendChild( new DOMElement( 'a' ) );
+			$div->setAttribute( 'style', "height: {$thumbHeight}px" );
+			$descWrapper = $div->appendChild( new DOMElement( 'div' ) );
+			$descWrapper->setAttribute( 'style', 
+				"margin-left: {$marginLeft}px; " . 
+				"margin-top: {$marginTop}px; "
+			);
+
+			$descAnchor = $descWrapper->appendChild( new DOMElement( 'a' ) );
 			$descAnchor->setAttribute( 'href', $imageTitle->escapeLocalURL() );
 			$descAnchor->setAttribute( 'title', wfMsgForContent( 'imagemap_description' ) );
-			$descAnchor->setAttribute( 'style', "position:absolute; top: {$descTop}px; left: {$descLeft}px;" );
 			$descImg = $descAnchor->appendChild( new DOMElement( 'img' ) );
 			$descImg->setAttribute( 'alt', wfMsgForContent( 'imagemap_description' ) );
 			$descImg->setAttribute( 'src', "$wgScriptPath/extensions/ImageMap/desc-20.png" );

Comments

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

Assuming this is ok...

Views
Toolbox