| Differences between
and this patch
- a/Source/WebCore/ChangeLog +31 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-07-12  Sergey Rogulenko  <rogulenko@google.com>
2
3
        Web Inspector: adding pause icon for JavaScript debugging
4
        https://bugs.webkit.org/show_bug.cgi?id=90880
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * inspector/InspectorClient.h:
9
        (WebCore::InspectorClient::showPauseWarning):
10
        (WebCore::InspectorClient::hidePauseWarning):
11
        (InspectorClient):
12
        * inspector/InspectorController.cpp:
13
        (WebCore::InspectorController::InspectorController):
14
        * inspector/InspectorDebuggerAgent.cpp:
15
        (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
16
        (WebCore::InspectorDebuggerAgent::disable):
17
        (WebCore::InspectorDebuggerAgent::didPause):
18
        (WebCore::InspectorDebuggerAgent::didContinue):
19
        * inspector/InspectorDebuggerAgent.h:
20
        (WebCore):
21
        (InspectorDebuggerAgent):
22
        (WebCore::InspectorDebuggerAgent::showPauseWarning):
23
        (WebCore::InspectorDebuggerAgent::hidePauseWarning):
24
        * inspector/PageDebuggerAgent.cpp:
25
        (WebCore::PageDebuggerAgent::create):
26
        (WebCore::PageDebuggerAgent::PageDebuggerAgent):
27
        * inspector/PageDebuggerAgent.h:
28
        (PageDebuggerAgent):
29
        * inspector/WorkerDebuggerAgent.cpp:
30
        (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
31
1
2012-07-11  Kenichi Ishibashi  <bashi@chromium.org>
32
2012-07-11  Kenichi Ishibashi  <bashi@chromium.org>
2
33
3
        [Chromium] Adding HarfBuzz-ng for Linux
34
        [Chromium] Adding HarfBuzz-ng for Linux
- a/Source/WebKit/chromium/ChangeLog +44 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2012-07-12  Sergey Rogulenko  <rogulenko@google.com>
2
3
        Web Inspector: adding pause icon for JavaScript debugging
4
        https://bugs.webkit.org/show_bug.cgi?id=90880
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * src/InspectorClientImpl.cpp:
9
        (WebKit::InspectorClientImpl::showPauseWarning):
10
        (WebKit):
11
        (WebKit::InspectorClientImpl::hidePauseWarning):
12
        * src/InspectorClientImpl.h:
13
        (InspectorClientImpl):
14
        * src/WebDevToolsAgentImpl.cpp:
15
        (OverlayZOrders):
16
        (DevToolsDashBoard):
17
        (WebKit::DevToolsDashBoard::DevToolsDashBoard):
18
        (WebKit::DevToolsDashBoard::~DevToolsDashBoard):
19
        (WebKit::DevToolsDashBoard::handleInputEvent):
20
        (Button):
21
        (WebKit::DevToolsDashBoard::Button::Button):
22
        (WebKit::DevToolsDashBoard::Button::draw):
23
        (WebKit::DevToolsDashBoard::Button::getState):
24
        (WebKit::DevToolsDashBoard::Button::updateState):
25
        (WebKit::DevToolsDashBoard::Button::drawRectContains):
26
        (WebKit::DevToolsDashBoard::Button::setLocation):
27
        (WebKit::DevToolsDashBoard::DashBoardIntPoint):
28
        (WebKit::DevToolsDashBoard::setUpFontDescription):
29
        (WebKit::DevToolsDashBoard::drawText):
30
        (WebKit::DevToolsDashBoard::paintPageOverlay):
31
        (WebKit):
32
        (WebKit::WebDevToolsAgentImpl::handleInputEvent):
33
        (WebKit::WebDevToolsAgentImpl::showPauseWarning):
34
        (WebKit::WebDevToolsAgentImpl::hidePauseWarning):
35
        (WebKit::WebDevToolsAgentImpl::resumeDebugger):
36
        * src/WebDevToolsAgentImpl.h:
37
        (WebKit):
38
        (WebDevToolsAgentImpl):
39
        * src/WebDevToolsAgentPrivate.h:
40
        (WebKit):
41
        (WebDevToolsAgentPrivate):
42
        * src/WebViewImpl.cpp:
43
        (WebKit::WebViewImpl::handleInputEvent):
44
1
2012-07-11  Kenichi Ishibashi  <bashi@chromium.org>
45
2012-07-11  Kenichi Ishibashi  <bashi@chromium.org>
2
46
3
        [Chromium] Adding HarfBuzz-ng for Linux
47
        [Chromium] Adding HarfBuzz-ng for Linux
- a/Source/WebCore/inspector/InspectorClient.h +3 lines
Lines 60-65 public: a/Source/WebCore/inspector/InspectorClient.h_sec1
60
60
61
    virtual bool canOverrideDeviceMetrics() { return false; }
61
    virtual bool canOverrideDeviceMetrics() { return false; }
62
62
63
    virtual void showPauseWarning() { }
64
    virtual void hidePauseWarning() { }
65
63
    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/)
66
    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/)
