Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: LayoutTests/editing/selection/resources/js-test-selection-shared.js

Issue 14794012: Make contenteditable="false" element as atomic node for selection motion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-05-17T17:08 Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function $(id) { return document.getElementById(id); }
2
3 var selection= window.getSelection();
4
5 function testCaretMotion(direction, granularity, repeatCount, origin, originOffs et, target, targetOffset) {
6 if (direction == 'both') {
7 testCaretMotion('forward', granularity, repeatCount, origin, originOffset, t arget, targetOffset);
ojan 2013/05/22 02:25:20 Here and elsewhere, Blink style is 4-space indents
yosin_UTC9 2013/05/22 07:54:12 Done.
8 testCaretMotion('backward', granularity,repeatCount, target, targetOffset, o rigin, originOffset);
9 return;
10 }
11
12 if (typeof origin == 'string')
13 origin = $(origin);
14
15 if (typeof target == 'string')
16 target = $(target);
17
18 if (originOffset < 0)
19 originOffset = origin.firstChild.length + originOffset + 1;
20
21 if (targetOffset < 0)
22 targetOffset = target.firstChild.length + targetOffset + 1;
23
24 selection.setPosition(origin.firstChild, originOffset);
25 debug('Move ' + direction + ' ' + granularity + ' x ' + repeatCount);
26 for (var i = 0; i < repeatCount; ++i)
27 selection.modify("move", direction, granularity);
28 shouldEvaluateTo('selection.anchorNode', target.firstChild);
29 shouldEvaluateTo('selection.anchorOffset', targetOffset);
30 }
31
1 function objectAsString(object, properties) { 32 function objectAsString(object, properties) {
2 var result = "["; 33 var result = "[";
3 for (var x = 0; x < properties.length; x++) { 34 for (var x = 0; x < properties.length; x++) {
4 var property = properties[x]; 35 var property = properties[x];
5 if (x != 0) 36 if (x != 0)
6 result += " "; 37 result += " ";
7 38
8 var value = object[property]; 39 var value = object[property];
9 if (value && value.nodeType) // textNode 40 if (value && value.nodeType) // textNode
10 value = value + "(" + value.nodeValue + ")"; 41 value = value + "(" + value.nodeValue + ")";
(...skipping 28 matching lines...) Expand all
39 } 70 }
40 71
41 function clickAt(x, y) { 72 function clickAt(x, y) {
42 if (window.eventSender) { 73 if (window.eventSender) {
43 eventSender.mouseMoveTo(x, y); 74 eventSender.mouseMoveTo(x, y);
44 eventSender.mouseDown(); 75 eventSender.mouseDown();
45 eventSender.mouseUp(); 76 eventSender.mouseUp();
46 return true; 77 return true;
47 } 78 }
48 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698