Title: [136587] trunk/Websites/bugs.webkit.org
Revision
136587
Author
o...@chromium.org
Date
2012-12-04 16:06:02 -0800 (Tue, 04 Dec 2012)

Log Message

Use sticky positioning for the code review toolbar
https://bugs.webkit.org/show_bug.cgi?id=104056

Reviewed by Adam Barth.

This simplifies the code and gives a nicer user-experience.
Also, while here, I fixed up the CSS to not have toolbar items
overlap when you make the window too small.

* PrettyPatch/PrettyPatch.rb:
* code-review-test.html:
* code-review.js:

Modified Paths

Diff

Modified: trunk/Websites/bugs.webkit.org/ChangeLog (136586 => 136587)


--- trunk/Websites/bugs.webkit.org/ChangeLog	2012-12-04 23:49:51 UTC (rev 136586)
+++ trunk/Websites/bugs.webkit.org/ChangeLog	2012-12-05 00:06:02 UTC (rev 136587)
@@ -1,5 +1,20 @@
 2012-12-04  Ojan Vafai  <o...@chromium.org>
 
+        Use sticky positioning for the code review toolbar
+        https://bugs.webkit.org/show_bug.cgi?id=104056
+
+        Reviewed by Adam Barth.
+
+        This simplifies the code and gives a nicer user-experience.
+        Also, while here, I fixed up the CSS to not have toolbar items
+        overlap when you make the window too small.
+
+        * PrettyPatch/PrettyPatch.rb:
+        * code-review-test.html:
+        * code-review.js:
+
+2012-12-04  Ojan Vafai  <o...@chromium.org>
+
         Properly create the header links in the code review tool
         https://bugs.webkit.org/show_bug.cgi?id=104037
 

Modified: trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb (136586 => 136587)


--- trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2012-12-04 23:49:51 UTC (rev 136586)
+++ trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2012-12-05 00:06:02 UTC (rev 136587)
@@ -318,6 +318,7 @@
 .overallComments textarea {
   height: 2em;
   max-width: 100%;
+  min-width: 200px;
 }
 
 .comment textarea, .overallComments textarea {
@@ -334,13 +335,9 @@
   display: block;
 }
 
-body {
-  margin-bottom: 40px;
-}
-
 #toolbar {
-  display: -webkit-box;
-  display: -moz-box;
+  display: -webkit-flex;
+  display: -moz-flex;
   padding: 3px;
   left: 0;
   right: 0;
@@ -348,9 +345,6 @@
   background-color: #eee;
   font-family: sans-serif;
   position: fixed;
-}
-
-#toolbar.anchored {
   bottom: 0;
 }
 
@@ -451,8 +445,8 @@
 }
 
 .overallComments {
-  -webkit-box-flex: 1;
-  -moz-box-flex: 1;
+  -webkit-flex: 1;
+  -moz-flex: 1;
   margin-right: 3px;
 }
 
@@ -480,13 +474,6 @@
   vertical-align: middle;
 }
 
-.pseudo_resize_event_iframe {
-  height: 10%;
-  width: 10%;
-  position: absolute;
-  top: -11%;
-}
-
 .revision {
   display: none;
 }

Modified: trunk/Websites/bugs.webkit.org/code-review-test.html (136586 => 136587)


--- trunk/Websites/bugs.webkit.org/code-review-test.html	2012-12-04 23:49:51 UTC (rev 136586)
+++ trunk/Websites/bugs.webkit.org/code-review-test.html	2012-12-05 00:06:02 UTC (rev 136587)
@@ -50,8 +50,7 @@
   ASSERT_EQUAL($('<div>').append(links).html(),
     '<a target="_blank" href="" +
     '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>
-');
+    '<a target="_blank" href="" log</a>');
 
   var links = tracLinks('foo/bar.h', '');
   ASSERT_EQUAL($('<div>').append(links).html(),

Modified: trunk/Websites/bugs.webkit.org/code-review.js (136586 => 136587)


--- trunk/Websites/bugs.webkit.org/code-review.js	2012-12-04 23:49:51 UTC (rev 136586)
+++ trunk/Websites/bugs.webkit.org/code-review.js	2012-12-05 00:06:02 UTC (rev 136587)
@@ -1060,19 +1060,6 @@
     g_overallCommentsInputTimer = setTimeout(saveDraftComments, 1000);
   }
 
-  function onBodyResize() {
-    updateToolbarAnchorState();
-  }
-
-  function updateToolbarAnchorState() {
-    var toolbar = $('#toolbar');
-    // Unanchor the toolbar and then see if it's bottom is below the body's bottom.
-    toolbar.toggleClass('anchored', false);
-    var toolbar_bottom = toolbar.offset().top + toolbar.outerHeight();
-    var should_anchor = toolbar_bottom >= document.body.clientHeight;
-    toolbar.toggleClass('anchored', should_anchor);
-  }
-
   function diffLinksHtml() {
     return '<a href="" class="unify-link">unified</a>' +
       '<a href="" class="side-by-side-link">side-by-side</a>';
@@ -1091,12 +1078,18 @@
             '<button id="preview_comments">Preview</button>' +
             '<button id="post_comments">Publish</button> ' +
           '</span>' +
+          '<div class="clear_float"></div>' +
         '</div>' +
         '<div class="autosave-state"></div>' +
         '</div>');
 
     $('.overallComments textarea').bind('click', openOverallComments);
     $('.overallComments textarea').bind('input', handleOverallCommentsInput);
+
+    var toolbar = $('#toolbar');
+    toolbar.css('position', '-webkit-sticky');
+    var supportsSticky = toolbar.css('position') == '-webkit-sticky';
+    document.body.style.marginBottom = supportsSticky ? 0 : '40px';
   }
 
   function handleDocumentReady() {
@@ -1130,14 +1123,6 @@
     $(document.body).prepend('<div id="comment_form" class="inactive"><div class="winter"></div><div class="lightbox"><iframe id="reviewform" src="" + attachment_id + '&action=""
     $('#reviewform').bind('load', handleReviewFormLoad);
 
-    // 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);
-    // Handle the event on a timeout to avoid crashing Firefox.
-    $(resize_iframe[0].contentWindow).bind('resize', function() { setTimeout(onBodyResize, 0)});
-
-    updateToolbarAnchorState();
     loadDiffState();
     generateFileDiffResizeStyleElement();
   };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to