64
    {
67
    {
65
        // FIXME: Platforms may want to implement this (see https://bugs.webkit.org/show_bug.cgi?id=82886).
68
        // FIXME: Platforms may want to implement this (see https://bugs.webkit.org/show_bug.cgi?id=82886).
- a/Source/WebCore/inspector/InspectorController.cpp -1 / +1 lines
Lines 130-136 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC a/Source/WebCore/inspector/InspectorController.cpp_sec1
130
    m_agents.append(consoleAgentPtr.release());
130
    m_agents.append(consoleAgentPtr.release());
131
131
132
#if ENABLE(JAVASCRIPT_DEBUGGER)
132
#if ENABLE(JAVASCRIPT_DEBUGGER)
133
    OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get()));
133
    OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get(), inspectorClient));
134
    m_debuggerAgent = debuggerAgentPtr.get();
134
    m_debuggerAgent = debuggerAgentPtr.get();
135
    m_agents.append(debuggerAgentPtr.release());
135
    m_agents.append(debuggerAgentPtr.release());
136
136
- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp -1 / +5 lines
Lines 60-68 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp_sec1
60
60
61
const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace-object-group";
61
const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace-object-group";
62
62
63
InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
63
InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client)
64
    : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger", instrumentingAgents, inspectorState)
64
    : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger", instrumentingAgents, inspectorState)
65
    , m_injectedScriptManager(injectedScriptManager)
65
    , m_injectedScriptManager(injectedScriptManager)
66
    , m_client(client)
66
    , m_frontend(0)
67
    , m_frontend(0)
67
    , m_pausedScriptState(0)
68
    , m_pausedScriptState(0)
68
    , m_javaScriptPauseScheduled(false)
69
    , m_javaScriptPauseScheduled(false)
Lines 103-108 void InspectorDebuggerAgent::disable() a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp_sec2
103
104
104
    if (m_listener)
105
    if (m_listener)
105
        m_listener->debuggerWasDisabled();
106
        m_listener->debuggerWasDisabled();
107
    hidePauseWarning();
106
}
108
}
107
109
108
bool InspectorDebuggerAgent::enabled()
110
bool InspectorDebuggerAgent::enabled()
Lines 657-662 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp_sec3
657
        }
659
        }
658
    }
660
    }
659
661
662
    showPauseWarning();
660
    m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData);
663
    m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData);
661
    m_javaScriptPauseScheduled = false;
664
    m_javaScriptPauseScheduled = false;
662
665
Lines 671-676 void InspectorDebuggerAgent::didContinue() a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp_sec4
671
    m_pausedScriptState = 0;
674
    m_pausedScriptState = 0;
672
    m_currentCallStack = ScriptValue();
675
    m_currentCallStack = ScriptValue();
673
    clearBreakDetails();
676
    clearBreakDetails();
677
    hidePauseWarning();
674
    m_frontend->resumed();
678
    m_frontend->resumed();
