Index: trunk/phase3/skins/common/diff.js |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +/* |
| 3 | +Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling |
| 4 | +<div>s in <td> cells collapse their height to a single line. |
| 5 | + |
| 6 | +Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried |
| 7 | +with overflow-x disable the scrolling all the way until Mozilla 1.8 / FF 1.5 |
| 8 | +and break Opera as well. |
| 9 | + |
| 10 | +So... we check for reaaaally old Gecko and hack in an alternate rule to let |
| 11 | +the wide cells spill instead of scrolling them. Not ideal as it won't work |
| 12 | +if JS is disabled, of course. |
| 13 | +*/ |
| 14 | + |
| 15 | +if (navigator && navigator.product == "Gecko" && navigator.productSub < "20021130") { |
| 16 | + var sheets = document.styleSheets; |
| 17 | + var lastSheet = sheets[sheets.length-1]; |
| 18 | + lastSheet.insertRule( |
| 19 | + "table.diff td div { overflow: visible; }", |
| 20 | + lastSheet.cssRules.length); |
| 21 | +} |
\ No newline at end of file |
Property changes on: trunk/phase3/skins/common/diff.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 22 | + native |
Index: trunk/phase3/skins/common/diff.css |
— | — | @@ -62,4 +62,13 @@ |
63 | 63 | /* As fallback, scrollbars will be added for very wide cells |
64 | 64 | instead of text overflowing or widening */ |
65 | 65 | overflow: auto; |
| 66 | + |
| 67 | + /* The above rule breaks on very old versions of Mozilla due |
| 68 | + to a bug which collapses the table cells to a single line. |
| 69 | + |
| 70 | + In Mozilla 1.1 and below with JavaScript enabled, the rule |
| 71 | + will be overridden with this by diff.js; wide cell contents |
| 72 | + then spill horizontally without widening the rest of the |
| 73 | + table: */ |
| 74 | + /* overflow: visible; */ |
66 | 75 | } |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1104,8 +1104,7 @@ |
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | if ( 'diff' == $this->formtype ) { |
1108 | | - $wgOut->addStyle( 'common/diff.css' ); |
1109 | | - $wgOut->addHTML( $this->getDiff() ); |
| 1108 | + $this->showDiff(); |
1110 | 1109 | } |
1111 | 1110 | } |
1112 | 1111 | |
— | — | @@ -1287,8 +1286,7 @@ |
1288 | 1287 | } |
1289 | 1288 | |
1290 | 1289 | if ( $this->formtype == 'diff') { |
1291 | | - $wgOut->addStyle( 'common/diff.css' ); |
1292 | | - $wgOut->addHTML( $this->getDiff() ); |
| 1290 | + $this->showDiff(); |
1293 | 1291 | } |
1294 | 1292 | |
1295 | 1293 | } |
— | — | @@ -1910,10 +1908,8 @@ |
1911 | 1909 | * |
1912 | 1910 | * If this is a section edit, we'll replace the section as for final |
1913 | 1911 | * save and then make a comparison. |
1914 | | - * |
1915 | | - * @return string HTML |
1916 | 1912 | */ |
1917 | | - function getDiff() { |
| 1913 | + function showDiff() { |
1918 | 1914 | $oldtext = $this->mArticle->fetchContent(); |
1919 | 1915 | $newtext = $this->mArticle->replaceSection( |
1920 | 1916 | $this->section, $this->textbox1, $this->summary, $this->edittime ); |
— | — | @@ -1924,11 +1920,13 @@ |
1925 | 1921 | $de = new DifferenceEngine( $this->mTitle ); |
1926 | 1922 | $de->setText( $oldtext, $newtext ); |
1927 | 1923 | $difftext = $de->getDiff( $oldtitle, $newtitle ); |
| 1924 | + $de->showDiffStyle(); |
1928 | 1925 | } else { |
1929 | 1926 | $difftext = ''; |
1930 | 1927 | } |
1931 | 1928 | |
1932 | | - return '<div id="wikiDiff">' . $difftext . '</div>'; |
| 1929 | + global $wgOut; |
| 1930 | + $wgOut->addHtml( '<div id="wikiDiff">' . $difftext . '</div>' ); |
1933 | 1931 | } |
1934 | 1932 | |
1935 | 1933 | /** |
Index: trunk/phase3/includes/DifferenceEngine.php |
— | — | @@ -296,11 +296,22 @@ |
297 | 297 | $wgOut->addWikitext( wfMsg( 'missingarticle', "<nowiki>(fixme, bug)</nowiki>" ) ); |
298 | 298 | return false; |
299 | 299 | } else { |
300 | | - $wgOut->addStyle( 'common/diff.css' ); |
| 300 | + $this->showDiffStyle(); |
301 | 301 | $wgOut->addHTML( $diff ); |
302 | 302 | return true; |
303 | 303 | } |
304 | 304 | } |
| 305 | + |
| 306 | + /** |
| 307 | + * Add style sheets and supporting JS for diff display. |
| 308 | + */ |
| 309 | + function showDiffStyle() { |
| 310 | + global $wgStylePath, $wgStyleVersion, $wgOut; |
| 311 | + $wgOut->addStyle( 'common/diff.css' ); |
| 312 | + |
| 313 | + // JS is needed to detect old versions of Mozilla to work around an annoyance bug. |
| 314 | + $wgOut->addScript( "<script type=\"text/javascript\" src=\"$wgStylePath/common/diff.js?$wgStyleVersion\"></script>" ); |
| 315 | + } |
305 | 316 | |
306 | 317 | /** |
307 | 318 | * Get diff table, including header |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -164,6 +164,7 @@ |
165 | 165 | * (bug 10215) Show custom editing introduction when editing existing pages |
166 | 166 | * (bug 10223) Fix edit link in noarticletext localizations for fr, oc |
167 | 167 | * (bug 10247) Fix IP address regex to avoid false positive IPv6 matches |
| 168 | +* (bug 9948) Workaround for diff regression with old Mozilla versions |
168 | 169 | |
169 | 170 | |
170 | 171 | == API changes since 1.10 == |
Index: trunk/extensions/Oversight/HideRevision.php |
— | — | @@ -663,7 +663,8 @@ |
664 | 664 | } |
665 | 665 | $ntext = strval( $rev->getText()); |
666 | 666 | |
667 | | - $wgOut->addStyle( 'common/diff.css' ); |
| 667 | + $diffEngine = new DifferenceEngine(); |
| 668 | + $diffEngine->showDiffStyle(); |
668 | 669 | $wgOut->addHtml( |
669 | 670 | "<ul>" . |
670 | 671 | $info . |
— | — | @@ -683,7 +684,7 @@ |
684 | 685 | "<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#$prevId)" . "</td>" . |
685 | 686 | "<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" . |
686 | 687 | "</tr>" . |
687 | | - DifferenceEngine::generateDiffBody( $otext, $ntext ) . |
| 688 | + $diffEngine->generateDiffBody( $otext, $ntext ) . |
688 | 689 | "</table>" . |
689 | 690 | "</div>\n" ); |
690 | 691 | } |