Title: [126857] trunk/Source/WebCore
Revision
126857
Author
[email protected]
Date
2012-08-28 01:52:26 -0700 (Tue, 28 Aug 2012)

Log Message

Web Inspector: introduce overlay page and migrate "paused in debugger" to it.
https://bugs.webkit.org/show_bug.cgi?id=95080

Reviewed by Yury Semikhatsky.

Separate page instance is now used to render overlay. Paused in debugger is migrated to the new overlay.

* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::~InspectorOverlay):
(WebCore):
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::drawOutline):
(WebCore::InspectorOverlay::setPausedInDebuggerMessage):
(WebCore::InspectorOverlay::drawNodeHighlight):
(WebCore::InspectorOverlay::drawRectHighlight):
(WebCore::InspectorOverlay::drawOverlayPage):
(WebCore::InspectorOverlay::overlayPage):
(WebCore::InspectorOverlay::evaluateInOverlay):
* inspector/InspectorOverlay.h:
(InspectorOverlay):
* inspector/InspectorOverlayPage.html: Added.
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::didPaint):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (126856 => 126857)


--- trunk/Source/WebCore/CMakeLists.txt	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-08-28 08:52:26 UTC (rev 126857)
@@ -2764,6 +2764,15 @@
 LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendDispatcher.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorFrontend.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorTypeBuilder.cpp)
 
 
+# Generate InspectorOverlayPage.h
+ADD_CUSTOM_COMMAND(
+    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h
+    MAIN_DEPENDENCY inspector/InspectorOverlayPage.html
+    COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl InspectorOverlayPage_html ${WEBCORE_DIR}/inspector/InspectorOverlayPage.html ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h
+    VERBATIM)
+LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h)
+
+
 # Generate InjectedScriptSource.h
 ADD_CUSTOM_COMMAND(
     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedScriptSource.h

Modified: trunk/Source/WebCore/ChangeLog (126856 => 126857)


--- trunk/Source/WebCore/ChangeLog	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/ChangeLog	2012-08-28 08:52:26 UTC (rev 126857)
@@ -1,3 +1,36 @@
+2012-08-28  Pavel Feldman  <[email protected]>
+
+        Web Inspector: introduce overlay page and migrate "paused in debugger" to it.
+        https://bugs.webkit.org/show_bug.cgi?id=95080
+
+        Reviewed by Yury Semikhatsky.
+
+        Separate page instance is now used to render overlay. Paused in debugger is migrated to the new overlay.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::~InspectorOverlay):
+        (WebCore):
+        (WebCore::InspectorOverlay::paint):
+        (WebCore::InspectorOverlay::drawOutline):
+        (WebCore::InspectorOverlay::setPausedInDebuggerMessage):
+        (WebCore::InspectorOverlay::drawNodeHighlight):
+        (WebCore::InspectorOverlay::drawRectHighlight):
+        (WebCore::InspectorOverlay::drawOverlayPage):
+        (WebCore::InspectorOverlay::overlayPage):
+        (WebCore::InspectorOverlay::evaluateInOverlay):
+        * inspector/InspectorOverlay.h:
+        (InspectorOverlay):
+        * inspector/InspectorOverlayPage.html: Added.
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::didPaint):
+
 2012-08-28  Andrey Adaikin  <[email protected]>
 
         Web Inspector: [WebGL] Simple experimental frontend implementation

Modified: trunk/Source/WebCore/DerivedSources.make (126856 => 126857)


--- trunk/Source/WebCore/DerivedSources.make	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/DerivedSources.make	2012-08-28 08:52:26 UTC (rev 126857)
@@ -1030,6 +1030,11 @@
 InspectorFrontend.h : Inspector.json $(INSPECTOR_GENERATOR_SCRIPTS)
 	python $(WebCore)/inspector/CodeGeneratorInspector.py $(WebCore)/inspector/Inspector.json --output_h_dir . --output_cpp_dir .
 
