Use JS to detect old Gecko versions known to have bogus implementation of overflow: auto for vertical sizing <div>s in table cells and change it to overflow: visible for an ugly but more-or-less-legible fallback behavior.
* (bug 10215) Show custom editing introduction when editing existing pages
* (bug 10223) Fix edit link in noarticletext localizations for fr, oc
* (bug 10247) Fix IP address regex to avoid false positive IPv6 matches
+* (bug 9948) Workaround for diff regression with old Mozilla versions
== API changes since 1.10 ==
$wgOut->addWikitext( wfMsg( 'missingarticle', "<nowiki>(fixme, bug)</nowiki>" ) );
return false;
} else {
- $wgOut->addStyle( 'common/diff.css' );
+ $this->showDiffStyle();
$wgOut->addHTML( $diff );
return true;
}
}
+
+ /**
+ * Add style sheets and supporting JS for diff display.
+ */
+ function showDiffStyle() {
+ global $wgStylePath, $wgStyleVersion, $wgOut;
+ $wgOut->addStyle( 'common/diff.css' );
+
+ // JS is needed to detect old versions of Mozilla to work around an annoyance bug.
+ $wgOut->addScript( "<script type=\"text/javascript\" src=\"$wgStylePath/common/diff.js?$wgStyleVersion\"></script>" );
+ }
/**
* Get diff table, including header
}
if ( 'diff' == $this->formtype ) {
- $wgOut->addStyle( 'common/diff.css' );
- $wgOut->addHTML( $this->getDiff() );
+ $this->showDiff();
}
}
}
if ( $this->formtype == 'diff') {
- $wgOut->addStyle( 'common/diff.css' );
- $wgOut->addHTML( $this->getDiff() );
+ $this->showDiff();
}
}
*
* If this is a section edit, we'll replace the section as for final
* save and then make a comparison.
- *
- * @return string HTML
*/
- function getDiff() {
+ function showDiff() {
$oldtext = $this->mArticle->fetchContent();
$newtext = $this->mArticle->replaceSection(
$this->section, $this->textbox1, $this->summary, $this->edittime );
$de = new DifferenceEngine( $this->mTitle );
$de->setText( $oldtext, $newtext );
$difftext = $de->getDiff( $oldtitle, $newtitle );
+ $de->showDiffStyle();
} else {
$difftext = '';
}
- return '<div id="wikiDiff">' . $difftext . '</div>';
+ global $wgOut;
+ $wgOut->addHtml( '<div id="wikiDiff">' . $difftext . '</div>' );
}
/**
/* As fallback, scrollbars will be added for very wide cells
instead of text overflowing or widening */
overflow: auto;
+
+ /* The above rule breaks on very old versions of Mozilla due
+ to a bug which collapses the table cells to a single line.
+
+ In Mozilla 1.1 and below with JavaScript enabled, the rule
+ will be overridden with this by diff.js; wide cell contents
+ then spill horizontally without widening the rest of the
+ table: */
+ /* overflow: visible; */
}
--- /dev/null
+/*
+Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling
+<div>s in <td> cells collapse their height to a single line.
+
+Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried
+with overflow-x disable the scrolling all the way until Mozilla 1.8 / FF 1.5
+and break Opera as well.
+
+So... we check for reaaaally old Gecko and hack in an alternate rule to let
+the wide cells spill instead of scrolling them. Not ideal as it won't work
+if JS is disabled, of course.
+*/
+
+if (navigator && navigator.product == "Gecko" && navigator.productSub < "20021130") {
+ var sheets = document.styleSheets;
+ var lastSheet = sheets[sheets.length-1];
+ lastSheet.insertRule(
+ "table.diff td div { overflow: visible; }",
+ lastSheet.cssRules.length);
+}
\ No newline at end of file