675
}
679
}
676
680
- a/Source/WebCore/inspector/InspectorDebuggerAgent.h -1 / +19 lines
Lines 33-38 a/Source/WebCore/inspector/InspectorDebuggerAgent.h_sec1
33
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
33
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
34
#include "InjectedScript.h"
34
#include "InjectedScript.h"
35
#include "InspectorBaseAgent.h"
35
#include "InspectorBaseAgent.h"
36
#include "InspectorClient.h"
36
#include "InspectorFrontend.h"
37
#include "InspectorFrontend.h"
37
#include "ScriptBreakpoint.h"
38
#include "ScriptBreakpoint.h"
38
#include "ScriptDebugListener.h"
39
#include "ScriptDebugListener.h"
Lines 47-52 a/Source/WebCore/inspector/InspectorDebuggerAgent.h_sec2
47
namespace WebCore {
48
namespace WebCore {
48
49
49
class InjectedScriptManager;
50
class InjectedScriptManager;
51
class InspectorClient;
50
class InspectorFrontend;
52
class InspectorFrontend;
51
class InspectorArray;
53
class InspectorArray;
52
class InspectorObject;
54
class InspectorObject;
Lines 124-130 public: a/Source/WebCore/inspector/InspectorDebuggerAgent.h_sec3
124
    virtual ScriptDebugServer& scriptDebugServer() = 0;
126
    virtual ScriptDebugServer& scriptDebugServer() = 0;
125
127
126
protected:
128
protected:
127
    InspectorDebuggerAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);
129
    InspectorDebuggerAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, InspectorClient*);
128
130
129
    virtual void startListeningScriptDebugServer() = 0;
131
    virtual void startListeningScriptDebugServer() = 0;
130
    virtual void stopListeningScriptDebugServer() = 0;
132
    virtual void stopListeningScriptDebugServer() = 0;
Lines 154-163 private: a/Source/WebCore/inspector/InspectorDebuggerAgent.h_sec4
154
156
155
    String sourceMapURLForScript(const Script&);
157
    String sourceMapURLForScript(const Script&);
156
158
159
    void showPauseWarning();
160
    void hidePauseWarning();
161
157
    typedef HashMap<String, Script> ScriptsMap;
162
    typedef HashMap<String, Script> ScriptsMap;
158
    typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
163
    typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
159
164
160
    InjectedScriptManager* m_injectedScriptManager;
165
    InjectedScriptManager* m_injectedScriptManager;
166
    InspectorClient* m_client;
161
    InspectorFrontend::Debugger* m_frontend;
167
    InspectorFrontend::Debugger* m_frontend;
162
    ScriptState* m_pausedScriptState;
168
    ScriptState* m_pausedScriptState;
163
    ScriptValue m_currentCallStack;
169
    ScriptValue m_currentCallStack;
Lines 170-175 private: a/Source/WebCore/inspector/InspectorDebuggerAgent.h_sec5
170
    Listener* m_listener;
176
    Listener* m_listener;
171
};
177
};
172
178
179
inline void InspectorDebuggerAgent::showPauseWarning()
180
{
181
    if (m_client)
182
        m_client->showPauseWarning();
183
}
184
185
inline void InspectorDebuggerAgent::hidePauseWarning()
186
{
187
    if (m_client)
188
        m_client->hidePauseWarning();
189
}
190
173
} // namespace WebCore
191
} // namespace WebCore
174
192
175
#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
193
#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
- a/Source/WebCore/inspector/PageDebuggerAgent.cpp -4 / +4 lines
Lines 40-52 a/Source/WebCore/inspector/PageDebuggerAgent.cpp_sec1
40
40
41
namespace WebCore {
41
namespace WebCore {
42
42
43
PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
43
PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorClient* client)
44
{
44
{
45
    return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager));
45
    return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager, client));
46
}
46
}
47
47
48
PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
48
PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorClient* client)
49
    : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager)
49
    : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager, client)
50
    , m_inspectedPage(inspectedPage)
50
    , m_inspectedPage(inspectedPage)
51
{
51
{
52
}
52
}
- a/Source/WebCore/inspector/PageDebuggerAgent.h -2 / +2 lines
Lines 44-50 class PageDebuggerAgent : public InspectorDebuggerAgent { a/Source/WebCore/inspector/PageDebuggerAgent.h_sec1
44
    WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
44
    WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
45
    WTF_MAKE_FAST_ALLOCATED;
45
    WTF_MAKE_FAST_ALLOCATED;
46
public:
46
public:
47
    static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
47
    static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorClient*);