+all : InspectorOverlayPage.h
+
+InspectorOverlayPage.h : InspectorOverlayPage.html
+	perl $(WebCore)/inspector/xxd.pl InspectorOverlayPage_html $(WebCore)/inspector/InspectorOverlayPage.html InspectorOverlayPage.h
+
 all : InjectedScriptSource.h
 
 InjectedScriptSource.h : InjectedScriptSource.js

Modified: trunk/Source/WebCore/DerivedSources.pri (126856 => 126857)


--- trunk/Source/WebCore/DerivedSources.pri	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/DerivedSources.pri	2012-08-28 08:52:26 UTC (rev 126857)
@@ -57,6 +57,8 @@
 
 INSPECTOR_BACKEND_COMMANDS_QRC = $$PWD/inspector/front-end/InspectorBackendCommands.qrc
 
+INSPECTOR_OVERLAY_PAGE = $$PWD/inspector/InspectorOverlayPage.html
+
 INJECTED_SCRIPT_SOURCE = $$PWD/inspector/InjectedScriptSource.js
 
 INJECTED_SCRIPT_WEBGL_MODULE_SOURCE = $$PWD/inspector/InjectedScriptWebGLModuleSource.js
@@ -783,6 +785,12 @@
 inspectorBackendCommands.add_output_to_sources = false
 GENERATORS += inspectorBackendCommands
 
+inspectorOverlayPage.output = InspectorOverlayPage.h
+inspectorOverlayPage.input = INSPECTOR_OVERLAY_PAGE
+inspectorOverlayPage.commands = perl $$PWD/inspector/xxd.pl InspectorOverlayPage_html ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+injectedScriptSource.add_output_to_sources = false
+GENERATORS += inspectorOverlayPage
+
 # GENERATOR 2-a: inspector injected script source compiler
 injectedScriptSource.output = InjectedScriptSource.h
 injectedScriptSource.input = INJECTED_SCRIPT_SOURCE

Modified: trunk/Source/WebCore/GNUmakefile.am (126856 => 126857)


--- trunk/Source/WebCore/GNUmakefile.am	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/GNUmakefile.am	2012-08-28 08:52:26 UTC (rev 126857)
@@ -918,6 +918,8 @@
 DerivedSources/WebCore/InspectorFrontend.cpp: DerivedSources/WebCore/InspectorBackendCommands.js
 DerivedSources/WebCore/InspectorBackendCommands.js: DerivedSources/WebCore/InspectorBackendDispatcher.h
 DerivedSources/WebCore/InspectorBackendDispatcher.h: DerivedSources/WebCore/InspectorBackendDispatcher.cpp
