[commit: haddock] master: Fix alignment of Source links in instance table in Firefox (a476b25)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:39:22 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : master
Link : http://git.haskell.org/haddock.git/commitdiff/a476b251e363b3b0ed30c75cf72a19fc275d6440
>---------------------------------------------------------------
commit a476b251e363b3b0ed30c75cf72a19fc275d6440
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Fri Jun 12 12:59:24 2015 -0400
Fix alignment of Source links in instance table in Firefox
Due to a Firefox bug [1], a combination of 'whitespace: nowrap' on the
parent element with 'float: right' on the inner element can cause the
floated element to be displaced downwards for no apparent reason.
To work around this, the left side is wrapped in its own <span> and set
to 'float: left'. As a precautionary measure to prevent the parent
element from collapsing entirely, we also add the classic "clearfix"
hack. The latter is not strictly needed but it helps prevent bugs if
the layout is altered again in the future.
Fixes #384.
Remark: line 159 of src/Haddock/Backends/Xhtml/Layout.hs was indented to
prevent confusion over the operator precedence of (<+>) vs (<<).
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=488725
>---------------------------------------------------------------
a476b251e363b3b0ed30c75cf72a19fc275d6440
haddock-api/resources/html/Ocean.std-theme/ocean.css | 13 +++++++++++++
haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 5 +++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css
index ef652a2..1110b40 100644
--- a/haddock-api/resources/html/Ocean.std-theme/ocean.css
+++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css
@@ -416,6 +416,14 @@ div#style-menu-holder {
margin-top: 0.8em;
}
+.clearfix:after {
+ clear: both;
+ content: " ";
+ display: block;
+ height: 0;
+ visibility: hidden;
+}
+
.subs dl {
margin: 0;
}
@@ -455,6 +463,11 @@ div#style-menu-holder {
margin-left: 1em;
}
+/* Workaround for bug in Firefox (issue #384) */
+.inst-left {
+ float: left;
+}
+
.top p.src {
border-top: 1px solid #ccc;
}
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
index e686d64..914a7a7 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
@@ -154,8 +154,9 @@ subTableSrc _ _ _ [] = Nothing
subTableSrc qual lnks splice decls = Just $ table << aboves (concatMap subRow decls)
where
subRow ((decl, mdoc, subs),L loc dn) =
- (td ! [theclass "src"] << decl
- <+> linkHtml loc dn
+ (td ! [theclass "src clearfix"] <<
+ (thespan ! [theclass "inst-left"] << decl)
+ <+> linkHtml loc dn
<->
docElement td << fmap (docToHtml Nothing qual) mdoc
)
More information about the ghc-commits
mailing list