48
    virtual ~PageDebuggerAgent();
48
    virtual ~PageDebuggerAgent();
49
49
50
private:
50
private:
Lines 56-62 private: a/Source/WebCore/inspector/PageDebuggerAgent.h_sec2
56
56
57
    virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
57
    virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
58
58
59
    PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
59
    PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorClient*);
60
    Page* const m_inspectedPage;
60
    Page* const m_inspectedPage;
61
};
61
};
62
62
- a/Source/WebCore/inspector/WorkerDebuggerAgent.cpp -1 / +1 lines
Lines 86-92 PassOwnPtr<WorkerDebuggerAgent> WorkerDebuggerAgent::create(InstrumentingAgents* a/Source/WebCore/inspector/WorkerDebuggerAgent.cpp_sec1
86
}
86
}
87
87
88
WorkerDebuggerAgent::WorkerDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, WorkerContext* inspectedWorkerContext, InjectedScriptManager* injectedScriptManager)
88
WorkerDebuggerAgent::WorkerDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, WorkerContext* inspectedWorkerContext, InjectedScriptManager* injectedScriptManager)
89
    : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager)
89
    : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager, 0)
90
    , m_scriptDebugServer(inspectedWorkerContext)
90
    , m_scriptDebugServer(inspectedWorkerContext)
91
    , m_inspectedWorkerContext(inspectedWorkerContext)
91
    , m_inspectedWorkerContext(inspectedWorkerContext)