+DerivedSources/WebCore/InspectorOverlayPage.h: $(WebCore)/inspector/InspectorOverlayPage.html
+	$(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InspectorOverlayPage_html $(WebCore)/inspector/InspectorOverlayPage.html $(GENSOURCES_WEBCORE)/InspectorOverlayPage.h
 DerivedSources/WebCore/InjectedScriptSource.h: $(WebCore)/inspector/InjectedScriptSource.js
 	$(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js $(GENSOURCES_WEBCORE)/InjectedScriptSource.h
 DerivedSources/WebCore/InjectedScriptWebGLModuleSource.h: $(WebCore)/inspector/InjectedScriptWebGLModuleSource.js
@@ -1194,6 +1196,7 @@
 	Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js \
 	Source/WebCore/inspector/Inspector.json \
 	Source/WebCore/inspector/Inspector-1.0.json \
+	Source/WebCore/inspector/InspectorOverlayPage.html \
 	Source/WebCore/inspector/generate-inspector-protocol-version \
 	Source/WebCore/inspector/xxd.pl \
 	Source/WebCore/LICENSE-APPLE \

Modified: trunk/Source/WebCore/GNUmakefile.list.am (126856 => 126857)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-08-28 08:52:26 UTC (rev 126857)
@@ -25,6 +25,7 @@
 	DerivedSources/WebCore/InspectorBackendDispatcher.h \
 	DerivedSources/WebCore/InspectorFrontend.cpp \
 	DerivedSources/WebCore/InspectorFrontend.h \
+	DerivedSources/WebCore/InspectorOverlayPage.h \
 	DerivedSources/WebCore/InspectorTypeBuilder.cpp \
 	DerivedSources/WebCore/InspectorTypeBuilder.h \
 	DerivedSources/WebCore/InspectorProtocolVersion.h \

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (126856 => 126857)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-08-28 08:52:26 UTC (rev 126857)
@@ -439,6 +439,30 @@
       ]
     },
     {
+      'target_name': 'inspector_overlay_page',
+      'type': 'none',
+      'actions': [
+        {
+          'action_name': 'generateInspectorOverlayPage',
+          'inputs': [
+            '../inspector/InspectorOverlayPage.html',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorOverlayPage.h',
+          ],
+          'msvs_cygwin_shell': 0,
+          'action': [
+            '<(perl_exe)',
+            '../inspector/xxd.pl',
+            'InspectorOverlayPage_html',
+            '<@(_inputs)',
+            '<@(_outputs)'
+          ],
+          'message': 'Generating InspectorOverlayPage.h from InspectorOverlayPage.html',
+        },
+      ]
+    },
+    {
       'target_name': 'injected_script_source',
       'type': 'none',
       'actions': [
@@ -1176,6 +1200,7 @@
       'hard_dependency': 1,
       'dependencies': [
         'webcore_bindings_sources',
+        'inspector_overlay_page',
         'inspector_protocol_sources',
         'injected_script_source',
         'injected_webgl_script_source',
@@ -1306,6 +1331,7 @@
         'debugger_script_source',
         'injected_script_source',
         'injected_webgl_script_source',
+        'inspector_overlay_page',
         'inspector_protocol_sources',
         'webcore_bindings_sources',
         '../../ThirdParty/glu/glu.gyp:libtess',

Modified: trunk/Source/WebCore/WebCore.gypi (126856 => 126857)


--- trunk/Source/WebCore/WebCore.gypi	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/WebCore.gypi	2012-08-28 08:52:26 UTC (rev 126857)
@@ -7226,6 +7226,7 @@
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorBackendCommands.js',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorFrontend.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorFrontend.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorOverlayPage.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorTypeBuilder.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorTypeBuilder.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorProtocolVersion.h',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (126856 => 126857)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-08-28 08:52:26 UTC (rev 126857)
@@ -614,6 +614,10 @@
 				>
 			</File>
 			<File
+				RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InspectorOverlayPage.h"
+				>
+			</File>
+			<File
 				RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InspectorTypeBuilder.cpp"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (126856 => 126857)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-08-28 08:52:26 UTC (rev 126857)
@@ -9135,6 +9135,7 @@
 		7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = InjectedScriptSource.js; sourceTree = "<group>"; };
 		7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; };
 		7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroupLoadDeferrer.h; sourceTree = "<group>"; };
+		7A7256B915EB9F5B007323A7 /* InspectorOverlayPage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = InspectorOverlayPage.html; sourceTree = "<group>"; };
 		7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; };
 		7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageAgent.h; sourceTree = "<group>"; };
 		7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; };
@@ -14671,6 +14672,7 @@
 				7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */,
 				7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */,
 				7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */,
+				7A7256B915EB9F5B007323A7 /* InspectorOverlayPage.html */,
 				4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */,
 				4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */,
 				9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */,

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (126856 => 126857)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2012-08-28 08:52:26 UTC (rev 126857)
@@ -32,7 +32,9 @@
 
 #include "InspectorOverlay.h"
 
+#include "DocumentLoader.h"
 #include "Element.h"
+#include "EmptyClients.h"
 #include "Font.h"
 #include "FontCache.h"
 #include "FontFamily.h"
@@ -41,12 +43,16 @@
 #include "GraphicsContext.h"
 #include "GraphicsTypes.h"
 #include "InspectorClient.h"
+#include "InspectorOverlayPage.h"
+#include "InspectorValues.h"
 #include "Node.h"
 #include "Page.h"
 #include "Range.h"
 #include "RenderBoxModelObject.h"
 #include "RenderInline.h"
 #include "RenderObject.h"
+#include "ScriptSourceCode.h"
+#include "ScriptValue.h"
 #include "Settings.h"
 #include "StyledElement.h"
 #include "TextRun.h"
