Source/WebCore: 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):

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: http://svn.webkit.org/repository/webkit/trunk@125014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ae14b41..c43d326 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -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
diff --git a/LayoutTests/inspector/elements/set-outer-html-2-expected.txt b/LayoutTests/inspector/elements/set-outer-html-2-expected.txt
index 2ad6ce3..3219e1e 100644
--- a/LayoutTests/inspector/elements/set-outer-html-2-expected.txt
+++ b/LayoutTests/inspector/elements/set-outer-html-2-expected.txt
@@ -29,7 +29,8 @@
 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>
diff --git a/LayoutTests/inspector/styles/styles-update-from-js.html b/LayoutTests/inspector/styles/styles-update-from-js.html
index 6363dff..82a54bc 100644
--- a/LayoutTests/inspector/styles/styles-update-from-js.html
+++ b/LayoutTests/inspector/styles/styles-update-from-js.html
@@ -87,8 +87,7 @@
 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>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index e135df22f..9d66868 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -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
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index 2a11659..5b21693 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1280,15 +1280,17 @@
 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));