Changeset 122966 in webkit
- Timestamp:
- Jul 18, 2012 7:04:58 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122964 r122966 1 2012-07-18 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 Pavel Feldman. 7 8 Refactored DOMNodeHighlighter into InspectorOverlay class and added a feature to show a "pause" screen when 9 the Javascript debugger is paused. 10 11 * inspector/DOMNodeHighlighter.cpp: 12 (WebCore::InspectorOverlay::InspectorOverlay): 13 (WebCore::InspectorOverlay::paint): 14 (WebCore::InspectorOverlay::drawOutline): 15 (WebCore::InspectorOverlay::getHighlight): 16 (WebCore::InspectorOverlay::setPausedInDebugger): 17 (WebCore::InspectorOverlay::hideHighlight): 18 (WebCore): 19 (WebCore::InspectorOverlay::highlightNode): 20 (WebCore::InspectorOverlay::setHighlightData): 21 (WebCore::InspectorOverlay::clearHighlightData): 22 (WebCore::InspectorOverlay::highlightedNode): 23 (WebCore::InspectorOverlay::update): 24 (WebCore::InspectorOverlay::drawHighlight): 25 (WebCore::InspectorOverlay::drawPausedInDebugger): 26 * inspector/DOMNodeHighlighter.h: 27 (WebCore): 28 (InspectorOverlay): 29 (WebCore::InspectorOverlay::create): 30 * inspector/InspectorController.cpp: 31 (WebCore::InspectorController::InspectorController): 32 (WebCore::InspectorController::drawHighlight): 33 (WebCore::InspectorController::getHighlight): 34 (WebCore::InspectorController::highlightedNode): 35 * inspector/InspectorController.h: 36 (WebCore): 37 (InspectorController): 38 * inspector/InspectorDOMAgent.cpp: 39 (WebCore::InspectorDOMAgent::InspectorDOMAgent): 40 (WebCore::InspectorDOMAgent::~InspectorDOMAgent): 41 (WebCore::InspectorDOMAgent::handleMousePress): 42 (WebCore::InspectorDOMAgent::mouseDidMoveOverElement): 43 (WebCore::InspectorDOMAgent::setSearchingForNode): 44 (WebCore::InspectorDOMAgent::setHighlightDataFromConfig): 45 (WebCore::InspectorDOMAgent::setInspectModeEnabled): 46 (WebCore::InspectorDOMAgent::highlightRect): 47 (WebCore::InspectorDOMAgent::highlightNode): 48 (WebCore::InspectorDOMAgent::highlightFrame): 49 (WebCore::InspectorDOMAgent::hideHighlight): 50 * inspector/InspectorDOMAgent.h: 51 (WebCore): 52 (WebCore::InspectorDOMAgent::create): 53 (InspectorDOMAgent): 54 * inspector/InspectorDebuggerAgent.h: 55 (InspectorDebuggerAgent): 56 * inspector/InspectorPageAgent.cpp: 57 (WebCore::InspectorPageAgent::create): 58 (WebCore::InspectorPageAgent::InspectorPageAgent): 59 (WebCore::InspectorPageAgent::didPaint): 60 * inspector/InspectorPageAgent.h: 61 (WebCore): 62 * inspector/PageDebuggerAgent.cpp: 63 (WebCore::PageDebuggerAgent::create): 64 (WebCore::PageDebuggerAgent::PageDebuggerAgent): 65 (WebCore::PageDebuggerAgent::disable): 66 (WebCore): 67 (WebCore::PageDebuggerAgent::didPause): 68 (WebCore::PageDebuggerAgent::didContinue): 69 * inspector/PageDebuggerAgent.h: 70 (WebCore): 71 (PageDebuggerAgent): 72 1 73 2012-07-17 Andrey Kosyakov <caseq@chromium.org> 2 74 -
trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp
r115172 r122966 40 40 #include "GraphicsContext.h" 41 41 #include "GraphicsTypes.h" 42 #include "InspectorClient.h" 42 43 #include "Node.h" 43 44 #include "Page.h" … … 463 464 } 464 465 465 static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, HighlightData* highlightData, Highlight *highlight)466 { 467 if (! document)466 static void getOrDrawRectHighlight(GraphicsContext* context, Page* page, HighlightData* highlightData, Highlight *highlight) 467 { 468 if (!page) 468 469 return; 469 470 … … 474 475 475 476 if (context) { 476 FrameView* view = document->frame()->view();477 FrameView* view = page->mainFrame()->view(); 477 478 if (!view->delegatesScrolling()) { 478 479 FloatRect visibleRect = view->visibleContentRect(); … … 486 487 } // anonymous namespace 487 488 488 namespace DOMNodeHighlighter { 489 490 void drawHighlight(GraphicsContext& context, Document* document, HighlightData* highlightData) 491 { 492 if (!highlightData) 493 return; 494 495 Highlight highlight; 496 if (highlightData->node) 497 getOrDrawNodeHighlight(&context, highlightData, &highlight); 498 else if (highlightData->rect) 499 getOrDrawRectHighlight(&context, document, highlightData, &highlight); 500 } 501 502 void getHighlight(Document* document, HighlightData* highlightData, Highlight* highlight) 503 { 504 if (!highlightData) 505 return; 506 507 highlight->contentColor = highlightData->content; 508 highlight->paddingColor = highlightData->padding; 509 highlight->borderColor = highlightData->border; 510 highlight->marginColor = highlightData->margin; 511 highlight->type = HighlightTypeRects; 512 513 if (highlightData->node) 514 getOrDrawNodeHighlight(0, highlightData, highlight); 515 else if (highlightData->rect) 516 getOrDrawRectHighlight(0, document, highlightData, highlight); 517 } 518 519 void drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) 489 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) 490 : m_page(page) 491 , m_client(client) 492 , m_pausedInDebugger(false) 493 { 494 } 495 496 void InspectorOverlay::paint(GraphicsContext& context) 497 { 498 drawPausedInDebugger(context); 499 drawHighlight(context); 500 } 501 502 void InspectorOverlay::drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) 520 503 { 521 504 FloatRect outlineRect = rect; … … 523 506 } 524 507 525 } // namespace DOMNodeHighlighter 508 void InspectorOverlay::getHighlight(Highlight* highlight) const 509 { 510 if (!m_highlightData) 511 return; 512 513 highlight->contentColor = m_highlightData->content; 514 highlight->paddingColor = m_highlightData->padding; 515 highlight->borderColor = m_highlightData->border; 516 highlight->marginColor = m_highlightData->margin; 517 highlight->type = HighlightTypeRects; 518 519 if (m_highlightData->node) 520 getOrDrawNodeHighlight(0, m_highlightData.get(), highlight); 521 else if (m_highlightData->rect) 522 getOrDrawRectHighlight(0, m_page, m_highlightData.get(), highlight); 523 } 524 525 void InspectorOverlay::setPausedInDebugger(bool flag) 526 { 527 m_pausedInDebugger = flag; 528 update(); 529 } 530 531 void InspectorOverlay::hideHighlight() 532 { 533 if (m_highlightData) { 534 // FIXME: Clear entire highlight data here, store config upon setInspectModeEnabled 535 m_highlightData->rect.clear(); 536 m_highlightData->node.clear(); 537 } 538 update(); 539 } 540 541 void InspectorOverlay::highlightNode(Node* node) 542 { 543 if (m_highlightData) 544 m_highlightData->node = node; 545 update(); 546 } 547 548 void InspectorOverlay::setHighlightData(PassOwnPtr<HighlightData> highlightData) 549 { 550 m_highlightData = highlightData; 551 update(); 552 } 553 554 void InspectorOverlay::clearHighlightData() 555 { 556 m_highlightData.clear(); 557 update(); 558 } 559 560 Node* InspectorOverlay::highlightedNode() const 561 { 562 return m_highlightData ? m_highlightData->node.get() : 0; 563 } 564 565 void InspectorOverlay::update() 566 { 567 if (m_highlightData || m_pausedInDebugger) 568 m_client->highlight(); 569 else 570 m_client->hideHighlight(); 571 } 572 573 void InspectorOverlay::drawHighlight(GraphicsContext& context) 574 { 575 if (!m_highlightData || (!m_highlightData->rect && !m_highlightData->node)) 576 return; 577 578 Highlight highlight; 579 if (m_highlightData->node) 580 getOrDrawNodeHighlight(&context, m_highlightData.get(), &highlight); 581 else if (m_highlightData->rect) 582 getOrDrawRectHighlight(&context, m_page, m_highlightData.get(), &highlight); 583 } 584 585 void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context) 586 { 587 if (!m_pausedInDebugger) 588 return; 589 590 DEFINE_STATIC_LOCAL(Color, backgroundColor, (0, 0, 0, 31)); 591 DEFINE_STATIC_LOCAL(Color, textBackgroundColor, (255, 255, 194)); 592 DEFINE_STATIC_LOCAL(Color, borderColor, (128, 128, 128)); 593 DEFINE_STATIC_LOCAL(int, fontHeight, (24)); 594 595 Frame* frame = m_page->mainFrame(); 596 Settings* settings = frame->settings(); 597 IntRect visibleRect = frame->view()->visibleContentRect(); 598 599 context.setFillColor(backgroundColor, ColorSpaceDeviceRGB); 600 context.drawRect(visibleRect); 601 602 FontDescription desc; 603 setUpFontDescription(desc, settings); 604 desc.setComputedSize(fontHeight); 605 Font font = Font(desc, 0, 0); 606 font.update(0); 607 608 String text = "Paused in debugger."; 609 TextRun textRun(text); 610 IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeight)); 611 titleRect.inflate(rectInflatePx); 612 titleRect.setLocation(IntPoint(visibleRect.width() / 2 - titleRect.width() / 2, 0)); 613 614 context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB); 615 context.setStrokeColor(borderColor, ColorSpaceDeviceRGB); 616 context.drawRect(titleRect); 617 context.setFillColor(Color::black, ColorSpaceDeviceRGB); 618 context.drawText(font, textRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + fontHeight)); 619 } 526 620 527 621 } // namespace WebCore -
trunk/Source/WebCore/inspector/DOMNodeHighlighter.h
r108338 r122966 33 33 #include "FloatQuad.h" 34 34 #include "LayoutTypes.h" 35 #include "Node.h" 35 36 36 37 #include <wtf/OwnPtr.h> 38 #include <wtf/PassOwnPtr.h> 37 39 #include <wtf/RefPtr.h> 38 40 #include <wtf/Vector.h> … … 41 43 42 44 class Color; 43 class Document;44 class FrameView;45 45 class GraphicsContext; 46 class InspectorClient; 47 class IntRect; 46 48 class Node; 49 class Page; 47 50 48 51 struct HighlightData { … … 76 79 }; 77 80 78 namespace DOMNodeHighlighter { 81 class InspectorOverlay { 82 public: 83 static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* client) 84 { 85 return adoptPtr(new InspectorOverlay(page, client)); 86 } 79 87 80 void drawHighlight(GraphicsContext&, Document*, HighlightData*);81 void getHighlight(Document*, HighlightData*, Highlight*);82 void drawOutline(GraphicsContext&, const LayoutRect&, const Color&);88 void paint(GraphicsContext&); 89 void drawOutline(GraphicsContext&, const LayoutRect&, const Color&); 90 void getHighlight(Highlight*) const; 83 91 84 } // namespace DOMNodeHighlighter 92 void setPausedInDebugger(bool); 93 94 void hideHighlight(); 95 void highlightNode(Node*); 96 void setHighlightData(PassOwnPtr<HighlightData>); 97 void clearHighlightData(); 98 99 Node* highlightedNode() const; 100 101 private: 102 InspectorOverlay(Page*, InspectorClient*); 103 104 void update(); 105 void drawHighlight(GraphicsContext&); 106 void drawPausedInDebugger(GraphicsContext&); 107 108 Page* m_page; 109 InspectorClient* m_client; 110 bool m_pausedInDebugger; 111 OwnPtr<HighlightData> m_highlightData; 112 }; 85 113 86 114 } // namespace WebCore -
trunk/Source/WebCore/inspector/InspectorController.cpp
r122838 r122966 35 35 #include "InspectorController.h" 36 36 37 #include "DOMNodeHighlighter.h" 37 38 #include "Frame.h" 38 39 #include "GraphicsContext.h" … … 79 80 , m_injectedScriptManager(InjectedScriptManager::createForPage()) 80 81 , m_state(adoptPtr(new InspectorState(inspectorClient))) 82 , m_overlay(InspectorOverlay::create(page, inspectorClient)) 81 83 , m_page(page) 82 84 , m_inspectorClient(inspectorClient) … … 86 88 m_agents.append(inspectorAgentPtr.release()); 87 89 88 OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient ));90 OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get())); 89 91 InspectorPageAgent* pageAgent = pageAgentPtr.get(); 90 92 m_pageAgent = pageAgentPtr.get(); 91 93 m_agents.append(pageAgentPtr.release()); 92 94 93 OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_injectedScriptManager.get()));95 OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get())); 94 96 m_domAgent = domAgentPtr.get(); 95 97 m_agents.append(domAgentPtr.release()); … … 131 133 132 134 #if ENABLE(JAVASCRIPT_DEBUGGER) 133 OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get() ));135 OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get(), m_overlay.get())); 134 136 m_debuggerAgent = debuggerAgentPtr.get(); 135 137 m_agents.append(debuggerAgentPtr.release()); … … 298 300 void InspectorController::drawHighlight(GraphicsContext& context) const 299 301 { 300 m_ domAgent->drawHighlight(context);302 m_overlay->paint(context); 301 303 } 302 304 303 305 void InspectorController::getHighlight(Highlight* highlight) const 304 306 { 305 m_ domAgent->getHighlight(highlight);307 m_overlay->getHighlight(highlight); 306 308 } 307 309 … … 345 347 Node* InspectorController::highlightedNode() const 346 348 { 347 return m_ domAgent->highlightedNode();349 return m_overlay->highlightedNode(); 348 350 } 349 351 -
trunk/Source/WebCore/inspector/InspectorController.h
r122838 r122966 53 53 class InspectorFrontendChannel; 54 54 class InspectorFrontendClient; 55 class InspectorOverlay; 55 56 class InspectorPageAgent; 56 57 class InspectorProfilerAgent; … … 121 122 OwnPtr<InjectedScriptManager> m_injectedScriptManager; 122 123 OwnPtr<InspectorState> m_state; 124 OwnPtr<InspectorOverlay> m_overlay; 123 125 124 126 InspectorAgent* m_inspectorAgent; -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r122106 r122966 67 67 #include "IdentifiersFactory.h" 68 68 #include "InjectedScriptManager.h" 69 #include "InspectorClient.h"70 69 #include "InspectorFrontend.h" 71 70 #include "InspectorHistory.h" … … 195 194 } 196 195 197 InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, Inspector Client* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)196 InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) 198 197 : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspectorState) 199 198 , m_pageAgent(pageAgent) 200 , m_client(client)201 199 , m_injectedScriptManager(injectedScriptManager) 200 , m_overlay(overlay) 202 201 , m_frontend(0) 203 202 , m_domListener(0) … … 211 210 { 212 211 reset(); 213 ASSERT(!m_highlightData || (!m_highlightData->node && !m_highlightData->rect));214 212 ASSERT(!m_searchingForNode); 215 213 } … … 269 267 } 270 268 return result; 271 }272 273 Node* InspectorDOMAgent::highlightedNode() const274 {275 return m_highlightData ? m_highlightData->node.get() : 0;276 269 } 277 270 … … 939 932 return false; 940 933 941 if ( m_highlightData && m_highlightData->node) {942 RefPtr<Node> node = m_highlightData->node;943 inspect(node.get());944 } 945 return true;934 if (Node* node = m_overlay->highlightedNode()) { 935 inspect(node); 936 return true; 937 } 938 return false; 946 939 } 947 940 … … 983 976 void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned) 984 977 { 985 if (!m_searchingForNode || !m_highlightData)978 if (!m_searchingForNode) 986 979 return; 987 980 … … 989 982 while (node && node->nodeType() == Node::TEXT_NODE) 990 983 node = node->parentNode(); 991 if (node) { 992 m_highlightData->node = node; 993 highlight(); 994 } 984 if (node) 985 m_overlay->highlightNode(node); 995 986 } 996 987 … … 1005 996 ErrorString error; 1006 997 hideHighlight(&error); 1007 m_highlightData.clear(); 1008 } 1009 } 1010 1011 void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) 1012 { 1013 setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); 998 m_overlay->clearHighlightData(); 999 } 1014 1000 } 1015 1001 … … 1017 1003 { 1018 1004 if (!highlightConfig) { 1019 m_ highlightData.clear();1005 m_overlay->clearHighlightData(); 1020 1006 return false; 1021 1007 } 1022 1008 1023 m_highlightData = adoptPtr(new HighlightData());1009 OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); 1024 1010 bool showInfo = false; // Default: false (do not show a tooltip). 1025 1011 highlightConfig->getBoolean("showInfo", &showInfo); 1026 m_highlightData->showInfo = showInfo; 1027 m_highlightData->content = parseConfigColor("contentColor", highlightConfig); 1028 m_highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); 1029 m_highlightData->padding = parseConfigColor("paddingColor", highlightConfig); 1030 m_highlightData->border = parseConfigColor("borderColor", highlightConfig); 1031 m_highlightData->margin = parseConfigColor("marginColor", highlightConfig); 1012 highlightData->showInfo = showInfo; 1013 highlightData->content = parseConfigColor("contentColor", highlightConfig); 1014 highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); 1015 highlightData->padding = parseConfigColor("paddingColor", highlightConfig); 1016 highlightData->border = parseConfigColor("borderColor", highlightConfig); 1017 highlightData->margin = parseConfigColor("marginColor", highlightConfig); 1018 m_overlay->setHighlightData(highlightData.release()); 1032 1019 return true; 1033 1020 } 1034 1021 1035 void InspectorDOMAgent::highlight() 1036 { 1037 // This method requires m_highlightData to have been filled in by its client. 1038 ASSERT(m_highlightData); 1039 m_client->highlight(); 1022 void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) 1023 { 1024 setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); 1040 1025 } 1041 1026 1042 1027 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor) 1043 1028 { 1044 m_highlightData = adoptPtr(new HighlightData());1045 m_highlightData->rect = adoptPtr(new IntRect(x, y, width, height));1046 m_highlightData->content = parseColor(color);1047 m_highlightData->contentOutline = parseColor(outlineColor);1048 m_ client->highlight();1029 OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); 1030 highlightData->rect = adoptPtr(new IntRect(x, y, width, height)); 1031 highlightData->content = parseColor(color); 1032 highlightData->contentOutline = parseColor(outlineColor); 1033 m_overlay->setHighlightData(highlightData.release()); 1049 1034 } 1050 1035 … … 1054 1039 const RefPtr<InspectorObject>& highlightConfig) 1055 1040 { 1056 if (Node* node = nodeForId(nodeId)) { 1057 if (setHighlightDataFromConfig(highlightConfig.get())) { 1058 m_highlightData->node = node; 1059 highlight(); 1060 } 1061 } 1041 if (Node* node = nodeForId(nodeId)) 1042 if (setHighlightDataFromConfig(highlightConfig.get())) 1043 m_overlay->highlightNode(node); 1062 1044 } 1063 1045 … … 1070 1052 Frame* frame = m_pageAgent->frameForId(frameId); 1071 1053 if (frame && frame->ownerElement()) { 1072 m_highlightData = adoptPtr(new HighlightData());1073 m_highlightData->node = frame->ownerElement();1074 m_highlightData->showInfo = true; // Always show tooltips for frames.1075 m_highlightData->content = parseColor(color);1076 m_highlightData->contentOutline = parseColor(outlineColor);1077 highlight();1054 OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); 1055 highlightData->node = frame->ownerElement(); 1056 highlightData->showInfo = true; // Always show tooltips for frames. 1057 highlightData->content = parseColor(color); 1058 highlightData->contentOutline = parseColor(outlineColor); 1059 m_overlay->setHighlightData(highlightData.release()); 1078 1060 } 1079 1061 } … … 1081 1063 void InspectorDOMAgent::hideHighlight(ErrorString*) 1082 1064 { 1083 if (m_highlightData) { 1084 m_highlightData->node.clear(); 1085 m_highlightData->rect.clear(); 1086 } 1087 m_client->hideHighlight(); 1065 m_overlay->hideHighlight(); 1088 1066 } 1089 1067 … … 1600 1578 } 1601 1579 1602 void InspectorDOMAgent::drawHighlight(GraphicsContext& context) const1603 {1604 if (!m_highlightData)1605 return;1606 1607 DOMNodeHighlighter::drawHighlight(context, m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get());1608 }1609 1610 void InspectorDOMAgent::getHighlight(Highlight* highlight) const1611 {1612 if (!m_highlightData)1613 return;1614 1615 DOMNodeHighlighter::getHighlight(m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get(), highlight);1616 }1617 1618 1580 } // namespace WebCore 1619 1581 -
trunk/Source/WebCore/inspector/InspectorDOMAgent.h
r118367 r122966 56 56 class Element; 57 57 class Event; 58 class GraphicsContext;59 class InspectorClient;60 58 class InspectorFrontend; 61 59 class InspectorHistory; 60 class InspectorOverlay; 62 61 class InspectorPageAgent; 63 class IntRect;64 62 class HitTestResult; 65 63 class HTMLElement; … … 71 69 class ScriptValue; 72 70 class ShadowRoot; 73 74 struct Highlight;75 struct HighlightData;76 71 77 72 typedef String ErrorString; … … 104 99 }; 105 100 106 static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, Inspector Client* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)101 static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) 107 102 { 108 return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, client, inspectorState, injectedScriptManager));103 return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, inspectorState, injectedScriptManager, overlay)); 109 104 } 110 105 … … 152 147 virtual void markUndoableState(ErrorString*); 153 148 154 Node* highlightedNode() const;155 156 149 void getEventListeners(Node*, Vector<EventListenerInfo>& listenersArray, bool includeAncestors); 157 150 … … 186 179 void focusNode(); 187 180 188 void drawHighlight(GraphicsContext&) const;189 void getHighlight(Highlight*) const;190 191 181 InspectorHistory* history() { return m_history.get(); } 192 182 … … 206 196 207 197 private: 208 InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, Inspector Client*, InspectorState*, InjectedScriptManager*);198 InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InjectedScriptManager*, InspectorOverlay*); 209 199 210 200 void setSearchingForNode(bool enabled, InspectorObject* highlightConfig); 211 201 bool setHighlightDataFromConfig(InspectorObject* highlightConfig); 212 void highlight();213 202 214 203 // Node-related methods. … … 242 231 243 232 InspectorPageAgent* m_pageAgent; 244 InspectorClient* m_client;245 233 InjectedScriptManager* m_injectedScriptManager; 234 InspectorOverlay* m_overlay; 246 235 InspectorFrontend::DOM* m_frontend; 247 236 DOMListener* m_domListener; … … 257 246 SearchResults m_searchResults; 258 247 OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask; 259 OwnPtr<HighlightData> m_highlightData;260 248 RefPtr<Node> m_nodeToFocus; 261 249 bool m_searchingForNode; -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r121549 r122966 134 134 virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0; 135 135 136 virtual void disable(); 137 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); 138 virtual void didContinue(); 139 136 140 private: 137 141 void enable(); 138 void disable();139 142 bool enabled(); 140 143 … … 143 146 virtual void didParseSource(const String& scriptId, const Script&); 144 147 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); 145 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception);146 virtual void didContinue();147 148 148 149 void setPauseOnExceptionsImpl(ErrorString*, int); -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r122652 r122966 224 224 } 225 225 226 PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client )227 { 228 return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client ));226 PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) 227 { 228 return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client, overlay)); 229 229 } 230 230 … … 309 309 } 310 310 311 InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client )311 InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) 312 312 : InspectorBaseAgent<InspectorPageAgent>("Page", instrumentingAgents, inspectorState) 313 313 , m_page(page) … … 316 316 , m_client(client) 317 317 , m_frontend(0) 318 , m_overlay(overlay) 318 319 , m_lastScriptIdentifier(0) 319 320 , m_lastPaintContext(0) … … 886 887 }; 887 888 888 DOMNodeHighlighter::drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]);889 m_overlay->drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]); 889 890 890 891 m_lastPaintContext = 0; -
trunk/Source/WebCore/inspector/InspectorPageAgent.h
r122532 r122966 54 54 class InspectorClient; 55 55 class InspectorObject; 56 class InspectorOverlay; 56 57 class InspectorState; 57 58 class InstrumentingAgents; … … 78 79 }; 79 80 80 static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient* );81 static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); 81 82 82 83 static bool cachedResourceContent(CachedResource*, String* result, bool* base64Encoded); … … 138 139 139 140 private: 140 InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient* );141 InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); 141 142 void updateViewMetrics(int, int, double, bool); 142 143 … … 148 149 InspectorClient* m_client; 149 150 InspectorFrontend::Page* m_frontend; 151 InspectorOverlay* m_overlay; 150 152 long m_lastScriptIdentifier; 151 153 String m_pendingScriptToEvaluateOnLoadOnce; -
trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp
r121014 r122966 36 36 37 37 #include "Console.h" 38 #include "DOMNodeHighlighter.h" 38 39 #include "Page.h" 39 40 #include "PageScriptDebugServer.h" … … 41 42 namespace WebCore { 42 43 43 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager )44 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) 44 45 { 45 return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager ));46 return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager, overlay)); 46 47 } 47 48 48 PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager )49 PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) 49 50 : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager) 50 51 , m_inspectedPage(inspectedPage) 52 , m_overlay(overlay) 51 53 { 52 54 } … … 93 95 } 94 96 97 void PageDebuggerAgent::disable() 98 { 99 InspectorDebuggerAgent::disable(); 100 m_overlay->setPausedInDebugger(false); 101 } 102 103 void PageDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception) 104 { 105 InspectorDebuggerAgent::didPause(scriptState, callFrames, exception); 106 m_overlay->setPausedInDebugger(true); 107 } 108 109 void PageDebuggerAgent::didContinue() 110 { 111 InspectorDebuggerAgent::didContinue(); 112 m_overlay->setPausedInDebugger(false); 113 } 95 114 96 115 } // namespace WebCore -
trunk/Source/WebCore/inspector/PageDebuggerAgent.h
r121014 r122966 38 38 namespace WebCore { 39 39 40 class InspectorOverlay; 40 41 class Page; 41 42 class PageScriptDebugServer; … … 45 46 WTF_MAKE_FAST_ALLOCATED; 46 47 public: 47 static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager* );48 static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); 48 49 virtual ~PageDebuggerAgent(); 49 50 … … 57 58 virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId); 58 59 59 PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); 60 virtual void disable(); 61 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); 62 virtual void didContinue(); 63 64 PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); 60 65 Page* const m_inspectedPage; 66 InspectorOverlay* m_overlay; 61 67 }; 62 68
Note: See TracChangeset
for help on using the changeset viewer.