@@ -81,7 +87,7 @@
     return quadPath;
 }
 
-void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor, const Color& outlineColor)
+void drawOutlinedQuad(GraphicsContext* context, const FloatQuad& quad, const Color& fillColor, const Color& outlineColor)
 {
     static const int outlineThickness = 2;
 
@@ -90,31 +96,31 @@
     // Clip out the quad, then draw with a 2px stroke to get a pixel
     // of outline (because inflating a quad is hard)
     {
-        context.save();
-        context.clipOut(quadPath);
+        context->save();
+        context->clipOut(quadPath);
 
-        context.setStrokeThickness(outlineThickness);
-        context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
-        context.strokePath(quadPath);
+        context->setStrokeThickness(outlineThickness);
+        context->setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
+        context->strokePath(quadPath);
 
-        context.restore();
+        context->restore();
     }
 
     // Now do the fill
-    context.setFillColor(fillColor, ColorSpaceDeviceRGB);
-    context.fillPath(quadPath);
+    context->setFillColor(fillColor, ColorSpaceDeviceRGB);
+    context->fillPath(quadPath);
 }
 
-void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
+void drawOutlinedQuadWithClip(GraphicsContext* context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
 {
-    context.save();
+    context->save();
     Path clipQuadPath = quadToPath(clipQuad);
-    context.clipOut(clipQuadPath);
+    context->clipOut(clipQuadPath);
     drawOutlinedQuad(context, quad, fillColor, Color::transparent);
-    context.restore();
+    context->restore();
 }
 
-void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad, const HighlightConfig& highlightConfig)
+void drawHighlightForBox(GraphicsContext* context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad, const HighlightConfig& highlightConfig)
 {
     bool hasMargin = highlightConfig.margin != Color::transparent;
     bool hasBorder = highlightConfig.border != Color::transparent;
@@ -139,16 +145,16 @@
         drawOutlinedQuad(context, contentQuad, highlightConfig.content, highlightConfig.contentOutline);
 }
 
-void drawHighlightForSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& absoluteQuads, const HighlightConfig& highlightConfig)
+void drawHighlightForSVGRenderer(GraphicsContext* context, const Vector<FloatQuad>& absoluteQuads, const HighlightConfig& highlightConfig)
 {
     for (size_t i = 0; i < absoluteQuads.size(); ++i)
         drawOutlinedQuad(context, absoluteQuads[i], highlightConfig.content, Color::transparent);
 }
 
-int drawSubstring(const TextRun& globalTextRun, int offset, int length, const Color& textColor, const Font& font, GraphicsContext& context, const LayoutRect& titleRect)
+int drawSubstring(const TextRun& globalTextRun, int offset, int length, const Color& textColor, const Font& font, GraphicsContext* context, const LayoutRect& titleRect)
 {
-    context.setFillColor(textColor, ColorSpaceDeviceRGB);
-    context.drawText(font, globalTextRun, IntPoint(titleRect.pixelSnappedX() + rectInflatePx, titleRect.pixelSnappedY() + font.fontMetrics().height()), offset, offset + length);
+    context->setFillColor(textColor, ColorSpaceDeviceRGB);
+    context->drawText(font, globalTextRun, IntPoint(titleRect.pixelSnappedX() + rectInflatePx, titleRect.pixelSnappedY() + font.fontMetrics().height()), offset, offset + length);
     return offset + length;
 }
 
@@ -218,7 +224,7 @@
     }
 }
 