92
{
92
{
- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp +12 lines
Lines 95-100 void InspectorClientImpl::hideHighlight() a/Source/WebKit/chromium/src/InspectorClientImpl.cpp_sec1
95
        agent->hideHighlight();
95
        agent->hideHighlight();
96
}
96
}
97
97
98
void InspectorClientImpl::showPauseWarning()
99
{
100
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
101
        agent->showPauseWarning();
102
}
103
104
void InspectorClientImpl::hidePauseWarning()
105
{
106
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
107
        agent->hidePauseWarning();
108
}
109
98
bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
110
bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
99
{
111
{
100
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
112
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
- a/Source/WebKit/chromium/src/InspectorClientImpl.h +3 lines
Lines 57-62 public: a/Source/WebKit/chromium/src/InspectorClientImpl.h_sec1
57
    virtual void highlight();
57
    virtual void highlight();
58
    virtual void hideHighlight();
58
    virtual void hideHighlight();
59
59
60
    virtual void showPauseWarning();
61
    virtual void hidePauseWarning();
62
60
    virtual bool sendMessageToFrontend(const WTF::String&);
63
    virtual bool sendMessageToFrontend(const WTF::String&);
61
64
62
    virtual bool supportsInspectorStateUpdates() const { return true; }
65
    virtual bool supportsInspectorStateUpdates() const { return true; }
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +194 lines
Lines 56-61 a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec1
56
#include "WebDataSource.h"
56
#include "WebDataSource.h"
57
#include "WebDevToolsAgentClient.h"
57
#include "WebDevToolsAgentClient.h"
58
#include "WebFrameImpl.h"
58
#include "WebFrameImpl.h"
59
#include "WebInputEvent.h"
59
#include "platform/WebRect.h"
60
#include "platform/WebRect.h"
60
#include "platform/WebString.h"
61
#include "platform/WebString.h"
61
#include "platform/WebURL.h"
62
#include "platform/WebURL.h"
Lines 77-82 static const int viewportGutter = 97; a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec2
77
78
78
// Use 99 as a big z-order number so that highlight is above other overlays.
79
// Use 99 as a big z-order number so that highlight is above other overlays.
79
static const int highlight = 99;
80
static const int highlight = 99;
81
82
static const int devToolsDashBoard = 100;
80
}
83
}
81
84
82
namespace WebKit {
85
namespace WebKit {
Lines 366-371 private: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec3
366
    double m_originalZoomFactor;
369
    double m_originalZoomFactor;
367
};
370
};
368
371
372
class DevToolsDashBoard : public WebPageOverlay {
373
public:
374
    DevToolsDashBoard(WebViewImpl* webView, WebDevToolsAgentImpl* webDevToolsAgentImpl)
375
        : m_webView(webView)
376
        , m_webDevToolsAgent(webDevToolsAgentImpl)
377
        , m_button(this)
378
    {
379
        m_webView->addPageOverlay(this, OverlayZOrders::devToolsDashBoard);
380
    }
381
382
    ~DevToolsDashBoard()
383
    {
384
        m_webView->removePageOverlay(this);
385
    }
386
387
    void handleInputEvent(const WebMouseEvent* mouseEvent)
388
    {
389
        bool isFocused, isPressed;
390
        m_button.getState(isFocused, isPressed);
391
        isFocused = m_button.drawRectContains(mouseEvent->x, mouseEvent->y);
392
        switch (mouseEvent->type) {
393
        case WebInputEvent::MouseUp:
394
            if (isFocused && isPressed)
395
                m_webDevToolsAgent->resumeDebugger();
396
            isPressed = false;
397
            break;
398
        case WebInputEvent::MouseDown:
399
            if (isFocused)
400
                isPressed = true;
401
            break;
402
        default:
403
            break;
404
        }
405
        m_button.updateState(isFocused, isPressed);
406
    }
407
408
private:
409
    static const int fontSize = 30;
410
    static const int buttonWidth = 40;
411
    static const int buttonHeight = 40;
412
    // Negative vaule means counting from the right/bottom
413
    static const int buttonX = -190;
414
    static const int buttonY = 25;
415
    static const int textX = -145;
416
    static const int textY = 52;
417
    static const RGBA32 textColor = 0xFFFF0000;
418
    static const RGBA32 backgroundColor = 0x1F000000;
419
420
    class Button {
421
    public:
422
        Button(DevToolsDashBoard* devToolsDashBoard)
423
            : m_dashBoard(devToolsDashBoard)
424
            , m_drawRect()
425
            , m_isFocused(false)
426
            , m_isPressed(false)
427
        {
428
            m_drawRect.setSize(IntSize(buttonWidth, buttonHeight));
429
        }
430
431
        void draw(GraphicsContext* context)
432
        {
433
            DEFINE_STATIC_LOCAL(RefPtr<Image>, buttonImageDefault, (Image::loadPlatformResource("mediaplayerPlayDisabled")));
434
            DEFINE_STATIC_LOCAL(RefPtr<Image>, buttonImage, (Image::loadPlatformResource("mediaplayerPlay")));
435
            DEFINE_STATIC_LOCAL(RefPtr<Image>, buttonImageDown, (Image::loadPlatformResource("mediaplayerPlayDown")));
436
            DEFINE_STATIC_LOCAL(RefPtr<Image>, buttonImageHover, (Image::loadPlatformResource("mediaplayerPlayHover")));
437
            Image* image = 0;
438
            if (m_isFocused) {
439
                if (m_isPressed)
440
                    image = buttonImageDown.get();
441
                else
442
                    image = buttonImage.get();
443
            } else {
444
                if (m_isPressed)
445
                    image = buttonImageHover.get();
446
                else
447
                    image = buttonImageDefault.get();
448
            }
449
            context->drawImage(image, ColorSpaceDeviceRGB, m_drawRect);
450
        }
451
452
        void getState(bool& isFocused, bool& isPressed)
453
        {
454
            isFocused = m_isFocused;
455
            isPressed = m_isPressed;
456
        }
457
458
        void updateState(bool isFocused, bool isPressed)
459
        {
460
            if (m_isFocused != isFocused || m_isPressed != isPressed) {
461
                m_isFocused = isFocused;
462
                m_isPressed = isPressed;
463
                m_dashBoard->m_webView->pageOverlays()->update();
464
            }
465
        }
466
467
        bool drawRectContains(int x, int y)
468
        {
469
            return m_drawRect.contains(x, y);
470
        }
471
472
        void setLocation(const IntPoint& location)
473
        {
474
            m_drawRect.setLocation(location);
475
        }
476
477
    private:
478
        DevToolsDashBoard* m_dashBoard;
479
        IntRect m_drawRect;
480
        bool m_isFocused;
481
        bool m_isPressed;
482
    };
483
484
    IntPoint DashBoardIntPoint(int x, int y, const IntSize& viewSize)
485
    {
486
        if (x < 0)
487
            x += viewSize.width();
488
        if (y < 0)
489
            y += viewSize.height();
490
        return IntPoint(x, y);
491
    }
492
493
    void setUpFontDescription(FontDescription& fontDescription, WebCore::Settings* settings)
494
    {
495
        fontDescription.setRenderingMode(settings->fontRenderingMode());
496
        fontDescription.setComputedSize(fontSize);
497
        const AtomicString& fixedFontFamily = settings->fixedFontFamily();
498
        if (!fixedFontFamily.isEmpty()) {
499
            fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
500
            fontDescription.firstFamily().setFamily(fixedFontFamily);
501
            fontDescription.firstFamily().appendFamily(0);
502
        }
503
    }
504
505
    void drawText(GraphicsContext& context, String text, FloatPoint point)
506
    {
507
        Frame* frame = m_webView->page() ? m_webView->page()->mainFrame() : 0;
508
        if (!frame)
509
            return;
510
        Settings* settings = frame->settings();
511
        FontDescription desc;
512
        setUpFontDescription(desc, settings);
513
        Font font = Font(desc, 0, 0);
514
        font.update(0);
515
        context.drawText(font, text, point);
516
    }
517
518
    virtual void paintPageOverlay(WebCanvas* canvas)
519
    {
520
        GraphicsContextBuilder builder(canvas);
521
        GraphicsContext& context = builder.context();
522
523
        context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
524
        context.drawRect(IntRect(IntPoint(), m_webView->size()));
525
526
        m_button.setLocation(DashBoardIntPoint(buttonX, buttonY, m_webView->size()));
527
        m_button.draw(&context);
528
529
        context.setFillColor(textColor, ColorSpaceDeviceRGB);
530
        drawText(context, "Paused", DashBoardIntPoint(textX, textY, m_webView->size()));
531
    }
532
533
    WebViewImpl* m_webView;
534
    WebDevToolsAgentImpl* m_webDevToolsAgent;
535
    int m_buttonState;
536
    Button m_button;
537
};
538
369
539
370
WebDevToolsAgentImpl::WebDevToolsAgentImpl(
540
WebDevToolsAgentImpl::WebDevToolsAgentImpl(
371
    WebViewImpl* webViewImpl,
541
    WebViewImpl* webViewImpl,
Lines 444-449 void WebDevToolsAgentImpl::webViewResized() a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec4
444
        m_metricsSupport->webViewResized();
614
        m_metricsSupport->webViewResized();
445
}
615
}
446
616
617
void WebDevToolsAgentImpl::handleInputEvent(const WebInputEvent* inputEvent)
618
{
619
    if (m_devToolsDashBoard && WebInputEvent::isMouseEventType(inputEvent->type))
620
        m_devToolsDashBoard->handleInputEvent(static_cast<const WebMouseEvent*>(inputEvent));
621
}
622
623
void WebDevToolsAgentImpl::showPauseWarning()
624
{
625
    if (!m_devToolsDashBoard)
626
        m_devToolsDashBoard = adoptPtr(new DevToolsDashBoard(m_webViewImpl, this));
627
}
628
629
void WebDevToolsAgentImpl::hidePauseWarning()
630
{
631
    if (m_devToolsDashBoard)
632
        m_devToolsDashBoard.clear();
633
}
634
447
void WebDevToolsAgentImpl::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow)
635
void WebDevToolsAgentImpl::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow)
448
{
636
{
449
    if (!width && !height) {
637
    if (!width && !height) {
Lines 614-617 WebString WebDevToolsAgent::disconnectEventAsText() a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec5
614
    return channel.m_message;
802
    return channel.m_message;
615
}
803
}
616
804
805
void WebDevToolsAgentImpl::resumeDebugger()
806
{
807
    if (InspectorController* controller = inspectorController())
808
        controller->resume();
809
}
810
617
} // namespace WebKit
811
} // namespace WebKit
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +7 lines
Lines 52-57 class Node; a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec1
52
52
53
namespace WebKit {
53
namespace WebKit {
54
54
55
class DevToolsDashBoard;
55
class DeviceMetricsSupport;
56
class DeviceMetricsSupport;
56
class WebDevToolsAgentClient;
57
class WebDevToolsAgentClient;
57
class WebFrame;
58
class WebFrame;
Lines 75-80 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec2
75
    virtual void mainFrameViewCreated(WebFrameImpl*);
76
    virtual void mainFrameViewCreated(WebFrameImpl*);
76
    virtual bool metricsOverridden();
77
    virtual bool metricsOverridden();
77
    virtual void webViewResized();
78
    virtual void webViewResized();
79
    virtual void handleInputEvent(const WebInputEvent*);
78
80
79
    // WebDevToolsAgent implementation.
81
    // WebDevToolsAgent implementation.
80
    virtual void attach();
82
    virtual void attach();
Lines 101-106 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec3
101
    virtual void clearBrowserCache();
103
    virtual void clearBrowserCache();
102
    virtual void clearBrowserCookies();
104
    virtual void clearBrowserCookies();
103
105
106
    virtual void showPauseWarning();
107
    virtual void hidePauseWarning();
104
    virtual void overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow);
108
    virtual void overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow);
