Title: [190497] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (190496 => 190497)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2015-10-02 13:57:10 UTC (rev 190496)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2015-10-02 13:57:22 UTC (rev 190497)
@@ -1,5 +1,21 @@
 2015-10-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r188768. rdar://problem/22802019
+
+    2015-08-21  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: REGRESSION(173684): Edit as HTML not working
+            https://bugs.webkit.org/show_bug.cgi?id=148268
+
+            Reviewed by Chris Dumez.
+
+            * inspector/dom/getOuterHTML-expected.txt: Added.
+            * inspector/dom/getOuterHTML.html: Added.
+            * inspector/dom/setOuterHTML-expected.txt: Added.
+            * inspector/dom/setOuterHTML.html: Added.
+
+2015-10-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r188755. rdar://problem/22802005
 
     2015-08-21  Chris Dumez  <cdu...@apple.com>

Added: branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML-expected.txt (0 => 190497)


--- branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML-expected.txt	2015-10-02 13:57:22 UTC (rev 190497)
@@ -0,0 +1,11 @@
+Test for DOM.getOuterHTML (Copy HTML).
+
+
+== Running test suite: DOM.getOuterHTML
+-- Running test case: GetOuterHTML
+Dumping outerHTML for element div#x:
+<div id="x" style="display:none">
+    <h1>A Title</h1>
+    <p>A Paragraph</p>
+</div>
+

Added: branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML.html (0 => 190497)


--- branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/getOuterHTML.html	2015-10-02 13:57:22 UTC (rev 190497)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("DOM.getOuterHTML");
+
+    suite.addTestCase({
+        name: "GetOuterHTML",
+        description: "Get the OuterHTML of the target element.",
+        test: (resolve, reject) => {
+            WebInspector.domTreeManager.requestDocument(function(documentNode) {
+                WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+                    let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+                    InspectorTest.assert(domNode, "DOMNode exists");
+                    domNode.getOuterHTML(function(error, outerHTML) {
+                        InspectorTest.expectNoError(error);
+                        InspectorTest.log("Dumping outerHTML for element div#x:");
+                        InspectorTest.log(outerHTML);
+                        resolve();
+                    });
+                });
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Test for DOM.getOuterHTML (Copy HTML).</p>
+
+<div id="x" style="display:none">
+    <h1>A Title</h1>
+    <p>A Paragraph</p>
+</div>
+
+</body>
+</html>

Added: branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML-expected.txt (0 => 190497)


--- branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML-expected.txt	2015-10-02 13:57:22 UTC (rev 190497)
@@ -0,0 +1,35 @@
+Test for DOM.setOuterHTML (Edit as HTML).
+
+
+== Running test suite: DOM.setOuterHTML
+-- Running test case: OuterHTMLBefore
+<div id="x" style="display:none">
+    <h1>Original Title</h1>
+    <p>Original Paragraph</p>
+</div>
+
+-- Running test case: SetOuterHTMLRemovingElements
+-- Running test case: CheckOuterHTMLAfterRemovingElements
+PASS: The outerHTML should be what was just set.
+<div id="x"></div>
+
+-- Running test case: SetOuterHTMLAddingElements
+-- Running test case: CheckOuterHTMLAfterAddingElements
+PASS: The outerHTML should be what was just set.
+<div id="x" style="display:none; color:red">
+    <div class="container">
+        <h1>A Title</h1>
+        <p>A Paragraph</p>
+    </div>
+</div>
+
+-- Running test case: SetOuterHTMLModifyingElements
+-- Running test case: CheckOuterHTMLAfterModifyingElements
+PASS: The outerHTML should be what was just set.
+<div id="x" style="display:none; color:red">
+    <div class="container">
+        <h1>A Different Title</h1>
+        <p>A Paragraph</p>
+    </div>
+</div>
+

Added: branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML.html (0 => 190497)


--- branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/setOuterHTML.html	2015-10-02 13:57:22 UTC (rev 190497)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let domNode;
+    let suite = InspectorTest.createAsyncSuite("DOM.setOuterHTML");
+
+    suite.addTestCase({
+        name: "OuterHTMLBefore",
+        description: "Log the initial outerHTML of the target element.",
+        test: (resolve, reject) => {
+            domNode.getOuterHTML(function(error, outerHTML) {
+                InspectorTest.expectNoError(error);
+                InspectorTest.log(outerHTML);
+                resolve();
+            });
+        }
+    });
+
+    const emptyOuterHTML = `<div id="x"></div>`;
+
+    const newOuterHTML = `
+<div id="x" style="display:none; color:red">
+    <div class="container">
+        <h1>A Title</h1>
+        <p>A Paragraph</p>
+    </div>
+</div>`.trim();
+
+    const modifiedOuterHTML = `
+<div id="x" style="display:none; color:red">
+    <div class="container">
+        <h1>A Different Title</h1>
+        <p>A Paragraph</p>
+    </div>
+</div>`.trim();
+
+    let steps = [
+        ["RemovingElements", emptyOuterHTML],
+        ["AddingElements", newOuterHTML],
+        ["ModifyingElements", modifiedOuterHTML],
+    ];
+
+    steps.forEach(function(tuple) {
+        let [title, replacementOuterHTML] = tuple;
+        suite.addTestCase({
+            name: `SetOuterHTML${title}`,
+            description: "Change the outerHTML.",
+            test: (resolve, reject) => {
+                domNode.setOuterHTML(replacementOuterHTML, function(error, outerHTML) {
+                    InspectorTest.expectNoError(error);
+                    resolve();
+                });
+            }
+        });
+
+        suite.addTestCase({
+            name: `CheckOuterHTMLAfter${title}`,
+            description: "Log the outerHTML of the target element after changes.",
+            test: (resolve, reject) => {
+                domNode.getOuterHTML(function(error, outerHTML) {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(outerHTML === replacementOuterHTML, "The outerHTML should be what was just set.");
+                    InspectorTest.log(outerHTML);
+                    resolve();
+                });
+            }
+        });
+    });
+
+    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+        WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+            domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            InspectorTest.assert(domNode, "DOMNode exists.");
+            suite.runTestCasesAndFinish();
+        });
+    });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Test for DOM.setOuterHTML (Edit as HTML).</p>
+
+<div id="x" style="display:none">
+    <h1>Original Title</h1>
+    <p>Original Paragraph</p>
+</div>
+
+</body>
+</html>

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (190496 => 190497)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-02 13:57:10 UTC (rev 190496)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-02 13:57:22 UTC (rev 190497)
@@ -1,5 +1,27 @@
 2015-10-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r188768. rdar://problem/22802019