-void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
+void drawElementTitle(GraphicsContext* context, Node* node, RenderObject* renderer, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
 {
     DEFINE_STATIC_LOCAL(Color, backgroundColor, (255, 255, 194));
     DEFINE_STATIC_LOCAL(Color, tagColor, (136, 18, 128)); // Same as .webkit-html-tag.
@@ -333,14 +339,14 @@
         for (int i = 1; i < 8; ++i)
             path.addLineTo(points[i]);
 
-        context.save();
-        context.translate(0.5f, 0.5f);
-        context.setStrokeColor(pxAndBorderColor, ColorSpaceDeviceRGB);
-        context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
-        context.setStrokeThickness(borderWidthPx);
-        context.fillPath(path);
-        context.strokePath(path);
-        context.restore();
+        context->save();
+        context->translate(0.5f, 0.5f);
+        context->setStrokeColor(pxAndBorderColor, ColorSpaceDeviceRGB);
+        context->setFillColor(backgroundColor, ColorSpaceDeviceRGB);
+        context->setStrokeThickness(borderWidthPx);
+        context->fillPath(path);
+        context->strokePath(path);
+        context->restore();
     }
 
     int currentPos = 0;
@@ -397,7 +403,7 @@
             contentsQuadToPage(mainView, containingView, highlight->quads[i]);
 
         if (context)
-            drawHighlightForSVGRenderer(*context, highlight->quads, highlightConfig);
+            drawHighlightForSVGRenderer(context, highlight->quads, highlightConfig);
     } else if (renderer->isBox() || renderer->isRenderInline()) {
         LayoutRect contentBox;
         LayoutRect paddingBox;
@@ -451,7 +457,7 @@
         highlight->quads.append(absContentQuad);
 
         if (context)
-            drawHighlightForBox(*context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad, highlightConfig);
+            drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad, highlightConfig);
     }
 
     // Draw node title if necessary.
@@ -460,7 +466,7 @@
         return;
 
     if (context && highlightConfig.showInfo)
-        drawElementTitle(*context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings());
+        drawElementTitle(context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings());
 }
 
 static void getOrDrawRectHighlight(GraphicsContext* context, Page* page, IntRect* rect, const HighlightConfig& highlightConfig, Highlight *highlight)
@@ -480,7 +486,7 @@
             context->translate(-visibleRect.x(), -visibleRect.y());
         }
 
-        drawOutlinedQuad(*context, highlightRect, highlightConfig.content, highlightConfig.contentOutline);
+        drawOutlinedQuad(context, highlightRect, highlightConfig.content, highlightConfig.contentOutline);
     }
 }
 
@@ -492,14 +498,21 @@
 {
 }
 
+InspectorOverlay::~InspectorOverlay()
+{
+}
+
 void InspectorOverlay::paint(GraphicsContext& context)
 {
-    drawPausedInDebugger(context);
-    drawNodeHighlight(context);
-    drawRectHighlight(context);
+    drawNodeHighlight(&context);
+    drawRectHighlight(&context);
+
+    if (m_pausedInDebuggerMessage.isNull())
+        return;
+    drawOverlayPage(&context);
 }
 
-void InspectorOverlay::drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color)
+void InspectorOverlay::drawOutline(GraphicsContext* context, const LayoutRect& rect, const Color& color)
 {
     FloatRect outlineRect = rect;
     drawOutlinedQuad(context, outlineRect, Color(), color);
@@ -523,6 +536,7 @@
 void InspectorOverlay::setPausedInDebuggerMessage(const String* message)
 {
     m_pausedInDebuggerMessage = message ? *message : String();
+    evaluateInOverlay("setPausedInDebuggerMessage", m_pausedInDebuggerMessage);
     update();
 }
 
@@ -554,62 +568,102 @@
 
 void InspectorOverlay::update()
 {
-    if (m_highlightNode || m_highlightRect || !m_pausedInDebuggerMessage.isNull())
-        m_client->highlight();
-    else
+    if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull()) {
         m_client->hideHighlight();
+        return;
+    }
+
+    FrameView* view = m_page->mainFrame()->view();
+    FrameView* overlayView = overlayPage()->mainFrame()->view();
+    IntRect visibleRect = enclosingIntRect(view->visibleContentRect());
+    overlayView->resize(visibleRect.width(), visibleRect.height());
+    if (overlayView->needsLayout())
+        overlayView->layout();
+    m_client->highlight();
 }
 
