Title: [122977] trunk/Source/WebCore
Revision
122977
Author
[email protected]
Date
2012-07-18 08:39:19 -0700 (Wed, 18 Jul 2012)

Log Message

Web Inspector: beautify the paused in debugger message, make it configurable from the front-end.
https://bugs.webkit.org/show_bug.cgi?id=91628

Reviewed by Vsevolod Vlasov.

Made message smaller, using consistent font;
Made message configurable from the front-end.

* English.lproj/localizedStrings.js:
* inspector/DOMNodeHighlighter.cpp:
(WebCore::InspectorOverlay::InspectorOverlay):
(WebCore::InspectorOverlay::setPausedInDebuggerMessage):
(WebCore::InspectorOverlay::update):
(WebCore::InspectorOverlay::drawPausedInDebugger):
* inspector/DOMNodeHighlighter.h:
(InspectorOverlay):
* inspector/Inspector.json:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::setOverlayMessage):
(WebCore):
(WebCore::InspectorDebuggerAgent::clear):
* inspector/InspectorDebuggerAgent.h:
(InspectorDebuggerAgent):
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::setOverlayMessage):
* inspector/PageDebuggerAgent.h:
(PageDebuggerAgent):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype._setDebuggerPausedDetails):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122976 => 122977)


--- trunk/Source/WebCore/ChangeLog	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/ChangeLog	2012-07-18 15:39:19 UTC (rev 122977)
@@ -1,3 +1,35 @@
+2012-07-18  Pavel Feldman  <[email protected]>
+
+        Web Inspector: beautify the paused in debugger message, make it configurable from the front-end.
+        https://bugs.webkit.org/show_bug.cgi?id=91628
+
+        Reviewed by Vsevolod Vlasov.
+
+        Made message smaller, using consistent font;
+        Made message configurable from the front-end.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/DOMNodeHighlighter.cpp:
+        (WebCore::InspectorOverlay::InspectorOverlay):
+        (WebCore::InspectorOverlay::setPausedInDebuggerMessage):
+        (WebCore::InspectorOverlay::update):
+        (WebCore::InspectorOverlay::drawPausedInDebugger):
+        * inspector/DOMNodeHighlighter.h:
+        (InspectorOverlay):
+        * inspector/Inspector.json:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::setOverlayMessage):
+        (WebCore):
+        (WebCore::InspectorDebuggerAgent::clear):
+        * inspector/InspectorDebuggerAgent.h:
+        (InspectorDebuggerAgent):
+        * inspector/PageDebuggerAgent.cpp:
+        (WebCore::PageDebuggerAgent::setOverlayMessage):
+        * inspector/PageDebuggerAgent.h:
+        (PageDebuggerAgent):
+        * inspector/front-end/DebuggerModel.js:
+        (WebInspector.DebuggerModel.prototype._setDebuggerPausedDetails):
+
 2012-07-18  Douglas Stockwell  <[email protected]>
 
         WebCore::StylePropertySet::addParsedProperties - crash

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (122976 => 122977)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-18 15:39:19 UTC (rev 122977)
@@ -724,3 +724,4 @@
 localizedStrings["Replace"] = "Replace";
 localizedStrings["Replace All"] = "Replace All";
 localizedStrings["Previous"] = "Previous";
+localizedStrings["Paused in debugger"] = "Paused in debugger";

Modified: trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp (122976 => 122977)


--- trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2012-07-18 15:39:19 UTC (rev 122977)
@@ -489,7 +489,6 @@
 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client)
     : m_page(page)
     , m_client(client)
-    , m_pausedInDebugger(false)
 {
 }
 
@@ -522,9 +521,9 @@
         getOrDrawRectHighlight(0, m_page, m_highlightData.get(), highlight);
 }
 
-void InspectorOverlay::setPausedInDebugger(bool flag)
+void InspectorOverlay::setPausedInDebuggerMessage(const String* message)
 {
-    m_pausedInDebugger = flag;
+    m_pausedInDebuggerMessage = message ? *message : String();
     update();
 }
 
@@ -564,7 +563,7 @@
 
 void InspectorOverlay::update()
 {
-    if (m_highlightData || m_pausedInDebugger)
+    if (m_highlightData || !m_pausedInDebuggerMessage.isNull())
         m_client->highlight();
     else
         m_client->hideHighlight();
@@ -584,38 +583,34 @@
 
 void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context)
 {
-    if (!m_pausedInDebugger)
+    if (m_pausedInDebuggerMessage.isNull())
         return;
 
     DEFINE_STATIC_LOCAL(Color, backgroundColor, (0, 0, 0, 31));
     DEFINE_STATIC_LOCAL(Color, textBackgroundColor, (255, 255, 194));
     DEFINE_STATIC_LOCAL(Color, borderColor, (128, 128, 128));
-    DEFINE_STATIC_LOCAL(int, fontHeight, (24));
 
     Frame* frame = m_page->mainFrame();
     Settings* settings = frame->settings();
     IntRect visibleRect = frame->view()->visibleContentRect();
 
     context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
-    context.drawRect(visibleRect);
+    context.fillRect(visibleRect);
 
     FontDescription desc;
     setUpFontDescription(desc, settings);
-    desc.setComputedSize(fontHeight);
     Font font = Font(desc, 0, 0);
     font.update(0);
 
-    String text = "Paused in debugger.";
-    TextRun textRun(text);
-    IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeight));
+    TextRun textRun(m_pausedInDebuggerMessage);
+    IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeightPx));
     titleRect.inflate(rectInflatePx);
     titleRect.setLocation(IntPoint(visibleRect.width() / 2 - titleRect.width() / 2, 0));
 
     context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB);
     context.setStrokeColor(borderColor, ColorSpaceDeviceRGB);
     context.drawRect(titleRect);
