Title: [235262] trunk/Websites/bugs.webkit.org
Revision
235262
Author
[email protected]
Date
2018-08-23 16:57:56 -0700 (Thu, 23 Aug 2018)

Log Message

EWS bubbles are being hidden due to lack of space.
https://bugs.webkit.org/show_bug.cgi?id=188607

Reviewed by Daniel Bates.

* PrettyPatch/PrettyPatch.rb:
* code-review.js:
* js/status-bubble.js: Added.
Refactor Review Patch page so that the postMessage to resize EWS iframes may be used on other pages too.

* template/en/default/attachment/edit.html.tmpl:
* template/en/default/attachment/list.html.tmpl:
Resize EWS iframes via postMessage on bug page and attachment details page.

Modified Paths

Added Paths

Diff

Modified: trunk/Websites/bugs.webkit.org/ChangeLog (235261 => 235262)


--- trunk/Websites/bugs.webkit.org/ChangeLog	2018-08-23 23:57:03 UTC (rev 235261)
+++ trunk/Websites/bugs.webkit.org/ChangeLog	2018-08-23 23:57:56 UTC (rev 235262)
@@ -1,3 +1,19 @@
+2018-08-23  Ross Kirsling  <[email protected]>
+
+        EWS bubbles are being hidden due to lack of space.
+        https://bugs.webkit.org/show_bug.cgi?id=188607
+
+        Reviewed by Daniel Bates.
+
+        * PrettyPatch/PrettyPatch.rb:
+        * code-review.js:
+        * js/status-bubble.js: Added.
+        Refactor Review Patch page so that the postMessage to resize EWS iframes may be used on other pages too.
+        
+        * template/en/default/attachment/edit.html.tmpl:
+        * template/en/default/attachment/list.html.tmpl:
+        Resize EWS iframes via postMessage on bug page and attachment details page. 
+
 2018-06-22  Daniel Bates  <[email protected]>
 
         EWS for security bugs

Modified: trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb (235261 => 235262)


--- trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2018-08-23 23:57:03 UTC (rev 235261)
+++ trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2018-08-23 23:57:56 UTC (rev 235262)
@@ -349,7 +349,7 @@
   height: 4em;
 }
 
-#statusBubbleContainer.wrap {
+.statusBubble.wrap {
   display: block;
 }
 
@@ -488,7 +488,7 @@
   outline-offset: -1px;
 }
 
-.statusBubble {
+.statusBubble > iframe {
   /* The width/height get set to the bubble contents via postMessage on browsers that support it. */
   width: 460px;
   height: 20px;
@@ -524,6 +524,7 @@
 }
 </style>
 <script src="" 
+<script src=""
 <script src=""
 </head>
 EOF

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


--- trunk/Websites/bugs.webkit.org/code-review.js	2018-08-23 23:57:03 UTC (rev 235261)
+++ trunk/Websites/bugs.webkit.org/code-review.js	2018-08-23 23:57:56 UTC (rev 235262)
@@ -535,20 +535,8 @@
     });
   }
 
-  window.addEventListener('message', function(e) {
-    if (e.origin != 'https://webkit-queues.webkit.org')
-      return;
+  window.addEventListener('message', handleStatusBubbleMessage, false);
 
-    if (e.data.height) {
-      $('.statusBubble')[0].style.height = e.data.height;
-      $('.statusBubble')[0].style.width = e.data.width;
-    }
-  }, false);
-
-  function handleStatusBubbleLoad(e) {
-    e.target.contentWindow.postMessage('containerMetrics', 'https://webkit-queues.webkit.org');
-  }
-
   function fetchHistory() {
     $.get('attachment.cgi?id=' + attachment_id + '&action="" function(data) {
       var bug_id = /Attachment \d+ Details for Bug (\d+)/.exec(data)[1];
@@ -578,13 +566,12 @@
       var details = $(data);
       addFlagsForAttachment(details);
 
-      statusBubble = document.createElement('iframe');
-      statusBubble.className = 'statusBubble';
+      var statusBubble = document.createElement('iframe');
       statusBubble.src  = '' + attachment_id;
       statusBubble.scrolling = 'no';
       // Can't append the HTML because we need to set the onload handler before appending the iframe to the DOM.
-      statusBubble._onload_ = handleStatusBubbleLoad;
-      $('#statusBubbleContainer').append(statusBubble);
+      statusBubble._onload_ = function () { handleStatusBubbleLoad(this); };
+      $('.statusBubble').append(statusBubble);
 
       $('#toolbar .bugLink').html('<a href="" + bug_id + '" target="_blank">Bug ' + bug_id + '</a>');
     });
@@ -1056,7 +1043,7 @@
 
   function openOverallComments(e) {
     $('.overallComments textarea').addClass('open');
-    $('#statusBubbleContainer').addClass('wrap');
+    $('.statusBubble').addClass('wrap');
   }
 
   var g_overallCommentsInputTimer;
@@ -1080,7 +1067,7 @@
           '<textarea placeholder="Overall comments"></textarea>' +
         '</div>' +
         '<div>' +
-          '<span id="statusBubbleContainer"></span>' +
+          '<span class="statusBubble"></span>' +
           '<span class="actions">' +
             '<span class="links"><span class="bugLink"></span></span>' +
             '<span id="flagContainer"></span>' +

Added: trunk/Websites/bugs.webkit.org/js/status-bubble.js (0 => 235262)


--- trunk/Websites/bugs.webkit.org/js/status-bubble.js	                        (rev 0)
+++ trunk/Websites/bugs.webkit.org/js/status-bubble.js	2018-08-23 23:57:56 UTC (rev 235262)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function handleStatusBubbleMessage(event) {
+    if (event.origin !== 'https://webkit-queues.webkit.org' || !event.data.height)
+        return;
+
+    for (const iframe of document.querySelectorAll('.statusBubble > iframe')) {
+        if (iframe.contentWindow === event.source) {
+            iframe.style.height = event.data.height + 'px';
+            iframe.style.width = event.data.width + 'px';
+            break;
+        }
+    }
+}
+
+function handleStatusBubbleLoad(iframe) {
+    iframe.contentWindow.postMessage('containerMetrics', 'https://webkit-queues.webkit.org');
+}

Modified: trunk/Websites/bugs.webkit.org/template/en/default/attachment/edit.html.tmpl (235261 => 235262)


--- trunk/Websites/bugs.webkit.org/template/en/default/attachment/edit.html.tmpl	2018-08-23 23:57:03 UTC (rev 235261)
+++ trunk/Websites/bugs.webkit.org/template/en/default/attachment/edit.html.tmpl	2018-08-23 23:57:56 UTC (rev 235262)
@@ -34,6 +34,11 @@
 [% can_edit = attachment.validate_can_edit %]
 [% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
 
+<script src="" 'js/status-bubble.js' FILTER mtime %]"></script>
+<script>
+  window.addEventListener('message', handleStatusBubbleMessage, false);
+</script>
+
 <form method="post" action="" _onsubmit_="normalizeComments();">
   <input type="hidden" name="id" value="[% attachment.id %]">
   <input type="hidden" name="action" value="update">
@@ -260,7 +265,7 @@
 
         <div class="statusBubble">
           <iframe src="" attachment.id %]"
-                  style="width: 600px; height: 20px; border: none;" scrolling="no">
+                  style="width: 600px; height: 20px; border: none;" scrolling="no" _onload_="handleStatusBubbleLoad(this)">
           </iframe>
         </div>
         <br>

Modified: trunk/Websites/bugs.webkit.org/template/en/default/attachment/list.html.tmpl (235261 => 235262)


--- trunk/Websites/bugs.webkit.org/template/en/default/attachment/list.html.tmpl	2018-08-23 23:57:03 UTC (rev 235261)
+++ trunk/Websites/bugs.webkit.org/template/en/default/attachment/list.html.tmpl	2018-08-23 23:57:56 UTC (rev 235262)
@@ -8,8 +8,11 @@
 
 [% RETURN UNLESS attachments.size || Param("maxattachmentsize") || Param("maxlocalattachment") %]
 
+<script src="" 'js/status-bubble.js' FILTER mtime %]"></script>
 <script type="text/_javascript_">
 <!--
+window.addEventListener('message', handleStatusBubbleMessage, false);
+
 function toggle_display(link) {
     var table = document.getElementById("attachment_table");
     var view_all = document.getElementById("view_all");
@@ -153,7 +156,7 @@
           [% IF attachment.ispatch %]
           <div class="statusBubble">
             <iframe src="" attachment.id %]"
-                    style="width: 600px; height: 20px; border: none;" scrolling="no">
+                    style="width: 600px; height: 20px; border: none;" scrolling="no" _onload_="handleStatusBubbleLoad(this)">
             </iframe>
           </div>
           [% END %]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to