-void InspectorOverlay::drawNodeHighlight(GraphicsContext& context)
+void InspectorOverlay::drawNodeHighlight(GraphicsContext* context)
 {
     if (!m_highlightNode)
         return;
 
     Highlight highlight;
-    getOrDrawNodeHighlight(&context, m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
+    getOrDrawNodeHighlight(context, m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
 }
 
-void InspectorOverlay::drawRectHighlight(GraphicsContext& context)
+void InspectorOverlay::drawRectHighlight(GraphicsContext* context)
 {
     if (!m_highlightRect)
         return;
 
     Highlight highlight;
-    getOrDrawRectHighlight(&context, m_page, m_highlightRect.get(), m_rectHighlightConfig, &highlight);
+    getOrDrawRectHighlight(context, m_page, m_highlightRect.get(), m_rectHighlightConfig, &highlight);
 }
 
-void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context)
+void InspectorOverlay::drawOverlayPage(GraphicsContext* context)
 {
-    if (m_pausedInDebuggerMessage.isNull())
-        return;
+    GraphicsContextStateSaver stateSaver(*context);
+    FrameView* view = overlayPage()->mainFrame()->view();
+    view->paint(context, IntRect(0, 0, view->width(), view->height()));
+}
 
-    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));
+Page* InspectorOverlay::overlayPage()
+{
+    if (m_overlayPage)
+        return m_overlayPage.get();
 
-    Frame* frame = m_page->mainFrame();
-    Settings* settings = frame->settings();
-    IntRect visibleRect = IntRect(IntPoint(), frame->view()->visibleSize());
+    static FrameLoaderClient* dummyFrameLoaderClient =  new EmptyFrameLoaderClient;
+    Page::PageClients pageClients;
+    fillWithEmptyClients(pageClients);
+    m_overlayPage = adoptPtr(new Page(pageClients));
 
-    context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
-    context.fillRect(visibleRect);
+    Settings* settings = m_page->settings();
+    Settings* overlaySettings = m_overlayPage->settings();
 
-    FontDescription desc;
-    setUpFontDescription(desc, settings);
-    Font font = Font(desc, 0, 0);
-    font.update(0);
+    overlaySettings->setStandardFontFamily(settings->standardFontFamily());
+#if OS(WINDOWS)
+    overlaySettings->setFixedFontFamily("Consolas");
+#elif OS(MAC_OS_X)
+    overlaySettings->setFixedFontFamily("Menlo");
+#elif OS(UNIX)
+    overlaySettings->setFixedFontFamily("dejavu sans mono");
+#endif
+    overlaySettings->setSerifFontFamily(settings->serifFontFamily());
+    overlaySettings->setSansSerifFontFamily(settings->sansSerifFontFamily());
+    overlaySettings->setCursiveFontFamily(settings->cursiveFontFamily());
+    overlaySettings->setFantasyFontFamily(settings->fantasyFontFamily());
+    overlaySettings->setPictographFontFamily(settings->pictographFontFamily());
+    overlaySettings->setMinimumFontSize(settings->minimumFontSize());
+    overlaySettings->setMinimumLogicalFontSize(settings->minimumLogicalFontSize());
+    overlaySettings->setDefaultFontSize(settings->defaultFontSize());
+    overlaySettings->setDefaultFixedFontSize(settings->defaultFixedFontSize());
+    overlaySettings->setMediaEnabled(false);
+    overlaySettings->setScriptEnabled(true);
+    overlaySettings->setPluginsEnabled(false);
 
-    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));
+    RefPtr<Frame> frame = Frame::create(m_overlayPage.get(), 0, dummyFrameLoaderClient);
+    frame->setView(FrameView::create(frame.get()));
+    frame->init();
+    FrameLoader* loader = frame->loader();
+    frame->view()->setCanHaveScrollbars(false);
+    frame->view()->setTransparent(true);
+    ASSERT(loader->activeDocumentLoader());
+    loader->activeDocumentLoader()->writer()->setMIMEType("text/html");
+    loader->activeDocumentLoader()->writer()->begin();
+    loader->activeDocumentLoader()->writer()->addData(reinterpret_cast<const char*>(InspectorOverlayPage_html), sizeof(InspectorOverlayPage_html));
+    loader->activeDocumentLoader()->writer()->end();
 
