r49688 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49687‎ | r49688 | r49689 >
Date:06:21, 21 April 2009
Author:aaron
Status:ok (Comments)
Tags:
Comment:
* Workaround ugly Safari/Chrome handling of <col> tags for hidden diffs (bug 18538)
* A few code style tweaks
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -43,7 +43,9 @@
4444 * @param $htmldiff boolean If set, output using HTMLDiff instead of raw wikicode diff
4545 * @param $unhide boolean If set, allow viewing deleted revs
4646 */
47 - function __construct( $titleObj = null, $old = 0, $new = 0, $rcid = 0, $refreshCache = false , $htmldiff = false, $unhide = false ) {
 47+ function __construct( $titleObj = null, $old = 0, $new = 0, $rcid = 0,
 48+ $refreshCache = false, $htmldiff = false, $unhide = false )
 49+ {
4850 $this->mTitle = $titleObj;
4951 wfDebug("DifferenceEngine old '$old' new '$new' rcid '$rcid'\n");
5052
@@ -192,12 +194,12 @@
193195 $db = wfGetDB( DB_SLAVE );
194196 $change = RecentChange::newFromConds(
195197 array(
196 - // Add redundant user,timestamp condition so we can use the existing index
197 - 'rc_user_text' => $this->mNewRev->getRawUserText(),
198 - 'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
199 - 'rc_this_oldid' => $this->mNewid,
200 - 'rc_last_oldid' => $this->mOldid,
201 - 'rc_patrolled' => 0
 198+ // Redundant user,timestamp condition so we can use the existing index
 199+ 'rc_user_text' => $this->mNewRev->getRawUserText(),
 200+ 'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
 201+ 'rc_this_oldid' => $this->mNewid,
 202+ 'rc_last_oldid' => $this->mOldid,
 203+ 'rc_patrolled' => 0
202204 ),
203205 __METHOD__
204206 );
@@ -755,17 +757,21 @@
756758 * Add the header to a diff body
757759 */
758760 static function addHeader( $diff, $otitle, $ntitle, $multi = '' ) {
759 - $header = "
760 - <table class='diff'>
761 - <col class='diff-marker' />
762 - <col class='diff-content' />
763 - <col class='diff-marker' />
764 - <col class='diff-content' />
 761+ $colspan = 1;
 762+ $header = "<table class='diff'>";
 763+ if( $diff ) { // Safari/Chrome show broken output if cols not used
 764+ $header .= "
 765+ <col class='diff-marker' />
 766+ <col class='diff-content' />
 767+ <col class='diff-marker' />
 768+ <col class='diff-content' />";
 769+ $colspan = 2;
 770+ }
 771+ $header .= "
765772 <tr valign='top'>
766 - <td colspan='2' class='diff-otitle'>{$otitle}</td>
767 - <td colspan='2' class='diff-ntitle'>{$ntitle}</td>
768 - </tr>
769 - ";
 773+ <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
 774+ <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
 775+ </tr>";
770776
771777 if ( $multi != '' )
772778 $header .= "<tr><td colspan='4' align='center' class='diff-multi'>{$multi}</td></tr>";
@@ -825,7 +831,6 @@
826832
827833 $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>";
828834 $this->mNewtitle .= " (<a href='$newEdit'>" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . "</a>)";
829 -
830835 } else {
831836 $newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid );
832837 $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mNewid );
@@ -834,10 +839,10 @@
835840 $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>";
836841 $this->mNewtitle .= " (<a href='$newEdit'>" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . "</a>)";
837842 }
838 - if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
 843+ if( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
839844 $this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
840845 } else if ( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
841 - $this->mNewtitle = '<span class="history-deleted">'.$this->mNewtitle.'</span>';
 846+ $this->mNewtitle = "<span class='history-deleted'>{$this->mNewtitle}</span>";
842847 }
843848
844849 // Load the old revision object

Comments

#Comment by Brion VIBBER (talk | contribs)   21:30, 28 April 2009

Confirmed this fixes it on current safari/mac. Yay!

Status & tagging log