-    context.setFillColor(Color::black, ColorSpaceDeviceRGB);
-    context.drawText(font, textRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + fontHeight));
+    drawSubstring(textRun, 0, m_pausedInDebuggerMessage.length(), Color::black, font, context, titleRect);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/DOMNodeHighlighter.h (122976 => 122977)


--- trunk/Source/WebCore/inspector/DOMNodeHighlighter.h	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/DOMNodeHighlighter.h	2012-07-18 15:39:19 UTC (rev 122977)
@@ -89,7 +89,7 @@
     void drawOutline(GraphicsContext&, const LayoutRect&, const Color&);
     void getHighlight(Highlight*) const;
 
-    void setPausedInDebugger(bool);
+    void setPausedInDebuggerMessage(const String*);
 
     void hideHighlight();
     void highlightNode(Node*);
@@ -107,7 +107,7 @@
 
     Page* m_page;
     InspectorClient* m_client;
-    bool m_pausedInDebugger;
+    String m_pausedInDebuggerMessage;
     OwnPtr<HighlightData> m_highlightData;
 };
 

Modified: trunk/Source/WebCore/inspector/Inspector.json (122976 => 122977)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-07-18 15:39:19 UTC (rev 122977)
@@ -2630,6 +2630,14 @@
                     { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the script run." }
                 ],
                 "description": "Runs script with given id in a given context."
+            },
+            {
+                "name": "setOverlayMessage",
+                "parameters": [
+                    { "name": "message", "type": "string", "optional": true, "description": "Overlay message to display when paused in debugger." }
+                ],
+                "hidden": true,
+                "description": "Sets overlay message."
             }
         ],
         "events": [

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (122976 => 122977)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2012-07-18 15:39:19 UTC (rev 122977)
@@ -570,6 +570,10 @@
     }
 }
 
+void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*)
+{
+}
+
 PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::currentCallFrames()
 {
     if (!m_pausedScriptState)
@@ -690,6 +694,8 @@
     m_continueToLocationBreakpointId = String();
     clearBreakDetails();
     m_javaScriptPauseScheduled = false;
+    ErrorString error;
+    setOverlayMessage(&error, 0);
 }
 
 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString)

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (122976 => 122977)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2012-07-18 15:39:19 UTC (rev 122977)
@@ -112,6 +112,7 @@
                              TypeBuilder::OptOutput<bool>* wasThrown);
     void compileScript(ErrorString*, const String& _expression_, const String& sourceURL, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*, TypeBuilder::OptOutput<String>* syntaxErrorMessage);
     void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown);
+    virtual void setOverlayMessage(ErrorString*, const String*);
 
     class Listener {
     public:

Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp (122976 => 122977)


--- trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp	2012-07-18 15:39:19 UTC (rev 122977)
@@ -94,24 +94,11 @@
     return injectedScript;
 }
 
-void PageDebuggerAgent::disable()
+void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message)
 {
-    InspectorDebuggerAgent::disable();
-    m_overlay->setPausedInDebugger(false);
+    m_overlay->setPausedInDebuggerMessage(message);
 }
 
-void PageDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception)
-{
-    InspectorDebuggerAgent::didPause(scriptState, callFrames, exception);
-    m_overlay->setPausedInDebugger(true);
-}
-
-void PageDebuggerAgent::didContinue()
-{
-    InspectorDebuggerAgent::didContinue();
-    m_overlay->setPausedInDebugger(false);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(_javascript__DEBUGGER) && ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.h (122976 => 122977)


--- trunk/Source/WebCore/inspector/PageDebuggerAgent.h	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.h	2012-07-18 15:39:19 UTC (rev 122977)
@@ -56,11 +56,8 @@
     virtual void unmuteConsole();
 
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
+    virtual void setOverlayMessage(ErrorString*, const String*);
 
-    virtual void disable();
-    virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception);
-    virtual void didContinue();
-
     PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*);
     Page* const m_inspectedPage;
     InspectorOverlay* m_overlay;

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (122976 => 122977)


--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2012-07-18 15:15:22 UTC (rev 122976)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2012-07-18 15:39:19 UTC (rev 122977)
@@ -298,10 +298,13 @@
         this._debuggerPausedDetails = debuggerPausedDetails;
         if (this._debuggerPausedDetails)
             this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPausedDetails);
-        if (debuggerPausedDetails)
+        if (debuggerPausedDetails) {
             this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);
-        else
+            DebuggerAgent.setOverlayMessage(WebInspector.UIString("Paused in debugger"));
+        } else {
             this.setSelectedCallFrame(null);
+            DebuggerAgent.setOverlayMessage();
+        }
     },
 
     /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to