-    context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB);
-    context.setStrokeColor(borderColor, ColorSpaceDeviceRGB);
-    context.drawRect(titleRect);
-    drawSubstring(textRun, 0, m_pausedInDebuggerMessage.length(), Color::black, font, context, titleRect);
+    return m_overlayPage.get();
 }
 
+void InspectorOverlay::evaluateInOverlay(const String& method, const String& argument)
+{
+    RefPtr<InspectorArray> command = InspectorArray::create();
+    command->pushString(method);
+    command->pushString(argument);
+    overlayPage()->mainFrame()->script()->evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.h (126856 => 126857)


--- trunk/Source/WebCore/inspector/InspectorOverlay.h	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.h	2012-08-28 08:52:26 UTC (rev 126857)
@@ -88,9 +88,10 @@
     {
         return adoptPtr(new InspectorOverlay(page, client));
     }
+    ~InspectorOverlay();
 
     void paint(GraphicsContext&);
-    void drawOutline(GraphicsContext&, const LayoutRect&, const Color&);
+    void drawOutline(GraphicsContext*, const LayoutRect&, const Color&);
     void getHighlight(Highlight*) const;
 
     void setPausedInDebuggerMessage(const String*);
@@ -105,9 +106,11 @@
     InspectorOverlay(Page*, InspectorClient*);
 
     void update();
-    void drawNodeHighlight(GraphicsContext&);
-    void drawRectHighlight(GraphicsContext&);
-    void drawPausedInDebugger(GraphicsContext&);
+    void drawNodeHighlight(GraphicsContext*);
+    void drawRectHighlight(GraphicsContext*);
+    void drawOverlayPage(GraphicsContext*);
+    Page* overlayPage();
+    void evaluateInOverlay(const String& method, const String& argument);
 
     Page* m_page;
     InspectorClient* m_client;
@@ -115,6 +118,7 @@
     RefPtr<Node> m_highlightNode;
     HighlightConfig m_nodeHighlightConfig;
     OwnPtr<IntRect> m_highlightRect;
+    OwnPtr<Page> m_overlayPage;
     HighlightConfig m_rectHighlightConfig;
 };
 

Added: trunk/Source/WebCore/inspector/InspectorOverlayPage.html (0 => 126857)


--- trunk/Source/WebCore/inspector/InspectorOverlayPage.html	                        (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorOverlayPage.html	2012-08-28 08:52:26 UTC (rev 126857)
@@ -0,0 +1,87 @@
+<!--
+ Copyright (C) 2012 Google Inc. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1.  Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+ 2.  Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+ 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    margin: 0;
+    padding: 0;
+}
+
+.fill {
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+}
+
+.dimmed {
+    background-color: rgba(0, 0, 0, 0.31);
+}
+
+.message-line {
+    text-align: center;
+}
+
+.message-box {
+    font-family: monospace;
+    background-color: rgb(255, 255, 194);
+    border: 1px solid rgb(128, 128, 128);
+    display: inline-block;
+    margin: 10px 0;
+    padding: 2px 4px;
+}
+
+</style>
+<script>
+function setPausedInDebuggerMessage(message)
+{
+    var pausedInDebugger = document.getElementById("paused-in-debugger");
+    if (message) {
+        pausedInDebugger.textContent = message;
+        pausedInDebugger.style.visibility = "visible";
+        document.body.classList.add("dimmed");
+    } else {
+        pausedInDebugger.style.visibility = "hidden";
+        document.body.classList.remove("dimmed");
+    }
+}
+
+function dispatch(message)
+{
+    var functionName = message.shift();
+    window[functionName].apply(null, message);
+}
+</script>
+</head>
+<body class="fill">
+<div class="message-line"><span class="message-box" id="paused-in-debugger"></span></div>
+</body>
+</html>
Property changes on: trunk/Source/WebCore/inspector/InspectorOverlayPage.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (126856 => 126857)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-08-28 08:42:35 UTC (rev 126856)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-08-28 08:52:26 UTC (rev 126857)
@@ -899,7 +899,7 @@
         Color(0, 0, 0xFF, 0x3F),
     };
 
-    m_overlay->drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]);
+    m_overlay->drawOutline(m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]);
 
     m_lastPaintContext = 0;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to