⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 126857 in webkit


Ignore:
Timestamp:
Aug 28, 2012, 1:52:26 AM (14 years ago)
Author:
pfeldman@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r126735 r126857  
    27652765
    27662766
     2767# Generate InspectorOverlayPage.h
     2768ADD_CUSTOM_COMMAND(
     2769    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h
     2770    MAIN_DEPENDENCY inspector/InspectorOverlayPage.html
     2771    COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl InspectorOverlayPage_html ${WEBCORE_DIR}/inspector/InspectorOverlayPage.html ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h
     2772    VERBATIM)
     2773LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorOverlayPage.h)
     2774
     2775
    27672776# Generate InjectedScriptSource.h
    27682777ADD_CUSTOM_COMMAND(
  • trunk/Source/WebCore/ChangeLog

    r126855 r126857  
     12012-08-28  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: introduce overlay page and migrate "paused in debugger" to it.
     4        https://bugs.webkit.org/show_bug.cgi?id=95080
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Separate page instance is now used to render overlay. Paused in debugger is migrated to the new overlay.
     9
     10        * CMakeLists.txt:
     11        * DerivedSources.make:
     12        * GNUmakefile.am:
     13        * WebCore.gyp/WebCore.gyp:
     14        * WebCore.gypi:
     15        * WebCore.vcproj/WebCore.vcproj:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * inspector/InspectorOverlay.cpp:
     18        (WebCore::InspectorOverlay::~InspectorOverlay):
     19        (WebCore):
     20        (WebCore::InspectorOverlay::paint):
     21        (WebCore::InspectorOverlay::drawOutline):
     22        (WebCore::InspectorOverlay::setPausedInDebuggerMessage):
     23        (WebCore::InspectorOverlay::drawNodeHighlight):
     24        (WebCore::InspectorOverlay::drawRectHighlight):
     25        (WebCore::InspectorOverlay::drawOverlayPage):
     26        (WebCore::InspectorOverlay::overlayPage):
     27        (WebCore::InspectorOverlay::evaluateInOverlay):
     28        * inspector/InspectorOverlay.h:
     29        (InspectorOverlay):
     30        * inspector/InspectorOverlayPage.html: Added.
     31        * inspector/InspectorPageAgent.cpp:
     32        (WebCore::InspectorPageAgent::didPaint):
     33
    1342012-08-28  Andrey Adaikin  <aandrey@chromium.org>
    235
  • trunk/Source/WebCore/DerivedSources.make

    r126627 r126857  
    10311031        python $(WebCore)/inspector/CodeGeneratorInspector.py $(WebCore)/inspector/Inspector.json --output_h_dir . --output_cpp_dir .
    10321032
     1033all : InspectorOverlayPage.h
     1034
     1035InspectorOverlayPage.h : InspectorOverlayPage.html
     1036        perl $(WebCore)/inspector/xxd.pl InspectorOverlayPage_html $(WebCore)/inspector/InspectorOverlayPage.html InspectorOverlayPage.h
     1037
    10331038all : InjectedScriptSource.h
    10341039
  • trunk/Source/WebCore/DerivedSources.pri

    r126756 r126857  
    5757
    5858INSPECTOR_BACKEND_COMMANDS_QRC = $$PWD/inspector/front-end/InspectorBackendCommands.qrc
     59
     60INSPECTOR_OVERLAY_PAGE = $$PWD/inspector/InspectorOverlayPage.html
    5961
    6062INJECTED_SCRIPT_SOURCE = $$PWD/inspector/InjectedScriptSource.js
     
    784786GENERATORS += inspectorBackendCommands
    785787
     788inspectorOverlayPage.output = InspectorOverlayPage.h
     789inspectorOverlayPage.input = INSPECTOR_OVERLAY_PAGE
     790inspectorOverlayPage.commands = perl $$PWD/inspector/xxd.pl InspectorOverlayPage_html ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
     791injectedScriptSource.add_output_to_sources = false
     792GENERATORS += inspectorOverlayPage
     793
    786794# GENERATOR 2-a: inspector injected script source compiler
    787795injectedScriptSource.output = InjectedScriptSource.h
  • trunk/Source/WebCore/GNUmakefile.am

    r126735 r126857  
    919919DerivedSources/WebCore/InspectorBackendCommands.js: DerivedSources/WebCore/InspectorBackendDispatcher.h
    920920DerivedSources/WebCore/InspectorBackendDispatcher.h: DerivedSources/WebCore/InspectorBackendDispatcher.cpp
     921DerivedSources/WebCore/InspectorOverlayPage.h: $(WebCore)/inspector/InspectorOverlayPage.html
     922        $(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InspectorOverlayPage_html $(WebCore)/inspector/InspectorOverlayPage.html $(GENSOURCES_WEBCORE)/InspectorOverlayPage.h
    921923DerivedSources/WebCore/InjectedScriptSource.h: $(WebCore)/inspector/InjectedScriptSource.js
    922924        $(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js $(GENSOURCES_WEBCORE)/InjectedScriptSource.h
     
    11951197        Source/WebCore/inspector/Inspector.json \
    11961198        Source/WebCore/inspector/Inspector-1.0.json \
     1199        Source/WebCore/inspector/InspectorOverlayPage.html \
    11971200        Source/WebCore/inspector/generate-inspector-protocol-version \
    11981201        Source/WebCore/inspector/xxd.pl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r126735 r126857  
    2626        DerivedSources/WebCore/InspectorFrontend.cpp \
    2727        DerivedSources/WebCore/InspectorFrontend.h \
     28        DerivedSources/WebCore/InspectorOverlayPage.h \
    2829        DerivedSources/WebCore/InspectorTypeBuilder.cpp \
    2930        DerivedSources/WebCore/InspectorTypeBuilder.h \
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r126735 r126857  
    440440    },
    441441    {
     442      'target_name': 'inspector_overlay_page',
     443      'type': 'none',
     444      'actions': [
     445        {
     446          'action_name': 'generateInspectorOverlayPage',
     447          'inputs': [
     448            '../inspector/InspectorOverlayPage.html',
     449          ],
     450          'outputs': [
     451            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorOverlayPage.h',
     452          ],
     453          'msvs_cygwin_shell': 0,
     454          'action': [
     455            '<(perl_exe)',
     456            '../inspector/xxd.pl',
     457            'InspectorOverlayPage_html',
     458            '<@(_inputs)',
     459            '<@(_outputs)'
     460          ],
     461          'message': 'Generating InspectorOverlayPage.h from InspectorOverlayPage.html',
     462        },
     463      ]
     464    },
     465    {
    442466      'target_name': 'injected_script_source',
    443467      'type': 'none',
     
    11771201      'dependencies': [
    11781202        'webcore_bindings_sources',
     1203        'inspector_overlay_page',
    11791204        'inspector_protocol_sources',
    11801205        'injected_script_source',
     
    13071332        'injected_script_source',
    13081333        'injected_webgl_script_source',
     1334        'inspector_overlay_page',
    13091335        'inspector_protocol_sources',
    13101336        'webcore_bindings_sources',
  • trunk/Source/WebCore/WebCore.gypi

    r126855 r126857  
    72277227            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorFrontend.cpp',
    72287228            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorFrontend.h',
     7229            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorOverlayPage.h',
    72297230            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorTypeBuilder.cpp',
    72307231            '<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorTypeBuilder.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r126735 r126857  
    615615                        </File>
    616616                        <File
     617                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InspectorOverlayPage.h"
     618                                >
     619                        </File>
     620                        <File
    617621                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InspectorTypeBuilder.cpp"
    618622                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r126834 r126857  
    91369136                7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; };
    91379137                7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroupLoadDeferrer.h; sourceTree = "<group>"; };
     9138                7A7256B915EB9F5B007323A7 /* InspectorOverlayPage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = InspectorOverlayPage.html; sourceTree = "<group>"; };
    91389139                7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; };
    91399140                7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageAgent.h; sourceTree = "<group>"; };
     
    1467214673                                7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */,
    1467314674                                7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */,
     14675                                7A7256B915EB9F5B007323A7 /* InspectorOverlayPage.html */,
    1467414676                                4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */,
    1467514677                                4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */,
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r126359 r126857  
    3333#include "InspectorOverlay.h"
    3434
     35#include "DocumentLoader.h"
    3536#include "Element.h"
     37#include "EmptyClients.h"
    3638#include "Font.h"
    3739#include "FontCache.h"
     
    4244#include "GraphicsTypes.h"
    4345#include "InspectorClient.h"
     46#include "InspectorOverlayPage.h"
     47#include "InspectorValues.h"
    4448#include "Node.h"
    4549#include "Page.h"
     
    4852#include "RenderInline.h"
    4953#include "RenderObject.h"
     54#include "ScriptSourceCode.h"
     55#include "ScriptValue.h"
    5056#include "Settings.h"
    5157#include "StyledElement.h"
     
    8288}
    8389
    84 void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor, const Color& outlineColor)
     90void drawOutlinedQuad(GraphicsContext* context, const FloatQuad& quad, const Color& fillColor, const Color& outlineColor)
    8591{
    8692    static const int outlineThickness = 2;
     
    9197    // of outline (because inflating a quad is hard)
    9298    {
    93         context.save();
    94         context.clipOut(quadPath);
    95 
    96         context.setStrokeThickness(outlineThickness);
    97         context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
    98         context.strokePath(quadPath);
    99 
    100         context.restore();
     99        context->save();
     100        context->clipOut(quadPath);
     101
     102        context->setStrokeThickness(outlineThickness);
     103        context->setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
     104        context->strokePath(quadPath);
     105
     106        context->restore();
    101107    }
    102108
    103109    // Now do the fill
    104     context.setFillColor(fillColor, ColorSpaceDeviceRGB);
    105     context.fillPath(quadPath);
    106 }
    107 
    108 void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
    109 {
    110     context.save();
     110    context->setFillColor(fillColor, ColorSpaceDeviceRGB);
     111    context->fillPath(quadPath);
     112}
     113
     114void drawOutlinedQuadWithClip(GraphicsContext* context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
     115{
     116    context->save();
    111117    Path clipQuadPath = quadToPath(clipQuad);
    112     context.clipOut(clipQuadPath);
     118    context->clipOut(clipQuadPath);
    113119    drawOutlinedQuad(context, quad, fillColor, Color::transparent);
    114     context.restore();
    115 }
    116 
    117 void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad, const HighlightConfig& highlightConfig)
     120    context->restore();
     121}
     122
     123void drawHighlightForBox(GraphicsContext* context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad, const HighlightConfig& highlightConfig)
    118124{
    119125    bool hasMargin = highlightConfig.margin != Color::transparent;
     
    140146}
    141147
    142 void drawHighlightForSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& absoluteQuads, const HighlightConfig& highlightConfig)
     148void drawHighlightForSVGRenderer(GraphicsContext* context, const Vector<FloatQuad>& absoluteQuads, const HighlightConfig& highlightConfig)
    143149{
    144150    for (size_t i = 0; i < absoluteQuads.size(); ++i)
     
    146152}
    147153
    148 int drawSubstring(const TextRun& globalTextRun, int offset, int length, const Color& textColor, const Font& font, GraphicsContext& context, const LayoutRect& titleRect)
    149 {
    150     context.setFillColor(textColor, ColorSpaceDeviceRGB);
    151     context.drawText(font, globalTextRun, IntPoint(titleRect.pixelSnappedX() + rectInflatePx, titleRect.pixelSnappedY() + font.fontMetrics().height()), offset, offset + length);
     154int drawSubstring(const TextRun& globalTextRun, int offset, int length, const Color& textColor, const Font& font, GraphicsContext* context, const LayoutRect& titleRect)
     155{
     156    context->setFillColor(textColor, ColorSpaceDeviceRGB);
     157    context->drawText(font, globalTextRun, IntPoint(titleRect.pixelSnappedX() + rectInflatePx, titleRect.pixelSnappedY() + font.fontMetrics().height()), offset, offset + length);
    152158    return offset + length;
    153159}
     
    219225}
    220226
    221 void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
     227void drawElementTitle(GraphicsContext* context, Node* node, RenderObject* renderer, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
    222228{
    223229    DEFINE_STATIC_LOCAL(Color, backgroundColor, (255, 255, 194));
     
    334340            path.addLineTo(points[i]);
    335341
    336         context.save();
    337         context.translate(0.5f, 0.5f);
    338         context.setStrokeColor(pxAndBorderColor, ColorSpaceDeviceRGB);
    339         context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
    340         context.setStrokeThickness(borderWidthPx);
    341         context.fillPath(path);
    342         context.strokePath(path);
    343         context.restore();
     342        context->save();
     343        context->translate(0.5f, 0.5f);
     344        context->setStrokeColor(pxAndBorderColor, ColorSpaceDeviceRGB);
     345        context->setFillColor(backgroundColor, ColorSpaceDeviceRGB);
     346        context->setStrokeThickness(borderWidthPx);
     347        context->fillPath(path);
     348        context->strokePath(path);
     349        context->restore();
    344350    }
    345351
     
    398404
    399405        if (context)
    400             drawHighlightForSVGRenderer(*context, highlight->quads, highlightConfig);
     406            drawHighlightForSVGRenderer(context, highlight->quads, highlightConfig);
    401407    } else if (renderer->isBox() || renderer->isRenderInline()) {
    402408        LayoutRect contentBox;
     
    452458
    453459        if (context)
    454             drawHighlightForBox(*context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad, highlightConfig);
     460            drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad, highlightConfig);
    455461    }
    456462
     
    461467
    462468    if (context && highlightConfig.showInfo)
    463         drawElementTitle(*context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings());
     469        drawElementTitle(context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings());
    464470}
    465471
     
    481487        }
    482488
    483         drawOutlinedQuad(*context, highlightRect, highlightConfig.content, highlightConfig.contentOutline);
     489        drawOutlinedQuad(context, highlightRect, highlightConfig.content, highlightConfig.contentOutline);
    484490    }
    485491}
     
    493499}
    494500
     501InspectorOverlay::~InspectorOverlay()
     502{
     503}
     504
    495505void InspectorOverlay::paint(GraphicsContext& context)
    496506{
    497     drawPausedInDebugger(context);
    498     drawNodeHighlight(context);
    499     drawRectHighlight(context);
    500 }
    501 
    502 void InspectorOverlay::drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color)
     507    drawNodeHighlight(&context);
     508    drawRectHighlight(&context);
     509
     510    if (m_pausedInDebuggerMessage.isNull())
     511        return;
     512    drawOverlayPage(&context);
     513}
     514
     515void InspectorOverlay::drawOutline(GraphicsContext* context, const LayoutRect& rect, const Color& color)
    503516{
    504517    FloatRect outlineRect = rect;
     
    524537{
    525538    m_pausedInDebuggerMessage = message ? *message : String();
     539    evaluateInOverlay("setPausedInDebuggerMessage", m_pausedInDebuggerMessage);
    526540    update();
    527541}
     
    555569void InspectorOverlay::update()
    556570{
    557     if (m_highlightNode || m_highlightRect || !m_pausedInDebuggerMessage.isNull())
    558         m_client->highlight();
    559     else
     571    if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull()) {
    560572        m_client->hideHighlight();
    561 }
    562 
    563 void InspectorOverlay::drawNodeHighlight(GraphicsContext& context)
     573        return;
     574    }
     575
     576    FrameView* view = m_page->mainFrame()->view();
     577    FrameView* overlayView = overlayPage()->mainFrame()->view();
     578    IntRect visibleRect = enclosingIntRect(view->visibleContentRect());
     579    overlayView->resize(visibleRect.width(), visibleRect.height());
     580    if (overlayView->needsLayout())
     581        overlayView->layout();
     582    m_client->highlight();
     583}
     584
     585void InspectorOverlay::drawNodeHighlight(GraphicsContext* context)
    564586{
    565587    if (!m_highlightNode)
     
    567589
    568590    Highlight highlight;
    569     getOrDrawNodeHighlight(&context, m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
    570 }
    571 
    572 void InspectorOverlay::drawRectHighlight(GraphicsContext& context)
     591    getOrDrawNodeHighlight(context, m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
     592}
     593
     594void InspectorOverlay::drawRectHighlight(GraphicsContext* context)
    573595{
    574596    if (!m_highlightRect)
     
    576598
    577599    Highlight highlight;
    578     getOrDrawRectHighlight(&context, m_page, m_highlightRect.get(), m_rectHighlightConfig, &highlight);
    579 }
    580 
    581 void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context)
    582 {
    583     if (m_pausedInDebuggerMessage.isNull())
    584         return;
    585 
    586     DEFINE_STATIC_LOCAL(Color, backgroundColor, (0, 0, 0, 31));
    587     DEFINE_STATIC_LOCAL(Color, textBackgroundColor, (255, 255, 194));
    588     DEFINE_STATIC_LOCAL(Color, borderColor, (128, 128, 128));
    589 
    590     Frame* frame = m_page->mainFrame();
    591     Settings* settings = frame->settings();
    592     IntRect visibleRect = IntRect(IntPoint(), frame->view()->visibleSize());
    593 
    594     context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
    595     context.fillRect(visibleRect);
    596 
    597     FontDescription desc;
    598     setUpFontDescription(desc, settings);
    599     Font font = Font(desc, 0, 0);
    600     font.update(0);
    601 
    602     TextRun textRun(m_pausedInDebuggerMessage);
    603     IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeightPx));
    604     titleRect.inflate(rectInflatePx);
    605     titleRect.setLocation(IntPoint(visibleRect.width() / 2 - titleRect.width() / 2, 0));
    606 
    607     context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB);
    608     context.setStrokeColor(borderColor, ColorSpaceDeviceRGB);
    609     context.drawRect(titleRect);
    610     drawSubstring(textRun, 0, m_pausedInDebuggerMessage.length(), Color::black, font, context, titleRect);
     600    getOrDrawRectHighlight(context, m_page, m_highlightRect.get(), m_rectHighlightConfig, &highlight);
     601}
     602
     603void InspectorOverlay::drawOverlayPage(GraphicsContext* context)
     604{
     605    GraphicsContextStateSaver stateSaver(*context);
     606    FrameView* view = overlayPage()->mainFrame()->view();
     607    view->paint(context, IntRect(0, 0, view->width(), view->height()));
     608}
     609
     610Page* InspectorOverlay::overlayPage()
     611{
     612    if (m_overlayPage)
     613        return m_overlayPage.get();
     614
     615    static FrameLoaderClient* dummyFrameLoaderClient =  new EmptyFrameLoaderClient;
     616    Page::PageClients pageClients;
     617    fillWithEmptyClients(pageClients);
     618    m_overlayPage = adoptPtr(new Page(pageClients));
     619
     620    Settings* settings = m_page->settings();
     621    Settings* overlaySettings = m_overlayPage->settings();
     622
     623    overlaySettings->setStandardFontFamily(settings->standardFontFamily());
     624#if OS(WINDOWS)
     625    overlaySettings->setFixedFontFamily("Consolas");
     626#elif OS(MAC_OS_X)
     627    overlaySettings->setFixedFontFamily("Menlo");
     628#elif OS(UNIX)
     629    overlaySettings->setFixedFontFamily("dejavu sans mono");
     630#endif
     631    overlaySettings->setSerifFontFamily(settings->serifFontFamily());
     632    overlaySettings->setSansSerifFontFamily(settings->sansSerifFontFamily());
     633    overlaySettings->setCursiveFontFamily(settings->cursiveFontFamily());
     634    overlaySettings->setFantasyFontFamily(settings->fantasyFontFamily());
     635    overlaySettings->setPictographFontFamily(settings->pictographFontFamily());
     636    overlaySettings->setMinimumFontSize(settings->minimumFontSize());
     637    overlaySettings->setMinimumLogicalFontSize(settings->minimumLogicalFontSize());
     638    overlaySettings->setDefaultFontSize(settings->defaultFontSize());
     639    overlaySettings->setDefaultFixedFontSize(settings->defaultFixedFontSize());
     640    overlaySettings->setMediaEnabled(false);
     641    overlaySettings->setScriptEnabled(true);
     642    overlaySettings->setPluginsEnabled(false);
     643
     644    RefPtr<Frame> frame = Frame::create(m_overlayPage.get(), 0, dummyFrameLoaderClient);
     645    frame->setView(FrameView::create(frame.get()));
     646    frame->init();
     647    FrameLoader* loader = frame->loader();
     648    frame->view()->setCanHaveScrollbars(false);
     649    frame->view()->setTransparent(true);
     650    ASSERT(loader->activeDocumentLoader());
     651    loader->activeDocumentLoader()->writer()->setMIMEType("text/html");
     652    loader->activeDocumentLoader()->writer()->begin();
     653    loader->activeDocumentLoader()->writer()->addData(reinterpret_cast<const char*>(InspectorOverlayPage_html), sizeof(InspectorOverlayPage_html));
     654    loader->activeDocumentLoader()->writer()->end();
     655
     656    return m_overlayPage.get();
     657}
     658
     659void InspectorOverlay::evaluateInOverlay(const String& method, const String& argument)
     660{
     661    RefPtr<InspectorArray> command = InspectorArray::create();
     662    command->pushString(method);
     663    command->pushString(argument);
     664    overlayPage()->mainFrame()->script()->evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
    611665}
    612666
  • trunk/Source/WebCore/inspector/InspectorOverlay.h

    r125025 r126857  
    8989        return adoptPtr(new InspectorOverlay(page, client));
    9090    }
     91    ~InspectorOverlay();
    9192
    9293    void paint(GraphicsContext&);
    93     void drawOutline(GraphicsContext&, const LayoutRect&, const Color&);
     94    void drawOutline(GraphicsContext*, const LayoutRect&, const Color&);
    9495    void getHighlight(Highlight*) const;
    9596
     
    106107
    107108    void update();
    108     void drawNodeHighlight(GraphicsContext&);
    109     void drawRectHighlight(GraphicsContext&);
    110     void drawPausedInDebugger(GraphicsContext&);
     109    void drawNodeHighlight(GraphicsContext*);
     110    void drawRectHighlight(GraphicsContext*);
     111    void drawOverlayPage(GraphicsContext*);
     112    Page* overlayPage();
     113    void evaluateInOverlay(const String& method, const String& argument);
    111114
    112115    Page* m_page;
     
    116119    HighlightConfig m_nodeHighlightConfig;
    117120    OwnPtr<IntRect> m_highlightRect;
     121    OwnPtr<Page> m_overlayPage;
    118122    HighlightConfig m_rectHighlightConfig;
    119123};
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r126837 r126857  
    900900    };
    901901
    902     m_overlay->drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]);
     902    m_overlay->drawOutline(m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]);
    903903
    904904    m_lastPaintContext = 0;
Note: See TracChangeset for help on using the changeset viewer.