+
+    2015-08-21  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: REGRESSION(173684): Edit as HTML not working
+            https://bugs.webkit.org/show_bug.cgi?id=148268
+
+            Reviewed by Chris Dumez.
+
+            Tests: inspector/dom/getOuterHTML.html
+                   inspector/dom/setOuterHTML.html
+
+            * inspector/DOMPatchSupport.cpp:
+            (WebCore::DOMPatchSupport::innerPatchChildren):
+            Revert the optimization change made in r173684. The optimization changes
+            had a few issues. It changed the logic to potentially drop out of the
+            loop before all new items were processed and using a node reference
+            to track an index did not account for the modifications insertBefore
+            may have made to that node's index in the list.
+
+2015-10-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r188690. rdar://problem/22802006
 
     2015-08-20  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-601-branch/Source/WebCore/inspector/DOMPatchSupport.cpp (190496 => 190497)


--- branches/safari-601-branch/Source/WebCore/inspector/DOMPatchSupport.cpp	2015-10-02 13:57:10 UTC (rev 190496)
+++ branches/safari-601-branch/Source/WebCore/inspector/DOMPatchSupport.cpp	2015-10-02 13:57:22 UTC (rev 190497)
@@ -342,7 +342,7 @@
     }
 
     // Mark retained nodes as used, do not reuse node more than once.
-    HashSet<size_t, WTF::IntHash<size_t>, WTF::UnsignedWithZeroKeyHashTraits<size_t>>  usedOldOrdinals;
+    HashSet<size_t, WTF::IntHash<size_t>, WTF::UnsignedWithZeroKeyHashTraits<size_t>> usedOldOrdinals;
     for (size_t i = 0; i < newList.size(); ++i) {
         if (!newMap[i].first)
             continue;
@@ -374,11 +374,10 @@
     }
 
     // 3. Insert missing nodes.
-    Node* node = parentNode->firstChild();
-    for (unsigned i = 0; node && i < newMap.size(); ++i, node = node->nextSibling()) {
+    for (size_t i = 0; i < newMap.size(); ++i) {
         if (newMap[i].first || merges.contains(newList[i].get()))
             continue;
-        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), node, ec))
+        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode->traverseToChildAt(i), ec))
             return false;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to