Title: [193808] trunk/Websites/webkit.org
Revision
193808
Author
j...@apple.com
Date
2015-12-08 20:15:09 -0800 (Tue, 08 Dec 2015)

Log Message

Wide tables should be scrollable on narrow mobile screens.
https://bugs.webkit.org/show_bug.cgi?id=151941

Reviewed by Timothy Hatcher.

* wp-content/themes/webkit/scripts/global.js:
(inView):
(onMovement):
(updateImages):
(enableScrollableTables):
(update): Deleted.
* wp-content/themes/webkit/style.css:
(.pagination .prev-post):
(article .scrollable):
(.scrollable .scrollable-padding):

Modified Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (193807 => 193808)


--- trunk/Websites/webkit.org/ChangeLog	2015-12-09 04:10:26 UTC (rev 193807)
+++ trunk/Websites/webkit.org/ChangeLog	2015-12-09 04:15:09 UTC (rev 193808)
@@ -1,5 +1,23 @@
 2015-12-08  Jonathan Davis  <j...@apple.com>
 
+        Wide tables should be scrollable on narrow mobile screens.
+        https://bugs.webkit.org/show_bug.cgi?id=151941
+
+        Reviewed by Timothy Hatcher.
+
+        * wp-content/themes/webkit/scripts/global.js:
+        (inView):
+        (onMovement):
+        (updateImages):
+        (enableScrollableTables):
+        (update): Deleted.
+        * wp-content/themes/webkit/style.css:
+        (.pagination .prev-post):
+        (article .scrollable):
+        (.scrollable .scrollable-padding):
+
+2015-12-08  Jonathan Davis  <j...@apple.com>
+
         Fix Code Style Guidelines code parsing.
         https://bugs.webkit.org/show_bug.cgi?id=152024
 

Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/scripts/global.js (193807 => 193808)


--- trunk/Websites/webkit.org/wp-content/themes/webkit/scripts/global.js	2015-12-09 04:10:26 UTC (rev 193807)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/scripts/global.js	2015-12-09 04:15:09 UTC (rev 193808)
@@ -40,7 +40,6 @@
         });
     }
 
-
     var latest = [], updating = false;
     function inView(element) {
         var box = element.getBoundingClientRect();
@@ -81,7 +80,7 @@
         updating = true;
     }
 
-    function update() {
+    function updateImages() {
         updating = false;
 
         for (var i = 0; i < imgs.length; i++) {
@@ -90,10 +89,30 @@
         }
 
     }
+    
+    function enableScrollableTables () {
+        var tables = document.querySelectorAll('.bodycopy > table');
+        var tableCount = tables.length;
 
+        for (var i = 0; i < tableCount; i++) {
+            var scrollableDiv = document.createElement('div');
+            var paddingDiv = document.createElement('div');
+
+            scrollableDiv.classList.add('scrollable');
+            paddingDiv.classList.add('scrollable-padding');
+
+            scrollableDiv.appendChild(paddingDiv);
+            tables[i].parentNode.insertBefore(scrollableDiv, tables[i]);
+
+            paddingDiv.appendChild(tables[i]);
+        }
+    }
+
     var imgs = document.querySelectorAll('div[data-url]');
     document.addEventListener('scroll', onMovement);
     document.addEventListener('resize', onMovement);
-    update();
+    
+    updateImages();
+    enableScrollableTables();
 
 });
\ No newline at end of file

Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/style.css (193807 => 193808)


--- trunk/Websites/webkit.org/wp-content/themes/webkit/style.css	2015-12-09 04:10:26 UTC (rev 193807)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/style.css	2015-12-09 04:15:09 UTC (rev 193808)
@@ -1666,7 +1666,25 @@
         margin-bottom: 1rem;
         text-align: left;
     }
+    
+    article .scrollable {
+        overflow: auto;
+        -webkit-overflow-scrolling: touch;
+        position: relative;
+        width: 100vw;
+        left: 50%;
+        transform: translate(-50%);
+        margin: 3rem 0;
+        border: 1px solid #cccccc;
+        border-left: none;
+        border-right: none;
+    }
 
+    .scrollable .scrollable-padding {
+        display: inline-block;
+        padding: 0 3rem;
+    }
+
 }
 
 @media only screen and (max-width: 600px) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to