Changeset 112423 in webkit
- Timestamp:
- Mar 28, 2012 12:19:36 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js
r111796 r112423 76 76 'results', 77 77 ] 78 this._tabIndexToSavedScrollOffset = {}; 78 79 this._tabs = $(this).tabs({ 79 80 disabled: [2], 81 show: function(event, ui) { this._restoreScrollOffset(ui.index); }, 80 82 }); 81 83 }, 84 _saveScrollOffset: function() { 85 var tabIndex = this._tabs.tabs('option', 'selected'); 86 this._tabIndexToSavedScrollOffset[tabIndex] = document.body.scrollTop; 87 }, 88 _restoreScrollOffset: function(tabIndex) 89 { 90 document.body.scrollTop = this._tabIndexToSavedScrollOffset[tabIndex] || 0; 91 }, 92 _setupHistoryHandlers: function() 93 { 94 function currentHash() { 95 var hash = window.location.hash; 96 return (!hash || hash == '#') ? '#unexpected' : hash; 97 } 98 99 var self = this; 100 $('.ui-tabs-nav a').bind('mouseup', function(event) { 101 var href = event.target.getAttribute('href'); 102 var hash = currentHash(); 103 if (href != hash) { 104 self._saveScrollOffset(); 105 window.location = href 106 } 107 }); 108 109 window.onhashchange = function(event) { 110 var tabName = currentHash().substring(1); 111 self._selectInternal(tabName); 112 }; 113 114 // When navigating from the browser chrome, we'll 115 // scroll to the #tabname contents. popstate fires before 116 // we scroll, so we can save the scroll offset first. 117 window.onpopstate = function() { 118 self._saveScrollOffset(); 119 }; 120 }, 82 121 attach: function() 83 122 { 84 123 document.body.insertBefore(this, document.body.firstChild); 124 this._setupHistoryHandlers(); 85 125 }, 86 126 tabNamed: function(tabName) … … 109 149 return this.tabNamed('results'); 110 150 }, 111 select: function(tabName) 112 { 151 _selectInternal: function(tabName) { 113 152 var tabIndex = this._tabNames.indexOf(tabName); 114 153 this._tabs.tabs('enable', tabIndex); 115 154 this._tabs.tabs('select', tabIndex); 155 }, 156 select: function(tabName) 157 { 158 this._saveScrollOffset(); 159 this._selectInternal(tabName); 160 window.location = '#' + tabName; 116 161 } 117 162 }); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js
r112149 r112423 191 191 var nonLinkTitle = document.createElement('a'); 192 192 $(nonLinkTitle).addClass('non-link-title'); 193 $(nonLinkTitle). attr('href', "#").text(testName);193 $(nonLinkTitle).text(testName); 194 194 195 195 var linkTitle = document.createElement('a'); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui_unittests.js
r111793 r112423 47 47 } 48 48 49 test("ui.onebar", 3, function() { 50 if (window.location.hash) { 51 window.location.hash = ''; 52 } 53 54 onebar = new ui.onebar(); 55 onebar.attach(); 56 equal(onebar.innerHTML, 57 '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">' + 58 '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#unexpected">Unexpected Failures</a></li>' + 59 '<li class="ui-state-default ui-corner-top"><a href="#expected">Expected Failures</a></li>' + 60 '<li class="ui-state-default ui-corner-top ui-state-disabled"><a href="#results">Results</a></li>' + 61 '</ul>' + 62 '<div id="unexpected" class="ui-tabs-panel ui-widget-content ui-corner-bottom"></div>' + 63 '<div id="expected" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"></div>' + 64 '<div id="results" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"></div>'); 65 66 onebar.select('expected'); 67 equal(window.location.hash, '#expected'); 68 onebar.select('unexpected'); 69 equal(window.location.hash, '#unexpected'); 70 71 $(onebar).detach(); 72 }); 73 49 74 test("results.ResultsGrid", 1, function() { 50 75 var grid = new ui.results.ResultsGrid() -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css
r112149 r112423 91 91 display: inline-block; 92 92 } 93 .ui-state-active .non-link-title, .ui-state-active .non-link-title:link, .ui-state-active .non-link-title:visited { 93 /* Stupid CSS specificity rules. We need the .ui-accordion-header to override the builtin jquery styling on anchor tags in accordion headers. */ 94 .ui-state-active.ui-accordion-header .non-link-title, .ui-state-active .non-link-title:link, .ui-state-active .non-link-title:visited { 94 95 display: none; 95 96 } -
trunk/Tools/ChangeLog
r112408 r112423 1 2012-03-28 Ojan Vafai <ojan@chromium.org> 2 3 Add history navigation to garden-o-matic 4 https://bugs.webkit.org/show_bug.cgi?id=82495 5 6 Reviewed by Dimitri Glazkov. 7 8 Also, maintain scroll offsets when returning to a tab. This makes addressing 9 expected failures considerably easier when dealing with below-the-fold tests. 10 11 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js: 12 -Store the scrollTop before switching to a new tab and restore the appropriate scrollTop after 13 switching. 14 -Modify window.location with the tabName in the hash. Can't use pushState because this is served 15 from a file URL and Chrome puts each different file URL in it's own origin. 16 17 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js: 18 Remove the href so that clicking on the accordion item does not modify window.location.hash. 19 20 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui_unittests.js: 21 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css: 22 1 23 2012-03-28 Philippe Normand <pnormand@igalia.com> 2 24
Note: See TracChangeset
for help on using the changeset viewer.