Source/WebCore: Web Inspector: show whitespace nodes if they are the only tag's children.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 10:16:00 +0000 (10:16 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 10:16:00 +0000 (10:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93441

Reviewed by Vsevolod Vlasov.

Pass whitespace node info into the front-end when it is the only element's child.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildArrayForContainerChildren):

LayoutTests: Web Inspector: show white space nodes if they are the only tag's children.
https://bugs.webkit.org/show_bug.cgi?id=93441

Reviewed by Vsevolod Vlasov.

* inspector/elements/set-outer-html-2-expected.txt:
* inspector/styles/styles-update-from-js.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125014 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/elements/set-outer-html-2-expected.txt
LayoutTests/inspector/styles/styles-update-from-js.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp

index ae14b41..c43d326 100644 (file)
@@ -1,3 +1,13 @@
+2012-08-08  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: show white space nodes if they are the only tag's children.
+        https://bugs.webkit.org/show_bug.cgi?id=93441
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/elements/set-outer-html-2-expected.txt:
+        * inspector/styles/styles-update-from-js.html:
+
 2012-08-08  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: cached images memory instrumentation regression after r124744
index 2ad6ce3..3219e1e 100644 (file)
@@ -29,7 +29,8 @@ Bringing things back
 Wrapper identity: identity
 Event AttrRemoved: H2
 Event AttrRemoved: H2
-Event ChildNodeCountUpdated: UL
+Event CharacterDataModified: 
+Event NodeInserted: LI
 ==========8<==========
 <div id="container" style="display:none">
 <p>WebKit is used by <a href="http://www.apple.com/safari/">Safari</a>, Dashboard, etc..</p>
index 6363dff..82a54bc 100644 (file)
@@ -87,8 +87,7 @@ function test()
 Tests that changes to an inline style from JavaScript are reflected in the Styles pane and Elements tree.
 </p>
 
-<div id="container" style="font-weight:bold">
-</div>
+<div id="container" style="font-weight:bold"></div>
 
 </body>
 </html>
index e135df2..9d66868 100644 (file)
@@ -1,3 +1,15 @@
+2012-08-08  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: show whitespace nodes if they are the only tag's children.
+        https://bugs.webkit.org/show_bug.cgi?id=93441
+
+        Reviewed by Vsevolod Vlasov.
+
+        Pass whitespace node info into the front-end when it is the only element's child.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
+
 2012-08-08  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Pass Isolate to ArrayValue and Dictionary
index 2a11659..5b21693 100644 (file)
@@ -1280,15 +1280,17 @@ PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA
 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap)
 {
     RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = TypeBuilder::Array<TypeBuilder::DOM::Node>::create();
-    Node* child = innerFirstChild(container);
-
     if (depth == 0) {
         // Special-case the only text child - pretend that container's children have been requested.
-        if (child && child->nodeType() == Node::TEXT_NODE && !innerNextSibling(child))
-            return buildArrayForContainerChildren(container, 1, nodesMap);
+        Node* firstChild = container->firstChild();
+        if (firstChild && firstChild->nodeType() == Node::TEXT_NODE && !firstChild->nextSibling()) {
+            children->addItem(buildObjectForNode(firstChild, 0, nodesMap));
+            m_childrenRequested.add(bind(container, nodesMap));
+        }
         return children.release();
     }
 
+    Node* child = innerFirstChild(container);
     depth--;
     m_childrenRequested.add(bind(container, nodesMap));