Commit e6e3e565 authored by thatcher's avatar thatcher
Browse files

LayoutTests:

        Reviewed by Maciej.

        Bug 5312: comments aren't available via DOM
        http://bugzilla.opendarwin.org/show_bug.cgi?id=5312

        New tests for DOM comment nodes. Updated results to account for new
        nodes in the DOM (editing offsets changed.)

        * editing/deleting/delete-line-013-expected.txt:
        * editing/deleting/delete-line-014-expected.txt:
        * editing/inserting/insert-3907422-fix-expected.txt:
        * editing/inserting/insert-div-009-expected.txt:
        * editing/inserting/insert-div-010-expected.txt:
        * editing/selection/extend-by-character-006-expected.txt:
        * editing/selection/move-between-blocks-no-001-expected.txt:
        * editing/selection/move-between-blocks-yes-001-expected.txt:
        * fast/dom/HTMLDocument/object-by-name-or-id-expected.txt:
        * fast/dom/HTMLDocument/object-by-name-or-id.html:
        * fast/dom/comment-document-fragment-expected.txt: Added.
        * fast/dom/comment-document-fragment.html: Added.
        * fast/dom/comment-dom-node-expected.txt: Added.
        * fast/dom/comment-dom-node.html: Added.
        * fast/dom/comment-not-documentElement-expected.checksum: Added.
        * fast/dom/comment-not-documentElement-expected.png: Added.
        * fast/dom/comment-not-documentElement-expected.txt: Added.
        * fast/dom/comment-not-documentElement.html: Added.
        * fast/text/atsui-pointtooffset-calls-cg-expected.txt:
        * fast/text/atsui-rtl-override-selection-expected.txt:

WebCore:

        Reviewed by Maciej.

        Bug 5312: comments aren't available via DOM
        http://bugzilla.opendarwin.org/show_bug.cgi?id=5312

        <rdar://problem/4564414> getting comments via DOM isn't working (5312)
        <rdar://problem/4545691> DOM_COMMENT node masking out real DOM elements

        * dom/Document.cpp:
        (WebCore::Document::removedLastRef): set m_documentElement to 0
        (WebCore::Document::childrenChanged): invalidate the document element we have cached in case it was replaced
        (WebCore::Document::documentElement): cache the first element as the document node if m_documentElement is 0
        * dom/Document.h: added m_documentElement
        * html/HTMLDocument.cpp: removed documentElement(), HTML documents just use Document's documentElement()
        * html/HTMLDocument.h: ditto
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::handleError): make a new HTML node is the document's firstChild is NULL or
        the firstChild is not a HTML element (like a comment)
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::parseComment): removed the #ifdef to include comment nodes

WebKit:

        Reviewed by Maciej.

        Bug 5312: comments aren't available via DOM
        http://bugzilla.opendarwin.org/show_bug.cgi?id=5312

        Makes the Web Inspector show comment node contents.

        * WebInspector/WebInspector.m:
        (-[DOMNode _displayName]): return the contents of the comment
        * WebInspector/webInspector/inspector.js: check for comment nodes



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f3cdbab5
2006-07-08 Timothy Hatcher <timothy@apple.com>
Reviewed by Maciej.
Bug 5312: comments aren't available via DOM
http://bugzilla.opendarwin.org/show_bug.cgi?id=5312
New tests for DOM comment nodes. Updated results to account for new
nodes in the DOM (editing offsets changed.)
* editing/deleting/delete-line-013-expected.txt:
* editing/deleting/delete-line-014-expected.txt:
* editing/inserting/insert-3907422-fix-expected.txt:
* editing/inserting/insert-div-009-expected.txt:
* editing/inserting/insert-div-010-expected.txt:
* editing/selection/extend-by-character-006-expected.txt:
* editing/selection/move-between-blocks-no-001-expected.txt:
* editing/selection/move-between-blocks-yes-001-expected.txt:
* fast/dom/HTMLDocument/object-by-name-or-id-expected.txt:
* fast/dom/HTMLDocument/object-by-name-or-id.html:
* fast/dom/comment-document-fragment-expected.txt: Added.
* fast/dom/comment-document-fragment.html: Added.
* fast/dom/comment-dom-node-expected.txt: Added.
* fast/dom/comment-dom-node.html: Added.
* fast/dom/comment-not-documentElement-expected.checksum: Added.
* fast/dom/comment-not-documentElement-expected.png: Added.
* fast/dom/comment-not-documentElement-expected.txt: Added.
* fast/dom/comment-not-documentElement.html: Added.
* fast/text/atsui-pointtooffset-calls-cg-expected.txt:
* fast/text/atsui-rtl-override-selection-expected.txt:
2006-07-08 Darin Adler <darin@apple.com>
 
