+2010-12-15 Ojan Vafai <ojan@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ anchor the toolbar to the bottom of the diff if the diff doesn't take a full screen of height
+ https://bugs.webkit.org/show_bug.cgi?id=51162
+
+ * PrettyPatch/PrettyPatch.rb:
+ * code-review.js:
+
2011-01-01 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
background-color: #f8f8f8;
border: 1px solid #ddd;
font-family: monospace;
- margin: 2em 0px;
+ margin: 1em 0;
}
h1 {
#toolbar {
display: -webkit-box;
display: -moz-box;
- position: fixed;
padding: 3px;
bottom: 0;
left: 0;
right: 0;
- border-top: 1px solid #ddd;
+ border: 1px solid #ddd;
background-color: #eee;
font-family: sans-serif;
}
+#toolbar.anchored {
+ position: fixed;
+}
+
#toolbar .actions {
float: right;
}
border: none;
vertical-align: middle;
}
+
+.pseudo_resize_event_iframe {
+ height: 10%;
+ width: 10%;
+ position: absolute;
+ top: -11%;
+}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="code-review.js?version=17"></script>
$('#statusBubbleContainer').addClass('wrap');
}
+ function onBodyResize() {
+ updateToolbarAnchorState();
+ }
+
+ function updateToolbarAnchorState() {
+ var has_scrollbar = window.innerWidth > document.documentElement.offsetWidth;
+ $('#toolbar').toggleClass('anchored', has_scrollbar);
+ }
+
$(document).ready(function() {
crawlDiff();
fetchHistory();
$(document.body).prepend('<div id="message"><div class="help">Select line numbers to add a comment.</div><div class="commentStatus"></div></div>');
- $(document.body).prepend('<div id="toolbar">' +
+ $(document.body).append('<div id="toolbar">' +
'<div class="overallComments">' +
'<textarea placeholder="Overall comments"></textarea>' +
'</div>' +
$('.overallComments textarea').bind('click', openOverallComments);
$(document.body).prepend('<div id="comment_form" class="inactive"><div class="winter"></div><div class="lightbox"><iframe id="reviewform" src="attachment.cgi?id=' + attachment_id + '&action=reviewform"></iframe></div></div>');
+
+ // Create a dummy iframe and monitor resizes in it's contentWindow to detect when the top document's body changes size.
+ // FIXME: Should we setTimeout throttle these?
+ var resize_iframe = $('<iframe class="pseudo_resize_event_iframe"></iframe>');
+ $(document.body).append(resize_iframe);
+ $(resize_iframe[0].contentWindow).bind('resize', onBodyResize);
+
+ updateToolbarAnchorState();
});
function discardComment() {