WebCore:
Land the new Inspector.
Co-written with Tim Hatcher.
Reviewed by Anders, Adele, Hyatt, and Sam.
No regression tests possible.
Add a new InspectorController that is in charge of the Inspector. It
has an InspectorClient that controls the Inspector's window and node
highlight.
* page/InspectorClient.h: Added.
(WebCore::InspectorClient::~InspectorClient):
* page/InspectorController.cpp: Added.
(WebCore::ConsoleMessage::ConsoleMessage):
(WebCore::InspectorResource::): Represents a single resource that the
Inspector knows about.
(WebCore::InspectorResource::InspectorResource):
(WebCore::InspectorResource::~InspectorResource):
(WebCore::InspectorResource::type):
(WebCore::InspectorResource::setScriptObject):
(WebCore::addSourceToFrame): Callback available from JS.
(WebCore::getResourceDocumentNode): Ditto.
(WebCore::highlightDOMNode): Ditto.
(WebCore::hideDOMNodeHighlight): Ditto.
(WebCore::loaded): Ditto.
(WebCore::unloading): Ditto.
(WebCore::attach): Ditto.
(WebCore::detach): Ditto.
(WebCore::log): Ditto.
(WebCore::search): Ditto.
(WebCore::inspectedWindow): Ditto.
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::~InspectorController):
(WebCore::InspectorController::inspect): Called by
ContextMenuController to inspect a node.
(WebCore::InspectorController::focusNode):
(WebCore::InspectorController::highlight):
(WebCore::InspectorController::hideHighlight):
(WebCore::InspectorController::windowVisible):
(WebCore::InspectorController::setWindowVisible):
(WebCore::InspectorController::addMessageToConsole):
(WebCore::InspectorController::attachWindow):
(WebCore::InspectorController::detachWindow):
(WebCore::InspectorController::windowScriptObjectAvailable):
(WebCore::InspectorController::scriptObjectReady):
(WebCore::InspectorController::windowUnloading):
(WebCore::addHeaders): Static helper function.
(WebCore::objectForRequest): Ditto.
(WebCore::objectForResponse): Ditto.
(WebCore::InspectorController::addScriptResource):
(WebCore::InspectorController::addAndUpdateScriptResource):
(WebCore::InspectorController::removeScriptResource):
(WebCore::InspectorController::updateScriptResource):
(WebCore::InspectorController::populateScriptResources):
(WebCore::InspectorController::addScriptConsoleMessage):
(WebCore::callClearFunction): Static helper function.
(WebCore::InspectorController::clearScriptResources):
(WebCore::InspectorController::clearScriptConsoleMessages):
(WebCore::InspectorController::clearNetworkTimeline):
(WebCore::InspectorController::pruneResources):
(WebCore::InspectorController::didCommitLoad): Callback from
FrameLoader.
(WebCore::InspectorController::frameDetachedFromParent): Ditto.
(WebCore::InspectorController::addResource): Ditto.
(WebCore::InspectorController::removeResource): Ditto.
(WebCore::InspectorController::didLoadResourceFromMemoryCache): Ditto.
(WebCore::InspectorController::identifierForInitialRequest): Ditto.
(WebCore::InspectorController::willSendRequest): Ditto.
(WebCore::InspectorController::didReceiveResponse): Ditto.
(WebCore::InspectorController::didReceiveContentLength): Ditto.
(WebCore::InspectorController::didFinishLoading): Ditto.
(WebCore::InspectorController::didFailLoading): Ditto.
* page/InspectorController.h: Added.
(WebCore::InspectorController::inspectedPage):
(WebCore::InspectorController::scriptContext):
(WebCore::InspectorController::setScriptContext):
(WebCore::InspectorController::resources):
(WebCore::InspectorController::removeAllResources):
Add the JavaScript that defines most of the behavior of the Inspector.
* page/inspector/ConsolePanel.js: Added.
* page/inspector/NetworkPanel.js: Added.
* page/inspector/Resource.js: Added.
* page/inspector/ResourceCategory.js: Added.
* page/inspector/ResourcePanel.js: Added.
* page/inspector/inspector.js: Added.
* page/inspector/treeoutline.js: Renamed from WebKit/WebInspector/webInspector/treeoutline.js.
* page/inspector/utilities.js: Added.
Add the Inspector's CSS and HTML.
* page/inspector/inspector.css: Added.
* page/inspector/inspector.html: Added.
Hang the InspectorController off of Page. We only create an
InspectorController if an InspectorClient is given to the Page.
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::inspectorController):
Use FrameLoader to notify the InspectorController of resource loads.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::begin):
(WebCore::FrameLoader::transitionToCommitted):
(WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
(WebCore::FrameLoader::detachFromParent):
(WebCore::FrameLoader::assignIdentifierToInitialRequest):
(WebCore::FrameLoader::willSendRequest):
(WebCore::FrameLoader::didReceiveResponse):
(WebCore::FrameLoader::didReceiveData):
(WebCore::FrameLoader::sendRemainingDelegateMessages):
(WebCore::FrameLoader::requestFromDelegate):
(WebCore::FrameLoader::didFinishLoad):
(WebCore::FrameLoader::dispatchWindowObjectAvailable):
(WebCore::FrameLoader::dispatchDidCommitLoad):
(WebCore::FrameLoader::dispatchAssignIdentifierToInitialRequest):
(WebCore::FrameLoader::dispatchWillSendRequest):
(WebCore::FrameLoader::dispatchDidReceiveResponse):
(WebCore::FrameLoader::dispatchDidReceiveContentLength):
(WebCore::FrameLoader::dispatchDidFinishLoading):
(WebCore::FrameLoader::dispatchDidLoadResourceFromMemoryCache):
* loader/FrameLoader.h:
Send console messages to the InspectorController.
* page/Chrome.cpp:
(WebCore::Chrome::addMessageToConsole): Send all console messages to
the InspectorController.
* page/Chrome.h: Add a new MessageLevel and MessageSource that are
used in the Inspector JS.
Report HTML errors when the Inspector window is open.
We don't report errors when the window is closed because we don't want
to slow down the HTMLTokenizer.
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::createTokenizer):
* html/HTMLParser.cpp:
(WebCore::HTMLParser::HTMLParser):
* html/HTMLParser.h:
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::HTMLTokenizer):
* html/HTMLTokenizer.h:
Append the "Inspect Element" context menu item after passing the
context menu to the ContextMenuClient. This work used to be done in
WebKit.
* page/ContextMenuClient.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent): Add the
"Inspect Element" item.
(WebCore::ContextMenuController::contextMenuItemSelected): Handle the
"Inspect Element" item.
* platform/ContextMenu.cpp:
(WebCore::ContextMenu::addInspectElementItem):
(WebCore::ContextMenu::checkOrEnableIfNeeded): Updated for "Inspect
Element" item.
* platform/ContextMenu.h:
* platform/ContextMenuItem.h:
(WebCore::): Add ContextMenuItemTagInspectElement.
* platform/graphics/svg/SVGImageEmptyClients.h:
* page/mac/WebCoreViewFactory.h: Add the "Inspect Element" localized
string.
* platform/LocalizedStrings.h: Ditto.
* platform/mac/LocalizedStringsMac.mm:
(WebCore::contextMenuItemTagInspectElement): Ditto.
Miscellaneous changes:
* css/view-source.css: Add message bubble styles.
* loader/DocumentLoader.h: Add a frame getter.
* platform/win/ScrollViewWin.cpp:
(WebCore::ScrollView::updateScrollbars): Respect
Frame::prohibitsScrolling.
Add new images needed for the Inspector.
* page/inspector/Images/attachedShadow.png: Added.
* page/inspector/Images/bottomShadow.png: Added.
* page/inspector/Images/breadcrumbBackground.png: Added.
* page/inspector/Images/checker.png: Added.
* page/inspector/Images/console.png: Added.
* page/inspector/Images/darkShadow.png: Added.
* page/inspector/Images/disclosureDownPressed.png: Added.
* page/inspector/Images/disclosureRightDown.png: Added.
* page/inspector/Images/disclosureRightPressed.png: Added.
* page/inspector/Images/document.png: Added.
* page/inspector/Images/domViewButton.png: Added.
* page/inspector/Images/domViewButtonSelected.png: Added.
* page/inspector/Images/downTriangle.png: Added.
* page/inspector/Images/errorIcon.png: Added.
* page/inspector/Images/errorMediumIcon.png: Added.
* page/inspector/Images/folder.png: Added.
* page/inspector/Images/goArrow.png: Added.
* page/inspector/Images/gradient.png: Added.
* page/inspector/Images/gradientHighlight.png: Added.
* page/inspector/Images/gradientHighlightBottom.png: Added.
* page/inspector/Images/hideStatusWidget.png: Added.
* page/inspector/Images/hideStatusWidgetPressed.png: Added.
* page/inspector/Images/network.png: Added.
* page/inspector/Images/paneBottomGrow.png: Added.
* page/inspector/Images/paneBottomGrowActive.png: Added.
* page/inspector/Images/paneGrowHandleLine.png: Added.
* page/inspector/Images/paneHeader.png: Added.
* page/inspector/Images/paneHeaderActive.png: Added.
* page/inspector/Images/plainDocument.png: Added.
* page/inspector/Images/popupArrows.png: Added.
* page/inspector/Images/rightTriangle.png: Added.
* page/inspector/Images/segment.png: Added.
* page/inspector/Images/segmentEnd.png: Added.
* page/inspector/Images/segmentHover.png: Added.
* page/inspector/Images/segmentHoverEnd.png: Added.
* page/inspector/Images/segmentSelected.png: Added.
* page/inspector/Images/segmentSelectedEnd.png: Added.
* page/inspector/Images/showStatusWidget.png: Added.
* page/inspector/Images/showStatusWidgetPressed.png: Added.
* page/inspector/Images/sidbarItemBackground.png: Added.
* page/inspector/Images/sidebarActionWidget.png: Added.
* page/inspector/Images/sidebarActionWidgetPressed.png: Added.
* page/inspector/Images/sidebarAttachWidget.png: Added.
* page/inspector/Images/sidebarAttachWidgetPressed.png: Added.
* page/inspector/Images/sidebarDetachWidget.png: Added.
* page/inspector/Images/sidebarDetachWidgetPressed.png: Added.
* page/inspector/Images/sidebarResizeWidget.png: Added.
* page/inspector/Images/sidebarSelection.png: Added.
* page/inspector/Images/sidebarSelectionBlurred.png: Added.
* page/inspector/Images/sidebarSelectionBlurredTall.png: Added.
* page/inspector/Images/sidebarSelectionGray.png: Added.
* page/inspector/Images/sidebarSelectionGrayTall.png: Added.
* page/inspector/Images/sidebarSelectionTall.png: Added.
* page/inspector/Images/sidebarStatusAreaBackground.png: Added.
* page/inspector/Images/sourceViewButton.png: Added.
* page/inspector/Images/sourceViewButtonSelected.png: Added.
* page/inspector/Images/splitviewDimple.png: Added.
* page/inspector/Images/splitviewDividerBackground.png: Added.
* page/inspector/Images/tab.png: Added.
* page/inspector/Images/tabSelected.png: Added.
* page/inspector/Images/timelinePillBlue.png: Added.
* page/inspector/Images/timelinePillGray.png: Added.
* page/inspector/Images/timelinePillGreen.png: Added.
* page/inspector/Images/timelinePillOrange.png: Added.
* page/inspector/Images/timelinePillPurple.png: Added.
* page/inspector/Images/timelinePillRed.png: Added.
* page/inspector/Images/timelinePillYellow.png: Added.
* page/inspector/Images/tipBalloon.png: Added.
* page/inspector/Images/tipBalloonBottom.png: Added.
* page/inspector/Images/tipIcon.png: Added.
* page/inspector/Images/tipIconPressed.png: Added.
* page/inspector/Images/toggleDown.png: Added.
* page/inspector/Images/toggleUp.png: Added.
* page/inspector/Images/toolbarBackground.png: Added.
* page/inspector/Images/toolbarBackgroundInactive.png: Added.
* page/inspector/Images/toolbarButton.png: Added.
* page/inspector/Images/toolbarButtonInactive.png: Added.
* page/inspector/Images/toolbarButtonPressed.png: Added.
* page/inspector/Images/toolbarButtonPressedInactive.png: Added.
* page/inspector/Images/toolbarSplitButtonDivider.png: Added.
* page/inspector/Images/toolbarSplitButtonDividerInactive.png: Added.
* page/inspector/Images/treeDownTriangleBlack.png: Added.
* page/inspector/Images/treeDownTriangleWhite.png: Added.
* page/inspector/Images/treeLeftTriangleBlack.png: Added.
* page/inspector/Images/treeRightTriangleBlack.png: Added.
* page/inspector/Images/treeRightTriangleWhite.png: Added.
* page/inspector/Images/warningIcon.png: Added.
* page/inspector/Images/warningMediumIcon.png: Added.
* page/inspector/Images/warningsErrors.png: Added.
Build-fu:
* WebCore.exp: Added new symbols.
* WebCore.xcodeproj/project.pbxproj: Added new source files and
resources.
* WebCore.vcproj/WebCore.vcproj: Ditto, and copy the resources to
$WebKitOutputDir.
Windows build fixes:
* history/HistoryItem.h: ResourceRequest is a struct.
* loader/FrameLoaderClient.h: Ditto.
WebKit:
Land the new Inspector.
Co-written with Tim Hatcher.
Reviewed by Anders, Adele, Hyatt, and Sam.
Implement the InspectorClient interface.
* WebCoreSupport/WebInspectorClient.h: Added.
* WebCoreSupport/WebInspectorClient.mm: Added.
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):
(WebInspectorClient::createPage):
(WebInspectorClient::showWindow):
(WebInspectorClient::closeWindow):
(WebInspectorClient::attachWindow):
(WebInspectorClient::detachWindow):
(WebInspectorClient::highlight):
(WebInspectorClient::hideHighlight):
(WebInspectorClient::inspectedURLChanged):
(WebInspectorClient::updateWindowTitle):
(-[WebInspectorWindowController init]):
(-[WebInspectorWindowController initWithInspectedWebView:]):
(-[WebInspectorWindowController dealloc]):
(-[WebInspectorWindowController inspectorVisible]):
(-[WebInspectorWindowController webView]):
(-[WebInspectorWindowController window]):
(-[WebInspectorWindowController windowShouldClose:]):
(-[WebInspectorWindowController close]):
(-[WebInspectorWindowController showWindow:]):
(-[WebInspectorWindowController attach]):
(-[WebInspectorWindowController detach]):
(-[WebInspectorWindowController highlightAndScrollToNode:]):
(-[WebInspectorWindowController highlightNode:]):
(-[WebInspectorWindowController hideHighlight]):
(-[WebInspectorWindowController animationDidEnd:]):
Add an easier-to-see highlight.
* Misc/WebNSViewExtras.h:
* Misc/WebNSViewExtras.m:
(-[NSView _web_convertRect:toView:]):
* WebInspector/WebNodeHighlight.h:
* WebInspector/WebNodeHighlight.m:
(-[WebNodeHighlightFadeInAnimation setCurrentProgress:]):
(-[WebNodeHighlight initWithTargetView:]):
(-[WebNodeHighlight setHighlightedNode:]):
(-[WebNodeHighlight highlightedNode]):
(-[WebNodeHighlight dealloc]):
(-[WebNodeHighlight attachHighlight]):
(-[WebNodeHighlight delegate]):
(-[WebNodeHighlight detachHighlight]):
(-[WebNodeHighlight show]):
(-[WebNodeHighlight hide]):
(-[WebNodeHighlight animationDidEnd:]):
(-[WebNodeHighlight ignoresMouseEvents]):
(-[WebNodeHighlight highlightView]):
(-[WebNodeHighlight setDelegate:]):
(-[WebNodeHighlight setHolesNeedUpdateInTargetViewRect:]):
(-[WebNodeHighlight setIgnoresMouseEvents:]):
(-[WebNodeHighlight targetView]):
(-[WebNodeHighlight _computeHighlightWindowFrame]):
(-[WebNodeHighlight _repositionHighlightWindow]):
* WebInspector/WebNodeHighlightView.h:
* WebInspector/WebNodeHighlightView.m:
(-[WebNodeHighlightView initWithWebNodeHighlight:]):
(-[WebNodeHighlightView dealloc]):
(-[WebNodeHighlightView detachFromWebNodeHighlight]):
(-[WebNodeHighlightView drawRect:]):
(-[WebNodeHighlightView webNodeHighlight]):
(-[WebNodeHighlightView fractionFadedIn]):
(-[WebNodeHighlightView setFractionFadedIn:]):
(-[WebNodeHighlightView setHolesNeedUpdateInRect:]):
(-[WebNodeHighlightView _holes]):
WebView changes needed for the new Inspector.
* WebView/WebView.mm: Remove the old _inspectElement method now that
this is handled by WebCore.
(-[WebView _isClosed]): Added.
(-[WebView initWithFrame]): Give each Page an InspectorClient to
enable the Inspector.
* WebView/WebViewPrivate.h:
Updates needed for WebCore changes.
* WebCoreSupport/WebContextMenuClient.h:
* WebCoreSupport/WebContextMenuClient.mm:
* WebCoreSupport/WebViewFactory.mm:
(-[WebViewFactory contextMenuItemTagInspectElement]):
* WebView/WebUIDelegatePrivate.h:
Remove old Inspector code.
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache):
(WebFrameLoaderClient::assignIdentifierToInitialRequest):
(WebFrameLoaderClient::dispatchDidFinishLoading):
* WebInspector/WebInspector.m: Removed.
* WebInspector/WebInspectorPanel.h: Removed.
* WebInspector/WebInspectorPanel.m: Removed.
* WebInspector/webInspector/Images/button.png: Removed.
* WebInspector/webInspector/Images/buttonDivider.png: Removed.
* WebInspector/webInspector/Images/buttonPressed.png: Removed.
* WebInspector/webInspector/Images/close.png: Removed.
* WebInspector/webInspector/Images/closePressed.png: Removed.
* WebInspector/webInspector/Images/downTriangle.png: Removed.
* WebInspector/webInspector/Images/menu.png: Removed.
* WebInspector/webInspector/Images/menuPressed.png: Removed.
* WebInspector/webInspector/Images/popup.png: Removed.
* WebInspector/webInspector/Images/popupPressed.png: Removed.
* WebInspector/webInspector/Images/resize.png: Removed.
* WebInspector/webInspector/Images/rightTriangle.png: Removed.
* WebInspector/webInspector/Images/scrollThumbBottom.png: Removed.
* WebInspector/webInspector/Images/scrollThumbMiddle.png: Removed.
* WebInspector/webInspector/Images/scrollTrackBottom.png: Removed.
* WebInspector/webInspector/Images/upTriangle.png: Removed.
* WebInspector/webInspector/inspector.css: Removed.
* WebInspector/webInspector/inspector.html: Removed.
* WebInspector/webInspector/inspector.js: Removed.
* WebInspector/webInspector/scrollarea.js: Removed.
* WebInspector/webInspector/scrollbar.js: Removed.
* WebInspector/webInspector/utilities.js: Removed.
* WebView/WebFrame.mm:
(-[WebFramePrivate dealloc]):
* WebView/WebFrameInternal.h:
* WebView/WebHTMLView.mm:
(-[WebHTMLView menuForEvent:]):
Build-fu:
* WebKit.exp:
* WebKit.xcodeproj/project.pbxproj:
WebKit/win:
Land the new Inspector.
Co-written with Tim Hatcher.
Reviewed by Anders, Adele, Hyatt, and Sam.
Implement the InspectorClient interface.
* WebInspectorClient.cpp: Added.
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::~WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):
(WebInspectorClient::createPage):
(WebInspectorClient::showWindow):
(WebInspectorClient::closeWindow):
(WebInspectorClient::windowVisible):
(WebInspectorClient::attachWindow):
(WebInspectorClient::detachWindow):
(WebInspectorClient::highlight):
(WebInspectorClient::hideHighlight):
(WebInspectorClient::inspectedURLChanged):
(WebInspectorClient::updateWindowTitle):
(WebInspectorClient::onSize):
(WebInspectorClient::onClose):
(WebInspectorClient::onWebViewWindowPosChanging):
(WebInspectorWndProc):
(SubclassedWebViewWndProc):
(registerWindowClass):
* WebInspectorClient.h: Added.
Add an easier-to-see highlight.
* WebNodeHighlight.cpp: Added.
(WebNodeHighlight::WebNodeHighlight):
(WebNodeHighlight::~WebNodeHighlight):
(WebNodeHighlight::highlight):
(WebNodeHighlight::hide):
(WebNodeHighlight::visible):
(WebNodeHighlight::updateWindow):
(WebNodeHighlight::removeSubclass):
(registerOverlayClass):
(OverlayWndProc):
(SubclassedWndProc):
* WebNodeHighlight.h: Added.
WebView changes needed for the new Inspector.
* WebView.cpp: Removed old inspectElement method now that this is
handled by WebCore.
(WebView::WebView):
(WebView::close):
(WebView::performContextMenuAction): Removed handling of the Inspect
Element context menu item.
(WebView::initWithFrame): Give each Page an InspectorClient to enable
the Inspector.
(WebView::setProhibitsMainFrameScrolling): Added.
* WebView.h:
Updates needed for WebCore changes.
* Interfaces/IWebUIDelegate.idl:
* WebContextMenuClient.cpp:
(WebContextMenuClient::getCustomMenuFromDefaultItems):
* WebContextMenuClient.h:
* WebCoreLocalizedStrings.cpp:
Remove old Inspector code.
* WebFrame.cpp:
* WebFrame.h:
* WebInspector/WebInspector.cpp: Removed.
* WebInspector/WebInspector.h: Removed.
* WebInspector/webInspector/Images/button.png: Removed.
* WebInspector/webInspector/Images/buttonDivider.png: Removed.
* WebInspector/webInspector/Images/buttonPressed.png: Removed.
* WebInspector/webInspector/Images/close.png: Removed.
* WebInspector/webInspector/Images/closePressed.png: Removed.
* WebInspector/webInspector/Images/downTriangle.png: Removed.
* WebInspector/webInspector/Images/menu.png: Removed.
* WebInspector/webInspector/Images/menuPressed.png: Removed.
* WebInspector/webInspector/Images/popup.png: Removed.
* WebInspector/webInspector/Images/popupPressed.png: Removed.
* WebInspector/webInspector/Images/resize.png: Removed.
* WebInspector/webInspector/Images/rightTriangle.png: Removed.
* WebInspector/webInspector/Images/scrollThumbBottom.png: Removed.
* WebInspector/webInspector/Images/scrollThumbMiddle.png: Removed.
* WebInspector/webInspector/Images/scrollTrackMiddle.png: Removed.
* WebInspector/webInspector/Images/upTriangle.png: Removed.
* WebInspector/webInspector/inspector.css: Removed.
* WebInspector/webInspector/inspector.html: Removed.
* WebInspector/webInspector/inspector.js: Removed.
* WebInspector/webInspector/scrollarea.js: Removed.
* WebInspector/webInspector/scrollbar.js: Removed.
* WebInspector/webInspector/treeoutline.js: Removed.
* WebInspector/webInspector/utilities.js: Removed.
Build-fu:
* WebKit.vcproj/WebKit.vcproj:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23677
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-06-20 Adam Roben <aroben@apple.com>
+
+ Land the new Inspector.
+
+ Co-written with Tim Hatcher.
+
+ Reviewed by Anders, Adele, Hyatt, and Sam.
+
+ No regression tests possible.
+
+ Add a new InspectorController that is in charge of the Inspector. It
+ has an InspectorClient that controls the Inspector's window and node
+ highlight.
+
+ * page/InspectorClient.h: Added.
+ (WebCore::InspectorClient::~InspectorClient):
+ * page/InspectorController.cpp: Added.
+ (WebCore::ConsoleMessage::ConsoleMessage):
+ (WebCore::InspectorResource::): Represents a single resource that the
+ Inspector knows about.
+ (WebCore::InspectorResource::InspectorResource):
+ (WebCore::InspectorResource::~InspectorResource):
+ (WebCore::InspectorResource::type):
+ (WebCore::InspectorResource::setScriptObject):
+ (WebCore::addSourceToFrame): Callback available from JS.
+ (WebCore::getResourceDocumentNode): Ditto.
+ (WebCore::highlightDOMNode): Ditto.
+ (WebCore::hideDOMNodeHighlight): Ditto.
+ (WebCore::loaded): Ditto.
+ (WebCore::unloading): Ditto.
+ (WebCore::attach): Ditto.
+ (WebCore::detach): Ditto.
+ (WebCore::log): Ditto.
+ (WebCore::search): Ditto.
+ (WebCore::inspectedWindow): Ditto.
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::~InspectorController):
+ (WebCore::InspectorController::inspect): Called by
+ ContextMenuController to inspect a node.
+ (WebCore::InspectorController::focusNode):
+ (WebCore::InspectorController::highlight):
+ (WebCore::InspectorController::hideHighlight):
+ (WebCore::InspectorController::windowVisible):
+ (WebCore::InspectorController::setWindowVisible):
+ (WebCore::InspectorController::addMessageToConsole):
+ (WebCore::InspectorController::attachWindow):
+ (WebCore::InspectorController::detachWindow):
+ (WebCore::InspectorController::windowScriptObjectAvailable):
+ (WebCore::InspectorController::scriptObjectReady):
+ (WebCore::InspectorController::windowUnloading):
+ (WebCore::addHeaders): Static helper function.
+ (WebCore::objectForRequest): Ditto.
+ (WebCore::objectForResponse): Ditto.
+ (WebCore::InspectorController::addScriptResource):
+ (WebCore::InspectorController::addAndUpdateScriptResource):
+ (WebCore::InspectorController::removeScriptResource):
+ (WebCore::InspectorController::updateScriptResource):
+ (WebCore::InspectorController::populateScriptResources):
+ (WebCore::InspectorController::addScriptConsoleMessage):
+ (WebCore::callClearFunction): Static helper function.
+ (WebCore::InspectorController::clearScriptResources):
+ (WebCore::InspectorController::clearScriptConsoleMessages):
+ (WebCore::InspectorController::clearNetworkTimeline):
+ (WebCore::InspectorController::pruneResources):
+ (WebCore::InspectorController::didCommitLoad): Callback from
+ FrameLoader.
+ (WebCore::InspectorController::frameDetachedFromParent): Ditto.
+ (WebCore::InspectorController::addResource): Ditto.
+ (WebCore::InspectorController::removeResource): Ditto.
+ (WebCore::InspectorController::didLoadResourceFromMemoryCache): Ditto.
+ (WebCore::InspectorController::identifierForInitialRequest): Ditto.
+ (WebCore::InspectorController::willSendRequest): Ditto.
+ (WebCore::InspectorController::didReceiveResponse): Ditto.
+ (WebCore::InspectorController::didReceiveContentLength): Ditto.
+ (WebCore::InspectorController::didFinishLoading): Ditto.
+ (WebCore::InspectorController::didFailLoading): Ditto.
+ * page/InspectorController.h: Added.
+ (WebCore::InspectorController::inspectedPage):
+ (WebCore::InspectorController::scriptContext):
+ (WebCore::InspectorController::setScriptContext):
+ (WebCore::InspectorController::resources):
+ (WebCore::InspectorController::removeAllResources):
+
+ Add the JavaScript that defines most of the behavior of the Inspector.
+
+ * page/inspector/ConsolePanel.js: Added.
+ * page/inspector/NetworkPanel.js: Added.
+ * page/inspector/Resource.js: Added.
+ * page/inspector/ResourceCategory.js: Added.
+ * page/inspector/ResourcePanel.js: Added.
+ * page/inspector/inspector.js: Added.
+ * page/inspector/treeoutline.js: Renamed from WebKit/WebInspector/webInspector/treeoutline.js.
+ * page/inspector/utilities.js: Added.
+
+ Add the Inspector's CSS and HTML.
+
+ * page/inspector/inspector.css: Added.
+ * page/inspector/inspector.html: Added.
+
+ Hang the InspectorController off of Page. We only create an
+ InspectorController if an InspectorClient is given to the Page.
+
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/Page.h:
+ (WebCore::Page::inspectorController):
+
+ Use FrameLoader to notify the InspectorController of resource loads.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::begin):
+ (WebCore::FrameLoader::transitionToCommitted):
+ (WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
+ (WebCore::FrameLoader::detachFromParent):
+ (WebCore::FrameLoader::assignIdentifierToInitialRequest):
+ (WebCore::FrameLoader::willSendRequest):
+ (WebCore::FrameLoader::didReceiveResponse):
+ (WebCore::FrameLoader::didReceiveData):
+ (WebCore::FrameLoader::sendRemainingDelegateMessages):
+ (WebCore::FrameLoader::requestFromDelegate):
+ (WebCore::FrameLoader::didFinishLoad):
+ (WebCore::FrameLoader::dispatchWindowObjectAvailable):
+ (WebCore::FrameLoader::dispatchDidCommitLoad):
+ (WebCore::FrameLoader::dispatchAssignIdentifierToInitialRequest):
+ (WebCore::FrameLoader::dispatchWillSendRequest):
+ (WebCore::FrameLoader::dispatchDidReceiveResponse):
+ (WebCore::FrameLoader::dispatchDidReceiveContentLength):
+ (WebCore::FrameLoader::dispatchDidFinishLoading):
+ (WebCore::FrameLoader::dispatchDidLoadResourceFromMemoryCache):
+ * loader/FrameLoader.h:
+
+ Send console messages to the InspectorController.
+
+ * page/Chrome.cpp:
+ (WebCore::Chrome::addMessageToConsole): Send all console messages to
+ the InspectorController.
+ * page/Chrome.h: Add a new MessageLevel and MessageSource that are
+ used in the Inspector JS.
+
+ Report HTML errors when the Inspector window is open.
+ We don't report errors when the window is closed because we don't want
+ to slow down the HTMLTokenizer.
+
+ * html/HTMLDocument.cpp:
+ (WebCore::HTMLDocument::createTokenizer):
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::HTMLParser):
+ * html/HTMLParser.h:
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::HTMLTokenizer):
+ * html/HTMLTokenizer.h:
+
+ Append the "Inspect Element" context menu item after passing the
+ context menu to the ContextMenuClient. This work used to be done in
+ WebKit.
+
+ * page/ContextMenuClient.h:
+ * page/ContextMenuController.cpp:
+ (WebCore::ContextMenuController::handleContextMenuEvent): Add the
+ "Inspect Element" item.
+ (WebCore::ContextMenuController::contextMenuItemSelected): Handle the
+ "Inspect Element" item.
+ * platform/ContextMenu.cpp:
+ (WebCore::ContextMenu::addInspectElementItem):
+ (WebCore::ContextMenu::checkOrEnableIfNeeded): Updated for "Inspect
+ Element" item.
+ * platform/ContextMenu.h:
+ * platform/ContextMenuItem.h:
+ (WebCore::): Add ContextMenuItemTagInspectElement.
+ * platform/graphics/svg/SVGImageEmptyClients.h:
+ * page/mac/WebCoreViewFactory.h: Add the "Inspect Element" localized
+ string.
+ * platform/LocalizedStrings.h: Ditto.
+ * platform/mac/LocalizedStringsMac.mm:
+ (WebCore::contextMenuItemTagInspectElement): Ditto.
+
+ Miscellaneous changes:
+
+ * css/view-source.css: Add message bubble styles.
+ * loader/DocumentLoader.h: Add a frame getter.
+ * platform/win/ScrollViewWin.cpp:
+ (WebCore::ScrollView::updateScrollbars): Respect
+ Frame::prohibitsScrolling.
+
+ Add new images needed for the Inspector.
+
+ * page/inspector/Images/attachedShadow.png: Added.
+ * page/inspector/Images/bottomShadow.png: Added.
+ * page/inspector/Images/breadcrumbBackground.png: Added.
+ * page/inspector/Images/checker.png: Added.
+ * page/inspector/Images/console.png: Added.
+ * page/inspector/Images/darkShadow.png: Added.
+ * page/inspector/Images/disclosureDownPressed.png: Added.
+ * page/inspector/Images/disclosureRightDown.png: Added.
+ * page/inspector/Images/disclosureRightPressed.png: Added.
+ * page/inspector/Images/document.png: Added.
+ * page/inspector/Images/domViewButton.png: Added.
+ * page/inspector/Images/domViewButtonSelected.png: Added.
+ * page/inspector/Images/downTriangle.png: Added.
+ * page/inspector/Images/errorIcon.png: Added.
+ * page/inspector/Images/errorMediumIcon.png: Added.
+ * page/inspector/Images/folder.png: Added.
+ * page/inspector/Images/goArrow.png: Added.
+ * page/inspector/Images/gradient.png: Added.
+ * page/inspector/Images/gradientHighlight.png: Added.
+ * page/inspector/Images/gradientHighlightBottom.png: Added.
+ * page/inspector/Images/hideStatusWidget.png: Added.
+ * page/inspector/Images/hideStatusWidgetPressed.png: Added.
+ * page/inspector/Images/network.png: Added.
+ * page/inspector/Images/paneBottomGrow.png: Added.
+ * page/inspector/Images/paneBottomGrowActive.png: Added.
+ * page/inspector/Images/paneGrowHandleLine.png: Added.
+ * page/inspector/Images/paneHeader.png: Added.
+ * page/inspector/Images/paneHeaderActive.png: Added.
+ * page/inspector/Images/plainDocument.png: Added.
+ * page/inspector/Images/popupArrows.png: Added.
+ * page/inspector/Images/rightTriangle.png: Added.
+ * page/inspector/Images/segment.png: Added.
+ * page/inspector/Images/segmentEnd.png: Added.
+ * page/inspector/Images/segmentHover.png: Added.
+ * page/inspector/Images/segmentHoverEnd.png: Added.
+ * page/inspector/Images/segmentSelected.png: Added.
+ * page/inspector/Images/segmentSelectedEnd.png: Added.
+ * page/inspector/Images/showStatusWidget.png: Added.
+ * page/inspector/Images/showStatusWidgetPressed.png: Added.
+ * page/inspector/Images/sidbarItemBackground.png: Added.
+ * page/inspector/Images/sidebarActionWidget.png: Added.
+ * page/inspector/Images/sidebarActionWidgetPressed.png: Added.
+ * page/inspector/Images/sidebarAttachWidget.png: Added.
+ * page/inspector/Images/sidebarAttachWidgetPressed.png: Added.
+ * page/inspector/Images/sidebarDetachWidget.png: Added.
+ * page/inspector/Images/sidebarDetachWidgetPressed.png: Added.
+ * page/inspector/Images/sidebarResizeWidget.png: Added.
+ * page/inspector/Images/sidebarSelection.png: Added.
+ * page/inspector/Images/sidebarSelectionBlurred.png: Added.
+ * page/inspector/Images/sidebarSelectionBlurredTall.png: Added.
+ * page/inspector/Images/sidebarSelectionGray.png: Added.
+ * page/inspector/Images/sidebarSelectionGrayTall.png: Added.
+ * page/inspector/Images/sidebarSelectionTall.png: Added.
+ * page/inspector/Images/sidebarStatusAreaBackground.png: Added.
+ * page/inspector/Images/sourceViewButton.png: Added.
+ * page/inspector/Images/sourceViewButtonSelected.png: Added.
+ * page/inspector/Images/splitviewDimple.png: Added.
+ * page/inspector/Images/splitviewDividerBackground.png: Added.
+ * page/inspector/Images/tab.png: Added.
+ * page/inspector/Images/tabSelected.png: Added.
+ * page/inspector/Images/timelinePillBlue.png: Added.
+ * page/inspector/Images/timelinePillGray.png: Added.
+ * page/inspector/Images/timelinePillGreen.png: Added.
+ * page/inspector/Images/timelinePillOrange.png: Added.
+ * page/inspector/Images/timelinePillPurple.png: Added.
+ * page/inspector/Images/timelinePillRed.png: Added.
+ * page/inspector/Images/timelinePillYellow.png: Added.
+ * page/inspector/Images/tipBalloon.png: Added.
+ * page/inspector/Images/tipBalloonBottom.png: Added.
+ * page/inspector/Images/tipIcon.png: Added.
+ * page/inspector/Images/tipIconPressed.png: Added.
+ * page/inspector/Images/toggleDown.png: Added.
+ * page/inspector/Images/toggleUp.png: Added.
+ * page/inspector/Images/toolbarBackground.png: Added.
+ * page/inspector/Images/toolbarBackgroundInactive.png: Added.
+ * page/inspector/Images/toolbarButton.png: Added.
+ * page/inspector/Images/toolbarButtonInactive.png: Added.
+ * page/inspector/Images/toolbarButtonPressed.png: Added.
+ * page/inspector/Images/toolbarButtonPressedInactive.png: Added.
+ * page/inspector/Images/toolbarSplitButtonDivider.png: Added.
+ * page/inspector/Images/toolbarSplitButtonDividerInactive.png: Added.
+ * page/inspector/Images/treeDownTriangleBlack.png: Added.
+ * page/inspector/Images/treeDownTriangleWhite.png: Added.
+ * page/inspector/Images/treeLeftTriangleBlack.png: Added.
+ * page/inspector/Images/treeRightTriangleBlack.png: Added.
+ * page/inspector/Images/treeRightTriangleWhite.png: Added.
+ * page/inspector/Images/warningIcon.png: Added.
+ * page/inspector/Images/warningMediumIcon.png: Added.
+ * page/inspector/Images/warningsErrors.png: Added.
+
+ Build-fu:
+
+ * WebCore.exp: Added new symbols.
+ * WebCore.xcodeproj/project.pbxproj: Added new source files and
+ resources.
+ * WebCore.vcproj/WebCore.vcproj: Ditto, and copy the resources to
+ $WebKitOutputDir.
+
+ Windows build fixes:
+
+ * history/HistoryItem.h: ResourceRequest is a struct.
+ * loader/FrameLoaderClient.h: Ditto.
+
2007-06-20 Mitz Pettel <mitz@webkit.org>
Reviewed by Beth.
__ZN7WebCore10EventNames10clickEventE
__ZN7WebCore10EventNames12keydownEventE
__ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbPNS_9DOMWindowEiiiiibbbbtPNS_15EventTargetNodeEPNS_9ClipboardEb
+__ZN7WebCore10StringImpl11computeHashEPKtj
__ZN7WebCore10StringImpl7replaceEtt
__ZN7WebCore10StringImplD1Ev
__ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
__ZN7WebCore12IconDatabase8importedEv
__ZN7WebCore12SharedBuffer10wrapNSDataEP6NSData
__ZN7WebCore12SharedBuffer12createNSDataEv
+__ZN7WebCore12TextEncodingC1ERKNS_6StringE
__ZN7WebCore12iconDatabaseEv
__ZN7WebCore13HitTestResultC1ERKS0_
__ZN7WebCore13HitTestResultD1Ev
__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
__ZN7WebCore16NavigationActionC1Ev
__ZN7WebCore18PlatformMouseEventC1EP7NSEvent
+__ZN7WebCore19InspectorController16setWindowVisibleEb
__ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEbRi
__ZN7WebCore19SelectionController5clearEv
__ZN7WebCore19SelectionController9selectAllEv
__ZN7WebCore20JavaScriptStatistics31garbageCollectOnAlternateThreadEb
__ZN7WebCore21ContextMenuController16clearContextMenuEv
__ZN7WebCore21PlatformKeyboardEventC1EP7NSEventb
+__ZN7WebCore21WindowsLatin1EncodingEv
__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
__ZN7WebCore24notifyHistoryItemChangedE
__ZN7WebCore4Page12setGroupNameERKNS_6StringE
__ZN7WebCore4Page15backForwardListEv
__ZN7WebCore4Page16setDefersLoadingEb
+__ZN7WebCore4Page18setInspectorClientEPNS_15InspectorClientE
__ZN7WebCore4Page23clearUndoRedoOperationsEv
__ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore9TimerBaseC2Ev
__ZN7WebCore9TimerBaseD2Ev
__ZN7WebCore9pageCacheEv
+__ZN7WebCoreeqERKNS_15ResourceRequestES2_
__ZN7WebCoreeqERKNS_4KURLES2_
__ZNK7WebCore10StringImplcvP8NSStringEv
__ZNK7WebCore11CachedImage5imageEv
__ZNK7WebCore12EventHandler17eventMayStartDragERKNS_18PlatformMouseEventE
__ZNK7WebCore12EventHandler20currentKeyboardEventEv
__ZNK7WebCore12RenderObject25backslashAsCurrencySymbolEv
+__ZNK7WebCore12SharedBuffer4dataEv
+__ZNK7WebCore12SharedBuffer4sizeEv
+__ZNK7WebCore12TextEncoding6decodeEPKcm
__ZNK7WebCore13HitTestResult10isLiveLinkEv
__ZNK7WebCore13HitTestResult10isSelectedEv
__ZNK7WebCore13HitTestResult11targetFrameEv
__ZNK7WebCore13HitTestResult9imageRectEv
__ZNK7WebCore13ResourceErrorcvP7NSErrorEv
__ZNK7WebCore14DocumentLoader10isStoppingEv
+__ZNK7WebCore14DocumentLoader10requestURLEv
__ZNK7WebCore14DocumentLoader11frameLoaderEv
__ZNK7WebCore14DocumentLoader11isCommittedEv
__ZNK7WebCore14DocumentLoader14initialRequestEv
__ZNK7WebCore14ResourceLoader11frameLoaderEv
__ZNK7WebCore15ProgressTracker17estimatedProgressEv
__ZNK7WebCore15ResourceRequest12nsURLRequestEv
+__ZNK7WebCore15ResourceRequest16httpHeaderFieldsEv
__ZNK7WebCore15ResourceRequest3urlEv
__ZNK7WebCore15ResourceRequest7isEmptyEv
__ZNK7WebCore16DeprecatedString11getNSStringEv
__ZNK7WebCore16DeprecatedString3midEjj
__ZNK7WebCore16DeprecatedString8endsWithERKS0_
__ZNK7WebCore16ResourceResponse13nsURLResponseEv
+__ZNK7WebCore16ResourceResponse14httpStatusCodeEv
+__ZNK7WebCore16ResourceResponse16httpHeaderFieldsEv
+__ZNK7WebCore16ResourceResponse16textEncodingNameEv
+__ZNK7WebCore16ResourceResponse17suggestedFilenameEv
+__ZNK7WebCore16ResourceResponse21expectedContentLengthEv
__ZNK7WebCore16ResourceResponse3urlEv
+__ZNK7WebCore16ResourceResponse8mimeTypeEv
__ZNK7WebCore19SelectionController17isInPasswordFieldEv
__ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
__ZNK7WebCore4Font11primaryFontEv
+__ZNK7WebCore4KURL17lastPathComponentEv
__ZNK7WebCore4KURL4hostEv
+__ZNK7WebCore4KURL4pathEv
__ZNK7WebCore4KURL8getNSURLEv
__ZNK7WebCore5Frame10isFrameSetEv
__ZNK7WebCore5Frame12eventHandlerEv
__ZNK7WebCore6Editor7canEditEv
__ZNK7WebCore6Editor8canPasteEv
__ZNK7WebCore6Editor9canDeleteEv
+__ZNK7WebCore6String10charactersEv
__ZNK7WebCore6String16deprecatedStringEv
__ZNK7WebCore6String6lengthEv
__ZNK7WebCore6String7isEmptyEv
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s "$(ProjectDir)\..\page\inspector\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
"
/>
</Configuration>
<Configuration
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s "$(ProjectDir)\..\page\inspector\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
"
/>
</Configuration>
<Configuration
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y "$(ProjectDir)..\bridge\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\events\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\misc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\scripts\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\ksvg2\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\kjs\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s "$(ProjectDir)\..\page\inspector\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
"
/>
</Configuration>
</Configurations>
>
</File>
<File
+ RelativePath="..\page\InspectorClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\page\InspectorController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\InspectorController.h"
+ >
+ </File>
+ <File
RelativePath="..\page\MouseEventWithHitTestResults.cpp"
>
</File>
065AD4F70B0C2EDA005A2B1D /* ContextMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */; settings = {ATTRIBUTES = (Private, ); }; };
0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; };
0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */; };
+ 06693DBA0BFBA2F400216072 /* InspectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 06693DB70BFBA2F400216072 /* InspectorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 06693DBB0BFBA2F400216072 /* InspectorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06693DB80BFBA2F400216072 /* InspectorController.cpp */; };
+ 06693DBC0BFBA2F400216072 /* InspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = 06693DB90BFBA2F400216072 /* InspectorController.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 06693F7B0BFBC91700216072 /* inspector in Resources */ = {isa = PBXBuildFile; fileRef = 06693F450BFBC91600216072 /* inspector */; };
066C772B0AB603B700238CC4 /* FileChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772A0AB603B700238CC4 /* FileChooser.h */; };
066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 066C772C0AB603D200238CC4 /* FileChooserMac.mm */; };
066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 066C772E0AB603FD00238CC4 /* RenderFileUploadControl.cpp */; };
14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14D8238A0AF92DF60004F057 /* Chrome.cpp */; };
14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D824060AF93AEB0004F057 /* ChromeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
14DC0D3709FED073007B0235 /* JSNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DC0D3509FED073007B0235 /* JSNode.cpp */; };
- 14DC0D3809FED073007B0235 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DC0D3609FED073007B0235 /* JSNode.h */; };
+ 14DC0D3809FED073007B0235 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DC0D3609FED073007B0235 /* JSNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14E8378309F85D1C00B85AE4 /* JSEvent.cpp */; };
14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E8378D09F85D4F00B85AE4 /* JSEvent.h */; };
14EC267F09CA07E000E1EEEC /* EventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
93B70D6509EB0C7C009D8468 /* kjs_css.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4909EB0C7C009D8468 /* kjs_css.cpp */; };
93B70D6609EB0C7C009D8468 /* kjs_css.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4A09EB0C7C009D8468 /* kjs_css.h */; };
93B70D6709EB0C7C009D8468 /* kjs_dom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4B09EB0C7C009D8468 /* kjs_dom.cpp */; };
- 93B70D6809EB0C7C009D8468 /* kjs_dom.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4C09EB0C7C009D8468 /* kjs_dom.h */; };
+ 93B70D6809EB0C7C009D8468 /* kjs_dom.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4C09EB0C7C009D8468 /* kjs_dom.h */; settings = {ATTRIBUTES = (Private, ); }; };
93B70D6909EB0C7C009D8468 /* kjs_events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4D09EB0C7C009D8468 /* kjs_events.cpp */; };
93B70D6A09EB0C7C009D8468 /* kjs_events.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4E09EB0C7C009D8468 /* kjs_events.h */; };
93B70D6B09EB0C7C009D8468 /* kjs_html.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4F09EB0C7C009D8468 /* kjs_html.cpp */; };
A8185F3E09765766005826D9 /* DOMImplementation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8185F3609765765005826D9 /* DOMImplementation.cpp */; };
A8185F3F09765766005826D9 /* DocumentFragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8185F3709765765005826D9 /* DocumentFragment.cpp */; };
A8185F4009765766005826D9 /* Document.h in Headers */ = {isa = PBXBuildFile; fileRef = A8185F3809765765005826D9 /* Document.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A818721B0977D3C0005826D9 /* NodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872100977D3C0005826D9 /* NodeList.h */; };
+ A818721B0977D3C0005826D9 /* NodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872100977D3C0005826D9 /* NodeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
A818721C0977D3C0005826D9 /* ContainerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872110977D3C0005826D9 /* ContainerNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
A818721E0977D3C0005826D9 /* NameNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872130977D3C0005826D9 /* NameNodeList.h */; };
A818721F0977D3C0005826D9 /* ContainerNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A81872140977D3C0005826D9 /* ContainerNode.cpp */; };
BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C0E0979C3BD00467741 /* CachedXSLStyleSheet.cpp */; };
BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */; };
BCB16C290979C3BD00467741 /* DocLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C100979C3BD00467741 /* DocLoader.cpp */; };
- BCB16C2A0979C3BD00467741 /* DocLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C110979C3BD00467741 /* DocLoader.h */; };
+ BCB16C2A0979C3BD00467741 /* DocLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C110979C3BD00467741 /* DocLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCB16C2C0979C3BD00467741 /* loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C130979C3BD00467741 /* loader.cpp */; };
BCB16C2D0979C3BD00467741 /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C140979C3BD00467741 /* loader.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCB16C2E0979C3BD00467741 /* Request.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C150979C3BD00467741 /* Request.cpp */; };
065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenuController.h; sourceTree = "<group>"; };
0668E1890ADD9624004128E0 /* PopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PopupMenu.h; sourceTree = "<group>"; };
0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PopupMenuMac.mm; sourceTree = "<group>"; };
+ 06693DB70BFBA2F400216072 /* InspectorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InspectorClient.h; sourceTree = "<group>"; };
+ 06693DB80BFBA2F400216072 /* InspectorController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorController.cpp; sourceTree = "<group>"; };
+ 06693DB90BFBA2F400216072 /* InspectorController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InspectorController.h; sourceTree = "<group>"; };
+ 06693F450BFBC91600216072 /* inspector */ = {isa = PBXFileReference; lastKnownFileType = folder; path = inspector; sourceTree = "<group>"; };
066C772A0AB603B700238CC4 /* FileChooser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FileChooser.h; sourceTree = "<group>"; };
066C772C0AB603D200238CC4 /* FileChooserMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FileChooserMac.mm; sourceTree = "<group>"; };
066C772E0AB603FD00238CC4 /* RenderFileUploadControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFileUploadControl.cpp; sourceTree = "<group>"; };
65BF02180974806300C43196 /* page */ = {
isa = PBXGroup;
children = (
+ 06693F450BFBC91600216072 /* inspector */,
93C09A820B064F05005ABD4D /* mac */,
8538F0000AD71770006A81D1 /* AbstractView.idl */,
BC124EE40C2641CD009E2349 /* BarInfo.cpp */,
65A21483097A3F5300B9050A /* FrameTree.h */,
65CBFEF70974F607001DAC25 /* FrameView.cpp */,
65CBFEF80974F607001DAC25 /* FrameView.h */,
+ 06693DB70BFBA2F400216072 /* InspectorClient.h */,
+ 06693DB80BFBA2F400216072 /* InspectorController.cpp */,
+ 06693DB90BFBA2F400216072 /* InspectorController.h */,
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
BC94D1520C275C8B006BC617 /* History.idl */,
93799EF90BF2743600D0F230 /* RenderWordBreak.h in Headers */,
37919C1D0BF3762800956998 /* ShapeArabic.h in Headers */,
BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */,
+ 06693DBA0BFBA2F400216072 /* InspectorClient.h in Headers */,
+ 06693DBC0BFBA2F400216072 /* InspectorController.h in Headers */,
BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */,
BC06ED070BFD5BAE00856E9D /* JSHTMLTableSectionElement.h in Headers */,
BC06ED9E0BFD660600856E9D /* JSHTMLTableColElement.h in Headers */,
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
933A142F0B7D188600A53FFD /* TextEvent.idl in Resources */,
464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */,
464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */,
+ 06693F7B0BFBC91700216072 /* inspector in Resources */,
BC491B4F0C023E2D009D6316 /* HTMLMarqueeElement.idl in Resources */,
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
93799EF80BF2743600D0F230 /* RenderWordBreak.cpp in Sources */,
37919C190BF375DD00956998 /* ShapeArabic.c in Sources */,
BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */,
+ 06693DBB0BFBA2F400216072 /* InspectorController.cpp in Sources */,
BCA169A20BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp in Sources */,
BC06ED060BFD5BAE00856E9D /* JSHTMLTableSectionElement.cpp in Sources */,
BC06ED9D0BFD660600856E9D /* JSHTMLTableColElement.cpp in Sources */,
color: rgb(26, 26, 166)
}
-/*
.webkit-html-external-link {
+ text-decoration: none;
+}
+
+.webkit-html-external-link:hover {
+ text-decoration: underline;
}
+/*
.webkit-html-resource-link {
}
*/
.webkit-html-entity {
rgb(136, 18, 128);
}
+
+.webkit-html-message-bubble {
+ -webkit-box-shadow: black 0px 2px 5px;
+ -webkit-border-radius: 9px;
+ -webkit-border-fit: lines;
+ font-size: 9px;
+ font-family: Lucida Grande;
+ font-weight: bold;
+ margin: 6px 25px;
+ padding: 0 7px 1px;
+}
+
+.webkit-html-warning-message {
+ background-color: rgb(100%, 62%, 42%);
+ border: 2px solid rgb(100%, 52%, 21%);
+}
+
+.webkit-html-error-message {
+ background-color: rgb(100%, 42%, 42%);
+ border: 2px solid rgb(100%, 31%, 31%);
+}
+
+.webkit-html-message-line {
+ padding-left: 23px;
+ text-indent: -20px;
+}
+
+.webkit-html-message-icon {
+ position: relative;
+ top: 2px;
+ margin: 0 4px;
+}
class Document;
class Image;
class KURL;
-class ResourceRequest;
+struct ResourceRequest;
class HistoryItem;
typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
#include "HTMLElementFactory.h"
#include "HTMLNames.h"
#include "HTMLTokenizer.h"
+#include "InspectorController.h"
#include "KURL.h"
+#include "Page.h"
#include "cssstyleselector.h"
#include "DocTypeStrings.cpp"
Tokenizer *HTMLDocument::createTokenizer()
{
- return new HTMLTokenizer(this);
+ bool reportErrors = false;
+ if (Page* page = m_frame->page())
+ if (InspectorController* controller = page->inspectorController())
+ reportErrors = controller->windowVisible();
+
+ return new HTMLTokenizer(this, reportErrors);
}
// --------------------------------------------------------------------------
*
*/
-HTMLParser::HTMLParser(HTMLDocument* doc)
+HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors)
: document(doc)
, current(doc)
, didRefCurrent(false)
, haveContent(false)
, haveFrameSet(false)
, m_isParsingFragment(false)
- , m_reportErrors(false)
+ , m_reportErrors(reportErrors)
, inStrayTableContent(0)
{
}
*/
class HTMLParser : Noncopyable {
public:
- HTMLParser(HTMLDocument*);
+ HTMLParser(HTMLDocument*, bool reportErrors);
HTMLParser(DocumentFragment*);
virtual ~HTMLParser();
// ----------------------------------------------------------------------------
-HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc)
+HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc, bool reportErrors)
: Tokenizer()
, buffer(0)
, scriptCode(0)
, m_requestingScript(false)
, m_timer(this, &HTMLTokenizer::timerFired)
, m_doc(doc)
- , parser(new HTMLParser(doc))
+ , parser(new HTMLParser(doc, reportErrors))
, inWrite(false)
, m_fragment(false)
{
class HTMLTokenizer : public Tokenizer, public CachedResourceClient {
public:
- HTMLTokenizer(HTMLDocument*);
+ HTMLTokenizer(HTMLDocument*, bool reportErrors);
HTMLTokenizer(HTMLViewSourceDocument*);
HTMLTokenizer(DocumentFragment*);
virtual ~HTMLTokenizer();
virtual ~DocumentLoader();
void setFrame(Frame*);
+ Frame* frame() const { return m_frame; }
+
virtual void attachToFrame();
virtual void detachFromFrame();
#include "HTTPParsers.h"
#include "IconDatabase.h"
#include "IconLoader.h"
+#include "InspectorController.h"
#include "Logging.h"
#include "MainResourceLoader.h"
#include "MimeTypeRegistry.h"
void FrameLoader::begin(const KURL& url)
{
clear();
- partClearedInBegin();
+ dispatchWindowObjectAvailable();
m_needsClear = true;
m_isComplete = false;
m_committedFirstRealDocumentLoad = true;
- m_client->dispatchDidCommitLoad();
+ dispatchDidCommitLoad();
// If we have a title let the WebView know about it.
if (!ptitle.isNull())
m_provisionalDocumentLoader->setLoadingFromCachedPage(false);
unsigned long identifier = m_frame->page()->progress()->createUniqueIdentifier();
- m_client->assignIdentifierToInitialRequest(identifier, m_provisionalDocumentLoader.get(), m_provisionalDocumentLoader->originalRequest());
+ dispatchAssignIdentifierToInitialRequest(identifier, m_provisionalDocumentLoader.get(), m_provisionalDocumentLoader->originalRequest());
if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier))
m_provisionalDocumentLoader->updateLoading();
stopAllLoaders();
saveScrollPositionAndViewStateToItem(currentHistoryItem());
detachChildren();
+
+ if (m_frame->page()) {
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->frameDetachedFromParent(m_frame);
+ }
+
m_client->detachedFromParent2();
setDocumentLoader(0);
m_client->detachedFromParent3();
void FrameLoader::assignIdentifierToInitialRequest(unsigned long identifier, const ResourceRequest& clientRequest)
{
- return m_client->assignIdentifierToInitialRequest(identifier, activeDocumentLoader(), clientRequest);
+ return dispatchAssignIdentifierToInitialRequest(identifier, activeDocumentLoader(), clientRequest);
}
void FrameLoader::willSendRequest(ResourceLoader* loader, ResourceRequest& clientRequest, const ResourceResponse& redirectResponse)
{
applyUserAgent(clientRequest);
- m_client->dispatchWillSendRequest(loader->documentLoader(), loader->identifier(), clientRequest, redirectResponse);
+ dispatchWillSendRequest(loader->documentLoader(), loader->identifier(), clientRequest, redirectResponse);
}
void FrameLoader::didReceiveResponse(ResourceLoader* loader, const ResourceResponse& r)
if (m_frame->page())
m_frame->page()->progress()->incrementProgress(loader->identifier(), r);
- m_client->dispatchDidReceiveResponse(loader->documentLoader(), loader->identifier(), r);
+ dispatchDidReceiveResponse(loader->documentLoader(), loader->identifier(), r);
}
void FrameLoader::didReceiveData(ResourceLoader* loader, const char* data, int length, int lengthReceived)
{
if (m_frame->page())
m_frame->page()->progress()->incrementProgress(loader->identifier(), data, length);
- m_client->dispatchDidReceiveContentLength(loader->documentLoader(), loader->identifier(), lengthReceived);
+ dispatchDidReceiveContentLength(loader->documentLoader(), loader->identifier(), lengthReceived);
}
void FrameLoader::didFailToLoad(ResourceLoader* loader, const ResourceError& error)
void FrameLoader::sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse& response, unsigned length, const ResourceError& error)
{
if (!response.isNull())
- m_client->dispatchDidReceiveResponse(m_documentLoader.get(), identifier, response);
+ dispatchDidReceiveResponse(m_documentLoader.get(), identifier, response);
if (length > 0)
- m_client->dispatchDidReceiveContentLength(m_documentLoader.get(), identifier, length);
+ dispatchDidReceiveContentLength(m_documentLoader.get(), identifier, length);
if (error.isNull())
- m_client->dispatchDidFinishLoading(m_documentLoader.get(), identifier);
+ dispatchDidFinishLoading(m_documentLoader.get(), identifier);
else
m_client->dispatchDidFailLoading(m_documentLoader.get(), identifier, error);
}
ASSERT(!request.isNull());
identifier = m_frame->page()->progress()->createUniqueIdentifier();
- m_client->assignIdentifierToInitialRequest(identifier, m_documentLoader.get(), request);
+ dispatchAssignIdentifierToInitialRequest(identifier, m_documentLoader.get(), request);
ResourceRequest newRequest(request);
- m_client->dispatchWillSendRequest(m_documentLoader.get(), identifier, newRequest, ResourceResponse());
+ dispatchWillSendRequest(m_documentLoader.get(), identifier, newRequest, ResourceResponse());
if (newRequest.isNull())
error = m_client->cancelledError(request);
void FrameLoader::loadedResourceFromMemoryCache(const ResourceRequest& request, const ResourceResponse& response, int length)
{
- if (m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, response, length))
+ if (dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, response, length))
return;
unsigned long identifier;
{
if (m_frame->page())
m_frame->page()->progress()->completeProgress(loader->identifier());
- m_client->dispatchDidFinishLoading(loader->documentLoader(), loader->identifier());
+ dispatchDidFinishLoading(loader->documentLoader(), loader->identifier());
}
void FrameLoader::didReceiveAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
return documentLoader()->request().httpReferrer();
}
-void FrameLoader::partClearedInBegin()
+void FrameLoader::dispatchWindowObjectAvailable()
{
Settings* settings = m_frame->settings();
- if (settings && settings->isJavaScriptEnabled())
+ if (settings && settings->isJavaScriptEnabled()) {
m_client->windowObjectCleared();
+
+ if (InspectorController* inspector = m_frame->page()->parentInspectorController())
+ inspector->windowScriptObjectAvailable();
+ }
}
Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, Element* element, const HashMap<String, String>& args)
return localSchemes().contains(scheme);
}
+void FrameLoader::dispatchDidCommitLoad()
+{
+ m_client->dispatchDidCommitLoad();
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->didCommitLoad(m_documentLoader.get());
+}
+
+void FrameLoader::dispatchAssignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
+{
+ m_client->assignIdentifierToInitialRequest(identifier, loader, request);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->identifierForInitialRequest(identifier, loader, request);
+}
+
+void FrameLoader::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+{
+ m_client->dispatchWillSendRequest(loader, identifier, request, redirectResponse);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->willSendRequest(loader, identifier, request, redirectResponse);
+}
+
+void FrameLoader::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+{
+ m_client->dispatchDidReceiveResponse(loader, identifier, r);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->didReceiveResponse(loader, identifier, r);
+}
+
+void FrameLoader::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int length)
+{
+ m_client->dispatchDidReceiveContentLength(loader, identifier, length);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->didReceiveContentLength(loader, identifier, length);
+}
+
+void FrameLoader::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier)
+{
+ m_client->dispatchDidFinishLoading(loader, identifier);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->didFinishLoading(loader, identifier);
+}
+
+bool FrameLoader::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
+{
+ bool result = m_client->dispatchDidLoadResourceFromMemoryCache(loader, request, response, length);
+
+ if (InspectorController* inspector = m_frame->page()->inspectorController())
+ inspector->didLoadResourceFromMemoryCache(loader, request, response, length);
+
+ return result;
+}
+
#if USE(LOW_BANDWIDTH_DISPLAY)
bool FrameLoader::addLowBandwidthDisplayRequest(CachedResource* cache)
Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>& args);
- void partClearedInBegin();
+ void dispatchWindowObjectAvailable();
void restoreDocumentState();
String overrideMediaType() const;
void switchOutLowBandwidthDisplayIfReady();
#endif
+ void dispatchDidCommitLoad();
+ void dispatchAssignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
+ void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&);
+ void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int length);
+ void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
+ bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length);
+
Frame* m_frame;
FrameLoaderClient* m_client;
class ResourceError;
class ResourceHandle;
class ResourceLoader;
- class ResourceRequest;
class ResourceResponse;
class SharedBuffer;
class SubstituteData;
class String;
class Widget;
+ struct ResourceRequest;
+
typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
class FrameLoaderClient {
#include "ChromeClient.h"
#include "FloatRect.h"
#include "Frame.h"
+#include "InspectorController.h"
#include "Page.h"
#include "ResourceHandle.h"
#include <wtf/PassRefPtr.h>
{
if (source == JSMessageSource && level == ErrorMessageLevel)
m_client->addMessageToConsole(message, lineNumber, sourceID);
+
+ if (InspectorController* inspector = m_page->inspectorController())
+ inspector->addMessageToConsole(source, level, message, lineNumber, sourceID);
}
bool Chrome::canRunBeforeUnloadConfirmPanel()
HTMLMessageSource,
XMLMessageSource,
JSMessageSource,
- CSSMessageSource
+ CSSMessageSource,
+ OtherMessageSource
};
enum MessageLevel {
+ TipMessageLevel,
LogMessageLevel,
WarningMessageLevel,
ErrorMessageLevel
virtual void lookUpInDictionary(Frame*) = 0;
virtual void speak(const String&) = 0;
virtual void stopSpeaking() = 0;
+ virtual bool shouldIncludeInspectElementItem() = 0;
#if PLATFORM(MAC)
virtual void searchWithSpotlight() = 0;
#include "FrameLoadRequest.h"
#include "HitTestRequest.h"
#include "HitTestResult.h"
+#include "InspectorController.h"
#include "KURL.h"
#include "MouseEvent.h"
#include "Node.h"
m_contextMenu->populate();
PlatformMenuDescription customMenu = m_client->getCustomMenuFromDefaultItems(m_contextMenu.get());
m_contextMenu->setPlatformDescription(customMenu);
+ if (m_client->shouldIncludeInspectElementItem())
+ m_contextMenu->addInspectElementItem();
event->setDefaultHandled();
}
frame->editor()->showColorPanel();
break;
#endif
+ case ContextMenuItemTagInspectElement:
+ if (InspectorController* inspector = frame->page()->inspectorController())
+ inspector->inspect(result.innerNonSharedNode());
+ break;
default:
break;
}
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorClient_h
+#define InspectorClient_h
+
+namespace WebCore {
+
+class Node;
+class Page;
+class String;
+
+class InspectorClient {
+public:
+ virtual ~InspectorClient() { }
+
+ virtual void inspectorDestroyed() = 0;
+
+ virtual Page* createPage() = 0;
+
+ virtual void showWindow() = 0;
+ virtual void closeWindow() = 0;
+
+ virtual void attachWindow() = 0;
+ virtual void detachWindow() = 0;
+
+ virtual void highlight(Node*) = 0;
+ virtual void hideHighlight() = 0;
+
+ virtual void inspectedURLChanged(const String& newURL) = 0;
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorClient_h)
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorController.h"
+
+#include "CString.h"
+#include "CachedResource.h"
+#include "DocLoader.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "Element.h"
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FrameTree.h"
+#include "HTMLFrameOwnerElement.h"
+#include "InspectorClient.h"
+#include "JSRange.h"
+#include "Page.h"
+#include "Range.h"
+#include "ResourceError.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "Shared.h"
+#include "SharedBuffer.h"
+#include "SystemTime.h"
+#include "TextEncoding.h"
+#include "TextIterator.h"
+#include "kjs_dom.h"
+#include "kjs_proxy.h"
+#include "kjs_window.h"
+
+#include <JavaScriptCore/APICast.h>
+#include <JavaScriptCore/JSLock.h>
+
+namespace WebCore {
+
+struct ConsoleMessage {
+ ConsoleMessage(MessageSource s, MessageLevel l, const String& m, unsigned li, const String& u)
+ : source(s)
+ , level(l)
+ , message(m)
+ , line(li)
+ , url(u)
+ {
+ }
+
+ MessageSource source;
+ MessageLevel level;
+ String message;
+ unsigned line;
+ String url;
+};
+
+struct InspectorResource : public Shared<InspectorResource> {
+ // Keep these in sync with WebInspector.Resource.Type
+ enum Type {
+ Doc,
+ Stylesheet,
+ Image,
+ Script,
+ Other
+ };
+
+ InspectorResource(unsigned long identifier, DocumentLoader* documentLoader, Frame* frame)
+ : identifier(identifier)
+ , loader(documentLoader)
+ , frame(frame)
+ , scriptContext(0)
+ , scriptObject(0)
+ , cached(false)
+ , finished(false)
+ , failed(false)
+ , length(0)
+ , startTime(-1.0)
+ , responseReceivedTime(-1.0)
+ , endTime(-1.0)
+ {
+ }
+
+ ~InspectorResource()
+ {
+ setScriptObject(0, 0);
+ }
+
+ Type type() const
+ {
+ if (request.isNull() || response.isNull())
+ return Other;
+
+ if (request.url() == loader->requestURL())
+ return Doc;
+
+ FrameLoader* frameLoader = loader->frameLoader();
+ if (!frameLoader)
+ return Other;
+
+ Document* doc = frameLoader->frame()->document();
+ if (!doc)
+ return Other;
+
+ CachedResource* cachedResource = doc->docLoader()->cachedResource(request.url().url());
+ if (!cachedResource)
+ return Other;
+
+ switch (cachedResource->type()) {
+ case CachedResource::ImageResource:
+ return Image;
+ case CachedResource::CSSStyleSheet:
+#if ENABLE(XSLT)
+ case CachedResource::XSLStyleSheet:
+#endif
+ return Stylesheet;
+ case CachedResource::Script:
+ return Script;
+ default:
+ return Other;
+ }
+ }
+
+ void setScriptObject(JSContextRef context, JSObjectRef newScriptObject)
+ {
+ if (scriptContext && scriptObject)
+ JSValueUnprotect(scriptContext, scriptObject);
+
+ scriptObject = newScriptObject;
+ scriptContext = context;
+
+ ASSERT((context && newScriptObject) || (!context && !newScriptObject));
+ if (context && newScriptObject)
+ JSValueProtect(context, newScriptObject);
+ }
+
+ unsigned long identifier;
+ RefPtr<DocumentLoader> loader;
+ RefPtr<Frame> frame;
+ ResourceRequest request;
+ ResourceResponse response;
+ ResourceResponse redirectResponse;
+ ResourceError error;
+ JSContextRef scriptContext;
+ JSObjectRef scriptObject;
+ bool cached;
+ bool finished;
+ bool failed;
+ int length;
+ double startTime;
+ double responseReceivedTime;
+ double endTime;
+};
+
+static JSValueRef addSourceToFrame(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ JSValueRef undefined = JSValueMakeUndefined(ctx);
+
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (argumentCount < 2 || !controller)
+ return undefined;
+
+ JSValueRef identifierValue = arguments[0];
+ if (!JSValueIsNumber(ctx, identifierValue))
+ return undefined;
+
+ unsigned long identifier = static_cast<unsigned long>(JSValueToNumber(ctx, identifierValue, 0));
+ RefPtr<InspectorResource> resource = controller->resources().get(identifier);
+ ASSERT(resource);
+ if (!resource)
+ return undefined;
+
+ RefPtr<SharedBuffer> buffer;
+ if (resource->request.url() == resource->loader->requestURL())
+ buffer = resource->loader->mainResourceData();
+ else {
+ FrameLoader* frameLoader = resource->loader->frameLoader();
+ if (!frameLoader)
+ return undefined;
+
+ Document* doc = frameLoader->frame()->document();
+ if (!doc)
+ return undefined;
+
+ CachedResource* cachedResource = doc->docLoader()->cachedResource(resource->request.url().url());
+ if (!cachedResource)
+ return undefined;
+
+ buffer = cachedResource->data();
+ }
+
+ if (!buffer)
+ return undefined;
+
+ String textEncodingName = resource->loader->overrideEncoding();
+ if (!textEncodingName)
+ textEncodingName = resource->response.textEncodingName();
+
+ TextEncoding encoding(textEncodingName);
+ if (!encoding.isValid())
+ encoding = WindowsLatin1Encoding();
+ String sourceString = encoding.decode(buffer->data(), buffer->size());
+
+ Node* node = toNode(toJS(arguments[1]));
+ ASSERT(node);
+ if (!node)
+ return undefined;
+
+ if (!node->attached()) {
+ ASSERT_NOT_REACHED();
+ return undefined;
+ }
+
+ ASSERT(node->isElementNode());
+ if (!node->isElementNode())
+ return undefined;
+
+ Element* element = static_cast<Element*>(node);
+ ASSERT(element->isFrameOwnerElement());
+ if (!element->isFrameOwnerElement())
+ return undefined;
+
+ HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(element);
+ ASSERT(frameOwner->contentFrame());
+ if (!frameOwner->contentFrame())
+ return undefined;
+
+ FrameLoader* loader = frameOwner->contentFrame()->loader();
+
+ loader->setResponseMIMEType(resource->response.mimeType());
+ loader->begin();
+ loader->write(sourceString);
+ loader->end();
+
+ return undefined;
+}
+
+static JSValueRef getResourceDocumentNode(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ JSValueRef undefined = JSValueMakeUndefined(ctx);
+
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!argumentCount || argumentCount > 1 || !controller)
+ return undefined;
+
+ JSValueRef identifierValue = arguments[0];
+ if (!JSValueIsNumber(ctx, identifierValue))
+ return undefined;
+
+ unsigned long identifier = static_cast<unsigned long>(JSValueToNumber(ctx, identifierValue, 0));
+ RefPtr<InspectorResource> resource = controller->resources().get(identifier);
+ ASSERT(resource);
+ if (!resource)
+ return undefined;
+
+ FrameLoader* frameLoader = resource->loader->frameLoader();
+ if (!frameLoader)
+ return undefined;
+
+ Document* document = frameLoader->frame()->document();
+ if (!document)
+ return undefined;
+
+ if (document->isPluginDocument() || document->isImageDocument())
+ return undefined;
+
+ KJS::JSLock lock;
+ JSValueRef documentValue = toRef(toJS(toJS(controller->scriptContext()), document));
+ return documentValue;
+}
+
+static JSValueRef highlightDOMNode(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ JSValueRef undefined = JSValueMakeUndefined(context);
+
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (argumentCount < 1 || !controller)
+ return undefined;
+
+ Node* node = toNode(toJS(arguments[0]));
+ if (!node)
+ return undefined;
+
+ controller->highlight(node);
+
+ return undefined;
+}
+
+static JSValueRef hideDOMNodeHighlight(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ JSValueRef undefined = JSValueMakeUndefined(context);
+
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (argumentCount || !controller)
+ return undefined;
+
+ controller->hideHighlight();
+
+ return undefined;
+}
+
+static JSValueRef loaded(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ controller->scriptObjectReady();
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSValueRef unloading(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ controller->windowUnloading();
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSValueRef attach(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ controller->attachWindow();
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSValueRef detach(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ controller->detachWindow();
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSValueRef log(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ if (argumentCount < 1 || !JSValueIsString(ctx, arguments[0]))
+ return JSValueMakeUndefined(ctx);
+
+#ifndef NDEBUG
+ JSStringRef string = JSValueToStringCopy(ctx, arguments[0], 0);
+ String message(JSStringGetCharactersPtr(string), JSStringGetLength(string));
+ JSStringRelease(string);
+
+ fprintf(stderr, "%s\n", message.latin1().data());
+#endif
+
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSValueRef search(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ if (argumentCount < 2 || !JSValueIsString(ctx, arguments[1]))
+ return JSValueMakeUndefined(ctx);
+
+ Node* node = toNode(toJS(arguments[0]));
+ if (!node)
+ return JSValueMakeUndefined(ctx);
+
+ JSStringRef string = JSValueToStringCopy(ctx, arguments[1], 0);
+ String target(JSStringGetCharactersPtr(string), JSStringGetLength(string));
+ JSStringRelease(string);
+
+ JSObjectRef globalObject = JSContextGetGlobalObject(ctx);
+ JSStringRef constructorString = JSStringCreateWithUTF8CString("Array");
+ JSObjectRef arrayConstructor = JSValueToObject(ctx, JSObjectGetProperty(ctx, globalObject, constructorString, 0), 0);
+ JSStringRelease(constructorString);
+ JSObjectRef array = JSObjectCallAsConstructor(ctx, arrayConstructor, 0, 0, 0);
+
+ JSStringRef pushString = JSStringCreateWithUTF8CString("push");
+ JSValueRef pushValue = JSObjectGetProperty(ctx, array, pushString, 0);
+ JSStringRelease(pushString);
+ JSObjectRef push = JSValueToObject(ctx, pushValue, 0);
+
+ RefPtr<Range> searchRange(rangeOfContents(node));
+
+ int exception = 0;
+ do {
+ RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, false));
+ if (resultRange->collapsed(exception))
+ break;
+
+ // A non-collapsed result range can in some funky whitespace cases still not
+ // advance the range's start position (4509328). Break to avoid infinite loop.
+ VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM);
+ if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM))
+ break;
+
+ KJS::JSLock lock;
+ JSValueRef arg0 = toRef(toJS(toJS(ctx), resultRange.get()));
+ JSObjectCallAsFunction(ctx, push, array, 1, &arg0, 0);
+
+ setStart(searchRange.get(), newStart);
+ } while (true);
+
+ return array;
+}
+
+static JSValueRef inspectedWindow(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ return toRef(KJS::Window::retrieve(controller->inspectedPage()->mainFrame()));
+}
+
+InspectorController::InspectorController(Page* page, InspectorClient* client)
+ : m_inspectedPage(page)
+ , m_client(client)
+ , m_page(0)
+ , m_scriptObject(0)
+ , m_controllerScriptObject(0)
+ , m_scriptContext(0)
+ , m_windowVisible(false)
+ , m_nextIdentifier(-2)
+{
+ ASSERT_ARG(page, page);
+ ASSERT_ARG(client, client);
+}
+
+InspectorController::~InspectorController()
+{
+ if (m_scriptContext) {
+ JSObjectRef global = JSContextGetGlobalObject(m_scriptContext);
+ JSStringRef controllerProperty = JSStringCreateWithUTF8CString("InspectorController");
+ JSObjectRef controller = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, global, controllerProperty, 0), 0);
+ JSStringRelease(controllerProperty);
+ JSObjectSetPrivate(controller, 0);
+ }
+
+ m_client->closeWindow();
+ m_client->inspectorDestroyed();
+
+ if (m_page)
+ m_page->setParentInspectorController(0);
+
+ deleteAllValues(m_frameResources);
+ deleteAllValues(m_consoleMessages);
+}
+
+void InspectorController::inspect(Node* node)
+{
+ if (!node)
+ return;
+
+ if (!m_page) {
+ m_page = m_client->createPage();
+ if (!m_page)
+ return;
+
+ m_page->setParentInspectorController(this);
+ }
+
+ if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
+ node = node->parentNode();
+ m_nodeToFocus = node;
+
+ if (!m_scriptObject)
+ return;
+
+ if (windowVisible())
+ focusNode();
+ else
+ m_client->showWindow();
+}
+
+void InspectorController::focusNode()
+{
+ ASSERT(m_scriptContext);
+ ASSERT(m_scriptObject);
+ ASSERT(m_nodeToFocus);
+
+ JSValueRef arg0;
+
+ {
+ KJS::JSLock lock;
+ arg0 = toRef(toJS(toJS(m_scriptContext), m_nodeToFocus.get()));
+ }
+
+ m_nodeToFocus = 0;
+
+ JSStringRef functionProperty = JSStringCreateWithUTF8CString("updateFocusedNode");
+ JSObjectRef function = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, functionProperty, 0), 0);
+ JSStringRelease(functionProperty);
+ ASSERT(function);
+
+ JSObjectCallAsFunction(m_scriptContext, function, m_scriptObject, 1, &arg0, 0);
+}
+
+void InspectorController::highlight(Node* node)
+{
+ ASSERT_ARG(node, node);
+
+ m_client->highlight(node);
+}
+
+void InspectorController::hideHighlight()
+{
+ m_client->hideHighlight();
+}
+
+bool InspectorController::windowVisible()
+{
+ return m_windowVisible;
+}
+
+void InspectorController::setWindowVisible(bool visible)
+{
+ if (visible == m_windowVisible)
+ return;
+
+ m_windowVisible = visible;
+
+ if (!m_scriptContext || !m_scriptObject)
+ return;
+
+ if (m_windowVisible) {
+ populateScriptResources();
+ if (m_nodeToFocus)
+ focusNode();
+ } else {
+ clearScriptResources();
+ clearScriptConsoleMessages();
+ clearNetworkTimeline();
+ }
+}
+
+void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+{
+ ConsoleMessage* consoleMessage = new ConsoleMessage(source, level, message, lineNumber, sourceID);
+ m_consoleMessages.append(consoleMessage);
+
+ if (windowVisible())
+ addScriptConsoleMessage(consoleMessage);
+}
+
+void InspectorController::attachWindow()
+{
+ m_client->attachWindow();
+}
+
+void InspectorController::detachWindow()
+{
+ m_client->detachWindow();
+}
+
+void InspectorController::windowScriptObjectAvailable()
+{
+ ASSERT(m_page);
+
+ m_scriptContext = toRef(m_page->mainFrame()->scriptProxy()->interpreter()->globalExec());
+
+ JSObjectRef global = JSContextGetGlobalObject(m_scriptContext);
+ ASSERT(global);
+
+ static JSStaticFunction staticFunctions[] = {
+ { "addSourceToFrame", addSourceToFrame, kJSPropertyAttributeNone },
+ { "getResourceDocumentNode", getResourceDocumentNode, kJSPropertyAttributeNone },
+ { "highlightDOMNode", highlightDOMNode, kJSPropertyAttributeNone },
+ { "hideDOMNodeHighlight", hideDOMNodeHighlight, kJSPropertyAttributeNone },
+ { "loaded", loaded, kJSPropertyAttributeNone },
+ { "windowUnloading", unloading, kJSPropertyAttributeNone },
+ { "attach", attach, kJSPropertyAttributeNone },
+ { "detach", detach, kJSPropertyAttributeNone },
+ { "log", log, kJSPropertyAttributeNone },
+ { "search", search, kJSPropertyAttributeNone },
+ { "inspectedWindow", inspectedWindow, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+ };
+
+ JSClassDefinition inspectorControllerDefinition = {
+ 0, kJSClassAttributeNone, "InspectorController", 0, 0, staticFunctions,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ JSClassRef controllerClass = JSClassCreate(&inspectorControllerDefinition);
+ ASSERT(controllerClass);
+
+ m_controllerScriptObject = JSObjectMake(m_scriptContext, controllerClass, reinterpret_cast<void*>(this));
+ ASSERT(m_controllerScriptObject);
+
+ JSStringRef controllerObjectString = JSStringCreateWithUTF8CString("InspectorController");
+ JSObjectSetProperty(m_scriptContext, global, controllerObjectString, m_controllerScriptObject, kJSPropertyAttributeNone, 0);
+ JSStringRelease(controllerObjectString);
+}
+
+void InspectorController::scriptObjectReady()
+{
+ ASSERT(m_scriptContext);
+ if (!m_scriptContext)
+ return;
+
+ JSObjectRef global = JSContextGetGlobalObject(m_scriptContext);
+ ASSERT(global);
+
+ JSStringRef inspectorString = JSStringCreateWithUTF8CString("WebInspector");
+ JSValueRef inspectorValue = JSObjectGetProperty(m_scriptContext, global, inspectorString, 0);
+ JSStringRelease(inspectorString);
+
+ ASSERT(inspectorValue);
+ if (!inspectorValue)
+ return;
+
+ m_scriptObject = JSValueToObject(m_scriptContext, inspectorValue, 0);
+ ASSERT(m_scriptObject);
+
+ JSValueProtect(m_scriptContext, m_scriptObject);
+
+ // Make sure our window is visible now that the page loaded
+ m_client->showWindow();
+}
+
+void InspectorController::windowUnloading()
+{
+ m_client->closeWindow();
+ m_page->setParentInspectorController(0);
+
+ ASSERT(m_scriptContext && m_scriptObject);
+ JSValueUnprotect(m_scriptContext, m_scriptObject);
+
+ m_page = 0;
+ m_scriptObject = 0;
+ m_scriptContext = 0;
+}
+
+static void addHeaders(JSContextRef context, JSObjectRef object, const HTTPHeaderMap& headers)
+{
+ ASSERT_ARG(context, context);
+ ASSERT_ARG(object, object);
+
+ HTTPHeaderMap::const_iterator end = headers.end();
+ for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) {
+ JSStringRef field = JSStringCreateWithCharacters(it->first.characters(), it->first.length());
+ JSStringRef valueString = JSStringCreateWithCharacters(it->second.characters(), it->second.length());
+ JSValueRef value = JSValueMakeString(context, valueString);
+ JSObjectSetProperty(context, object, field, value, kJSPropertyAttributeNone, 0);
+ JSStringRelease(field);
+ JSStringRelease(valueString);
+ }
+}
+
+static JSObjectRef objectForRequest(JSContextRef context, const ResourceRequest& request)
+{
+ ASSERT_ARG(context, context);
+
+ JSObjectRef object = JSObjectMake(context, 0, 0);
+ addHeaders(context, object, request.httpHeaderFields());
+
+ return object;
+}
+
+static JSObjectRef objectForResponse(JSContextRef context, const ResourceResponse& response)
+{
+ ASSERT_ARG(context, context);
+
+ JSObjectRef object = JSObjectMake(context, 0, 0);
+ addHeaders(context, object, response.httpHeaderFields());
+
+ return object;
+}
+
+JSObjectRef InspectorController::addScriptResource(InspectorResource* resource)
+{
+ ASSERT_ARG(resource, resource);
+ ASSERT(!resource->scriptObject);
+
+ ASSERT(m_scriptContext);
+ ASSERT(m_scriptObject);
+ if (!m_scriptContext || !m_scriptObject)
+ return 0;
+
+ JSStringRef resourceString = JSStringCreateWithUTF8CString("Resource");
+ JSObjectRef resourceConstructor = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, resourceString, 0), 0);
+ JSStringRelease(resourceString);
+
+ String urlString = resource->request.url().url();
+ JSStringRef url = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef urlValue = JSValueMakeString(m_scriptContext, url);
+ JSStringRelease(url);
+
+ urlString = resource->request.url().host();
+ JSStringRef domain = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef domainValue = JSValueMakeString(m_scriptContext, domain);
+ JSStringRelease(domain);
+
+ urlString = resource->request.url().path();
+ JSStringRef path = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef pathValue = JSValueMakeString(m_scriptContext, path);
+ JSStringRelease(path);
+
+ urlString = resource->request.url().lastPathComponent();
+ JSStringRef lastPathComponent = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef lastPathComponentValue = JSValueMakeString(m_scriptContext, lastPathComponent);
+ JSStringRelease(lastPathComponent);
+
+ JSValueRef identifier = JSValueMakeNumber(m_scriptContext, resource->identifier);
+ JSValueRef mainResource = JSValueMakeBoolean(m_scriptContext, m_mainResource == resource);
+ JSValueRef cached = JSValueMakeBoolean(m_scriptContext, resource->cached);
+
+ JSValueRef arguments[] = { objectForRequest(m_scriptContext, resource->request), urlValue, domainValue, pathValue, lastPathComponentValue, identifier, mainResource, cached };
+ JSObjectRef result = JSObjectCallAsConstructor(m_scriptContext, resourceConstructor, 8, arguments, 0);
+
+ resource->setScriptObject(m_scriptContext, result);
+
+ ASSERT(result);
+
+ JSStringRef addResourceString = JSStringCreateWithUTF8CString("addResource");
+ JSObjectRef addResourceFunction = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, addResourceString, 0), 0);
+ JSStringRelease(addResourceString);
+
+ JSValueRef addArguments[] = { result };
+ JSObjectCallAsFunction(m_scriptContext, addResourceFunction, m_scriptObject, 1, addArguments, 0);
+
+ return result;
+}
+
+JSObjectRef InspectorController::addAndUpdateScriptResource(InspectorResource* resource)
+{
+ ASSERT_ARG(resource, resource);
+
+ JSObjectRef scriptResource = addScriptResource(resource);
+ updateScriptResource(resource, resource->response);
+ updateScriptResource(resource, resource->length);
+ updateScriptResource(resource, resource->startTime, resource->responseReceivedTime, resource->endTime);
+ updateScriptResource(resource, resource->finished, resource->failed);
+ return scriptResource;
+}
+
+void InspectorController::removeScriptResource(InspectorResource* resource)
+{
+ ASSERT(m_scriptContext);
+ ASSERT(m_scriptObject);
+ if (!m_scriptContext || !m_scriptObject)
+ return;
+
+ ASSERT(resource);
+ ASSERT(resource->scriptObject);
+ if (!resource || !resource->scriptObject)
+ return;
+
+ JSStringRef removeResourceString = JSStringCreateWithUTF8CString("removeResource");
+ JSObjectRef removeResourceFunction = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, removeResourceString, 0), 0);
+ JSStringRelease(removeResourceString);
+
+ JSValueRef arguments[] = { resource->scriptObject };
+ JSObjectCallAsFunction(m_scriptContext, removeResourceFunction, m_scriptObject, 1, arguments, 0);
+
+ resource->setScriptObject(0, 0);
+}
+
+void InspectorController::updateScriptResource(InspectorResource* resource, const ResourceRequest& request)
+{
+ ASSERT(resource->scriptObject);
+ ASSERT(m_scriptContext);
+ if (!resource->scriptObject || !m_scriptContext)
+ return;
+
+ String urlString = request.url().url();
+ JSStringRef url = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef urlValue = JSValueMakeString(m_scriptContext, url);
+ JSStringRelease(url);
+
+ urlString = request.url().host();
+ JSStringRef domain = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef domainValue = JSValueMakeString(m_scriptContext, domain);
+ JSStringRelease(domain);
+
+ urlString = request.url().path();
+ JSStringRef path = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef pathValue = JSValueMakeString(m_scriptContext, path);
+ JSStringRelease(path);
+
+ urlString = request.url().lastPathComponent();
+ JSStringRef lastPathComponent = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
+ JSValueRef lastPathComponentValue = JSValueMakeString(m_scriptContext, lastPathComponent);
+ JSStringRelease(lastPathComponent);
+
+ JSValueRef mainResourceValue = JSValueMakeBoolean(m_scriptContext, m_mainResource == resource);
+
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("url");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, urlValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("domain");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, domainValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("path");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, pathValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("lastPathComponent");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, lastPathComponentValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("requestHeaders");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, objectForRequest(m_scriptContext, request), kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("mainResource");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, mainResourceValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+}
+
+void InspectorController::updateScriptResource(InspectorResource* resource, const ResourceResponse& response, bool /*redirect*/)
+{
+ ASSERT(resource->scriptObject);
+ ASSERT(m_scriptContext);
+ if (!resource->scriptObject || !m_scriptContext)
+ return;
+
+ JSStringRef mimeType = JSStringCreateWithCharacters(response.mimeType().characters(), response.mimeType().length());
+ JSValueRef mimeTypeValue = JSValueMakeString(m_scriptContext, mimeType);
+ JSStringRelease(mimeType);
+
+ JSStringRef suggestedFilename = JSStringCreateWithCharacters(response.suggestedFilename().characters(), response.suggestedFilename().length());
+ JSValueRef suggestedFilenameValue = JSValueMakeString(m_scriptContext, suggestedFilename);
+ JSStringRelease(suggestedFilename);
+
+ JSValueRef expectedContentLengthValue = JSValueMakeNumber(m_scriptContext, static_cast<double>(response.expectedContentLength()));
+ JSValueRef statusCodeValue = JSValueMakeNumber(m_scriptContext, response.httpStatusCode());
+
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("mimeType");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, mimeTypeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("suggestedFilename");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, suggestedFilenameValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("expectedContentLength");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, expectedContentLengthValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("statusCode");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, statusCodeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("responseHeaders");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, objectForResponse(m_scriptContext, response), kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ JSValueRef typeValue = JSValueMakeNumber(m_scriptContext, resource->type());
+ propertyName = JSStringCreateWithUTF8CString("type");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, typeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+}
+
+void InspectorController::updateScriptResource(InspectorResource*, const ResourceError&)
+{
+ // FIXME: Do something here when we start showing HTTP errors in the Inspector.
+}
+
+void InspectorController::updateScriptResource(InspectorResource* resource, int length)
+{
+ ASSERT(resource->scriptObject);
+ ASSERT(m_scriptContext);
+ if (!resource->scriptObject || !m_scriptContext)
+ return;
+
+ JSValueRef lengthValue = JSValueMakeNumber(m_scriptContext, length);
+
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("contentLength");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, lengthValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+}
+
+void InspectorController::updateScriptResource(InspectorResource* resource, bool finished, bool failed)
+{
+ ASSERT(resource->scriptObject);
+ ASSERT(m_scriptContext);
+ if (!resource->scriptObject || !m_scriptContext)
+ return;
+
+ JSValueRef failedValue = JSValueMakeBoolean(m_scriptContext, failed);
+ JSValueRef finishedValue = JSValueMakeBoolean(m_scriptContext, finished);
+
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("failed");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, failedValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("finished");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, finishedValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+}
+
+void InspectorController::updateScriptResource(InspectorResource* resource, double startTime, double responseReceivedTime, double endTime)
+{
+ ASSERT(resource->scriptObject);
+ ASSERT(m_scriptContext);
+ if (!resource->scriptObject || !m_scriptContext)
+ return;
+
+ JSValueRef startTimeValue = JSValueMakeNumber(m_scriptContext, startTime);
+ JSValueRef responseReceivedTimeValue = JSValueMakeNumber(m_scriptContext, responseReceivedTime);
+ JSValueRef endTimeValue = JSValueMakeNumber(m_scriptContext, endTime);
+
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("startTime");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, startTimeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("responseReceivedTime");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, responseReceivedTimeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("endTime");
+ JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, endTimeValue, kJSPropertyAttributeNone, 0);
+ JSStringRelease(propertyName);
+}
+
+void InspectorController::populateScriptResources()
+{
+ ASSERT(m_scriptContext);
+ if (!m_scriptContext)
+ return;
+
+ clearScriptResources();
+ clearScriptConsoleMessages();
+ clearNetworkTimeline();
+
+ ResourcesMap::iterator resourcesEnd = m_resources.end();
+ for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
+ addAndUpdateScriptResource(it->second.get());
+
+ unsigned messageCount = m_consoleMessages.size();
+ for (unsigned i = 0; i < messageCount; ++i)
+ addScriptConsoleMessage(m_consoleMessages[i]);
+}
+
+void InspectorController::addScriptConsoleMessage(const ConsoleMessage* message)
+{
+ ASSERT_ARG(message, message);
+
+ JSStringRef messageConstructorString = JSStringCreateWithUTF8CString("ConsoleMessage");
+ JSObjectRef messageConstructor = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, messageConstructorString, 0), 0);
+ JSStringRelease(messageConstructorString);
+
+ JSStringRef addMessageString = JSStringCreateWithUTF8CString("addMessageToConsole");
+ JSObjectRef addMessage = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, addMessageString, 0), 0);
+ JSStringRelease(addMessageString);
+
+ JSValueRef sourceValue = JSValueMakeNumber(m_scriptContext, message->source);
+ JSValueRef levelValue = JSValueMakeNumber(m_scriptContext, message->level);
+ JSStringRef messageString = JSStringCreateWithCharacters(message->message.characters(), message->message.length());
+ JSValueRef messageValue = JSValueMakeString(m_scriptContext, messageString);
+ JSValueRef lineValue = JSValueMakeNumber(m_scriptContext, message->line);
+ JSStringRef urlString = JSStringCreateWithCharacters(message->url.characters(), message->url.length());
+ JSValueRef urlValue = JSValueMakeString(m_scriptContext, urlString);
+
+ JSValueRef args[] = { sourceValue, levelValue, messageValue, lineValue, urlValue };
+ JSObjectRef messageObject = JSObjectCallAsConstructor(m_scriptContext, messageConstructor, 5, args, 0);
+ JSStringRelease(messageString);
+ JSStringRelease(urlString);
+
+ JSObjectCallAsFunction(m_scriptContext, addMessage, m_scriptObject, 1, &messageObject, 0);
+}
+
+static void callClearFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName)
+{
+ ASSERT_ARG(context, context);
+ ASSERT_ARG(thisObject, thisObject);
+
+ JSStringRef string = JSStringCreateWithUTF8CString(functionName);
+ JSObjectRef function = JSValueToObject(context, JSObjectGetProperty(context, thisObject, string, 0), 0);
+ JSStringRelease(string);
+
+ JSObjectCallAsFunction(context, function, thisObject, 0, 0, 0);
+}
+
+void InspectorController::clearScriptResources()
+{
+ if (!m_scriptContext || !m_scriptObject)
+ return;
+
+ ResourcesMap::iterator resourcesEnd = m_resources.end();
+ for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
+ InspectorResource* resource = it->second.get();
+ resource->setScriptObject(0, 0);
+ }
+
+ callClearFunction(m_scriptContext, m_scriptObject, "clearResources");
+}
+
+void InspectorController::clearScriptConsoleMessages()
+{
+ if (!m_scriptContext || !m_scriptObject)
+ return;
+
+ callClearFunction(m_scriptContext, m_scriptObject, "clearConsoleMessages");
+}
+
+void InspectorController::clearNetworkTimeline()
+{
+ if (!m_scriptContext || !m_scriptObject)
+ return;
+
+ callClearFunction(m_scriptContext, m_scriptObject, "clearNetworkTimeline");
+}
+
+void InspectorController::pruneResources(ResourcesMap* resourceMap, DocumentLoader* loaderToKeep)
+{
+ ASSERT_ARG(resourceMap, resourceMap);
+
+ ResourcesMap mapCopy(*resourceMap);
+ ResourcesMap::iterator end = mapCopy.end();
+ for (ResourcesMap::iterator it = mapCopy.begin(); it != end; ++it) {
+ InspectorResource* resource = (*it).second.get();
+ if (resource == m_mainResource)
+ continue;
+
+ if (!loaderToKeep || resource->loader != loaderToKeep) {
+ removeResource(resource);
+ if (windowVisible() && resource->scriptObject)
+ removeScriptResource(resource);
+ }
+ }
+}
+
+void InspectorController::didCommitLoad(DocumentLoader* loader)
+{
+ if (loader->frame() == m_inspectedPage->mainFrame()) {
+ ASSERT(m_mainResource);
+ ASSERT(m_mainResource->loader == loader);
+
+ m_client->inspectedURLChanged(loader->URL().url());
+ deleteAllValues(m_consoleMessages);
+ m_consoleMessages.clear();
+ if (windowVisible()) {
+ clearScriptConsoleMessages();
+ clearNetworkTimeline();
+
+ // We don't add the main resource until its load is committed. This
+ // is needed to keep the load for a user-entered URL from showing
+ // up in the list of resources for the page they are navigating
+ // away from.
+ addAndUpdateScriptResource(m_mainResource.get());
+ }
+ }
+
+ for (Frame* frame = loader->frame(); frame; frame = frame->tree()->traverseNext(loader->frame()))
+ if (ResourcesMap* resourceMap = m_frameResources.get(frame))
+ pruneResources(resourceMap, loader);
+}
+
+void InspectorController::frameDetachedFromParent(Frame* frame)
+{
+ if (ResourcesMap* resourceMap = m_frameResources.get(frame))
+ removeAllResources(resourceMap);
+}
+
+void InspectorController::addResource(InspectorResource* resource)
+{
+ m_resources.set(resource->identifier, resource);
+
+ Frame* frame = resource->frame.get();
+ ResourcesMap* resourceMap = m_frameResources.get(frame);
+ if (resourceMap)
+ resourceMap->set(resource->identifier, resource);
+ else {
+ resourceMap = new ResourcesMap;
+ resourceMap->set(resource->identifier, resource);
+ m_frameResources.set(frame, resourceMap);
+ }
+}
+
+void InspectorController::removeResource(InspectorResource* resource)
+{
+ m_resources.remove(resource->identifier);
+
+ Frame* frame = resource->frame.get();
+ ResourcesMap* resourceMap = m_frameResources.get(frame);
+ if (!resourceMap) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ resourceMap->remove(resource->identifier);
+ if (resourceMap->isEmpty()) {
+ m_frameResources.remove(frame);
+ delete resourceMap;
+ }
+}
+
+void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
+{
+ InspectorResource* resource = new InspectorResource(m_nextIdentifier--, loader, loader->frame());
+ resource->finished = true;
+ resource->request = request;
+ resource->response = response;
+ resource->length = length;
+ resource->cached = true;
+ resource->startTime = currentTime();
+ resource->responseReceivedTime = resource->startTime;
+ resource->endTime = resource->startTime;
+
+ if (loader->frame() == m_inspectedPage->mainFrame() && request.url() == loader->requestURL())
+ m_mainResource = resource;
+
+ addResource(resource);
+
+ if (windowVisible())
+ addAndUpdateScriptResource(resource);
+}
+
+void InspectorController::identifierForInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
+{
+ InspectorResource* resource = new InspectorResource(identifier, loader, loader->frame());
+ resource->request = request;
+
+ if (loader->frame() == m_inspectedPage->mainFrame() && request.url() == loader->requestURL())
+ m_mainResource = resource;
+
+ addResource(resource);
+}
+
+void InspectorController::willSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+{
+ InspectorResource* resource = m_resources.get(identifier).get();
+ if (!resource)
+ return;
+
+ resource->startTime = currentTime();
+
+ if (resource->request != request)
+ resource->request = request;
+
+ if (!redirectResponse.isNull())
+ resource->redirectResponse = redirectResponse;
+
+ if (resource != m_mainResource && windowVisible()) {
+ if (!resource->scriptObject)
+ addScriptResource(resource);
+ else
+ updateScriptResource(resource, resource->request);
+
+ updateScriptResource(resource, resource->startTime, resource->responseReceivedTime, resource->endTime);
+
+ if (!redirectResponse.isNull())
+ updateScriptResource(resource, redirectResponse, true);
+ }
+}
+
+void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response)
+{
+ InspectorResource* resource = m_resources.get(identifier).get();
+ if (!resource)
+ return;
+
+ resource->response = response;
+ resource->responseReceivedTime = currentTime();
+
+ if (windowVisible() && resource->scriptObject) {
+ updateScriptResource(resource, response);
+ updateScriptResource(resource, resource->startTime, resource->responseReceivedTime, resource->endTime);
+ }
+}
+
+void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
+{
+ InspectorResource* resource = m_resources.get(identifier).get();
+ if (!resource)
+ return;
+
+ resource->length += lengthReceived;
+
+ if (windowVisible() && resource->scriptObject)
+ updateScriptResource(resource, resource->length);
+}
+
+void InspectorController::didFinishLoading(DocumentLoader* loader, unsigned long identifier)
+{
+ RefPtr<InspectorResource> resource = m_resources.get(identifier);
+ if (!resource)
+ return;
+
+ removeResource(resource.get());
+
+ resource->finished = true;
+ resource->endTime = currentTime();
+
+ addResource(resource.get());
+
+ if (windowVisible() && resource->scriptObject) {
+ updateScriptResource(resource.get(), resource->startTime, resource->responseReceivedTime, resource->endTime);
+ updateScriptResource(resource.get(), resource->finished);
+ }
+}
+
+void InspectorController::didFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
+{
+ RefPtr<InspectorResource> resource = m_resources.get(identifier);
+ if (!resource)
+ return;
+
+ removeResource(resource.get());
+
+ resource->finished = true;
+ resource->failed = true;
+ resource->error = error;
+ resource->endTime = currentTime();
+
+ addResource(resource.get());
+
+ if (windowVisible() && resource->scriptObject) {
+ updateScriptResource(resource.get(), resource->error);
+ updateScriptResource(resource.get(), resource->startTime, resource->responseReceivedTime, resource->endTime);
+ updateScriptResource(resource.get(), resource->finished, resource->failed);
+ }
+}
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorController_h
+#define InspectorController_h
+
+#include "Chrome.h"
+#include <JavaScriptCore/JavaScriptCore.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DocumentLoader;
+class Frame;
+class InspectorClient;
+class Node;
+class Page;
+class ResourceResponse;
+class ResourceError;
+
+struct ConsoleMessage;
+struct InspectorResource;
+struct ResourceRequest;
+
+class InspectorController {
+public:
+ typedef HashMap<long long, RefPtr<InspectorResource> > ResourcesMap;
+ typedef HashMap<RefPtr<Frame>, ResourcesMap*> FrameResourcesMap;
+
+ InspectorController(Page*, InspectorClient*);
+ ~InspectorController();
+
+ Page* inspectedPage() const { return m_inspectedPage; }
+
+ void inspect(Node*);
+ void highlight(Node*);
+ void hideHighlight();
+
+ bool windowVisible();
+ void setWindowVisible(bool visible = true);
+
+ void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
+
+ void attachWindow();
+ void detachWindow();
+
+ JSContextRef scriptContext() const { return m_scriptContext; };
+ void setScriptContext(JSContextRef context) { m_scriptContext = context; };
+
+ void windowScriptObjectAvailable();
+
+ void scriptObjectReady();
+ void windowUnloading();
+
+ void populateScriptResources();
+ void clearScriptResources();
+
+ void didCommitLoad(DocumentLoader*);
+ void frameDetachedFromParent(Frame*);
+
+ void didLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length);
+
+ void identifierForInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
+ void willSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ void didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&);
+ void didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived);
+ void didFinishLoading(DocumentLoader*, unsigned long identifier);
+ void didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&);
+
+ const ResourcesMap& resources() const { return m_resources; }
+private:
+ void focusNode();
+
+ void addScriptConsoleMessage(const ConsoleMessage*);
+ void clearScriptConsoleMessages();
+
+ void clearNetworkTimeline();
+
+ void addResource(InspectorResource*);
+ void removeResource(InspectorResource*);
+
+ JSObjectRef addScriptResource(InspectorResource*);
+ void removeScriptResource(InspectorResource*);
+
+ JSObjectRef addAndUpdateScriptResource(InspectorResource*);
+ void updateScriptResource(InspectorResource*, const ResourceRequest&);
+ void updateScriptResource(InspectorResource*, const ResourceResponse&, bool redirect = false);
+ void updateScriptResource(InspectorResource*, const ResourceError&);
+ void updateScriptResource(InspectorResource*, int length);
+ void updateScriptResource(InspectorResource*, bool finished, bool failed = false);
+ void updateScriptResource(InspectorResource*, double startTime, double responseReceivedTime, double endTime);
+
+ void pruneResources(ResourcesMap*, DocumentLoader* loaderToKeep = 0);
+ void removeAllResources(ResourcesMap* map) { pruneResources(map); }
+
+ Page* m_inspectedPage;
+ InspectorClient* m_client;
+ Page* m_page;
+ RefPtr<Node> m_nodeToFocus;
+ RefPtr<InspectorResource> m_mainResource;
+ ResourcesMap m_resources;
+ FrameResourcesMap m_frameResources;
+ Vector<ConsoleMessage*> m_consoleMessages;
+ JSObjectRef m_scriptObject;
+ JSObjectRef m_controllerScriptObject;
+ JSContextRef m_scriptContext;
+ bool m_windowVisible;
+ long long m_nextIdentifier;
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorController_h)
#include "FrameTree.h"
#include "FrameView.h"
#include "HistoryItem.h"
+#include "InspectorController.h"
#include "ProgressTracker.h"
#include "RenderWidget.h"
#include "SelectionController.h"
, m_frameCount(0)
, m_tabKeyCyclesThroughElements(true)
, m_defersLoading(false)
+ , m_parentInspectorController(0)
{
if (!allPages) {
allPages = new HashSet<Page*>;
m_editorClient->clearUndoRedoOperations();
}
+void Page::setInspectorClient(InspectorClient* client)
+{
+ m_inspectorController.set(new InspectorController(this, client));
+}
+
} // namespace WebCore
class EditorClient;
class FocusController;
class Frame;
+ class InspectorClient;
+ class InspectorController;
class Node;
class ProgressTracker;
class Selection;
DragController* dragController() const { return m_dragController.get(); }
FocusController* focusController() const { return m_focusController.get(); }
ContextMenuController* contextMenuController() const { return m_contextMenuController.get(); }
+ InspectorController* inspectorController() const { return m_inspectorController.get(); }
Settings* settings() const { return m_settings.get(); }
ProgressTracker* progress() const { return m_progress.get(); }
+
+ void setInspectorClient(InspectorClient*);
+
+ void setParentInspectorController(InspectorController* controller) { m_parentInspectorController = controller; }
+ InspectorController* parentInspectorController() const { return m_parentInspectorController; }
void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; }
bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; }
OwnPtr<DragController> m_dragController;
OwnPtr<FocusController> m_focusController;
OwnPtr<ContextMenuController> m_contextMenuController;
+ OwnPtr<InspectorController> m_inspectorController;
OwnPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
bool m_tabKeyCyclesThroughElements;
bool m_defersLoading;
+ InspectorController* m_parentInspectorController;
+
#if PLATFORM(WIN)
static HINSTANCE s_instanceHandle;
#endif
--- /dev/null
+WebInspector.ConsolePanel = function()
+{
+ WebInspector.Panel.call(this);
+
+ this.messages = [];
+
+ this.commandHistory = [];
+ this.commandOffset = 0;
+
+ this.messageList = document.createElement("ol");
+ this.messageList.className = "console-message-list";
+ this.element.appendChild(this.messageList);
+
+ var console = this;
+ this.messageList.addEventListener("click", function(event) { console.messageListClicked(event) }, true);
+
+ this.consolePrompt = document.createElement("textarea");
+ this.consolePrompt.className = "console-prompt";
+ this.element.appendChild(this.consolePrompt);
+
+ this.consolePrompt.addEventListener("keydown", function(event) { console.promptKeypress(event) }, false);
+}
+
+WebInspector.ConsolePanel.prototype = {
+ show: function()
+ {
+ WebInspector.consoleListItem.item.select();
+ WebInspector.Panel.prototype.show.call(this);
+ },
+
+ hide: function()
+ {
+ WebInspector.consoleListItem.item.deselect();
+ WebInspector.Panel.prototype.hide.call(this);
+ },
+
+ addMessage: function(msg)
+ {
+ if (msg.url in WebInspector.resourceURLMap) {
+ msg.resource = WebInspector.resourceURLMap[msg.url];
+ switch (msg.level) {
+ case WebInspector.ConsoleMessage.WarningMessageLevel:
+ ++msg.resource.warnings;
+ msg.resource.panel.addMessageToSource(msg);
+ break;
+ case WebInspector.ConsoleMessage.ErrorMessageLevel:
+ ++msg.resource.errors;
+ msg.resource.panel.addMessageToSource(msg);
+ break;
+ }
+ }
+ this.messages.push(msg);
+
+ var item = msg.toListItem();
+ item.message = msg;
+ this.messageList.appendChild(item);
+ item.scrollIntoView(false);
+ },
+
+ clearMessages: function()
+ {
+ for (var i = 0; i < this.messages.length; ++i) {
+ var resource = this.messages[i].resource;
+ if (!resource)
+ continue;
+
+ resource.errors = 0;
+ resource.warnings = 0;
+ }
+
+ this.messages = [];
+ this.messageList.removeChildren();
+ },
+
+ messageListClicked: function(event)
+ {
+ var link = event.target.firstParentOrSelfWithNodeName("a");
+ if (link) {
+ WebInspector.updateFocusedNode(link.representedNode);
+ return;
+ }
+
+ var item = event.target.firstParentOrSelfWithNodeName("li");
+ if (!item)
+ return;
+
+ var resource = item.message.resource;
+ if (!resource)
+ return;
+
+ resource.panel.showSourceLine(item.message.line);
+
+ event.stopPropagation();
+ event.preventDefault();
+ },
+
+ promptKeypress: function(event)
+ {
+ switch (event.keyIdentifier) {
+ case "Enter":
+ this._onEnterPressed(event);
+ break;
+ case "Up":
+ this._onUpPressed(event);
+ break;
+ case "Down":
+ this._onDownPressed(event);
+ break;
+ }
+ },
+
+ _onEnterPressed: function(event)
+ {
+ event.preventDefault();
+ event.stopPropagation();
+
+ var str = this.consolePrompt.value;
+ if (!str.length)
+ return;
+
+ this.commandHistory.push(str);
+ this.commandOffset = 0;
+
+ this.consolePrompt.value = "";
+
+ var result;
+ var exception = false;
+ try {
+ // This with block is needed to work around http://bugs.webkit.org/show_bug.cgi?id=11399
+ with (InspectorController.inspectedWindow()) {
+ result = eval(str);
+ }
+ } catch(e) {
+ result = e;
+ exception = true;
+ }
+
+ var level = exception ? WebInspector.ConsoleMessage.ErrorMessageLevel : WebInspector.ConsoleMessage.LogMessageLevel;
+
+ this.addMessage(new WebInspector.ConsoleCommand(str, this._outputToNode(result)));
+ },
+
+ _onUpPressed: function(event)
+ {
+ event.preventDefault();
+ event.stopPropagation();
+
+ if (this.commandOffset == this.commandHistory.length)
+ return;
+
+ if (this.commandOffset == 0)
+ this.tempSavedCommand = this.consolePrompt.value;
+
+ ++this.commandOffset;
+ this.consolePrompt.value = this.commandHistory[this.commandHistory.length - this.commandOffset];
+ this.consolePrompt.moveCursorToEnd();
+ },
+
+ _onDownPressed: function(event)
+ {
+ event.preventDefault();
+ event.stopPropagation();
+
+ if (this.commandOffset == 0)
+ return;
+
+ --this.commandOffset;
+
+ if (this.commandOffset == 0) {
+ this.consolePrompt.value = this.tempSavedCommand;
+ this.consolePrompt.moveCursorToEnd();
+ delete this.tempSavedCommand;
+ return;
+ }
+
+ this.consolePrompt.value = this.commandHistory[this.commandHistory.length - this.commandOffset];
+ this.consolePrompt.moveCursorToEnd();
+ },
+
+ _outputToNode: function(output)
+ {
+ if (output instanceof Node) {
+ var anchor = document.createElement("a");
+ anchor.innerHTML = output.titleInfo().title;
+ anchor.representedNode = output;
+ return anchor;
+ }
+ return document.createTextNode(Object.describe(output));
+ }
+}
+
+WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.ConsoleMessage = function(source, level, message, line, url)
+{
+ this.source = source;
+ this.level = level;
+ this.message = message;
+ this.line = line;
+ this.url = url;
+}
+
+WebInspector.ConsoleMessage.prototype = {
+ get shortURL()
+ {
+ if (this.resource)
+ return this.resource.displayName;
+ return this.url;
+ },
+
+ toListItem: function()
+ {
+ var item = document.createElement("li");
+ item.className = "console-message";
+ switch (this.source) {
+ case WebInspector.ConsoleMessage.HTMLMessageSource:
+ item.className += " console-html-source";
+ break;
+ case WebInspector.ConsoleMessage.XMLMessageSource:
+ item.className += " console-xml-source";
+ break;
+ case WebInspector.ConsoleMessage.JSMessageSource:
+ item.className += " console-js-source";
+ break;
+ case WebInspector.ConsoleMessage.CSSMessageSource:
+ item.className += " console-css-source";
+ break;
+ case WebInspector.ConsoleMessage.OtherMessageSource:
+ item.className += " console-other-source";
+ break;
+ }
+
+ switch (this.level) {
+ case WebInspector.ConsoleMessage.TipMessageLevel:
+ item.className += " console-tip-level";
+ break;
+ case WebInspector.ConsoleMessage.LogMessageLevel:
+ item.className += " console-log-level";
+ break;
+ case WebInspector.ConsoleMessage.WarningMessageLevel:
+ item.className += " console-warning-level";
+ break;
+ case WebInspector.ConsoleMessage.ErrorMessageLevel:
+ item.className += " console-error-level";
+ }
+
+
+ var messageDiv = document.createElement("div");
+ messageDiv.className = "console-message-message";
+ messageDiv.innerText = this.message;
+ item.appendChild(messageDiv);
+
+ var urlDiv = document.createElement("div");
+ urlDiv.className = "console-message-url";
+ urlDiv.innerText = this.url;
+ item.appendChild(urlDiv);
+
+ if (this.line >= 0) {
+ var lineDiv = document.createElement("div");
+ lineDiv.className = "console-message-line";
+ lineDiv.innerText = this.line;
+ item.appendChild(lineDiv);
+ }
+
+ return item;
+ },
+
+ toString: function()
+ {
+ var sourceString;
+ switch (this.source) {
+ case WebInspector.ConsoleMessage.HTMLMessageSource:
+ sourceString = "HTML";
+ break;
+ case WebInspector.ConsoleMessage.XMLMessageSource:
+ sourceString = "XML";
+ break;
+ case WebInspector.ConsoleMessage.JSMessageSource:
+ sourceString = "JS";
+ break;
+ case WebInspector.ConsoleMessage.CSSMessageSource:
+ sourceString = "CSS";
+ break;
+ case WebInspector.ConsoleMessage.OtherMessageSource:
+ sourceString = "Other";
+ break;
+ }
+
+ var levelString;
+ switch (this.level) {
+ case WebInspector.ConsoleMessage.TipMessageLevel:
+ levelString = "Tip";
+ break;
+ case WebInspector.ConsoleMessage.LogMessageLevel:
+ levelString = "Log";
+ break;
+ case WebInspector.ConsoleMessage.WarningMessageLevel:
+ levelString = "Warning";
+ break;
+ case WebInspector.ConsoleMessage.ErrorMessageLevel:
+ levelString = "Error";
+ break;
+ }
+
+ return sourceString + " " + levelString + ": " + this.message + "\n" + this.url + " line " + this.line;
+ }
+}
+
+// Note: Keep these constants in sync with the ones in Chrome.h
+WebInspector.ConsoleMessage.HTMLMessageSource = 0;
+WebInspector.ConsoleMessage.XMLMessageSource = 1;
+WebInspector.ConsoleMessage.JSMessageSource = 2;
+WebInspector.ConsoleMessage.CSSMessageSource = 3;
+WebInspector.ConsoleMessage.OtherMessageSource = 4;
+
+WebInspector.ConsoleMessage.TipMessageLevel = 0;
+WebInspector.ConsoleMessage.LogMessageLevel = 1;
+WebInspector.ConsoleMessage.WarningMessageLevel = 2;
+WebInspector.ConsoleMessage.ErrorMessageLevel = 3;
+
+WebInspector.ConsoleCommand = function(input, output)
+{
+ this.input = input;
+ this.output = output;
+}
+
+WebInspector.ConsoleCommand.prototype = {
+ toListItem: function()
+ {
+ var item = document.createElement("li");
+ item.className = "console-command";
+
+ var inputDiv = document.createElement("div");
+ inputDiv.className = "console-command-input";
+ inputDiv.innerText = this.input;
+ item.appendChild(inputDiv);
+
+ var outputDiv = document.createElement("div");
+ outputDiv.className = "console-command-output";
+ outputDiv.appendChild(this.output);
+ item.appendChild(outputDiv);
+
+ return item;
+ }
+}
--- /dev/null
+WebInspector.NetworkPanel = function()
+{
+ WebInspector.Panel.call(this);
+
+ this.timelineEntries = [];
+
+ this.timelineElement = document.createElement("div");
+ this.timelineElement.className = "network-timeline";
+ this.element.appendChild(this.timelineElement);
+
+ this.summaryElement = document.createElement("div");
+ this.summaryElement.className = "network-summary";
+ this.element.appendChild(this.summaryElement);
+
+ this.dividersElement = document.createElement("div");
+ this.dividersElement.className = "network-dividers";
+ this.timelineElement.appendChild(this.dividersElement);
+
+ this.resourcesElement = document.createElement("div");
+ this.resourcesElement.className = "network-resources";
+ var panel = this;
+ this.resourcesElement.addEventListener("click", function(event) { return panel.onClick(event) }, false);
+ this.timelineElement.appendChild(this.resourcesElement);
+
+ var graphArea = document.createElement("div");
+ graphArea.className = "network-graph-area";
+ this.summaryElement.appendChild(graphArea);
+
+ this.graphLabelElement = document.createElement("div");
+ this.graphLabelElement.className = "network-graph-label";
+ graphArea.appendChild(this.graphLabelElement);
+
+ this.graphModeSelectElement = document.createElement("select");
+ this.graphModeSelectElement.className = "network-graph-mode";
+ this.graphModeSelectElement.addEventListener("change", function(event) { return panel.onModeChange(event) }, false);
+ this.graphLabelElement.appendChild(this.graphModeSelectElement);
+ this.graphLabelElement.appendChild(document.createElement("br"));
+
+ var sizeOptionElement = document.createElement("option");
+ sizeOptionElement.textContent = "Transfer Size";
+ sizeOptionElement.calculator = new WebInspector.TransferSizeCalculator();
+ this.graphModeSelectElement.appendChild(sizeOptionElement);
+
+ var timeOptionElement = document.createElement("option");
+ timeOptionElement.textContent = "Transfer Time";
+ timeOptionElement.calculator = new WebInspector.TransferTimeCalculator();
+ this.graphModeSelectElement.appendChild(timeOptionElement);
+
+ var graphSideElement = document.createElement("div");
+ graphSideElement.className = "network-graph-side";
+ graphArea.appendChild(graphSideElement);
+
+ this.summaryGraphElement = document.createElement("canvas");
+ this.summaryGraphElement.setAttribute("width", "450");
+ this.summaryGraphElement.setAttribute("height", "38");
+ this.summaryGraphElement.className = "network-summary-graph";
+ graphSideElement.appendChild(this.summaryGraphElement);
+
+ this.legendElement = document.createElement("div");
+ this.legendElement.className = "network-graph-legend";
+ graphSideElement.appendChild(this.legendElement);
+
+ var networkPanel = this;
+ window.addEventListener("resize", function() { networkPanel.updateTimelineDividersIfNeeded() }, false);
+
+ this.setup = true;
+ this.drawSummaryGraph(); // draws an empty graph
+}
+
+WebInspector.NetworkPanel.prototype = {
+ show: function()
+ {
+ WebInspector.networkListItem.select();
+ WebInspector.Panel.prototype.show.call(this);
+ },
+
+ hide: function()
+ {
+ WebInspector.networkListItem.deselect();
+ WebInspector.Panel.prototype.hide.call(this);
+ },
+
+ onClick: function(event)
+ {
+ var resourceElement = event.target.firstParentOrSelfWithClass("network-resource");
+ if (!resourceElement)
+ return;
+
+ var balloon = event.target.firstParentOrSelfWithClass("tip-balloon");
+ if (balloon) {
+ resourceElement.timelineEntry.toggleTipBalloon(event);
+ return;
+ }
+
+ resourceElement.timelineEntry.toggleShowingInfo();
+ },
+
+ onModeChange: function(event)
+ {
+ this.updateSummaryGraph();
+ },
+
+ get calculator()
+ {
+ return this.graphModeSelectElement.options[this.graphModeSelectElement.selectedIndex].calculator;
+ },
+
+ get totalDuration()
+ {
+ return this.latestEndTime - this.earliestStartTime;
+ },
+
+ refresh: function()
+ {
+ if (!this.setup)
+ return;
+
+ this.needsRefresh = false;
+
+ // calling refresh will call updateTimelineBoundriesIfNeeded, which can clear needsRefresh for future entries,
+ // so find all the entries that needs refresh first, then loop back trough them to call refresh
+ var entriesNeedingRefresh = [];
+ var entriesLength = this.timelineEntries.length;
+ for (var i = 0; i < entriesLength; ++i) {
+ var entry = this.timelineEntries[i];
+ if (entry.needsRefresh || entry.infoNeedsRefresh)
+ entriesNeedingRefresh.push(entry);
+ }
+
+ entriesLength = entriesNeedingRefresh.length;
+ for (var i = 0; i < entriesLength; ++i)
+ entriesNeedingRefresh[i].refresh(false, true, true);
+
+ this.updateTimelineDividersIfNeeded();
+ this.sortTimelineEntriesIfNeeded();
+ this.updateSummaryGraph();
+ },
+
+ makeLegendElement: function(label, value, color)
+ {
+ var legendElement = document.createElement("label");
+ legendElement.className = "network-graph-legend-item";
+
+ if (color) {
+ var swatch = document.createElement("canvas");
+ swatch.className = "network-graph-legend-swatch";
+ swatch.setAttribute("width", "13");
+ swatch.setAttribute("height", "24");
+
+ legendElement.appendChild(swatch);
+
+ this.drawSwatch(swatch, color);
+ }
+
+ var labelElement = document.createElement("div");
+ labelElement.className = "network-graph-legend-label";
+ legendElement.appendChild(labelElement);
+
+ var headerElement = document.createElement("div");
+ var headerElement = document.createElement("div");
+ headerElement.className = "network-graph-legend-header";
+ headerElement.textContent = label;
+ labelElement.appendChild(headerElement);
+
+ var valueElement = document.createElement("div");
+ valueElement.className = "network-graph-legend-value";
+ valueElement.textContent = value;
+ labelElement.appendChild(valueElement);
+
+ return legendElement;
+ },
+
+ sortTimelineEntriesSoonIfNeeded: function()
+ {
+ if ("sortTimelineEntriesTimeout" in this)
+ return;
+
+ var _self = this;
+ this.sortTimelineEntriesTimeout = setTimeout(function () { _self.sortTimelineEntriesIfNeeded() }, 500);
+ },
+
+ sortTimelineEntriesIfNeeded: function()
+ {
+ if ("sortTimelineEntriesTimeout" in this) {
+ clearTimeout(this.sortTimelineEntriesTimeout);
+ delete this.sortTimelineEntriesTimeout;
+ }
+
+ this.timelineEntries.sort(WebInspector.NetworkPanel.timelineEntryCompare);
+
+ var nextSibling = null;
+ for (var i = (this.timelineEntries.length - 1); i >= 0; --i) {
+ var entry = this.timelineEntries[i];
+ if (entry.resourceElement.nextSibling !== nextSibling)
+ this.resourcesElement.insertBefore(entry.resourceElement, nextSibling);
+ nextSibling = entry.resourceElement;
+ }
+ },
+
+ updateTimelineBoundriesIfNeeded: function(resource, immediate)
+ {
+ var didUpdate = false;
+ if (resource.startTime !== -1 && (this.earliestStartTime === undefined || resource.startTime < this.earliestStartTime)) {
+ this.earliestStartTime = resource.startTime;
+ didUpdate = true;
+ }
+
+ if (resource.endTime !== -1 && (this.latestEndTime === undefined || resource.endTime > this.latestEndTime)) {
+ this.latestEndTime = resource.endTime;
+ didUpdate = true;
+ }
+
+ if (didUpdate) {
+ if (immediate) {
+ this.refreshAllTimelineEntries(true, true, immediate);
+ this.updateTimelineDividersIfNeeded();
+ } else {
+ this.refreshAllTimelineEntriesSoon(true, true, immediate);
+ this.updateTimelineDividersSoonIfNeeded();
+ }
+ }
+
+ return didUpdate;
+ },
+
+ updateTimelineDividersSoonIfNeeded: function()
+ {
+ if ("updateTimelineDividersTimeout" in this)
+ return;
+
+ var _self = this;
+ this.updateTimelineDividersTimeout = setTimeout(function () { _self.updateTimelineDividersIfNeeded() }, 500);
+ },
+
+ updateTimelineDividersIfNeeded: function()
+ {
+ if ("updateTimelineDividersTimeout" in this) {
+ clearTimeout(this.updateTimelineDividersTimeout);
+ delete this.updateTimelineDividersTimeout;
+ }
+
+ if (!this.visible) {
+ this.needsRefresh = true;
+ return;
+ }
+
+ var dividerCount = Math.round(this.dividersElement.offsetWidth / 64);
+ var timeSlice = this.totalDuration / dividerCount;
+
+ if (this.lastDividerTimeSlice === timeSlice)
+ return;
+
+ this.lastDividerTimeSlice = timeSlice;
+
+ this.dividersElement.removeChildren();
+
+ for (var i = 1; i <= dividerCount; ++i) {
+ var divider = document.createElement("div");
+ divider.className = "network-divider";
+ if (i === dividerCount)
+ divider.addStyleClass("last");
+ divider.style.left = ((i / dividerCount) * 100) + "%";
+
+ var label = document.createElement("div");
+ label.className = "network-divider-label";
+ label.textContent = Number.secondsToString(timeSlice * i);
+ divider.appendChild(label);
+
+ this.dividersElement.appendChild(divider);
+ }
+ },
+
+ refreshAllTimelineEntriesSoon: function(skipBoundryUpdate, skipTimelineSort, immediate)
+ {
+ if ("refreshAllTimelineEntriesTimeout" in this)
+ return;
+
+ var _self = this;
+ this.refreshAllTimelineEntriesTimeout = setTimeout(function () { _self.refreshAllTimelineEntries() }, 500, skipBoundryUpdate, skipTimelineSort, immediate);
+ },
+
+ refreshAllTimelineEntries: function(skipBoundryUpdate, skipTimelineSort, immediate)
+ {
+ if ("refreshAllTimelineEntriesTimeout" in this) {
+ clearTimeout(this.refreshAllTimelineEntriesTimeout);
+ delete this.refreshAllTimelineEntriesTimeout;
+ }
+
+ var entriesLength = this.timelineEntries.length;
+ for (var i = 0; i < entriesLength; ++i)
+ this.timelineEntries[i].refresh(skipBoundryUpdate, skipTimelineSort, immediate);
+ },
+
+ drawSwatch: function(canvas, color) {
+ var ctx = canvas.getContext('2d');
+
+ ctx.save();
+
+ drawSwatchSquare(ctx, color);
+
+ ctx.save();
+
+ ctx.translate(0, (13 * 2) - 1);
+ ctx.scale(1, -1);
+
+ drawSwatchSquare(ctx, color);
+
+ ctx.restore();
+
+ fadeOutRect(ctx, 0, 0 + 13, 13, 13, 0.5, 0.0);
+
+ ctx.restore();
+ },
+
+ drawSummaryGraph: function(segments) {
+ if (!this.summaryGraphElement)
+ return;
+
+ var ctx = this.summaryGraphElement.getContext('2d');
+ var x = 0;
+ var y = 0;
+ var width = 450;
+ var height = 19;
+
+ if (!segments || !segments.length)
+ segments = [{color: "white", value: 1}];
+
+ ctx.save();
+
+ ctx.clearRect(x, y, width, (height * 2));
+
+ drawShadowLine(ctx, x, y + height, width, 2);
+ drawPill(ctx, x, y, width, height, height / 2, segments);
+
+ ctx.save();
+
+ ctx.translate(0, (height * 2) + 1);
+ ctx.scale(1, -1);
+
+ drawPill(ctx, x, y, width, height, height / 2, segments);
+
+ ctx.restore();
+
+ fadeOutRect(ctx, x, y + height + 2, width, height, 0.5, 0.0);
+
+ ctx.restore();
+ },
+
+ updateSummaryGraphSoon: function()
+ {
+ if ("updateSummaryGraphTimeout" in this)
+ return;
+
+ var _self = this;
+ this.updateSummaryGraphTimeout = setTimeout(function () { _self.updateSummaryGraph() }, 500);
+ },
+
+ updateSummaryGraph: function()
+ {
+ if ("updateSummaryGraphTimeout" in this) {
+ clearTimeout(this.updateSummaryGraphTimeout);
+ delete this.updateSummaryGraphTimeout;
+ }
+
+ var graphInfo = this.calculator.computeValues(this.timelineEntries);
+
+ var categoryOrder = ["documents", "stylesheets", "images", "scripts", "other"];
+ var categoryColors = {documents: {r: 47, g: 102, b: 236}, stylesheets: {r: 157, g: 231, b: 119}, images: {r: 164, g: 60, b: 255}, scripts: {r: 255, g: 121, b: 0}, other: {r: 186, g: 186, b: 186}};
+ var fillSegments = [];
+
+ this.legendElement.removeChildren();
+
+ if (this.totalLegendLabel)
+ this.totalLegendLabel.parentNode.removeChild(this.totalLegendLabel);
+
+ this.totalLegendLabel = this.makeLegendElement(this.calculator.title, this.calculator.formatValue(graphInfo.total));
+ this.totalLegendLabel.addStyleClass("network-graph-legend-total");
+ this.graphLabelElement.appendChild(this.totalLegendLabel);
+
+ for (var i = 0; i < categoryOrder.length; ++i) {
+ var category = categoryOrder[i];
+ var size = graphInfo.categoryValues[category];
+ if (!size)
+ continue;
+
+ var color = categoryColors[category];
+ var colorString = "rgb(" + color.r + ", " + color.g + ", " + color.b + ")";
+
+ var fillSegment = {color: colorString, value: size};
+ fillSegments.push(fillSegment);
+
+ var legendLabel = this.makeLegendElement(category, this.calculator.formatValue(size), colorString);
+ this.legendElement.appendChild(legendLabel);
+ }
+
+ this.drawSummaryGraph(fillSegments);
+ },
+
+ clearTimeline: function()
+ {
+ delete this.earliestStartTime;
+ delete this.latestEndTime;
+
+ var entriesLength = this.timelineEntries.length;
+ for (var i = 0; i < entriesLength; ++i)
+ delete this.timelineEntries[i].resource.networkTimelineEntry;
+
+ this.timelineEntries = [];
+ this.resourcesElement.removeChildren();
+
+ this.drawSummaryGraph(); // draws an empty graph
+ },
+
+ addResourceToTimeline: function(resource)
+ {
+ var timelineEntry = new WebInspector.NetworkTimelineEntry(this, resource);
+ this.timelineEntries.push(timelineEntry);
+ this.resourcesElement.appendChild(timelineEntry.resourceElement);
+
+ timelineEntry.refresh();
+ this.updateSummaryGraphSoon();
+ }
+}
+
+WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.NetworkPanel.timelineEntryCompare = function(a, b)
+{
+ if (a.resource.startTime < b.resource.startTime)
+ return -1;
+ if (a.resource.startTime > b.resource.startTime)
+ return 1;
+ if (a.resource.endTime < b.resource.endTime)
+ return -1;
+ if (a.resource.endTime > b.resource.endTime)
+ return 1;
+ return 0;
+}
+
+WebInspector.NetworkTimelineEntry = function(panel, resource)
+{
+ this.panel = panel;
+ this.resource = resource;
+ resource.networkTimelineEntry = this;
+
+ this.resourceElement = document.createElement("div");
+ this.resourceElement.className = "network-resource";
+ this.resourceElement.timelineEntry = this;
+
+ this.titleElement = document.createElement("div");
+ this.titleElement.className = "network-title";
+ this.resourceElement.appendChild(this.titleElement);
+
+ this.fileElement = document.createElement("div");
+ this.fileElement.className = "network-file";
+ this.fileElement.innerHTML = WebInspector.linkifyURL(resource.url, resource.displayName);
+ this.titleElement.appendChild(this.fileElement);
+
+ this.tipButtonElement = document.createElement("button");
+ this.tipButtonElement.className = "tip-button";
+ this.showingTipButton = this.resource.tips.length;
+ this.fileElement.insertBefore(this.tipButtonElement, this.fileElement.firstChild);
+
+ var entry = this;
+ this.tipButtonElement.addEventListener("click", function(event) { entry.toggleTipBalloon(event) }, false );
+
+ this.areaElement = document.createElement("div");
+ this.areaElement.className = "network-area";
+ this.titleElement.appendChild(this.areaElement);
+
+ this.barElement = document.createElement("div");
+ this.areaElement.appendChild(this.barElement);
+
+ this.infoElement = document.createElement("div");
+ this.infoElement.className = "network-info hidden";
+ this.resourceElement.appendChild(this.infoElement);
+}
+
+WebInspector.NetworkTimelineEntry.prototype = {
+ refresh: function(skipBoundryUpdate, skipTimelineSort, immediate)
+ {
+ if (!this.panel.visible) {
+ this.needsRefresh = true;
+ this.panel.needsRefresh = true;
+ return;
+ }
+
+ delete this.needsRefresh;
+
+ if (!skipBoundryUpdate) {
+ if (this.panel.updateTimelineBoundriesIfNeeded(this.resource, immediate))
+ return; // updateTimelineBoundriesIfNeeded calls refresh() on all entries, so we can just return
+ }
+
+ if (!skipTimelineSort) {
+ if (immediate)
+ this.panel.sortTimelineEntriesIfNeeded();
+ else
+ this.panel.sortTimelineEntriesSoonIfNeeded();
+ }
+
+ if (this.resource.startTime !== -1) {
+ var percentStart = ((this.resource.startTime - this.panel.earliestStartTime) / this.panel.totalDuration) * 100;
+ this.barElement.style.left = percentStart + "%";
+ } else {
+ this.barElement.style.left = null;
+ }
+
+ if (this.resource.endTime !== -1) {
+ var percentEnd = ((this.panel.latestEndTime - this.resource.endTime) / this.panel.totalDuration) * 100;
+ this.barElement.style.right = percentEnd + "%";
+ } else {
+ this.barElement.style.right = "0px";
+ }
+
+ this.barElement.className = "network-bar network-category-" + this.resource.category.title;
+
+ if (this.infoNeedsRefresh)
+ this.refreshInfo();
+ },
+
+ refreshInfo: function()
+ {
+ if (!this.showingInfo) {
+ this.infoNeedsRefresh = true;
+ return;
+ }
+
+ if (!this.panel.visible) {
+ this.panel.needsRefresh = true;
+ this.infoNeedsRefresh = true;
+ return;
+ }
+
+ this.infoNeedsRefresh = false;
+
+ this.infoElement.removeChildren();
+
+ var sections = [
+ {title: "Request", info: this.resource.sortedRequestHeaders},
+ {title: "Response", info: this.resource.sortedResponseHeaders}
+ ];
+
+ function createSectionTable(section) {
+ if (!section.info.length)
+ return;
+
+ var table = document.createElement("table");
+ this.infoElement.appendChild(table);
+
+ var heading = document.createElement("th");
+ heading.innerText = section.title;
+ var row = table.createTHead().insertRow(-1).appendChild(heading);
+ var body = document.createElement("tbody");
+ table.appendChild(body);
+
+ section.info.forEach(function(header) {
+ var row = body.insertRow(-1);
+ var th = document.createElement("th");
+ th.innerText = header.header;
+ row.appendChild(th);
+ row.insertCell(-1).innerText = header.value;
+ });
+ }
+ sections.forEach(createSectionTable, this);
+ },
+
+ refreshInfoIfNeeded: function()
+ {
+ if (this.infoNeedsRefresh === false)
+ return;
+
+ this.refreshInfo();
+ },
+
+ toggleShowingInfo: function()
+ {
+ this.showingInfo = !this.showingInfo;
+ },
+
+ get showingInfo()
+ {
+ return this._showingInfo;
+ },
+
+ set showingInfo(x)
+ {
+ if (this._showingInfo === x)
+ return;
+
+ this._showingInfo = x;
+
+ var element = this.infoElement;
+ if (x) {
+ element.removeStyleClass("hidden");
+ element.style.setProperty("overflow", "hidden");
+ this.refreshInfoIfNeeded();
+ WebInspector.animateStyle([{element: element, start: {height: 0}, end: {height: element.offsetHeight}}], 250, function() { element.style.removeProperty("height"); element.style.removeProperty("overflow") });
+ } else {
+ element.style.setProperty("overflow", "hidden");
+ WebInspector.animateStyle([{element: element, end: {height: 0}}], 250, function() { element.addStyleClass("hidden"); element.style.removeProperty("height") });
+ }
+ },
+
+ get showingTipButton()
+ {
+ return !this.tipButtonElement.hasStyleClass("hidden");
+ },
+
+ set showingTipButton(x)
+ {
+ if (x)
+ this.tipButtonElement.removeStyleClass("hidden");
+ else
+ this.tipButtonElement.addStyleClass("hidden");
+ },
+
+ toggleTipBalloon: function(event)
+ {
+ this.showingTipBalloon = !this.showingTipBalloon;
+ event.stopPropagation();
+ },
+
+ get showingTipBalloon()
+ {
+ return this._showingTipBalloon;
+ },
+
+ set showingTipBalloon(x)
+ {
+ if (this._showingTipBalloon === x)
+ return;
+
+ this._showingTipBalloon = x;
+
+ if (x) {
+ if (!this.tipBalloonElement) {
+ this.tipBalloonElement = document.createElement("div");
+ this.tipBalloonElement.className = "tip-balloon";
+ this.titleElement.appendChild(this.tipBalloonElement);
+
+ this.tipBalloonContentElement = document.createElement("div");
+ this.tipBalloonContentElement.className = "tip-balloon-content";
+ this.tipBalloonElement.appendChild(this.tipBalloonContentElement);
+ var tipText = '';
+ for (var id in this.resource.tips)
+ tipText += this.resource.tips[id].message + "\n";
+ this.tipBalloonContentElement.textContent = tipText;
+ }
+
+ this.tipBalloonElement.removeStyleClass("hidden");
+ WebInspector.animateStyle([{element: this.tipBalloonElement, start: {left: 160, opacity: 0}, end: {left: 145, opacity: 1}}], 250);
+ } else {
+ var element = this.tipBalloonElement;
+ WebInspector.animateStyle([{element: this.tipBalloonElement, start: {left: 145, opacity: 1}, end: {left: 160, opacity: 0}}], 250, function() { element.addStyleClass("hidden") });
+ }
+ }
+}
+
+WebInspector.TimelineValueCalculator = function()
+{
+}
+
+WebInspector.TimelineValueCalculator.prototype = {
+ computeValues: function(entries)
+ {
+ var total = 0;
+ var categoryValues = {};
+
+ function compute(entry)
+ {
+ var value = this._value(entry);
+ if (value === undefined)
+ return;
+
+ if (!(entry.resource.category in categoryValues))
+ categoryValues[entry.resource.category] = 0;
+ categoryValues[entry.resource.category] += value;
+ total += value;
+ }
+ entries.forEach(compute, this);
+
+ return {categoryValues: categoryValues, total: total};
+ },
+
+ _value: function(entry)
+ {
+ return 0;
+ },
+
+ get title()
+ {
+ return "";
+ },
+
+ formatValue: function(value)
+ {
+ return value.toString();
+ }
+}
+
+WebInspector.TransferTimeCalculator = function()
+{
+ WebInspector.TimelineValueCalculator.call(this);
+}
+
+WebInspector.TransferTimeCalculator.prototype = {
+ computeValues: function(entries)
+ {
+ var entriesByCategory = {};
+ entries.forEach(function(entry) {
+ if (!(entry.resource.category in entriesByCategory))
+ entriesByCategory[entry.resource.category] = [];
+ entriesByCategory[entry.resource.category].push(entry);
+ });
+
+ var earliestStart;
+ var latestEnd;
+ var categoryValues = {};
+ for (var category in entriesByCategory) {
+ entriesByCategory[category].sort(WebInspector.NetworkPanel.timelineEntryCompare);
+ categoryValues[category] = 0;
+
+ var segment = {start: -1, end: -1};
+ entriesByCategory[category].forEach(function(entry) {
+ if (entry.resource.startTime == -1 || entry.resource.endTime == -1)
+ return;
+
+ if (earliestStart === undefined)
+ earliestStart = entry.resource.startTime;
+ else
+ earliestStart = Math.min(earliestStart, entry.resource.startTime);
+
+ if (latestEnd === undefined)
+ latestEnd = entry.resource.endTime;
+ else
+ latestEnd = Math.max(latestEnd, entry.resource.endTime);
+
+ if (entry.resource.startTime <= segment.end) {
+ segment.end = Math.max(segment.end, entry.resource.endTime);
+ return;
+ }
+
+ categoryValues[category] += segment.end - segment.start;
+
+ segment.start = entry.resource.startTime;
+ segment.end = entry.resource.endTime;
+ });
+
+ // Add the last segment
+ categoryValues[category] += segment.end - segment.start;
+ }
+
+ return {categoryValues: categoryValues, total: latestEnd - earliestStart};
+ },
+
+ get title()
+ {
+ return "Transfer Time";
+ },
+
+ formatValue: function(value)
+ {
+ return Number.secondsToString(value);
+ }
+}
+
+WebInspector.TransferTimeCalculator.prototype.__proto__ = WebInspector.TimelineValueCalculator.prototype;
+
+WebInspector.TransferSizeCalculator = function()
+{
+ WebInspector.TimelineValueCalculator.call(this);
+}
+
+WebInspector.TransferSizeCalculator.prototype = {
+ _value: function(entry)
+ {
+ return entry.resource.contentLength;
+ },
+
+ get title()
+ {
+ return "Transfer Size";
+ },
+
+ formatValue: function(value)
+ {
+ return Number.bytesToString(value);
+ }
+}
+
+WebInspector.TransferSizeCalculator.prototype.__proto__ = WebInspector.TimelineValueCalculator.prototype;
+
+function makeRoundedRectPath(ctx, x, y, w, h, r) {
+ ctx.beginPath();
+ ctx.moveTo(x, y + r);
+ ctx.lineTo(x, y + h - r);
+ ctx.quadraticCurveTo(x, y + h, x + r, y + h);
+ ctx.lineTo(x + w - r, y + h);
+ ctx.quadraticCurveTo(x + w, y + h, x + w, y + h - r);
+ ctx.lineTo(x + w, y + r);
+ ctx.quadraticCurveTo(x + w, y, x + w - r, y);
+ ctx.lineTo(x + r, y);
+ ctx.quadraticCurveTo(x, y, x, y + r);
+ ctx.closePath();
+}
+
+function drawPillShading(ctx, x, y, w, h) {
+ var lightGradient = ctx.createLinearGradient(x, y, x, y + (h / 1.5));
+ lightGradient.addColorStop(0.0, 'rgba(220, 220, 220, 0.6)');
+ lightGradient.addColorStop(0.4, 'rgba(220, 220, 220, 0.2)');
+ lightGradient.addColorStop(1.0, 'rgba(255, 255, 255, 0.0)');
+
+ var darkGradient = ctx.createLinearGradient(x, y + (h / 3), x, y + h);
+ darkGradient.addColorStop(0.0, 'rgba(0, 0, 0, 0.0)');
+ darkGradient.addColorStop(0.8, 'rgba(0, 0, 0, 0.2)');
+ darkGradient.addColorStop(1.0, 'rgba(0, 0, 0, 0.5)');
+
+ ctx.fillStyle = darkGradient;
+ ctx.fillRect(x, y, w, h);
+
+ ctx.fillStyle = lightGradient;
+ ctx.fillRect(x, y, w, h);
+}
+
+function drawDividerLines(ctx, x, y, w, h) {
+ ctx.save();
+
+ ctx.lineWidth = 1;
+
+ for (var i = 1; i < 20; ++i) {
+ ctx.beginPath();
+ ctx.moveTo(x + (i * Math.round(w / 20)) + 0.5, y);
+ ctx.lineTo(x + (i * Math.round(w / 20)) + 0.5, y + h);
+ ctx.closePath();
+
+ ctx.strokeStyle = 'rgba(0, 0, 0, 0.2)';
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(x + (i * Math.round(w / 20)) + 1.5, y);
+ ctx.lineTo(x + (i * Math.round(w / 20)) + 1.5, y + h);
+ ctx.closePath();
+
+ ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
+ ctx.stroke();
+ }
+
+ ctx.restore();
+}
+
+function fadeOutRect(ctx, x, y, w, h, a1, a2) {
+ ctx.save();
+
+ var gradient = ctx.createLinearGradient(x, y, x, y + h);
+ gradient.addColorStop(0.0, 'rgba(0, 0, 0, ' + (1.0 - a1) + ')');
+ gradient.addColorStop(0.8, 'rgba(0, 0, 0, ' + (1.0 - a2) + ')');
+ gradient.addColorStop(1.0, 'rgba(0, 0, 0, 1.0)');
+
+ ctx.globalCompositeOperation = 'destination-out';
+
+ ctx.fillStyle = gradient;
+ ctx.fillRect(x, y, w, h);
+
+ ctx.restore();
+}
+
+function drawPillSegments(ctx, x, y, w, h, segments) {
+ var total = 0;
+ for (var i = 0; i < segments.length; ++i)
+ total += segments[i].value;
+
+ var percents = segments.map(function(s) { return Math.max(Math.round(100 * s.value / total), 1) });
+ var percentTotal = 0;
+ for (var i = 0; i < percents.length; ++i)
+ percentTotal += percents[i];
+
+ while (percentTotal > 100) {
+ var difference = percentTotal - 100;
+ for (var i = 0; i < percents.length && percentTotal > 100; ++i) {
+ if (percents[i] > 1) {
+ --percents[i];
+ --percentTotal;
+ }
+ }
+ }
+
+ var previousWidth = 0;
+ for (var i = 0; i < segments.length; ++i) {
+ var width = Math.round(w * percents[i] / 100);
+ ctx.fillStyle = segments[i].color;
+ ctx.fillRect(x + previousWidth, y, width, h);
+ previousWidth += width;
+ }
+}
+
+function drawPill(ctx, x, y, w, h, r, segments) {
+ ctx.save();
+
+ makeRoundedRectPath(ctx, x, y, w, h, r);
+ ctx.clip();
+
+ drawPillSegments(ctx, x, y, w, h, segments);
+ drawDividerLines(ctx, x, y, w, h);
+ drawPillShading(ctx, x, y, w, h);
+
+ ctx.restore();
+}
+
+function drawShadowLine(ctx, x, y, w, h) {
+ ctx.beginPath();
+ ctx.moveTo(x + 1.5, y + 0.5);
+ ctx.lineTo(x + w - 1.5, y + 0.5);
+ ctx.closePath();
+
+ ctx.strokeStyle = 'rgba(0, 0, 0, 0.2)';
+ ctx.lineWidth = h;
+ ctx.stroke();
+}
+
+function drawSwatchSquare(ctx, color) {
+ ctx.save();
+
+ ctx.fillStyle = color;
+ ctx.fillRect(0, 0, 13, 13);
+
+ var gradient = ctx.createLinearGradient(0, 0, 13, 13);
+ gradient.addColorStop(0.0, 'rgba(255, 255, 255, 0.2)');
+ gradient.addColorStop(1.0, 'rgba(255, 255, 255, 0.0)');
+
+ ctx.fillStyle = gradient;
+ ctx.fillRect(0, 0, 13, 13);
+
+ gradient = ctx.createLinearGradient(13, 13, 0, 0);
+ gradient.addColorStop(0.0, 'rgba(0, 0, 0, 0.2)');
+ gradient.addColorStop(1.0, 'rgba(0, 0, 0, 0.0)');
+
+ ctx.fillStyle = gradient;
+ ctx.fillRect(0, 0, 13, 13);
+
+ ctx.strokeStyle = "rgba(0, 0, 0, 0.6)";
+ ctx.strokeRect(0.5, 0.5, 12, 12);
+
+ ctx.restore();
+}
--- /dev/null
+WebInspector.Resource = function(requestHeaders, url, domain, path, lastPathComponent, identifier, mainResource, cached)
+{
+ this.identifier = identifier;
+
+ this.startTime = -1;
+ this.endTime = -1;
+ this.mainResource = mainResource;
+ this.requestHeaders = requestHeaders;
+ this.url = url;
+ this.domain = domain;
+ this.path = path;
+ this.lastPathComponent = lastPathComponent;
+ this.cached = cached;
+
+ this.listItem = new WebInspector.ResourceTreeElement(this);
+ this.updateTitle();
+
+ this.category = WebInspector.resourceCategories.other;
+}
+
+// Keep these in sync with WebCore::InspectorResource::Type
+WebInspector.Resource.Type = {
+ Document: 0,
+ Stylesheet: 1,
+ Image: 2,
+ Script: 3,
+ Other: 4,
+
+ isTextType: function(type)
+ {
+ return (type == 0) || (type == 1) || (type == 3);
+ },
+
+ toString: function(type)
+ {
+ switch (type) {
+ case 0:
+ return "document";
+ case 1:
+ return "stylesheet";
+ case 2:
+ return "image";
+ case 3:
+ return "script";
+ case 4:
+ default:
+ return "other";
+ }
+ },
+}
+
+WebInspector.Resource.prototype = {
+ get url()
+ {
+ return this._url;
+ },
+
+ set url(x)
+ {
+ if (this._url === x)
+ return;
+
+ var oldURL = this._url;
+ this._url = x;
+ WebInspector.resourceURLChanged(this, oldURL);
+ this.updateTitleSoon();
+ },
+
+ get domain()
+ {
+ return this._domain;
+ },
+
+ set domain(x)
+ {
+ if (this._domain === x)
+ return;
+ this._domain = x;
+ this.updateTitleSoon();
+ },
+
+ get lastPathComponent()
+ {
+ return this._lastPathComponent;
+ },
+
+ set lastPathComponent(x)
+ {
+ if (this._lastPathComponent === x)
+ return;
+ this._lastPathComponent = x;
+ this._lastPathComponentLowerCase = x ? x.toLowerCase() : null;
+ this.updateTitleSoon();
+ },
+
+ get displayName()
+ {
+ var title = this.lastPathComponent;
+ if (!title)
+ title = this.domain;
+ if (!title)
+ title = this.url;
+ return title;
+ },
+
+ get startTime()
+ {
+ return this._startTime;
+ },
+
+ set startTime(x)
+ {
+ if (this._startTime === x)
+ return;
+
+ this._startTime = x;
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.refresh();
+ },
+
+ get responseReceivedTime()
+ {
+ return this._responseReceivedTime;
+ },
+
+ set responseReceivedTime(x)
+ {
+ if (this._responseReceivedTime === x)
+ return;
+
+ this._responseReceivedTime = x;
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.refresh();
+ },
+
+ get endTime()
+ {
+ return this._endTime;
+ },
+
+ set endTime(x)
+ {
+ if (this._endTime === x)
+ return;
+
+ this._endTime = x;
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.refresh();
+ },
+
+ get contentLength()
+ {
+ return this._contentLength;
+ },
+
+ set contentLength(x)
+ {
+ if (this._contentLength === x)
+ return;
+
+ this._contentLength = x;
+
+ if (this._expectedContentLength && this._expectedContentLength > x) {
+ this.updateTitle();
+ var canvas = document.getElementById("loadingIcon" + this.identifier);
+ if (canvas)
+ WebInspector.drawLoadingPieChart(canvas, (x / this._expectedContentLength));
+ }
+
+ WebInspector.networkPanel.updateSummaryGraphSoon();
+ },
+
+ get expectedContentLength()
+ {
+ return this._expectedContentLength;
+ },
+
+ set expectedContentLength(x)
+ {
+ if (this._expectedContentLength === x)
+ return;
+
+ this._expectedContentLength = x;
+
+ if (x && this._contentLength && this._contentLength <= x) {
+ var canvas = document.getElementById("loadingIcon" + this.identifier);
+ if (canvas)
+ WebInspector.drawLoadingPieChart(canvas, (this._contentLength / x));
+ }
+ },
+
+ get finished()
+ {
+ return this._finished;
+ },
+
+ set finished(x)
+ {
+ if (this._finished === x)
+ return;
+
+ this._finished = x;
+ this.updateTitleSoon();
+
+ if (this.panel)
+ this.panel.needsRefresh = true;
+
+ if (x) {
+ var canvas = document.getElementById("loadingIcon" + this.identifier);
+ if (canvas)
+ canvas.parentNode.removeChild(canvas);
+
+ this._checkTips();
+ this._checkWarnings();
+ }
+ },
+
+ get failed()
+ {
+ return this._failed;
+ },
+
+ set failed(x)
+ {
+ this._failed = x;
+ },
+
+ get category()
+ {
+ return this._category;
+ },
+
+ set category(x)
+ {
+ if (this._category === x)
+ return;
+
+ var oldCategory = this._category;
+ if (oldCategory)
+ oldCategory.removeResource(this);
+
+ this._category = x;
+ this.updateTitle();
+
+ if (this._category)
+ this._category.addResource(this);
+
+ if (this.panel)
+ this.panel.needsRefresh = true;
+ },
+
+ get mimeType()
+ {
+ return this._mimeType;
+ },
+
+ set mimeType(x)
+ {
+ if (this._mimeType === x)
+ return;
+
+ this._mimeType = x;
+ },
+
+ get type()
+ {
+ return this._type;
+ },
+
+ set type(x)
+ {
+ if (this._type === x)
+ return;
+
+ this._type = x;
+
+ switch (x) {
+ case WebInspector.Resource.Type.Document:
+ this.category = WebInspector.resourceCategories.documents;
+ break;
+ case WebInspector.Resource.Type.Stylesheet:
+ this.category = WebInspector.resourceCategories.stylesheets;
+ break;
+ case WebInspector.Resource.Type.Script:
+ this.category = WebInspector.resourceCategories.scripts;
+ break;
+ case WebInspector.Resource.Type.Image:
+ this.category = WebInspector.resourceCategories.images;
+ break;
+ case WebInspector.Resource.Type.Other:
+ default:
+ this.category = WebInspector.resourceCategories.other;
+ break;
+ }
+ },
+
+ get documentNode() {
+ if ("identifier" in this)
+ return InspectorController.getResourceDocumentNode(this.identifier);
+ return null;
+ },
+
+ get requestHeaders()
+ {
+ if (this._requestHeaders === undefined)
+ this._requestHeaders = {};
+ return this._requestHeaders;
+ },
+
+ set requestHeaders(x)
+ {
+ if (this._requestHeaders === x)
+ return;
+
+ this._requestHeaders = x;
+ delete this._sortedRequestHeaders;
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.refreshInfo();
+ },
+
+ get sortedRequestHeaders()
+ {
+ if (this._sortedRequestHeaders !== undefined)
+ return this._sortedRequestHeaders;
+
+ this._sortedRequestHeaders = [];
+ for (var key in this.requestHeaders)
+ this._sortedRequestHeaders.push({header: key, value: this.requestHeaders[key]});
+ this._sortedRequestHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
+
+ return this._sortedRequestHeaders;
+ },
+
+ get responseHeaders()
+ {
+ if (this._responseHeaders === undefined)
+ this._responseHeaders = {};
+ return this._responseHeaders;
+ },
+
+ set responseHeaders(x)
+ {
+ if (this._responseHeaders === x)
+ return;
+
+ this._responseHeaders = x;
+ delete this._sortedResponseHeaders;
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.refreshInfo();
+ },
+
+ get sortedResponseHeaders()
+ {
+ if (this._sortedResponseHeaders !== undefined)
+ return this._sortedResponseHeaders;
+
+ this._sortedResponseHeaders = [];
+ for (var key in this.responseHeaders)
+ this._sortedResponseHeaders.push({header: key, value: this.responseHeaders[key]});
+ this._sortedResponseHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
+
+ return this._sortedResponseHeaders;
+ },
+
+ get tips()
+ {
+ if (!("_tips" in this))
+ this._tips = {};
+ return this._tips;
+ },
+
+ _addTip: function(tip)
+ {
+ if (tip.id in this.tips)
+ return;
+
+ this.tips[tip.id] = tip;
+
+ // FIXME: Re-enable this code once we have a scope bar in the Console.
+ // Otherwise, we flood the Console with too many tips.
+ /*
+ var msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.OtherMessageSource,
+ WebInspector.ConsoleMessage.TipMessageLevel, tip.message, -1, this.url);
+ WebInspector.consolePanel.addMessage(msg);
+ */
+
+ if (this.networkTimelineEntry)
+ this.networkTimelineEntry.showingTipButton = true;
+ },
+
+ _checkTips: function()
+ {
+ for (var tip in WebInspector.Tips)
+ this._checkTip(WebInspector.Tips[tip]);
+ },
+
+ _checkTip: function(tip)
+ {
+ var addTip = false;
+ switch (tip.id) {
+ case WebInspector.Tips.ResourceNotCompressed.id:
+ addTip = this._shouldCompress();
+ break;
+ }
+
+ if (addTip)
+ this._addTip(tip);
+ },
+
+ _shouldCompress: function()
+ {
+ return WebInspector.Resource.Type.isTextType(this.type)
+ && !("Content-Encoding" in this.responseHeaders)
+ && this.contentLength !== undefined
+ && this.contentLength >= 512;
+ },
+
+ _mimeTypeIsConsistentWithType: function()
+ {
+ if (this.type === undefined || this.type === WebInspector.Resource.Type.Other)
+ return true;
+
+ if (this.mimeType in WebInspector.MIMETypes)
+ return this.type in WebInspector.MIMETypes[this.mimeType];
+
+ return true;
+ },
+
+ _checkWarnings: function()
+ {
+ for (var warning in WebInspector.Warnings)
+ this._checkWarning(WebInspector.Warnings[warning]);
+ },
+
+ _checkWarning: function(warning)
+ {
+ var addWarning = false;
+ var msg;
+ switch (warning.id) {
+ case WebInspector.Warnings.IncorrectMIMEType.id:
+ if (!this._mimeTypeIsConsistentWithType())
+ msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.OtherMessageSource,
+ WebInspector.ConsoleMessage.WarningMessageLevel,
+ String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message,
+ WebInspector.Resource.Type.toString(this.type), this.mimeType),
+ -1, this.url);
+ break;
+ }
+
+ if (msg)
+ WebInspector.consolePanel.addMessage(msg);
+ },
+
+ updateTitleSoon: function()
+ {
+ if (this.updateTitleTimeout)
+ return;
+ var _self = this;
+ this.updateTitleTimeout = setTimeout(function () { _self.updateTitle() }, 0);
+ },
+
+ updateTitle: function()
+ {
+ delete this.updateTitleTimeout;
+
+ var title = this.displayName;
+
+ var info = "";
+ if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain)))
+ info = this.domain;
+
+ if (this.path && this.lastPathComponent) {
+ var lastPathComponentIndex = this.path.lastIndexOf("/" + this.lastPathComponent);
+ if (lastPathComponentIndex != -1)
+ info += this.path.substring(0, lastPathComponentIndex);
+ }
+
+ var fullTitle = "";
+
+ if (this.errors)
+ fullTitle += "<span class=\"count errors\">" + (this.errors + this.warnings) + "</span>";
+ else if (this.warnings)
+ fullTitle += "<span class=\"count warnings\">" + this.warnings + "</span>";
+
+ fullTitle += "<span class=\"title" + (info && info.length ? "" : " only") + "\">" + title.escapeHTML() + "</span>";
+ if (info && info.length)
+ fullTitle += "<span class=\"info\">" + info.escapeHTML() + "</span>";
+
+ var iconClass = "icon";
+ switch (this.category) {
+ default:
+ break;
+ case WebInspector.resourceCategories.images:
+ case WebInspector.resourceCategories.other:
+ iconClass = "icon plain";
+ }
+
+ if (!this.finished)
+ fullTitle += "<div class=\"" + iconClass + "\"><canvas id=\"loadingIcon" + this.identifier + "\" class=\"progress\" width=\"16\" height=\"16\"></canvas></div>";
+ else if (this.category === WebInspector.resourceCategories.images)
+ fullTitle += "<div class=\"" + iconClass + "\"><img class=\"preview\" src=\"" + this.url + "\"></div>";
+ else
+ fullTitle += "<div class=\"" + iconClass + "\"></div>";
+
+ this.listItem.title = fullTitle;
+ this.listItem.tooltip = this.url;
+ },
+
+ get panel()
+ {
+ if (!this._panel)
+ this._panel = new WebInspector.ResourcePanel(this);
+ return this._panel;
+ },
+
+ select: function()
+ {
+ WebInspector.navigateToResource(this);
+ },
+
+ deselect: function()
+ {
+ this.listItem.deselect(true);
+ if (WebInspector.currentPanel === this._panel)
+ WebInspector.currentPanel = null;
+ },
+
+ attach: function()
+ {
+ this.panel.attach();
+ },
+
+ detach: function()
+ {
+ if (this._panel)
+ this.panel.detach();
+ },
+
+ get errors()
+ {
+ if (!("_errors" in this))
+ this._errors = 0;
+
+ return this._errors;
+ },
+
+ set errors(x)
+ {
+ if (this._errors === x)
+ return;
+
+ this._errors = x;
+ this.updateTitleSoon();
+ },
+
+ get warnings()
+ {
+ if (!("_warnings" in this))
+ this._warnings = 0;
+
+ return this._warnings;
+ },
+
+ set warnings(x)
+ {
+ if (this._warnings === x)
+ return;
+
+ this._warnings = x;
+ this.updateTitleSoon();
+ }
+}
+
+WebInspector.ResourceTreeElement = function(resource)
+{
+ var item = new TreeElement("", resource, false);
+ item.onselect = WebInspector.ResourceTreeElement.selected;
+ item.ondeselect = WebInspector.ResourceTreeElement.deselected;
+ item.onreveal = WebInspector.ResourceTreeElement.revealed;
+ return item;
+}
+
+WebInspector.ResourceTreeElement.selected = function(element)
+{
+ var selectedElement = WebInspector.statusOutline.selectedTreeElement;
+ if (selectedElement)
+ selectedElement.deselect();
+ element.representedObject.select();
+}
+
+WebInspector.ResourceTreeElement.deselected = function(element)
+{
+ element.representedObject.deselect();
+}
+
+WebInspector.ResourceTreeElement.revealed = function(element)
+{
+ if (!element._listItemNode || !element.treeOutline || !element.treeOutline._childrenListNode)
+ return;
+ element.treeOutline._childrenListNode.scrollToElement(element._listItemNode);
+}
--- /dev/null
+WebInspector.ResourceCategory = function(title)
+{
+ this.title = title;
+ this.resources = [];
+ this.listItem = new WebInspector.ResourceCategoryTreeElement(this);
+ this.listItem.hidden = true;
+ WebInspector.fileOutline.appendChild(this.listItem);
+}
+
+WebInspector.ResourceCategory.prototype = {
+ toString: function()
+ {
+ return this.title;
+ },
+
+ addResource: function(resource)
+ {
+ var a = resource;
+ var resourcesLength = this.resources.length;
+ for (var i = 0; i < resourcesLength; ++i) {
+ var b = this.resources[i];
+ if (a._lastPathComponentLowerCase < b._lastPathComponentLowerCase)
+ break;
+ }
+
+ this.resources.splice(i, 0, resource);
+ this.listItem.insertChild(resource.listItem, i);
+ this.listItem.hidden = false;
+
+ resource.attach();
+ },
+
+ removeResource: function(resource)
+ {
+ resource.detach();
+
+ var resourcesLength = this.resources.length;
+ for (var i = 0; i < resourcesLength; ++i) {
+ if (this.resources[i] === resource) {
+ this.resources.splice(i, 1);
+ break;
+ }
+ }
+
+ this.listItem.removeChild(resource.listItem);
+
+ if (!this.resources.length)
+ this.listItem.hidden = true;
+ },
+
+ removeAllResources: function(resource)
+ {
+ var resourcesLength = this.resources.length;
+ for (var i = 0; i < resourcesLength; ++i)
+ this.resources[i].detach();
+ this.resources = [];
+ this.listItem.removeChildren();
+ this.listItem.hidden = true;
+ }
+}
+
+WebInspector.ResourceCategoryTreeElement = function(category)
+{
+ var item = new TreeElement(category.title, category, true);
+ item.selectable = false;
+ return item;
+}
--- /dev/null
+WebInspector.ResourcePanel = function(resource)
+{
+ this.resource = resource;
+ this.messages = [];
+
+ WebInspector.Panel.call(this);
+}
+
+WebInspector.ResourcePanel.prototype = {
+ show: function()
+ {
+ this.resource.listItem.select(true);
+ this.resource.listItem.reveal();
+
+ if (this.currentView && "onshow" in this.currentView)
+ this.currentView.onshow();
+
+ WebInspector.Panel.prototype.show.call(this);
+ },
+
+ hide: function()
+ {
+ this.resource.listItem.deselect(true);
+ if (this.currentView && "onhide" in this.currentView)
+ this.currentView.onhide();
+ WebInspector.Panel.prototype.hide.call(this);
+ },
+
+ sourceRow: function(lineNumber)
+ {
+ this.refreshIfNeeded();
+ var doc = this.sourceFrame.contentDocument;
+ var rows = doc.getElementsByTagName("table")[0].rows;
+
+ // Line numbers are a 1-based index, but the rows collection is 0-based.
+ --lineNumber;
+ if (lineNumber >= rows.length)
+ lineNumber = rows.length - 1;
+
+ return rows[lineNumber];
+ },
+
+ showSourceLine: function(lineNumber)
+ {
+ var row = this.sourceRow(lineNumber);
+ if (!row)
+ return;
+ this.navigateToView("source");
+ row.scrollIntoView(true);
+ },
+
+ addMessageToSource: function(msg)
+ {
+ this.messages.push(msg);
+ if (this.sourceFrame)
+ this._addMessageToSource(msg);
+ },
+
+ _addMessageToSource: function(msg)
+ {
+ var row = this.sourceRow(msg.line);
+ if (!row)
+ return;
+ var cell = row.getElementsByTagName("td")[1];
+
+ var errorDiv = cell.lastChild;
+ if (!errorDiv || errorDiv.nodeName.toLowerCase() !== "div" || !errorDiv.hasStyleClass("webkit-html-message-bubble")) {
+ errorDiv = document.createElement("div");
+ errorDiv.className = "webkit-html-message-bubble";
+ cell.appendChild(errorDiv);
+ }
+ var imageURL;
+ switch (msg.level) {
+ case WebInspector.ConsoleMessage.ErrorMessageLevel:
+ errorDiv.addStyleClass("webkit-html-error-message");
+ imageURL = "Images/errorIcon.png";
+ break;
+ case WebInspector.ConsoleMessage.WarningMessageLevel:
+ errorDiv.addStyleClass("webkit-html-warning-message");
+ imageURL = "Images/warningIcon.png";
+ break;
+ }
+
+ var lineDiv = document.createElement("div");
+ lineDiv.className = "webkit-html-message-line";
+ errorDiv.appendChild(lineDiv);
+
+ var image = document.createElement("img");
+ image.src = imageURL;
+ image.className = "webkit-html-message-icon";
+ lineDiv.appendChild(image);
+
+ lineDiv.appendChild(document.createTextNode(msg.message));
+ },
+
+ _addMessagesToSource: function()
+ {
+ for (var i = 0; i < this.messages.length; ++i)
+ this._addMessageToSource(this.messages[i]);
+ },
+
+ navigateToView: function(view)
+ {
+ if (typeof view === "string" || view instanceof String) {
+ if (this.needsRefresh)
+ this.refresh();
+ view = this.views[view];
+ }
+
+ WebInspector.navigateToView(view);
+ },
+
+ createViews: function()
+ {
+ this.currentView = null;
+
+ var selectViewFunction = function(event)
+ {
+ WebInspector.navigateToView(event.currentTarget.view);
+ }
+
+ var views = [
+ {name: "source", title: "Source", selected: true},
+ ];
+
+ if (this.resource.category === WebInspector.resourceCategories.documents) {
+ var domView = {name: "dom", title: "DOM", selected: false};
+ var panel = this;
+ domView.onshow = function() { InspectorController.highlightDOMNode(panel.focusedDOMNode) };
+ domView.onhide = function() { InspectorController.hideDOMNodeHighlight() };
+ views.push(domView);
+ }
+
+ var oldViews = this.views || {};
+ this.views = {};
+ this.viewButtons = [];
+ for (var i = 0; i < views.length; ++i) {
+ var buttonElement = document.createElement("button");
+ buttonElement.setAttribute("title", views[i].title);
+ buttonElement.addEventListener("click", selectViewFunction, "true");
+ buttonElement.appendChild(document.createElement("img"));
+
+ var contentElement = document.createElement("div");
+ contentElement.className = "content " + views[i].name;
+
+ // We need to reuse the old view object if possible because it might
+ // already be in the backForwardList
+ var view = oldViews[views[i].name] || {};
+
+ view.buttonElement = buttonElement;
+ view.contentElement = contentElement;
+ view.panel = this;
+ view.buttonElement.view = view;
+ if ("onshow" in views[i])
+ view.onshow = views[i].onshow;
+ if ("onhide" in views[i])
+ view.onhide = views[i].onhide;
+
+ this.views[views[i].name] = view;
+ this.viewButtons.push(buttonElement);
+ this.element.appendChild(contentElement);
+ }
+
+ this.currentView = this.views.source;
+
+ if (WebInspector.currentPanel == this)
+ WebInspector.updateViewButtons();
+ },
+
+ _createSourceFrame: function()
+ {
+ this.sourceFrame = document.createElement("iframe");
+ this.sourceFrame.setAttribute("viewsource", "true");
+ this.sourceFrame.name = "sourceFrame" + WebInspector.ResourcePanel.sourceFrameCounter++;
+ this.views.source.contentElement.appendChild(this.sourceFrame);
+ InspectorController.addSourceToFrame(this.resource.identifier, this.sourceFrame);
+ WebInspector.addMainEventListeners(this.sourceFrame.contentDocument);
+ this._addMessagesToSource();
+ },
+
+ updateTreeSelection: function()
+ {
+ if (!this.domTreeOutline || !this.domTreeOutline.selectedTreeElement)
+ return;
+ var element = this.domTreeOutline.selectedTreeElement;
+ element.updateSelection(element);
+ },
+
+ refresh: function()
+ {
+ this.needsRefresh = false;
+
+ this.element.removeChildren();
+
+ this.createViews();
+
+ if (!this.resource.finished)
+ this.views.source.contentElement.addStyleClass("loading");
+ else if (this.resource.failed)
+ this.views.source.contentElement.removeStyleClass("failed");
+ else if (this.resource.category === WebInspector.resourceCategories.documents) {
+ this._createSourceFrame();
+
+ this.views.dom.contentElement.sideContentElement = document.createElement("div");
+ this.views.dom.contentElement.sideContentElement.className = "content side";
+
+ this.views.dom.contentElement.treeContentElement = document.createElement("div");
+ this.views.dom.contentElement.treeContentElement.className = "content tree outline-disclosure";
+
+ this.views.dom.contentElement.treeListElement = document.createElement("ol");
+ this.domTreeOutline = new TreeOutline(this.views.dom.contentElement.treeListElement);
+ this.domTreeOutline.panel = this;
+
+ var panel = this;
+ window.addEventListener("resize", function() { panel.updateTreeSelection() }, false);
+
+ this.views.dom.contentElement.crumbsElement = document.createElement("div");
+ this.views.dom.contentElement.crumbsElement.className = "crumbs";
+
+ this.views.dom.contentElement.innerCrumbsElement = document.createElement("div");
+ this.views.dom.contentElement.crumbsElement.appendChild(this.views.dom.contentElement.innerCrumbsElement);
+
+ this.views.dom.contentElement.sidebarPanes = {};
+ this.views.dom.contentElement.sidebarPanes.styles = new WebInspector.SidebarPane("Styles");
+ this.views.dom.contentElement.sidebarPanes.metrics = new WebInspector.SidebarPane("Metrics");
+ this.views.dom.contentElement.sidebarPanes.properties = new WebInspector.SidebarPane("Properties");
+
+ var panel = this;
+ this.views.dom.contentElement.sidebarPanes.styles.onexpand = function() { panel.updateStyles() };
+ this.views.dom.contentElement.sidebarPanes.metrics.onexpand = function() { panel.updateMetrics() };
+ this.views.dom.contentElement.sidebarPanes.properties.onexpand = function() { panel.updateProperties() };
+
+ this.views.dom.contentElement.sidebarPanes.styles.expanded = true;
+
+ this.views.dom.contentElement.sidebarElement = document.createElement("div");
+ this.views.dom.contentElement.sidebarElement.className = "sidebar";
+
+ this.views.dom.contentElement.sidebarElement.appendChild(this.views.dom.contentElement.sidebarPanes.styles.element);
+ this.views.dom.contentElement.sidebarElement.appendChild(this.views.dom.contentElement.sidebarPanes.metrics.element);
+ this.views.dom.contentElement.sidebarElement.appendChild(this.views.dom.contentElement.sidebarPanes.properties.element);
+
+ this.views.dom.contentElement.sideContentElement.appendChild(this.views.dom.contentElement.treeContentElement);
+ this.views.dom.contentElement.sideContentElement.appendChild(this.views.dom.contentElement.crumbsElement);
+ this.views.dom.contentElement.treeContentElement.appendChild(this.views.dom.contentElement.treeListElement);
+
+ this.views.dom.contentElement.appendChild(this.views.dom.contentElement.sideContentElement);
+ this.views.dom.contentElement.appendChild(this.views.dom.contentElement.sidebarElement);
+
+ this.rootDOMNode = this.resource.documentNode;
+ } else if (this.resource.category === WebInspector.resourceCategories.images) {
+ this.views.source.contentElement.removeStyleClass("source");
+ this.views.source.contentElement.addStyleClass("image");
+
+ var container = document.createElement("div");
+ container.className = "image";
+ this.views.source.contentElement.appendChild(container);
+
+ this.imagePreviewElement = document.createElement("img");
+ this.imagePreviewElement.setAttribute("src", this.resource.url);
+
+ container.appendChild(this.imagePreviewElement);
+
+ container = document.createElement("div");
+ container.className = "info";
+ this.views.source.contentElement.appendChild(container);
+
+ var imageNameElement = document.createElement("h1");
+ imageNameElement.className = "title";
+ imageNameElement.textContent = this.resource.displayName;
+ container.appendChild(imageNameElement);
+
+ var infoListElement = document.createElement("dl");
+ infoListElement.className = "infoList";
+
+ var imageProperties = [
+ {name: "Dimensions", value: this.imagePreviewElement.naturalWidth + " \u00D7 " + this.imagePreviewElement.height},
+ {name: "File size", value: (this.resource.contentLength / 1024).toPrecision(2) + "KB"},
+ {name: "MIME type", value: this.resource.mimeType}
+ ];
+
+ var listHTML = '';
+ for (var i = 0; i < imageProperties.length; ++i)
+ listHTML += "<dt>" + imageProperties[i].name + "</dt><dd>" + imageProperties[i].value + "</dd>";
+
+ infoListElement.innerHTML = listHTML;
+ container.appendChild(infoListElement);
+ } else if (this.resource.category === WebInspector.resourceCategories.stylesheets
+ || this.resource.category === WebInspector.resourceCategories.scripts) {
+ this.views.source.contentElement.addStyleClass(this.resource.category.title.toLowerCase());
+ this._createSourceFrame();
+ } else {
+ if (this.resource.category)
+ this.views.source.contentElement.addStyleClass(this.resource.category.title.toLowerCase());
+ }
+ },
+
+ get currentView()
+ {
+ return this._currentView;
+ },
+
+ set currentView(x)
+ {
+ if (this._currentView === x)
+ return;
+
+ if (this._currentView) {
+ this._currentView.buttonElement.removeStyleClass("selected");
+ this._currentView.contentElement.removeStyleClass("selected");
+ if ("onhide" in this._currentView)
+ this._currentView.onhide();
+ }
+
+ this._currentView = x;
+
+ if (x) {
+ x.buttonElement.addStyleClass("selected");
+ x.contentElement.addStyleClass("selected");
+ if ("onshow" in x)
+ x.onshow();
+
+ if (x.contentElement.parentNode !== this.element)
+ InspectorController.log("Tried to set currentView to a view " + x.title + " whose contentElement is a non-child");
+ }
+ },
+
+ get rootDOMNode()
+ {
+ return this._rootDOMNode;
+ },
+
+ set rootDOMNode(x)
+ {
+ if (this._rootDOMNode === x)
+ return;
+
+ this._rootDOMNode = x;
+
+ this.updateBreadcrumb();
+ this.updateTreeOutline();
+ },
+
+ get focusedDOMNode()
+ {
+ return this._focusedDOMNode;
+ },
+
+ set focusedDOMNode(x)
+ {
+ if (this.resource.category !== WebInspector.resourceCategories.documents) {
+ InspectorController.log("Called set focusedDOMNode on a non-document resource " + this.resource.displayName + " which is not a document");
+ return;
+ }
+
+ if (this._focusedDOMNode === x) {
+ var nodeItem = this.revealNode(x);
+ if (nodeItem)
+ nodeItem.select();
+ return;
+ }
+
+ this._focusedDOMNode = x;
+
+ this.updateBreadcrumb();
+
+ for (var pane in this.views.dom.contentElement.sidebarPanes)
+ this.views.dom.contentElement.sidebarPanes[pane].needsUpdate = true;
+
+ this.updateStyles();
+ this.updateMetrics();
+ this.updateProperties();
+
+ InspectorController.highlightDOMNode(x);
+
+ var nodeItem = this.revealNode(x);
+ if (nodeItem)
+ nodeItem.select();
+ },
+
+ revealNode: function(node)
+ {
+ var nodeItem = this.domTreeOutline.findTreeElement(node, function(a, b) { return isAncestorNode.call(a, b); }, function(a) { return a.parentNode; });
+ if (!nodeItem)
+ return;
+
+ nodeItem.reveal();
+ return nodeItem;
+ },
+
+ updateTreeOutline: function()
+ {
+ this.domTreeOutline.removeChildrenRecursive();
+
+ if (!this.rootDOMNode)
+ return;
+
+ // FIXME: this could use findTreeElement to reuse a tree element if it already exists
+ var node = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(this.rootDOMNode) : this.rootDOMNode.firstChild);
+ while (node) {
+ var item = new WebInspector.DOMNodeTreeElement(node);
+ this.domTreeOutline.appendChild(item);
+ node = Preferences.ignoreWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling;
+ }
+
+ this.updateTreeSelection();
+ },
+
+ updateBreadcrumb: function()
+ {
+ if (!this.views || !this.views.dom.contentElement)
+ return;
+ var crumbs = this.views.dom.contentElement.innerCrumbsElement;
+ if (!crumbs)
+ return;
+
+ var handled = false;
+ var foundRoot = false;
+ var crumb = crumbs.firstChild;
+ while (crumb) {
+ if (crumb.representedObject === this.rootDOMNode)
+ foundRoot = true;
+
+ if (foundRoot)
+ crumb.addStyleClass("hidden");
+ else
+ crumb.removeStyleClass("hidden");
+
+ if (crumb.representedObject === this.focusedDOMNode) {
+ crumb.addStyleClass("selected");
+ handled = true;
+ } else {
+ crumb.removeStyleClass("selected");
+ }
+
+ crumb = crumb.nextSibling;
+ }
+
+ if (handled)
+ return;
+
+ crumbs.removeChildren();
+
+ var panel = this;
+ var selectCrumbFunction = function(event)
+ {
+ if (event.currentTarget.hasStyleClass("hidden"))
+ panel.rootDOMNode = event.currentTarget.representedObject.parentNode;
+ panel.focusedDOMNode = event.currentTarget.representedObject;
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ var selectCrumbRootFunction = function(event)
+ {
+ panel.rootDOMNode = event.currentTarget.representedObject.parentNode;
+ panel.focusedDOMNode = event.currentTarget.representedObject;
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ foundRoot = false;
+ var current = this.focusedDOMNode;
+ while (current) {
+ if (current.nodeType === Node.DOCUMENT_NODE)
+ break;
+
+ if (current === this.rootDOMNode)
+ foundRoot = true;
+
+ var crumb = document.createElement("span");
+ crumb.className = "crumb";
+ crumb.representedObject = current;
+ crumb.addEventListener("mousedown", selectCrumbFunction, false);
+ crumb.addEventListener("dblclick", selectCrumbRootFunction, false);
+
+ var crumbTitle;
+ switch (current.nodeType) {
+ case Node.ELEMENT_NODE:
+ crumbTitle = current.nodeName.toLowerCase();
+
+ var value = current.getAttribute("id");
+ if (value && value.length)
+ crumbTitle += "#" + value;
+
+ value = current.getAttribute("class");
+ if (value && value.length) {
+ var classes = value.split(/\s+/);
+ var classesLength = classes.length;
+ for (var i = 0; i < classesLength; ++i) {
+ value = classes[i];
+ if (value && value.length)
+ crumbTitle += "." + value;
+ }
+ }
+
+ break;
+
+ case Node.TEXT_NODE:
+ if (isNodeWhitespace.call(current))
+ crumbTitle = "(whitespace)";
+ else
+ crumbTitle = "(text)";
+ break
+
+ case Node.COMMENT_NODE:
+ crumbTitle = "<!-->";
+ break;
+
+ default:
+ crumbTitle = current.nodeName.toLowerCase();
+ }
+
+ crumb.textContent = crumbTitle;
+
+ if (foundRoot)
+ crumb.addStyleClass("hidden");
+ if (current === this.focusedDOMNode)
+ crumb.addStyleClass("selected");
+ if (!crumbs.childNodes.length)
+ crumb.addStyleClass("end");
+ if (current.parentNode.nodeType === Node.DOCUMENT_NODE)
+ crumb.addStyleClass("start");
+
+ crumbs.appendChild(crumb);
+ current = current.parentNode;
+ }
+ },
+
+ updateStyles: function()
+ {
+ if (!this.views.dom.contentElement.sidebarPanes.styles.expanded)
+ return;
+ if (!this.views.dom.contentElement.sidebarPanes.styles.needsUpdate)
+ return;
+
+ this.views.dom.contentElement.sidebarPanes.styles.needsUpdate = false;
+
+ var stylesBody = this.views.dom.contentElement.sidebarPanes.styles.bodyElement;
+
+ stylesBody.removeChildren();
+ this.views.dom.contentElement.sidebarPanes.styles.sections = [];
+
+ if (!this.focusedDOMNode)
+ return;
+
+ var styleNode = this.focusedDOMNode;
+ if (styleNode.nodeType === Node.TEXT_NODE && styleNode.parentNode)
+ styleNode = styleNode.parentNode;
+
+ var styleRules = [];
+ var styleProperties = [];
+
+ if (styleNode.nodeType === Node.ELEMENT_NODE) {
+ var propertyCount = [];
+
+ var computedStyle = styleNode.ownerDocument.defaultView.getComputedStyle(styleNode);
+ if (computedStyle && computedStyle.length)
+ styleRules.push({ isComputedStyle: true, selectorText: "Computed Style", style: computedStyle });
+
+ var styleNodeName = styleNode.nodeName.toLowerCase();
+ for (var i = 0; i < styleNode.attributes.length; ++i) {
+ var attr = styleNode.attributes[i];
+ if (attr.style) {
+ var attrStyle = { attrName: attr.name, style: attr.style };
+ attrStyle.subtitle = "element\u2019s \u201C" + attr.name + "\u201D attribute";
+ attrStyle.selectorText = styleNodeName + "[" + attr.name;
+ if (attr.value.length)
+ attrStyle.selectorText += "=" + attr.value;
+ attrStyle.selectorText += "]";
+ styleRules.push(attrStyle);
+ }
+ }
+
+ if (styleNode.style && styleNode.style.length) {
+ var inlineStyle = { selectorText: "Inline Style Attribute", style: styleNode.style };
+ inlineStyle.subtitle = "element\u2019s \u201Cstyle\u201D attribute";
+ styleRules.push(inlineStyle);
+ }
+
+ var matchedStyleRules = styleNode.ownerDocument.defaultView.getMatchedCSSRules(styleNode, "", !Preferences.showUserAgentStyles);
+ if (matchedStyleRules) {
+ for (var i = matchedStyleRules.length - 1; i >= 0; --i)
+ styleRules.push(matchedStyleRules[i]);
+ }
+
+ var priorityUsed = false;
+ var usedProperties = {};
+ var shorthandProperties = {};
+ for (var i = 0; i < styleRules.length; ++i) {
+ styleProperties[i] = [];
+
+ var style = styleRules[i].style;
+ var styleShorthandLookup = [];
+ for (var j = 0; j < style.length; ++j) {
+ var prop = null;
+ var name = style[j];
+ var shorthand = style.getPropertyShorthand(name);
+ if (!shorthand && styleRules[i].isComputedStyle)
+ shorthand = shorthandProperties[name];
+
+ if (shorthand) {
+ prop = styleShorthandLookup[shorthand];
+ shorthandProperties[name] = shorthand;
+ }
+
+ if (!priorityUsed && style.getPropertyPriority(name).length)
+ priorityUsed = true;
+
+ if (prop) {
+ prop.subProperties.push(name);
+ } else {
+ prop = { style: style, subProperties: [name], unusedProperties: [], name: (shorthand ? shorthand : name) };
+ styleProperties[i].push(prop);
+
+ if (shorthand) {
+ styleShorthandLookup[shorthand] = prop;
+ if (!styleRules[i].isComputedStyle) {
+ if (!propertyCount[shorthand]) {
+ propertyCount[shorthand] = 1;
+ } else {
+ prop.unusedProperties[shorthand] = true;
+ propertyCount[shorthand]++;
+ }
+ }
+ }
+ }
+
+ if (styleRules[i].isComputedStyle)
+ continue;
+
+ usedProperties[name] = true;
+ if (shorthand)
+ usedProperties[shorthand] = true;
+
+ if (!propertyCount[name]) {
+ propertyCount[name] = 1;
+ } else {
+ prop.unusedProperties[name] = true;
+ propertyCount[name]++;
+ }
+ }
+ }
+
+ if (priorityUsed) {
+ // walk the properties again and account for !important
+ var priorityCount = [];
+ for (var i = 0; i < styleRules.length; ++i) {
+ if (styleRules[i].isComputedStyle)
+ continue;
+ var style = styleRules[i].style;
+ for (var j = 0; j < styleProperties[i].length; ++j) {
+ var prop = styleProperties[i][j];
+ for (var k = 0; k < prop.subProperties.length; ++k) {
+ var name = prop.subProperties[k];
+ if (style.getPropertyPriority(name).length) {
+ if (!priorityCount[name]) {
+ if (prop.unusedProperties[name])
+ prop.unusedProperties[name] = false;
+ priorityCount[name] = 1;
+ } else {
+ priorityCount[name]++;
+ }
+ } else if (priorityCount[name]) {
+ prop.unusedProperties[name] = true;
+ }
+ }
+ }
+ }
+ }
+
+ var styleRulesLength = styleRules.length;
+ for (var i = 0; i < styleRulesLength; ++i) {
+ var selectorText = styleRules[i].selectorText;
+
+ var section = new WebInspector.PropertiesSection(selectorText);
+ if (!styleRules[i].isComputedStyle)
+ section.expanded = true;
+
+ if (!styleRules[i].isComputedStyle) {
+ var sheet;
+ var file = false;
+ if (styleRules[i].subtitle)
+ sheet = styleRules[i].subtitle;
+ else if (styleRules[i].parentStyleSheet && styleRules[i].parentStyleSheet.href) {
+ var url = styleRules[i].parentStyleSheet.href;
+ sheet = WebInspector.linkifyURL(url, url.trimURL(WebInspector.mainResource.domain).escapeHTML());
+ file = true;
+ } else if (styleRules[i].parentStyleSheet && !styleRules[i].parentStyleSheet.ownerNode)
+ sheet = "user agent stylesheet";
+ else
+ sheet = "inline stylesheet";
+
+ if (file)
+ section.subtitleElement.addStyleClass("file");
+
+ section.subtitle = sheet;
+ }
+
+ stylesBody.appendChild(section.element);
+ this.views.dom.contentElement.sidebarPanes.styles.sections.push(section);
+
+ var properties = styleProperties[i];
+ var isComputedStyle = styleRules[i].isComputedStyle;
+ var alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
+
+ for (var j = 0; j < properties.length; ++j) {
+ var prop = properties[j];
+
+ if (isComputedStyle && !alwaysShowComputedProperties[prop.name] && !usedProperties[prop.name])
+ continue;
+
+ var propTreeElement = new WebInspector.StylePropertyTreeElement(prop, isComputedStyle);
+ section.propertiesTreeOutline.appendChild(propTreeElement);
+ }
+ }
+ } else {
+ // can't style this node
+ }
+ },
+
+ updateMetrics: function()
+ {
+ if (!this.views.dom.contentElement.sidebarPanes.metrics.expanded)
+ return;
+ if (!this.views.dom.contentElement.sidebarPanes.metrics.needsUpdate)
+ return;
+
+ this.views.dom.contentElement.sidebarPanes.metrics.needsUpdate = false;
+
+ var metricsBody = this.views.dom.contentElement.sidebarPanes.metrics.bodyElement;
+
+ metricsBody.removeChildren();
+
+ if (!this.focusedDOMNode)
+ return;
+
+ var style;
+ if (this.focusedDOMNode.nodeType === Node.ELEMENT_NODE)
+ style = this.focusedDOMNode.ownerDocument.defaultView.getComputedStyle(this.focusedDOMNode);
+ if (!style)
+ return;
+
+ var metricsElement = document.createElement("div");
+ metricsElement.className = "metrics";
+
+ function boxPartValue(style, name, suffix)
+ {
+ var value = style.getPropertyValue(name + suffix);
+ if (value === "" || value === "0px")
+ value = "\u2012";
+ return value.replace(/px$/, "");
+ }
+
+ // Display types for which margin is ignored.
+ var noMarginDisplayType = {
+ "table-cell": true,
+ "table-column": true,
+ "table-column-group": true,
+ "table-footer-group": true,
+ "table-header-group": true,
+ "table-row": true,
+ "table-row-group": true
+ };
+
+ // Display types for which padding is ignored.
+ var noPaddingDisplayType = {
+ "table-column": true,
+ "table-column-group": true,
+ "table-footer-group": true,
+ "table-header-group": true,
+ "table-row": true,
+ "table-row-group": true
+ };
+
+ var boxes = ["content", "padding", "border", "margin"];
+ var previousBox;
+ for (var i = 0; i < boxes.length; ++i) {
+ var name = boxes[i];
+
+ if (name === "margin" && noMarginDisplayType[style.display])
+ continue;
+ if (name === "padding" && noPaddingDisplayType[style.display])
+ continue;
+
+ var boxElement = document.createElement("div");
+ boxElement.className = name;
+
+ if (boxes[i] === "content") {
+ var width = style.width.replace(/px$/, "");
+ var height = style.height.replace(/px$/, "");
+ boxElement.textContent = width + " \u00D7 " + height;
+ } else {
+ var suffix = boxes[i] === "border" ? "-width" : "";
+
+ var labelElement = document.createElement("div");
+ labelElement.className = "label";
+ labelElement.textContent = name;
+ boxElement.appendChild(labelElement);
+
+ var topElement = document.createElement("div");
+ topElement.className = "top";
+ topElement.textContent = boxPartValue(style, name + "-top", suffix);
+ boxElement.appendChild(topElement);
+
+ var leftElement = document.createElement("div");
+ leftElement.className = "left";
+ leftElement.textContent = boxPartValue(style, name + "-left", suffix);
+ boxElement.appendChild(leftElement);
+
+ if (previousBox)
+ boxElement.appendChild(previousBox);
+
+ var rightElement = document.createElement("div");
+ rightElement.className = "right";
+ rightElement.textContent = boxPartValue(style, name + "-right", suffix);
+ boxElement.appendChild(rightElement);
+
+ var bottomElement = document.createElement("div");
+ bottomElement.className = "bottom";
+ bottomElement.textContent = boxPartValue(style, name + "-bottom", suffix);
+ boxElement.appendChild(bottomElement);
+ }
+
+ previousBox = boxElement;
+ }
+
+ metricsElement.appendChild(previousBox);
+ metricsBody.appendChild(metricsElement);
+ },
+
+ updateProperties: function()
+ {
+ if (!this.views.dom.contentElement.sidebarPanes.properties.expanded)
+ return;
+ if (!this.views.dom.contentElement.sidebarPanes.properties.needsUpdate)
+ return;
+
+ this.views.dom.contentElement.sidebarPanes.properties.needsUpdate = false;
+
+ var propertiesBody = this.views.dom.contentElement.sidebarPanes.properties.bodyElement;
+
+ propertiesBody.removeChildren();
+ this.views.dom.contentElement.sidebarPanes.properties.sections = [];
+
+ if (!this.focusedDOMNode)
+ return;
+
+ for (var prototype = this.focusedDOMNode; prototype; prototype = prototype.__proto__) {
+ var hasChildren = false;
+ for (var prop in prototype) {
+ if (prop === "__treeElementIdentifier")
+ continue;
+ if (!prototype.hasOwnProperty(prop))
+ continue;
+
+ hasChildren = true;
+ break;
+ }
+
+ if (!hasChildren)
+ continue;
+
+ var title = prototype.toString().replace(/^\[object (\w*?)(Prototype)?\]$/i, "$1");
+ var section = new WebInspector.PropertiesSection(title);
+ section.onpopulate = WebInspector.DOMPropertiesSection.onpopulate(prototype);
+
+ propertiesBody.appendChild(section.element);
+ this.views.dom.contentElement.sidebarPanes.properties.sections.push(section);
+ }
+ },
+
+ handleKeyEvent: function(event)
+ {
+ if (this.domTreeOutline && this.currentView && this.currentView === this.views.dom)
+ this.domTreeOutline.handleKeyEvent(event);
+ }
+}
+
+WebInspector.ResourcePanel.sourceFrameCounter = 0;
+
+WebInspector.ResourcePanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.SidebarPane = function(title)
+{
+ this.element = document.createElement("div");
+ this.element.className = "pane";
+
+ this.titleElement = document.createElement("div");
+ this.titleElement.className = "title";
+
+ var pane = this;
+ this.titleElement.addEventListener("click", function() { pane.expanded = !pane.expanded; }, false);
+
+ this.bodyElement = document.createElement("div");
+ this.bodyElement.className = "body";
+
+ this.element.appendChild(this.titleElement);
+ this.element.appendChild(this.bodyElement);
+
+ this.title = title;
+ this.growbarVisible = false;
+ this.expanded = false;
+ this.onexpand = null;
+ this.oncollapse = null;
+}
+
+WebInspector.SidebarPane.prototype = {
+ get title()
+ {
+ return this._title;
+ },
+
+ set title(x)
+ {
+ if (this._title === x)
+ return;
+ this._title = x;
+ this.titleElement.textContent = x;
+ },
+
+ get growbarVisible()
+ {
+ return this._growbarVisible;
+ },
+
+ set growbarVisible(x)
+ {
+ if (this._growbarVisible === x)
+ return;
+
+ this._growbarVisible = x;
+
+ if (x && !this._growbarElement) {
+ this._growbarElement = document.createElement("div");
+ this._growbarElement.className = "growbar";
+ this.element.appendChild(this._growbarElement);
+ } else if (!x && this._growbarElement) {
+ if (this._growbarElement.parentNode)
+ this._growbarElement.parentNode(this._growbarElement);
+ delete this._growbarElement;
+ }
+ },
+
+ get expanded()
+ {
+ return this._expanded;
+ },
+
+ set expanded(x)
+ {
+ if (x)
+ this.expand();
+ else
+ this.collapse();
+ },
+
+ expand: function()
+ {
+ if (this._expanded)
+ return;
+ this._expanded = true;
+ this.element.addStyleClass("expanded");
+ if (this.onexpand)
+ this.onexpand(this);
+ },
+
+ collapse: function()
+ {
+ if (!this._expanded)
+ return;
+ this._expanded = false;
+ this.element.removeStyleClass("expanded");
+ if (this.oncollapse)
+ this.oncollapse(this);
+ }
+}
+
+WebInspector.PropertiesSection = function(title, subtitle)
+{
+ this.element = document.createElement("div");
+ this.element.className = "section";
+
+ this.headerElement = document.createElement("div");
+ this.headerElement.className = "header";
+
+ this.titleElement = document.createElement("div");
+ this.titleElement.className = "title";
+
+ this.subtitleElement = document.createElement("div");
+ this.subtitleElement.className = "subtitle";
+
+ this.headerElement.appendChild(this.titleElement);
+ this.headerElement.appendChild(this.subtitleElement);
+
+ var section = this;
+ this.headerElement.addEventListener("click", function() { section.expanded = !section.expanded; }, false);
+
+ this.propertiesElement = document.createElement("ol");
+ this.propertiesElement.className = "properties";
+ this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
+
+ this.element.appendChild(this.headerElement);
+ this.element.appendChild(this.propertiesElement);
+
+ this.title = title;
+ this.subtitle = subtitle;
+ this.expanded = false;
+}
+
+WebInspector.PropertiesSection.prototype = {
+ get title()
+ {
+ return this._title;
+ },
+
+ set title(x)
+ {
+ if (this._title === x)
+ return;
+ this._title = x;
+ this.titleElement.textContent = x;
+ },
+
+ get subtitle()
+ {
+ return this._subtitle;
+ },
+
+ set subtitle(x)
+ {
+ if (this._subtitle === x)
+ return;
+ this._subtitle = x;
+ this.subtitleElement.innerHTML = x;
+ },
+
+ get expanded()
+ {
+ return this._expanded;
+ },
+
+ set expanded(x)
+ {
+ if (x)
+ this.expand();
+ else
+ this.collapse();
+ },
+
+ expand: function()
+ {
+ if (this._expanded)
+ return;
+ this._expanded = true;
+
+ if (!this._populated && this.onpopulate) {
+ this.onpopulate(this);
+ this._populated = true;
+ }
+ this.element.addStyleClass("expanded");
+ },
+
+ collapse: function()
+ {
+ if (!this._expanded)
+ return;
+ this._expanded = false;
+ this.element.removeStyleClass("expanded");
+ }
+}
+
+WebInspector.DOMPropertiesSection = function()
+{
+ // FIXME: Perhaps this should be a real subclass someday
+}
+
+WebInspector.DOMPropertiesSection.onpopulate = function(prototype)
+{
+ return function(section) {
+ var properties = Object.sortedProperties(prototype);
+ for (var i = 0; i < properties.length; ++i) {
+ var name = properties[i];
+ if (!prototype.hasOwnProperty(name))
+ continue;
+ if (name === "__treeElementIdentifier")
+ continue;
+ var item = new WebInspector.DOMPropertyTreeElement(name, prototype);
+ section.propertiesTreeOutline.appendChild(item);
+ }
+ }
+}
+
+WebInspector.DOMNodeTreeElement = function(node)
+{
+ var hasChildren = (Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes());
+
+ var titleInfo = nodeTitleInfo.call(node, hasChildren, WebInspector.linkifyURL);
+ var title = titleInfo.title;
+ hasChildren = titleInfo.hasChildren;
+
+ var item = new TreeElement(title, node, hasChildren);
+ item.updateSelection = WebInspector.DOMNodeTreeElement.updateSelection;
+ item.onpopulate = WebInspector.DOMNodeTreeElement.populate;
+ item.onexpand = WebInspector.DOMNodeTreeElement.expanded;
+ item.oncollapse = WebInspector.DOMNodeTreeElement.collapsed;
+ item.onselect = WebInspector.DOMNodeTreeElement.selected;
+ item.onreveal = WebInspector.DOMNodeTreeElement.revealed;
+ item.ondblclick = WebInspector.DOMNodeTreeElement.doubleClicked;
+ if (hasChildren)
+ item.whitespaceIgnored = Preferences.ignoreWhitespace;
+ return item;
+}
+
+WebInspector.DOMNodeTreeElement.updateSelection = function(element)
+{
+ if (!element || !element._listItemNode)
+ return;
+
+ if (!element.selectionElement) {
+ element.selectionElement = document.createElement("div");
+ element.selectionElement.className = "selection selected";
+ element._listItemNode.insertBefore(element.selectionElement, element._listItemNode.firstChild);
+ }
+
+ element.selectionElement.style.height = element._listItemNode.offsetHeight + "px";
+}
+
+WebInspector.DOMNodeTreeElement.populate = function(element)
+{
+ if (element.children.length || element.whitespaceIgnored !== Preferences.ignoreWhitespace)
+ return;
+
+ element.removeChildren();
+ element.whitespaceIgnored = Preferences.ignoreWhitespace;
+
+ var node = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(element.representedObject) : element.representedObject.firstChild);
+ while (node) {
+ var item = new WebInspector.DOMNodeTreeElement(node);
+ element.appendChild(item);
+ node = Preferences.ignoreWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling;
+ }
+
+ if (element.representedObject.nodeType == Node.ELEMENT_NODE) {
+ var title = "<span class=\"tag close\"></" + element.representedObject.nodeName.toLowerCase().escapeHTML() + "></span>";
+ var item = new TreeElement(title, element.representedObject, false);
+ item.selectable = false;
+ element.appendChild(item);
+ }
+}
+
+WebInspector.DOMNodeTreeElement.expanded = function(element)
+{
+ element.treeOutline.panel.updateTreeSelection();
+}
+
+WebInspector.DOMNodeTreeElement.collapsed = function(element)
+{
+ element.treeOutline.panel.updateTreeSelection();
+}
+
+WebInspector.DOMNodeTreeElement.revealed = function(element)
+{
+ if (!element._listItemNode || !element.treeOutline || !element.treeOutline._childrenListNode)
+ return;
+ var parent = element.treeOutline.panel.views.dom.contentElement.treeContentElement;
+ parent.scrollToElement(element._listItemNode);
+}
+
+WebInspector.DOMNodeTreeElement.selected = function(element)
+{
+ var panel = element.treeOutline.panel;
+ panel.focusedDOMNode = element.representedObject;
+
+ // Call updateSelection twice to make sure the height is correct,
+ // the first time might have a bad height because we are in a weird tree state
+ element.updateSelection(element);
+ setTimeout(function() { element.updateSelection(element) }, 0);
+}
+
+WebInspector.DOMNodeTreeElement.doubleClicked = function(element)
+{
+ var panel = element.treeOutline.panel;
+ panel.rootDOMNode = element.representedObject.parentNode;
+ panel.focusedDOMNode = element.representedObject;
+}
+
+WebInspector.StylePropertyTreeElement = function(prop, computedStyle)
+{
+ var overloadCount = 0;
+ var priority;
+ if (prop.subProperties && prop.subProperties.length > 1) {
+ for (var i = 0; i < prop.subProperties.length; ++i) {
+ var name = prop.subProperties[i];
+ if (!priority)
+ priority = prop.style.getPropertyPriority(name);
+ if (prop.unusedProperties[name])
+ overloadCount++;
+ }
+ }
+
+ if (!priority)
+ priority = prop.style.getPropertyPriority(prop.name);
+
+ var overloaded = (prop.unusedProperties[prop.name] || overloadCount === prop.subProperties.length);
+ var title = WebInspector.StylePropertyTreeElement.createTitle(prop.name, prop.style, overloaded, priority, computedStyle);
+
+ var item = new TreeElement(title, prop, (prop.subProperties && prop.subProperties.length > 1));
+ item.computedStyle = computedStyle;
+ item.onpopulate = WebInspector.StylePropertyTreeElement.populate;
+ return item;
+}
+
+WebInspector.StylePropertyTreeElement.createTitle = function(name, style, overloaded, priority, computed)
+{
+ // "Nicknames" for some common values that are easier to read.
+ var valueNickname = {
+ "rgb(0, 0, 0)": "black",
+ "rgb(255, 255, 255)": "white",
+ "rgba(0, 0, 0, 0)": "transparent"
+ };
+
+ var value = style.getPropertyValue(name);
+
+ var textValue = value;
+ if (value) {
+ var urls = value.match(/url\([^)]+\)/);
+ if (urls) {
+ for (var i = 0; i < urls.length; ++i) {
+ var url = urls[i].substring(4, urls[i].length - 1);
+ textValue = textValue.replace(urls[i], "url(" + WebInspector.linkifyURL(url) + ")");
+ }
+ } else {
+ if (value in valueNickname)
+ textValue = valueNickname[value];
+ textValue = textValue.escapeHTML();
+ }
+ }
+
+ var classes = [];
+ if (!computed && (style.isPropertyImplicit(name) || value == "initial"))
+ classes.push("implicit");
+ if (overloaded)
+ classes.push("overloaded");
+
+ var title = "";
+ if (classes.length)
+ title += "<span class=\"" + classes.join(" ") + "\">";
+
+ title += "<span class=\"name\">" + name.escapeHTML() + "</span>: ";
+ title += "<span class=\"value\">" + textValue;
+ if (priority && priority.length)
+ title += " !" + priority;
+ title += "</span>;";
+
+ if (value) {
+ // FIXME: this dosen't catch keyword based colors like black and white
+ var colors = value.match(/(rgb\([0-9]+,\s?[0-9]+,\s?[0-9]+\))|(rgba\([0-9]+,\s?[0-9]+,\s?[0-9]+,\s?[0-9]+\))/g);
+ if (colors) {
+ var colorsLength = colors.length;
+ for (var i = 0; i < colorsLength; ++i)
+ title += "<span class=\"swatch\" style=\"background-color: " + colors[i] + "\"></span>";
+ }
+ }
+
+ if (classes.length)
+ title += "</span>";
+
+ return title;
+}
+
+WebInspector.StylePropertyTreeElement.populate = function(element)
+{
+ if (element.children.length)
+ return;
+
+ var prop = element.representedObject;
+ if (prop.subProperties && prop.subProperties.length > 1) {
+ for (var i = 0; i < prop.subProperties.length; ++i) {
+ var name = prop.subProperties[i];
+ var overloaded = (prop.unusedProperties[prop.name] || prop.unusedProperties[name]);
+ var priority = prop.style.getPropertyPriority(name);
+ var title = WebInspector.StylePropertyTreeElement.createTitle(name, prop.style, overloaded, priority, element.computedStyle);
+ var subitem = new TreeElement(title, {}, false);
+ element.appendChild(subitem);
+ }
+ }
+}
+
+WebInspector.RequestResponseTreeElement = function(name, object)
+{
+ var title = "<span class=\"name\">" + name.escapeHTML() + "</span>";
+
+ var hasChildren = object instanceof Object;
+ if (!hasChildren) {
+ var objectAsString = object.toString();
+ title += ": <span class=\"value\">" + objectAsString.escapeHTML() + "</span>";
+ }
+
+ var item = new TreeElement(title, object, hasChildren);
+ item.onpopulate = WebInspector.RequestResponseTreeElement.onpopulate;
+ return item;
+}
+
+WebInspector.RequestResponseTreeElement.onpopulate = function(element)
+{
+ if (element.children.length)
+ return;
+
+ for (var field in element.representedObject) {
+ var item = new WebInspector.RequestResponseTreeElement(field, element.representedObject[field]);
+ element.appendChild(item);
+ }
+}
+
+WebInspector.DOMPropertyTreeElement = function(name, object)
+{
+ var title = "<span class=\"name\">" + name.escapeHTML() + "</span>: ";
+ title += "<span class=\"value\">" + Object.describe(object[name], true).escapeHTML() + "</span>";
+
+ var hasChildren = false;
+ var type = typeof object[name];
+ if (object[name] && (type === "object" || type === "function")) {
+ for (value in object[name]) {
+ hasChildren = true;
+ break;
+ }
+ }
+
+ var representedObj = { object: object, name: name };
+ var item = new TreeElement(title, representedObj, hasChildren);
+ item.onpopulate = WebInspector.DOMPropertyTreeElement.populate;
+ return item;
+}
+
+WebInspector.DOMPropertyTreeElement.populate = function(element)
+{
+ if (element.children.length)
+ return;
+
+ var parent = element.representedObject.object[element.representedObject.name];
+ var properties = Object.sortedProperties(parent);
+ for (var i = 0; i < properties.length; ++i) {
+ if (properties[i] === "__treeElementIdentifier")
+ continue;
+ var item = new WebInspector.DOMPropertyTreeElement(properties[i], parent);
+ element.appendChild(item);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+body {
+ -webkit-user-select: none;
+ height: 100%;
+ width: 100%;
+ overflow: hidden;
+ font-family: Lucida Grande, sans-serif;
+}
+
+iframe, a img {
+ border: none;
+}
+
+.focused .selected {
+ background-color: rgb(56, 121, 217);
+}
+
+.blurred .selected, body.inactive .selected {
+ background-color: rgb(212, 212, 212);
+}
+
+.hidden {
+ display: none;
+}
+
+#toolbar {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 28px;
+ background: rgb(245, 245, 250);
+ background-image: url(Images/toolbarBackground.png);
+ background-repeat: repeat-x;
+ background-position: top;
+ border-bottom: 1px solid rgb(80, 80, 80);
+ padding: 2px 8px;
+ -webkit-box-sizing: border-box;
+ -webkit-background-size: auto 135%;
+}
+
+body.inactive #toolbar {
+ background-image: url(Images/toolbarBackgroundInactive.png);
+ border-bottom: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.attached #toolbar {
+ border-top: 1px solid rgb(80, 80, 80);
+ background-image: url(Images/darkShadow.png), url(Images/toolbarBackground.png);
+ background-position: center -2px, top;
+ -webkit-background-size: auto auto, auto 135%;
+}
+
+body.attached.inactive #toolbar {
+ background-image: url(Images/darkShadow.png), url(Images/toolbarBackgroundInactive.png);
+ background-position: center -3px, top;
+ border-top: 1px solid rgb(100, 100, 100);
+ border-bottom: 1px solid rgb(64%, 64%, 64%);
+}
+
+#toolbar button, #toolbar button:disabled:active {
+ border-width: 3px 3px 4px 3px;
+ -webkit-border-image: url(Images/toolbarButton.png) 3 3 4 3;
+ height: 19px;
+ -webkit-box-sizing: border-box;
+ vertical-align: middle;
+}
+
+#toolbar button:focus {
+ outline: none;
+}
+
+#toolbar button:active, #toolbar button.selected {
+ -webkit-border-image: url(Images/toolbarButtonPressed.png) 3 3 4 3;
+}
+
+body.inactive #toolbar button:active, body.inactive #toolbar button.selected {
+ -webkit-border-image: url(Images/toolbarButtonPressedInactive.png) 3 3 4 3;
+}
+
+body.inactive #toolbar button, body.inactive #toolbar button:disabled:active {
+ -webkit-border-image: url(Images/toolbarButtonInactive.png) 3 3 4 3;
+}
+
+#toolbar .split-button-divider {
+ width: 1px;
+ height: 19px;
+ content: url(Images/toolbarSplitButtonDivider.png);
+ vertical-align: middle;
+}
+
+body.inactive #toolbar .split-button-divider {
+ content: url(Images/toolbarSplitButtonDividerInactive.png);
+}
+
+#toolbar .split-button {
+ padding: 0;
+ width: 20px;
+}
+
+#toolbar .split-button.middle {
+ border-left: transparent none 0 !important;
+ border-right: transparent none 0 !important;
+}
+
+#toolbar .split-button.first {
+ border-right: transparent none 0 !important;
+}
+
+#toolbar .split-button.last {
+ border-left: transparent none 0 !important;
+}
+
+#back img {
+ content: url(Images/treeLeftTriangleBlack.png);
+ position: relative;
+ top: -1px;
+ left: -1px;
+ width: 8px;
+ height: 8px;
+}
+
+#back:disabled img, #forward:disabled img {
+ opacity: 0.5;
+}
+
+#forward img {
+ content: url(Images/treeRightTriangleBlack.png);
+ position: relative;
+ top: -1px;
+ left: 2px;
+ width: 8px;
+ height: 8px;
+}
+
+.view-button-source img {
+ content: url(Images/sourceViewButton.png);
+ position: relative;
+ top: -1px;
+ width: 8px;
+ height: 7px;
+}
+
+.view-button-source.selected img {
+ content: url(Images/sourceViewButtonSelected.png);
+}
+
+.view-button-dom img {
+ content: url(Images/domViewButton.png);
+ position: relative;
+ top: -1px;
+ left: 1px;
+ width: 10px;
+ height: 7px;
+}
+
+.view-button-dom.selected img {
+ content: url(Images/domViewButtonSelected.png);
+}
+
+#viewbuttons {
+ position: absolute;
+ left: 200px;
+ padding-left: 8px;
+}
+
+#viewbuttons .selected {
+ font-weight: bold;
+}
+
+#search {
+ float: right;
+ width: 200px;
+}
+
+#search:focus {
+ outline: 1px auto;
+}
+
+#searchResults {
+ position: absolute;
+ top: -73px;
+ left: 200px;
+ right: 0;
+ height: 100px;
+ z-index: -1;
+ background-color: white;
+ border-bottom: 1px solid rgb(180, 180, 180);
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+.search-results-section {
+ color: gray;
+ width: 28px;
+ float: left;
+ margin-left: -45px;
+ text-align: right;
+ font-size: 10px;
+ margin-top: 1px;
+ white-space: nowrap;
+}
+
+.selected .search-results-section {
+ color: rgba(255, 255, 255, 0.8);
+}
+
+.blurred .selected .search-results-section {
+ color: rgba(0, 0, 0, 0.5);
+}
+
+#searchResults > ol > ol > li {
+ padding-left: 45px;
+ white-space: nowrap;
+}
+
+.search-matched-string {
+ background-color: #ff8;
+}
+
+.selected .search-matched-string {
+ background-color: transparent;
+}
+
+#sidebar {
+ position: absolute;
+ top: 28px;
+ left: 0;
+ bottom: 0;
+ width: 200px;
+ background-color: rgb(214, 221, 229);
+ border-right: 1px solid rgb(64%, 64%, 64%);
+ -webkit-box-sizing: border-box;
+}
+
+body.inactive #sidebar {
+ background-color: rgb(232, 232, 232);
+}
+
+#statusbar {
+ position: absolute;
+ padding: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: 21px;
+ border-top: 1px solid #bbb;
+ -webkit-box-sizing: border-box;
+ background-image: url(Images/sidebarResizeWidget.png), url(Images/sidebarStatusAreaBackground.png);
+ background-position: right, center;
+ background-repeat: no-repeat, repeat-x;
+}
+
+#statusbar button {
+ -webkit-apearance: none;
+ vertical-align: top;
+ border: 0;
+ width: 32px;
+ height: 20px;
+ margin: 0;
+ margin-left: -1px;
+ padding: 0;
+}
+
+#statusbar button:focus {
+ outline: none;
+}
+
+#statusbar button.action {
+ background-image: url(Images/sidebarActionWidget.png);
+}
+
+#statusbar button.action:active {
+ background-image: url(Images/sidebarActionWidgetPressed.png);
+}
+
+#statusbar #statusToggle {
+ background-image: url(Images/showStatusWidget.png);
+}
+
+#statusbar #statusToggle:active {
+ background-image: url(Images/showStatusWidgetPressed.png);
+}
+
+#statusbar #statusToggle.hide {
+ background-image: url(Images/hideStatusWidget.png);
+}
+
+#statusbar #statusToggle.hide:active {
+ background-image: url(Images/hideStatusWidgetPressed.png);
+}
+
+body.detached #attachToggle {
+ background-image: url(Images/sidebarAttachWidget.png);
+}
+
+body.detached #attachToggle:active {
+ background-image: url(Images/sidebarAttachWidgetPressed.png);
+}
+
+body.attached #attachToggle {
+ background-image: url(Images/sidebarDetachWidget.png);
+}
+
+body.attached #attachToggle:active {
+ background-image: url(Images/sidebarDetachWidgetPressed.png);
+}
+
+#status {
+ overflow: hidden;
+ position: absolute;
+ bottom: -57px;
+ left: 0;
+ width: 100%;
+ height: 78px;
+ padding: 2px 0;
+ margin: 0;
+ border-top: 1px solid rgb(64%, 64%, 64%);
+ -webkit-box-sizing: border-box;
+ list-style: none;
+ font-size: 11px;
+}
+
+#status li {
+ position: relative;
+ height: 37px;
+ -webkit-box-sizing: border-box;
+}
+
+#status li.selected {
+ background-image: url(Images/sidebarSelectionTall.png);
+ background-repeat: repeat-x;
+ background-position: center;
+ background-color: transparent !important;
+ color: white;
+ font-weight: bold;
+ text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+}
+
+#status .icon {
+ position: absolute;
+ top: 2px;
+ left: 15px;
+ width: 32px;
+ height: 32px;
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+
+#status .icon.console {
+ background-image: url(Images/console.png);
+}
+
+#status .icon.network {
+ background-image: url(Images/network.png);
+}
+
+#status .title {
+ -webkit-box-sizing: border-box;
+ position: relative;
+ top: 5px;
+ padding-left: 58px;
+ right: 5px;
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#status .title.only {
+ top: 10px;
+}
+
+#status .info {
+ -webkit-box-sizing: border-box;
+ position: relative;
+ margin-top: 6px;
+ padding-left: 58px;
+ right: 5px;
+ display: block;
+ font-size: 9px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#list {
+ overflow-x: hidden;
+ overflow-y: auto;
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 21px;
+ width: 100%;
+ padding: 2px 0;
+ margin: 0;
+ -webkit-box-sizing: border-box;
+ list-style: none;
+ font-size: 11px;
+}
+
+#list > li {
+ height: 26px;
+ color: rgb(96, 110, 128);
+ text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+ font-weight: bold;
+ line-height: 20px;
+ text-indent: 20px;
+ background-image: url(Images/rightTriangle.png);
+ background-repeat: no-repeat;
+ background-position: 10px 6px;
+ text-transform: uppercase;
+}
+
+#list > ol + li {
+ margin-top: 5px;
+}
+
+#list > li + li {
+ margin-top: 5px;
+}
+
+#list > li.expanded {
+ background-image: url(Images/downTriangle.png);
+ background-position: 10px 7px;
+}
+
+#list > ol {
+ display: none;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+#list > ol.expanded {
+ display: block;
+}
+
+#list > ol > li {
+ position: relative;
+ height: 37px;
+ -webkit-box-sizing: border-box;
+}
+
+#list .icon {
+ position: absolute;
+ top: 2px;
+ left: 15px;
+ width: 32px;
+ height: 32px;
+ background-image: url(Images/document.png);
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+
+#list .icon.plain {
+ background-image: url(Images/plainDocument.png);
+}
+
+#list .icon .preview {
+ margin: auto;
+ display: block;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ max-width: 20px;
+ max-height: 22px;
+ -webkit-user-drag: none;
+ -webkit-box-sizing: border-box;
+ border-top: 6px solid transparent;
+}
+
+#list .icon .progress {
+ margin: auto;
+ display: block;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+
+#list .title {
+ -webkit-box-sizing: border-box;
+ position: relative;
+ top: 5px;
+ padding-left: 58px;
+ right: 5px;
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#list .title.only {
+ top: 10px;
+}
+
+#sidebar li .count {
+ float: right;
+ margin-top: 11px;
+ margin-right: 6px;
+ font-family: Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 10px;
+ -webkit-border-radius: 7px;
+ color: white;
+ text-shadow: none;
+ background-image: url(Images/gradientHighlight.png), url(Images/gradient.png);
+ -webkit-background-size: 100%, 100%;
+ background-position: center;
+ padding: 2px 4px;
+ text-align: center;
+ text-indent: 0;
+ min-width: 20px;
+ -webkit-box-sizing: border-box;
+}
+
+#sidebar li .count.warnings {
+ background-color: orange;
+}
+
+#sidebar li .count.errors {
+ background-color: red;
+}
+
+#list .info {
+ -webkit-box-sizing: border-box;
+ position: relative;
+ margin-top: 6px;
+ padding-left: 58px;
+ right: 5px;
+ display: block;
+ font-size: 9px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#list li.selected {
+ background-image: url(Images/sidebarSelectionTall.png);
+ background-repeat: repeat-x;
+ background-position: center;
+ background-color: transparent !important;
+ color: white;
+ font-weight: bold;
+ text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+}
+
+#sidebar.blurred li.selected {
+ background-image: url(Images/sidebarSelectionBlurredTall.png);
+}
+
+body.inactive #sidebar li.selected {
+ background-image: url(Images/sidebarSelectionGrayTall.png);
+}
+
+#main {
+ position: absolute;
+ top: 28px;
+ left: 200px;
+ right: 0;
+ bottom: 0;
+ overflow: hidden;
+ background-color: white;
+ z-index: -100;
+}
+
+.panel {
+ display: none;
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ &nbs