diff --git a/layout/tools/reftest/reftest-analyzer.xhtml b/layout/tools/reftest/reftest-analyzer.xhtml index 3e255038a7db..64a50253e42d 100644 --- a/layout/tools/reftest/reftest-analyzer.xhtml +++ b/layout/tools/reftest/reftest-analyzer.xhtml @@ -118,7 +118,7 @@ function load() { req.open('GET', gParams.logurl, true); req.send(); } - window.addEventListener('keypress', maybe_load_image, false); + window.addEventListener('keypress', handle_keyboard_shortcut, false); ID("image1").addEventListener('error', image_load_error, false); ID("image2").addEventListener('error', image_load_error, false); } @@ -390,7 +390,7 @@ function show_image(i) { } } -function maybe_load_image(event) { +function handle_keyboard_shortcut(event) { switch (event.charCode) { case 49: // "1" key document.getElementById("radio1").checked = true; @@ -400,6 +400,32 @@ function maybe_load_image(event) { document.getElementById("radio2").checked = true; show_image(2); break; + case 100: // "d" key + document.getElementById("differences").click(); + break; + case 112: // "p" key + shift_images(-1); + break; + case 110: // "n" key + shift_images(1); + break; + } +} + +function shift_images(dir) { + var activeItem = document.querySelector(".activeitem"); + if (!activeItem) { + return; + } + for (var elm = activeItem; elm; elm = elm.parentElement) { + if (elm.tagName != "tr") { + continue; + } + elm = dir > 0 ? elm.nextElementSibling : elm.previousElementSibling; + if (elm) { + elm.getElementsByTagName("a")[0].click(); + } + return; } } @@ -546,7 +572,7 @@ function show_pixelinfo(x, y, pix1rgb, pix1hex, pix2rgb, pix2hex) {
- +