Page MenuHomePhabricator

9948-work.diff

Authored By
bzimport
Nov 21 2014, 9:37 PM
Size
2 KB
Referenced Files
None
Subscribers
None

9948-work.diff

Index: skins/common/diff.js
===================================================================
--- skins/common/diff.js (revision 0)
+++ skins/common/diff.js (revision 0)
@@ -0,0 +1,20 @@
+/*
+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
Property changes on: skins/common/diff.js
___________________________________________________________________
Name: svn:eol-style
+ native
Index: skins/common/diff.css
===================================================================
--- skins/common/diff.css (revision 22407)
+++ skins/common/diff.css (working copy)
@@ -62,4 +62,13 @@
/* 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; */
}
Index: includes/DifferenceEngine.php
===================================================================
--- includes/DifferenceEngine.php (revision 22407)
+++ includes/DifferenceEngine.php (working copy)
@@ -296,11 +296,22 @@
$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;
+ $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\"></script>" );
+ }
/**
* Get diff table, including header

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3316
Default Alt Text
9948-work.diff (2 KB)

Event Timeline