Title: [124769] trunk/Source/WebCore
Revision
124769
Author
commit-qu...@webkit.org
Date
2012-08-06 07:14:24 -0700 (Mon, 06 Aug 2012)

Log Message

Web Inspector: a tiny refactoring of Highlighter in InspectorDOMAgent
https://bugs.webkit.org/show_bug.cgi?id=93257

Patch by Sergey Rogulenko <rogule...@google.com> on 2012-08-06
Reviewed by Pavel Feldman.

Moving error string setting inside highlightConfigFromInspectorObject.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setSearchingForNode):
(WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
(WebCore::InspectorDOMAgent::highlightNode):
* inspector/InspectorDOMAgent.h:
(InspectorDOMAgent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124768 => 124769)


--- trunk/Source/WebCore/ChangeLog	2012-08-06 14:09:59 UTC (rev 124768)
+++ trunk/Source/WebCore/ChangeLog	2012-08-06 14:14:24 UTC (rev 124769)
@@ -1,3 +1,19 @@
+2012-08-06  Sergey Rogulenko  <rogule...@google.com>
+
+        Web Inspector: a tiny refactoring of Highlighter in InspectorDOMAgent
+        https://bugs.webkit.org/show_bug.cgi?id=93257
+
+        Reviewed by Pavel Feldman.
+
+        Moving error string setting inside highlightConfigFromInspectorObject.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setSearchingForNode):
+        (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
+        (WebCore::InspectorDOMAgent::highlightNode):
+        * inspector/InspectorDOMAgent.h:
+        (InspectorDOMAgent):
+
 2012-08-03  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: add memory instrumentation for CSSValue and its descendants

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (124768 => 124769)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-08-06 14:09:59 UTC (rev 124768)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-08-06 14:14:24 UTC (rev 124769)
@@ -1005,20 +1005,20 @@
         return;
     m_searchingForNode = enabled;
     if (enabled) {
-        if (!highlightInspectorObject) {
-            *errorString = "Internal error: highlight configuration parameter is missing";
+        m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject);
+        if (!m_inspectModeHighlightConfig)
             return;
-        }
-        m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(highlightInspectorObject);
-    }
-    else {
-        ErrorString error;
-        hideHighlight(&error);
-    }
+    } else
+        hideHighlight(errorString);
 }
 
-PassOwnPtr<HighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(InspectorObject* highlightInspectorObject)
+PassOwnPtr<HighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString* errorString, InspectorObject* highlightInspectorObject)
 {
+    if (!highlightInspectorObject) {
+        *errorString = "Internal error: highlight configuration parameter is missing";
+        return nullptr;
+    }
+
     OwnPtr<HighlightConfig> highlightConfig = adoptPtr(new HighlightConfig());
     bool showInfo = false; // Default: false (do not show a tooltip).
     highlightInspectorObject->getBoolean("showInfo", &showInfo);
@@ -1049,14 +1049,15 @@
     int nodeId,
     const RefPtr<InspectorObject>& highlightInspectorObject)
 {
-    if (Node* node = nodeForId(nodeId)) {
-        if (!highlightInspectorObject) {
-            *errorString = "Internal error: highlight configuration parameter is missing";
-            return;
-        }
-        OwnPtr<HighlightConfig> highlightConfig = highlightConfigFromInspectorObject(highlightInspectorObject.get());
-        m_overlay->highlightNode(node, *highlightConfig);
-    }
+    Node* node = nodeForId(nodeId);
+    if (!node)
+        return;
+
+    OwnPtr<HighlightConfig> highlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject.get());
+    if (!highlightConfig)
+        return;
+
+    m_overlay->highlightNode(node, *highlightConfig);
 }
 
 void InspectorDOMAgent::highlightFrame(

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (124768 => 124769)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-08-06 14:09:59 UTC (rev 124768)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-08-06 14:14:24 UTC (rev 124769)
@@ -202,7 +202,7 @@
     InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InjectedScriptManager*, InspectorOverlay*);
 
     void setSearchingForNode(ErrorString*, bool enabled, InspectorObject* highlightConfig);
-    PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(InspectorObject* highlightInspectorObject);
+    PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString*, InspectorObject* highlightInspectorObject);
 
     // Node-related methods.
     typedef HashMap<RefPtr<Node>, int> NodeToIdMap;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to