105
    virtual void autoZoomPageToFitWidth();
109
    virtual void autoZoomPageToFitWidth();
106
110
Lines 109-114 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec4
109
    // WebPageOverlay
113
    // WebPageOverlay
110
    virtual void paintPageOverlay(WebCanvas*);
114
    virtual void paintPageOverlay(WebCanvas*);
111
115
116
    void resumeDebugger();
117
112
private:
118
private:
113
    WebCore::InspectorController* inspectorController();
119
    WebCore::InspectorController* inspectorController();
114
    WebCore::Frame* mainFrame();
120
    WebCore::Frame* mainFrame();
Lines 118-123 private: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec5
118
    WebViewImpl* m_webViewImpl;
124
    WebViewImpl* m_webViewImpl;
119
    bool m_attached;
125
    bool m_attached;
120
    OwnPtr<DeviceMetricsSupport> m_metricsSupport;
126
    OwnPtr<DeviceMetricsSupport> m_metricsSupport;
127
    OwnPtr<DevToolsDashBoard> m_devToolsDashBoard;
121
};
128
};
122
129
123
} // namespace WebKit
130
} // namespace WebKit
- a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h +3 lines
Lines 35-40 a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h_sec1
35
35
36
namespace WebKit {
36
namespace WebKit {
37
class WebFrameImpl;
37
class WebFrameImpl;
38
class WebInputEvent;
38
struct WebSize;
39
struct WebSize;
39
40
40
class WebDevToolsAgentPrivate : public WebDevToolsAgent {
41
class WebDevToolsAgentPrivate : public WebDevToolsAgent {
Lines 55-60 public: a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h_sec2
55
56
56
    // WebViewImpl has been resized.
57
    // WebViewImpl has been resized.
57
    virtual void webViewResized() = 0;
58
    virtual void webViewResized() = 0;
59
60
    virtual void handleInputEvent(const WebInputEvent*) = 0;
58
};
61
};
59
62
60
} // namespace WebKit
63
} // namespace WebKit
- a/Source/WebKit/chromium/src/WebViewImpl.cpp -1 / +4 lines
Lines 1758-1765 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) a/Source/WebKit/chromium/src/WebViewImpl.cpp_sec1
1758
        return true;
1758
        return true;
1759
1759
1760
    // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately.
1760
    // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately.
1761
    if (m_ignoreInputEvents)
1761
    if (m_ignoreInputEvents) {
1762
        if (devToolsAgentPrivate())
1763
            devToolsAgentPrivate()->handleInputEvent(&inputEvent);
1762
        return false;
1764
        return false;
1765
    }
1763
1766
1764
    TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent, &inputEvent);
1767
    TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent, &inputEvent);
1765
1768

Return to Bug 90880