Reviewed by Geoff (well, half of it at least).
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 7 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
......
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 7 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
......
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
......
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
......
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
......
......@@ -17,5 +17,5 @@ layer at (0,0) size 800x600
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
selection start: position 1 of child 0 {#text} of child 1 {SPAN} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 4 of child 0 {#text} of child 1 {SPAN} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection start: position 1 of child 0 {#text} of child 1 {SPAN} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 4 of child 0 {#text} of child 1 {SPAN} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
......@@ -113,4 +113,4 @@ layer at (0,0) size 800x600
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 318x28
text run at (14,14) width 318: "that all men are created equal, ..."
caret: position 25 of child 0 {#text} of child 1 {SPAN} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
caret: position 25 of child 0 {#text} of child 1 {SPAN} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 7 of BODY > HTML > #document
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 8 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
......@@ -64,4 +64,4 @@ layer at (0,0) size 800x600
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 318x28
text run at (14,14) width 318: "that all men are created equal, ..."
caret: position 10 of child 0 {#text} of child 4 {DIV} of child 1 {BODY} of child 0 {HTML} of document
caret: position 10 of child 0 {#text} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
......@@ -6,8 +6,8 @@ By name:
no children: PASS
param: PASS
param and whitespace: PASS
param and empty comment (expected to fail): FAIL
param and non-empty comment (expected to fail): FAIL
param and empty comment: PASS
param and non-empty comment: PASS
param and text: PASS
param and img: PASS
......@@ -15,8 +15,8 @@ By id:
no children: PASS
param: PASS
param and whitespace: PASS
param and empty comment (expected to fail): FAIL
param and non-empty comment (expected to fail): FAIL
param and empty comment: PASS
param and non-empty comment: PASS
param and text: PASS
param and img: PASS
......@@ -52,16 +52,16 @@ print("By name:<br>");
testProperty("no children", "object1", true);
testProperty("param", "object2", true);
testProperty("param and whitespace", "object5", true);
testProperty("param and empty comment (expected to fail)", "object9", false);
testProperty("param and non-empty comment (expected to fail)", "object11", false);
testProperty("param and empty comment", "object9", false);
testProperty("param and non-empty comment", "object11", false);
testProperty("param and text", "object6", false);
testProperty("param and img", "object13", false);
print("<br>By id:<br>");
testProperty("no children", "object3", true);
testProperty("param", "object4", true);
testProperty("param and whitespace", "object8", true);
testProperty("param and empty comment (expected to fail)", "object10", false);
testProperty("param and non-empty comment (expected to fail)", "object12", false);
testProperty("param and empty comment", "object10", false);
testProperty("param and non-empty comment", "object12", false);
testProperty("param and text", "object7", false);
testProperty("param and img", "object14", false);
......
<!-- this comment should show up as the
first child of the HTML element in the DOM.
the document should also say "SUCESS",
if you don't see SUCESS then the DOM was
not built correctly because of this comment -->
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
SUCESS
<html>
<body>
<div id="test"><!--SUCESS--></div>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
x = document.getElementById("test").firstChild;
if (x && x.nodeType == Node.COMMENT_NODE)
document.write(x.nodeValue);
else
document.write("FAIL");
</script>
</body>
</html>
79eaf115bf9e6acb0d43779e84a37b3d
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderText {#text} at (0,0) size 60x18
text run at (0,0) width 60: "SUCESS"
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
<!-- this comment should not become the documentElement,
if it does then the page will be blank -->
<html>
<body>
<script>
if (document.documentElement.nodeType == Node.ELEMENT_NODE)
document.write("SUCESS");
else
document.write("FAIL");
</script>
</body>
</html>
......@@ -20,4 +20,4 @@ layer at (0,0) size 800x600
text run at (62,18) width 632: " by clicking the X and verifying that the correct caret position (13) is reported to the editing delegate."
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
caret: position 13 of child 1 {#text} of child 1 {BODY} of child 0 {HTML} of document
caret: position 13 of child 2 {#text} of child 1 {BODY} of child 0 {HTML} of document
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment