Title: [163464] trunk/Tools
Revision
163464
Author
[email protected]
Date
2014-02-05 12:04:40 -0800 (Wed, 05 Feb 2014)

Log Message

Copying failing test paths from build.webkit.org/dashboard popovers also copies non-selectable links
https://bugs.webkit.org/show_bug.cgi?id=128236

Reviewed by Timothy Hatcher.

Work around bug 80159 - copying should always respect user-select:none, but it doesn't yet.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
When copying, temporarily make non-selectable parts invisible, and put text of
the selection onto pasteboard. Since we immediately make everything visible again,
there is even no blinking.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js (163463 => 163464)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js	2014-02-05 20:03:55 UTC (rev 163463)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js	2014-02-05 20:04:40 UTC (rev 163464)
@@ -214,6 +214,31 @@
             content.appendChild(rowElement);
         }
 
+        // Work around bug 80159: -webkit-user-select:none not respected when copying content.
+        // We set clipboard data manually, temporarily making non-selectable content hidden
+        // to easily get accurate selection text.
+        content._oncopy_ = function(event) {
+            var iterator = document.createNodeIterator(
+                event.currentTarget,
+                NodeFilter.SHOW_ELEMENT,
+                {
+                    acceptNode: function(element) {
+                        if (window.getComputedStyle(element).webkitUserSelect !== "none")
+                            return NodeFilter.FILTER_ACCEPT;
+                        return NodeFilter.FILTER_SKIP;
+                    }
+                }
+            );
+
+            while ((node = iterator.nextNode()))
+                node.style.visibility = "visible";
+
+            event.currentTarget.style.visibility = "hidden";
+            event.clipboardData.setData('text', window.getSelection());
+            event.currentTarget.style.visibility = "";
+            return false;
+        }
+
         return content;
     },
 

Modified: trunk/Tools/ChangeLog (163463 => 163464)


--- trunk/Tools/ChangeLog	2014-02-05 20:03:55 UTC (rev 163463)
+++ trunk/Tools/ChangeLog	2014-02-05 20:04:40 UTC (rev 163464)
@@ -1,3 +1,17 @@
+2014-02-05  Alexey Proskuryakov  <[email protected]>
+
+        Copying failing test paths from build.webkit.org/dashboard popovers also copies non-selectable links
+        https://bugs.webkit.org/show_bug.cgi?id=128236
+
+        Reviewed by Timothy Hatcher.
+
+        Work around bug 80159 - copying should always respect user-select:none, but it doesn't yet.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
+        When copying, temporarily make non-selectable parts invisible, and put text of
+        the selection onto pasteboard. Since we immediately make everything visible again,
+        there is even no blinking.
+
 2014-02-05  Nick Diego Yamane  <[email protected]>
 
         Unreviewed. Add myself to contributors.json
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to