Changeset 63781 in webkit
- Timestamp:
- Jul 20, 2010 3:39:24 PM (14 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r63780 r63781 1 2010-07-20 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 make dump-as-markup work better on subframes and allow dumping a subtree 6 https://bugs.webkit.org/show_bug.cgi?id=42673 7 8 * editing/selection/dump-as-markup-expected.txt: 9 * editing/selection/dump-as-markup.html: 10 * resources/dump-as-markup.js: 11 (Markup.description): 12 (Markup._getSelectionFromNode): 13 (Markup._getMarkupForTextNode): 14 (Markup._getSelectionMarker): 15 1 16 2010-07-20 Daniel Erat <derat@chromium.org> 2 17 -
trunk/LayoutTests/editing/selection/dump-as-markup-expected.txt
r58335 r63781 1 Tests basic dump-as-markup functionality. 1 2 2 3 <HTML> … … 54 55 </#text> 55 56 <SCRIPT> 57 Markup.description("Tests basic dump-as-markup functionality."); 56 58 window.getSelection().selectAllChildren(bar) 57 59 </SCRIPT> … … 62 64 63 65 FRAME 0: 64 FIXME: Add method to layout test controller to get access to cross-origin frames. 66 67 <HTML> 68 <HEAD> 69 <#text> 70 </#text> 71 <TITLE> 72 <#text>Test</#text> 73 </TITLE> 74 <#text> 75 </#text> 76 <STYLE type="text/css"> 77 </STYLE> 78 <#text> 79 </#text> 80 </HEAD> 81 <#text> 82 </#text> 83 <BODY> 84 <#text> 85 </#text> 86 <P> 87 </P> 88 <#text> 89 90 91 </#text> 92 </BODY> 93 </HTML> -
trunk/LayoutTests/editing/selection/dump-as-markup.html
r58331 r63781 12 12 13 13 <script> 14 Markup.description("Tests basic dump-as-markup functionality."); 14 15 window.getSelection().selectAllChildren(bar) 15 16 </script> -
trunk/LayoutTests/resources/dump-as-markup.js
r58331 r63781 7 7 var Markup = {}; 8 8 9 /** 10 * Dumps the markup for the given node (HTML element if no node is given). 11 * Over-writes the body's content with the markup in layout test mode. Appends 12 * a pre element when loaded manually, in order to aid debugging. 13 */ 9 // The description of what this test is testing. Gets prepended to the dumped markup. 10 Markup.description = function(description) 11 { 12 Markup._description = description; 13 } 14 15 // Dumps the markup for the given node (HTML element if no node is given). 16 // Over-writes the body's content with the markup in layout test mode. Appends 17 // a pre element when loaded manually, in order to aid debugging. 14 18 Markup.dump = function(opt_node) 15 19 { … … 18 22 opt_node = undefined; 19 23 20 var markup = Markup.get(opt_node); 24 var node = opt_node || document.body.parentElement 25 26 var markup = Markup._description ? Markup._description + '\n' : ""; 27 markup += Markup.get(node); 28 21 29 var container; 22 30 if (window.layoutTestController) … … 32 40 33 41 // FIXME: Have this respect layoutTestController.dumpChildFramesAsText? 34 for (var i = 0; i < window.frames.length; i++) { 42 // FIXME: Should we care about framesets? 43 var iframes = node.getElementsByTagName('iframe'); 44 for (var i = 0; i < iframes.length; i++) { 35 45 markup += '\n\nFRAME ' + i + ':\n' 36 46 try { 37 markup += Markup.get( window.frames[i].contentDocument.body.parentElement);47 markup += Markup.get(iframes[i].contentDocument.body.parentElement); 38 48 } catch (e) { 39 49 markup += 'FIXME: Add method to layout test controller to get access to cross-origin frames.'; … … 57 67 } 58 68 59 /** 60 * Returns the markup for the given node. To be used for cases where a test needs 61 * to get the markup but not clobber the whole page. 62 */ 63 Markup.get = function(opt_node, opt_depth) 64 { 65 var node = opt_node || document.body.parentElement 69 // Returns the markup for the given node. To be used for cases where a test needs 70 // to get the markup but not clobber the whole page. 71 Markup.get = function(node, opt_depth) 72 { 66 73 var depth = opt_depth || 0; 67 74 … … 152 159 } 153 160 161 Markup._getSelectionFromNode = function(node) 162 { 163 return node.ownerDocument.defaultView.getSelection(); 164 } 165 154 166 Markup._getMarkupForTextNode = function(node) 155 167 { … … 157 169 var startOffset, endOffset, startText, endText; 158 170 159 var sel = window.getSelection();171 var sel = Markup._getSelectionFromNode(node); 160 172 if (node == sel.anchorNode && node == sel.focusNode) { 161 173 if (sel.isCollapsed) { … … 193 205 Markup._getSelectionMarker = function(node, index) 194 206 { 195 var sel = window.getSelection();207 var sel = Markup._getSelectionFromNode(node);; 196 208 if (index == sel.anchorOffset && node == sel.anchorNode) { 197 209 if (sel.isCollapsed)
Note: See TracChangeset
for help on using the changeset viewer.