| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Google Inc. All rights reserved. | 2 * Copyright (C) 2007 Google Inc. All rights reserved. |
| 3 * Authors: Collin Jackson, Adam Barth | 3 * Authors: Collin Jackson, Adam Barth |
| 4 * | 4 * |
| 5 * This is the V8 version of the KJS InspectorController, which is located in | 5 * This is the V8 version of the KJS InspectorController, which is located in |
| 6 * webkit/pending. | 6 * webkit/pending. |
| 7 * Copyright (C) 2007 Apple Inc. All rights reserved. | 7 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "FloatRect.h" | 51 #include "FloatRect.h" |
| 52 #include "Frame.h" | 52 #include "Frame.h" |
| 53 #include "FrameLoader.h" | 53 #include "FrameLoader.h" |
| 54 #include "FrameTree.h" | 54 #include "FrameTree.h" |
| 55 #include "FrameView.h" | 55 #include "FrameView.h" |
| 56 #include "GraphicsContext.h" | 56 #include "GraphicsContext.h" |
| 57 #include "HTMLFrameOwnerElement.h" | 57 #include "HTMLFrameOwnerElement.h" |
| 58 #include "InspectorClient.h" | 58 #include "InspectorClient.h" |
| 59 #include "v8_proxy.h" | 59 #include "v8_proxy.h" |
| 60 #include "v8_binding.h" | 60 #include "v8_binding.h" |
| 61 // TODO(ojan): Import this and enable the JavaScriptDebugServer in the code belo
w. | |
| 62 // We need to do this once we start adding debugger hooks or when we do the next | |
| 63 // full webkit merge, whichever comes first. | |
| 64 // #include "JavaScriptDebugServer.h" | |
| 65 #include "Page.h" | 61 #include "Page.h" |
| 66 #include "Range.h" | 62 #include "Range.h" |
| 67 #include "ResourceRequest.h" | 63 #include "ResourceRequest.h" |
| 68 #include "ResourceResponse.h" | 64 #include "ResourceResponse.h" |
| 69 #include "ScriptCallContext.h" | 65 #include "ScriptCallContext.h" |
| 70 #include "ScriptController.h" | 66 #include "ScriptController.h" |
| 71 #include "Settings.h" | 67 #include "Settings.h" |
| 72 #include "SharedBuffer.h" | 68 #include "SharedBuffer.h" |
| 73 #include "SystemTime.h" | 69 #include "SystemTime.h" |
| 74 #include "TextEncoding.h" | 70 #include "TextEncoding.h" |
| 75 #include "TextIterator.h" | 71 #include "TextIterator.h" |
| 76 #include <wtf/RefCounted.h> | 72 #include <wtf/RefCounted.h> |
| 77 | 73 |
| 78 #if ENABLE(DATABASE) | 74 #if ENABLE(DATABASE) |
| 79 #include "Database.h" | 75 #include "Database.h" |
| 80 #include "JSDatabase.h" | 76 #include "JSDatabase.h" |
| 81 #endif | 77 #endif |
| 82 | 78 |
| 79 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 80 #include "JavaScriptDebugServer.h" |
| 81 #endif |
| 82 |
| 83 namespace WebCore { | 83 namespace WebCore { |
| 84 | 84 |
| 85 // Maximum size of the console message cache. | 85 // Maximum size of the console message cache. |
| 86 static const size_t MAX_CONSOLE_MESSAGES = 250; | 86 static const size_t MAX_CONSOLE_MESSAGES = 250; |
| 87 | 87 |
| 88 namespace bug1228513 { | 88 namespace bug1228513 { |
| 89 // TODO(ericroman): Temporary hacks to help diagnose http://b/1228513 | 89 // TODO(ericroman): Temporary hacks to help diagnose http://b/1228513 |
| 90 | 90 |
| 91 // To remove all these hacks, search for "bug1228513" | 91 // To remove all these hacks, search for "bug1228513" |
| 92 // in InspectorController.{cpp,h} | 92 // in InspectorController.{cpp,h} |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // version uses an OwnPtr (http://b/904340). However, since we're not | 607 // version uses an OwnPtr (http://b/904340). However, since we're not |
| 608 // using a create method to initialize the InspectorController, we need | 608 // using a create method to initialize the InspectorController, we need |
| 609 // to start the RefCount at 0. | 609 // to start the RefCount at 0. |
| 610 RefCounted<InspectorController>(0) | 610 RefCounted<InspectorController>(0) |
| 611 , m_bug1228513_inspectorState(bug1228513::VALID) | 611 , m_bug1228513_inspectorState(bug1228513::VALID) |
| 612 , m_trackResources(false) | 612 , m_trackResources(false) |
| 613 , m_inspectedPage(page) | 613 , m_inspectedPage(page) |
| 614 , m_client(client) | 614 , m_client(client) |
| 615 , m_page(0) | 615 , m_page(0) |
| 616 , m_windowVisible(false) | 616 , m_windowVisible(false) |
| 617 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 617 , m_debuggerAttached(false) | 618 , m_debuggerAttached(false) |
| 618 , m_attachDebuggerWhenShown(false) | 619 , m_attachDebuggerWhenShown(false) |
| 620 #endif |
| 619 , m_recordingUserInitiatedProfile(false) | 621 , m_recordingUserInitiatedProfile(false) |
| 620 , m_showAfterVisible(ElementsPanel) | 622 , m_showAfterVisible(ElementsPanel) |
| 621 , m_nextIdentifier(-2) | 623 , m_nextIdentifier(-2) |
| 622 , m_groupLevel(0) | 624 , m_groupLevel(0) |
| 623 { | 625 { |
| 624 ASSERT_ARG(page, page); | 626 ASSERT_ARG(page, page); |
| 625 ASSERT_ARG(client, client); | 627 ASSERT_ARG(client, client); |
| 626 } | 628 } |
| 627 | 629 |
| 628 InspectorController::~InspectorController() | 630 InspectorController::~InspectorController() |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 m_windowVisible = visible; | 752 m_windowVisible = visible; |
| 751 | 753 |
| 752 if (!hasScriptObject()) | 754 if (!hasScriptObject()) |
| 753 return; | 755 return; |
| 754 | 756 |
| 755 if (m_windowVisible) { | 757 if (m_windowVisible) { |
| 756 setAttachedWindow(attached); | 758 setAttachedWindow(attached); |
| 757 populateScriptObjects(); | 759 populateScriptObjects(); |
| 758 if (m_nodeToFocus) | 760 if (m_nodeToFocus) |
| 759 focusNode(); | 761 focusNode(); |
| 762 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 760 if (m_attachDebuggerWhenShown) | 763 if (m_attachDebuggerWhenShown) |
| 761 startDebuggingAndReloadInspectedPage(); | 764 startDebuggingAndReloadInspectedPage(); |
| 765 #endif |
| 762 if (m_showAfterVisible != CurrentPanel) | 766 if (m_showAfterVisible != CurrentPanel) |
| 763 showPanel(m_showAfterVisible); | 767 showPanel(m_showAfterVisible); |
| 764 } else { | 768 } else { |
| 765 stopDebugging(); | 769 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 770 stopDebugging(); |
| 771 #endif |
| 766 resetScriptObjects(); | 772 resetScriptObjects(); |
| 767 } | 773 } |
| 768 | 774 |
| 769 m_showAfterVisible = CurrentPanel; | 775 m_showAfterVisible = CurrentPanel; |
| 770 } | 776 } |
| 771 | 777 |
| 772 void InspectorController::enableTrackResources(bool trackResources) | 778 void InspectorController::enableTrackResources(bool trackResources) |
| 773 { | 779 { |
| 774 if (m_trackResources == trackResources) | 780 if (m_trackResources == trackResources) |
| 775 return; | 781 return; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 } | 1002 } |
| 997 } | 1003 } |
| 998 | 1004 |
| 999 void InspectorController::close() | 1005 void InspectorController::close() |
| 1000 { | 1006 { |
| 1001 if (!enabled()) | 1007 if (!enabled()) |
| 1002 return; | 1008 return; |
| 1003 | 1009 |
| 1004 ++bug1228513::g_totalNumClose; | 1010 ++bug1228513::g_totalNumClose; |
| 1005 | 1011 |
| 1006 stopDebugging(); | 1012 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 1013 stopDebugging(); |
| 1014 #endif |
| 1007 closeWindow(); | 1015 closeWindow(); |
| 1008 if (m_page) { | 1016 if (m_page) { |
| 1009 v8::HandleScope handle_scope; | 1017 v8::HandleScope handle_scope; |
| 1010 v8::Handle<v8::Context> context = V8Proxy::GetContext(m_page->mainFrame(
)); | 1018 v8::Handle<v8::Context> context = V8Proxy::GetContext(m_page->mainFrame(
)); |
| 1011 v8::Context::Scope scope(context); | 1019 v8::Context::Scope scope(context); |
| 1012 setScriptObject(v8::Handle<v8::Object>()); | 1020 setScriptObject(v8::Handle<v8::Object>()); |
| 1013 } | 1021 } |
| 1014 | 1022 |
| 1015 m_page = 0; | 1023 m_page = 0; |
| 1016 } | 1024 } |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 void InspectorController::moveWindowBy(float x, float y) const | 1618 void InspectorController::moveWindowBy(float x, float y) const |
| 1611 { | 1619 { |
| 1612 if (!m_page || !enabled()) | 1620 if (!m_page || !enabled()) |
| 1613 return; | 1621 return; |
| 1614 | 1622 |
| 1615 FloatRect frameRect = m_page->chrome()->windowRect(); | 1623 FloatRect frameRect = m_page->chrome()->windowRect(); |
| 1616 frameRect.move(x, y); | 1624 frameRect.move(x, y); |
| 1617 m_page->chrome()->setWindowRect(frameRect); | 1625 m_page->chrome()->setWindowRect(frameRect); |
| 1618 } | 1626 } |
| 1619 | 1627 |
| 1620 void InspectorController::startDebuggingAndReloadInspectedPage() | |
| 1621 { | |
| 1622 notImplemented(); | |
| 1623 } | |
| 1624 | |
| 1625 void InspectorController::stopDebugging() | |
| 1626 { | |
| 1627 notImplemented(); | |
| 1628 } | |
| 1629 | |
| 1630 static void drawOutlinedRect(GraphicsContext& context, const IntRect& rect, cons
t Color& fillColor) | 1628 static void drawOutlinedRect(GraphicsContext& context, const IntRect& rect, cons
t Color& fillColor) |
| 1631 { | 1629 { |
| 1632 static const int outlineThickness = 1; | 1630 static const int outlineThickness = 1; |
| 1633 static const Color outlineColor(62, 86, 180, 228); | 1631 static const Color outlineColor(62, 86, 180, 228); |
| 1634 | 1632 |
| 1635 IntRect outline = rect; | 1633 IntRect outline = rect; |
| 1636 outline.inflate(outlineThickness); | 1634 outline.inflate(outlineThickness); |
| 1637 | 1635 |
| 1638 context.clearRect(outline); | 1636 context.clearRect(outline); |
| 1639 | 1637 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 element->scrollIntoViewIfNeeded(); | 1725 element->scrollIntoViewIfNeeded(); |
| 1728 overlayRect = view->visibleContentRect(); | 1726 overlayRect = view->visibleContentRect(); |
| 1729 } | 1727 } |
| 1730 | 1728 |
| 1731 context.translate(-overlayRect.x(), -overlayRect.y()); | 1729 context.translate(-overlayRect.x(), -overlayRect.y()); |
| 1732 | 1730 |
| 1733 drawHighlightForBoxes(context, lineBoxRects, contentBox, paddingBox, borderB
ox, marginBox); | 1731 drawHighlightForBoxes(context, lineBoxRects, contentBox, paddingBox, borderB
ox, marginBox); |
| 1734 } | 1732 } |
| 1735 | 1733 |
| 1736 } // namespace WebCore | 1734 } // namespace WebCore |
| OLD | NEW |