| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Touch Adjustment : Adjust context-menu to selectable text - bug 94101</title> |
| <script src="../fast/js/resources/js-test-pre.js"></script> |
| <script src="resources/touchadjustment.js"></script> |
| <style> |
| #sandbox { |
| position: absolute; |
| top: 0px; |
| left: 0px; |
| width: 400px; |
| height: 200px; |
| } |
| #sandbox p { |
| padding: 5px; |
| font: 20px Ahem; |
| } |
| </style> |
| </head> |
| <body> |
| |
| <div id=sandbox> |
| <p id=p1><span id=span1>Text text text.</span> |
| </div> |
| |
| <p id='description'></p> |
| <div id='console'></div> |
| |
| <script> |
| // Set up shortcut access to elements |
| var e = {}; |
| ['sandbox', 'p1', 'span1'].forEach(function(a) { |
| e[a] = document.getElementById(a); |
| }); |
| |
| function testAdjustedTouches() |
| { |
| // Set editing-behaviour to win, so context-menu gesture does not trigger selections. |
| internals.settings.setEditingBehavior('win'); |
| // Check the context-menu is not adjusted to the selectable text. |
| testTouchPointContextMenu(touchPoint(100, 30, 20), null, true); |
| // Set editing-behaviour mac, so context-menu gesture triggers selections. |
| internals.settings.setEditingBehavior('mac'); |
| // Check the context-menu is adjusted to the selectable text. |
| testTouchPointContextMenu(touchPoint(100, 30, 20), "'Text text text.'", true); |
| } |
| |
| function runTests() |
| { |
| if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestContextMenuNode) { |
| description('Test touch adjustment for context-menu gestures with automatic select behaviour.'); |
| testAdjustedTouches(); |
| e.sandbox.style.display = 'none'; |
| } |
| } |
| runTests(); |
| </script> |
| |
| <script src="../fast/js/resources/js-test-post.js"></script> |
| |
| </body> |
| </html> |