Expose the ProfileNode functionName sorting functions on
JavaScriptProfileNode.

Reviewed by Kevin McCullough.

* page/JavaScriptProfileNode.cpp:
(WebCore::sortFunctionNameDescending): Call ProfileNode.
(WebCore::sortFunctionNameAscending): Ditto.
(WebCore::ProfileNodeClass): Add static functions.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/5060458> Elements without AXActions should not return kAXErrorFailure
<rdar://problem/3438014> Might need accessibility solution for context menus in web pages



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implements the Profiles panel and Profile view.

Reviewed by Kevin McCullough.

* English.lproj/localizedStrings.js: Added new strings.
* page/inspector/Images/profileIcon.png: Added.
* page/inspector/Images/profilesIcon.png: Changed. New icon design
that fits in with the other toolbar icons.
* page/inspector/ProfileView.js:
(WebInspector.ProfileView): Remove custom table elements
and create a DataGrid. Sorts the profile by descending total time,
since the profiles aren't sorted by default.
(WebInspector.ProfileView.prototype.refresh): Clears the DataGrid
and recreates all the nodes. The selection is preserved.
(WebInspector.ProfileView.prototype.refreshShowAsPercents): Traverse
all the children and change showTotalTimeAsPercent and showSelfTimeAsPercent
to match the ProfileView values. Then call refresh on the child.
(WebInspector.ProfileView.prototype._sortData): Determine the sort
function to call on the head profile node. Call it and then call
refresh to rebuild the DataGrid.
(WebInspector.ProfileView.prototype._mouseDownInDataGrid): Return early
if the event is not a double-click. When it is a double-click, determine
the column that was targeted and if it was total or self toggle the
show as percent property. Call refreshShowAsPercents.
(WebInspector.ProfileDataGridNode):
(WebInspector.ProfileDataGridNode.prototype.get data):
(WebInspector.ProfileDataGridNode.prototype.expand):
(WebInspector.ProfileDataGridNode.prototype.collapse):
(WebInspector.ProfileDataGridNode.prototype._populate):
* page/inspector/ProfilesPanel.js:
(WebInspector.ProfilesPanel):
(WebInspector.ProfilesPanel.prototype.show): Populate the sidebar
with all profiles. This is a workaround until the Inspector
is told about new profiles.
(WebInspector.ProfilesPanel.prototype.reset): Clear the sidebar and
profile views.
(WebInspector.ProfilesPanel.prototype.handleKeyEvent): Pass the key
event to the sidebar.
(WebInspector.ProfilesPanel.prototype.addProfile): Create a
ProfileSidebarTreeElement object and add it to the sidebar.
(WebInspector.ProfilesPanel.prototype.showProfile): Create a ProfileView
and show it.
(WebInspector.ProfilesPanel.prototype.closeVisibleView): Hide the
visible view.
(WebInspector.ProfilesPanel.prototype._startSidebarDragging): Call
WebInspector.elementDragStart.
(WebInspector.ProfilesPanel.prototype._sidebarDragging): Call _updateSidebarWidth.
(WebInspector.ProfilesPanel.prototype._endSidebarDragging):
Call WebInspector.elementDragEnd.
(WebInspector.ProfilesPanel.prototype._updateSidebarWidth): Update the
sidebar width based on the passed in value.
(WebInspector.ProfileSidebarTreeElement): Subclass WebInspector.SidebarTreeElement.
(WebInspector.ProfileSidebarTreeElement.prototype.onselect): Call ProfilesPanel.showProfile.
(WebInspector.ProfileSidebarTreeElement.prototype.get mainTitle): Return profile.title.
(WebInspector.ProfileSidebarTreeElement.prototype.set mainTitle): Do nothing.
(WebInspector.ProfileSidebarTreeElement.prototype.get subtitle): Ditto.
(WebInspector.ProfileSidebarTreeElement.prototype.set subtitle): Ditto.
* page/inspector/inspector.css: New styles for the profile sidebar
item and profile data grid columns.
* page/inspector/inspector.js:
* page/inspector/utilities.js:
(Number.secondsToString): Added a higherResolution argument
that returns fractional milliseconds.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore:

        Reviewed by Darin Adler.

        - fix https://bugs.webkit.org/show_bug.cgi?id=17655
          <rdar://problem/5778077> REGRESSION (3.1.1-TOT): Reproducible crash calling querySelector on viewless Document

        Test: fast/dom/SelectorAPI/viewless-document.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::CSSStyleSelector): Updated to initialize the
        selector checker.
        (WebCore::CSSStyleSelector::init): Removed initialization of
        m_collectRulesOnly, which is now part of the selector checker.
        (WebCore::CSSStyleSelector::matchRules): Updated for renames and data
        moved into the selector checker.
        (WebCore::CSSStyleSelector::matchRulesForList): Ditto.
        (WebCore::CSSStyleSelector::initForStyleResolve): Added a PseudoId
        argument, which is used to initialize a data member of the selector
        checker. Updated for renames. Removed initialization of m_isXMLDoc
        because this bit is now initialized only once in the selector checker's
        constructor.
        (WebCore::CSSStyleSelector::SelectorChecker::SelectorChecker): Added.
        (WebCore::CSSStyleSelector::SelectorChecker::checkPseudoState): Changed
        into a SelectorChecker method.
        (WebCore::CSSStyleSelector::SelectorChecker::checkSelector): Added. Used
        by querySelector() and querySelectorAll().
        (WebCore::CSSStyleSelector::canShareStyleWithElement): Updated for data
        moved into the selector checker.
        (WebCore::CSSStyleSelector::matchUARules): Ditto.
        (WebCore::CSSStyleSelector::styleForElement):
        (WebCore::CSSStyleSelector::pseudoStyleForElement): Ditto. Also removed
        code that set the parentStyle variable after the last place it is
        accessed, and changed to ensure that m_style is set early in this
        function.
        (WebCore::CSSStyleSelector::adjustRenderStyle): Updated for data moved
        into the selector checker.
        (WebCore::CSSStyleSelector::styleRulesForElement): Ditto.
        (WebCore::CSSStyleSelector::checkSelector): Ditto. Also changed to pass
        the element's style and the parent style to the selector checker, as
        well as the dynamic pseudo variable and the selector attributes vector.
        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Added
        arguments for the style of the base element and its parent. When the
        elementStyle argument is 0, the style is fetched from the element
        and its parent as needed. Also changed to take a reference to the
        dynamic pseudo ID and a pointer to the vector of attributes affecting
        the match.
        (WebCore::CSSStyleSelector::applyProperty): Updated for data moved
        into the selector checker.
        (WebCore::CSSStyleSelector::checkForGenericFamilyChange): Ditto.
        (WebCore::CSSStyleSelector::getComputedSizeFromSpecifiedSize): Ditto.
        (WebCore::CSSStyleSelector::fontSizeForKeyword): Ditto.
        (WebCore::CSSStyleSelector::getColorFromPrimitiveValue): Ditto.
        (WebCore::CSSStyleSelector::SelectorChecker::allVisitedStateChanged):
        Changed into a SelectorChecker method.
        (WebCore::CSSStyleSelector::SelectorChecker::visitedStateChanged):
        Ditto.

        * css/CSSStyleSelector.h:
        Added a SelectorChecker class and moved data and methods used in
        checking selectors into it.
        (WebCore::CSSStyleSelector::allVisitedStateChanged): Changed to call the
        SelectorChecker method.
        (WebCore::CSSStyleSelector::visitedStateChanged): Ditto.
        * dom/Node.cpp:
        (WebCore::Node::querySelector): Changed to use a SelectorChecker instead
        of the document's style selector.
        * dom/SelectorNodeList.cpp:
        (WebCore::SelectorNodeList::SelectorNodeList): Ditto.

LayoutTests:

        Reviewed by Darin Adler.

        - test for https://bugs.webkit.org/show_bug.cgi?id=17655
          <rdar://problem/5778077> REGRESSION (3.1.1-TOT): Reproducible crash calling querySelector on viewless Document

        * fast/dom/SelectorAPI/resources/viewless-document.js: Added.
        * fast/dom/SelectorAPI/viewless-document-expected.txt: Added.
        * fast/dom/SelectorAPI/viewless-document.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Alice Liu  <alice.liu@apple.com>

        Reviewed by Brady.

        fix <rdar://problem/5908580> 10A58: Dictionary Panel hangs in WebCore::Cache::pruneDeadResources()

        * loader/Cache.cpp:
        (WebCore::Cache::requestUserCSSStyleSheet):
        Add a call to resourceAccessed() to more closely mirror what is done in requestResource()
        (WebCore::Cache::insertInLRUList):
        Assert that any resource in the LRU list has been accessed.  This is early detection of a
        potential hang later when pruning resources, and also agrees with the early return in 
        removeFromLRUList().



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Tim.

        <rdar://problem/5770054> JavaScript profiler (10928)
        Split function name into 3 parts so that the Web Inspector can link it to
        the resource location from whence it came.

        * kjs/ustring.cpp: Implemented operator> for UStrings
        (KJS::operator>):
        * kjs/ustring.h:
        * profiler/Profile.cpp:
        (KJS::Profile::Profile): Initialize all 3 values.
        (KJS::Profile::willExecute): Use CallIdentifier struct.
        (KJS::Profile::didExecute): Ditto.
        * profiler/Profile.h: Ditto and remove unused function.
        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::ProfileNode): Use CallIdentifier struct.
        (KJS::ProfileNode::willExecute): Ditto and fix an issue where we
        restarted the m_startTime even though it was already started.
        (KJS::ProfileNode::didExecute): Ditto.
        (KJS::ProfileNode::findChild): Ditto.
        (KJS::functionNameDescendingComparator): Ditto and use new comparator.
        (KJS::functionNameAscendingComparator): Ditto.
        (KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct.
        (KJS::ProfileNode::printDataSampleStyle): Ditto.
        * profiler/ProfileNode.h:
        (KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct
        (KJS::CallIdentifier::operator== ):
        (KJS::ProfileNode::create): Use the CallIdentifier struct.
        (KJS::ProfileNode::callIdentifier):
        (KJS::ProfileNode::functionName): Now only return the function name, not
        the url and line number too.
        (KJS::ProfileNode::url):
        (KJS::ProfileNode::lineNumber):
        * profiler/Profiler.cpp: Use the CallIdentifier struct. 
        (KJS::Profiler::startProfiling):
        (KJS::Profiler::willExecute):
        (KJS::Profiler::didExecute):
        (KJS::getCallIdentifiers):
        (KJS::getCallIdentifierFromFunctionImp):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Accidentally turned on the profiler.

        * kjs/config.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Tim.

        <rdar://problem/5770054> JavaScript profiler (10928)
        Removed only profiler-internal use of currentProfile since that concept
        is changing.

        * profiler/Profile.h: Now stopProfiling takes a time and bool as
        arguments.  The time is used to calculate %s from and the bool tells
        if this node is the head node and should be the one calculating the time.
        (KJS::Profile::stopProfiling):
        * profiler/ProfileNode.cpp: Ditto.
        (KJS::ProfileNode::stopProfiling):
        * profiler/ProfileNode.h: Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Adam.

        <rdar://problem/5950538> JSProfiler: Keep track of non-JS execution time
        We now have an extra node that represents the excess non-JS time.
        - Also changed "SCRIPT" and "anonymous function" to be more consistent
        with the debugger.

        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::stopProfiling): If this ProfileNode is the head node
        create a new child that has the excess execution time.
        (KJS::ProfileNode::calculatePercentages): Moved calculation of the
        percentages into a function since it's called from multiple places.
        * profiler/ProfileNode.h: Add the newly needed functions used above.
        (KJS::ProfileNode::setTotalTime):
        (KJS::ProfileNode::setSelfTime):
        (KJS::ProfileNode::setNumberOfCalls):
        * profiler/Profiler.cpp: renamed "SCRIPT" and "anonymous function" to be
        consistent with the debugger and use constants that can be localized
        more easily.
        (KJS::getCallIdentifiers):
        (KJS::getCallIdentifierFromFunctionImp):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Fix Bug 19134: Inspector should support console.assert

        <https://bugs.webkit.org/show_bug.cgi?id=19134>

        Reviewed by Tim Hatcher.

        Test: manual-tests/inspector/console-assert.html

        * bindings/js/JSConsoleCustom.cpp:
        (WebCore::JSConsole::assertCondition): Added.
        * bindings/scripts/CodeGeneratorJS.pm: Added parsing of the
        ImplementationFunction extended attribute, which allows you to
        override the name of the C++ function used to implement this method.
        * manual-tests/inspector/console-assert.html: Added.
        * page/Console.cpp:
        (WebCore::Console::assertCondition): Added.
        * page/Console.h:
        * page/Console.idl: Added assert().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Darin.

        <rdar://problem/5950796> JSProfiler: dump functions are in the code
        Removed dump and logging functions from the Release version of the code
        and renamed them to be obviously for debugging only.

        * JavaScriptCore.exp:
        * profiler/Profile.cpp:
        (KJS::Profile::debugPrintData):
        (KJS::Profile::debugPrintDataSampleStyle):
        * profiler/Profile.h:
        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::debugPrintData):
        (KJS::ProfileNode::debugPrintDataSampleStyle):
        * profiler/ProfileNode.h:
        * profiler/Profiler.cpp:
        * profiler/Profiler.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin Calhoun  <kcalhoun@apple.com>

        Reviewed by Darin.

        Fix <rdar://problem/5929010> Adopt new QTKit methods for <video> implementation

        If the class QTVideoRendererWebKitOnly is present use it to render video,
        otherwise fall back to existing use of QTMovieView/QTMovieContentView.

        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
        (WebCore::MediaPlayerPrivate::createQTMovie):
        (WebCore::QTVideoRendererClass):
        (WebCore::MediaPlayerPrivate::detachQTMovieView):
        (WebCore::MediaPlayerPrivate::createQTVideoRenderer):
        (WebCore::MediaPlayerPrivate::destroyQTVideoRenderer):
        (WebCore::MediaPlayerPrivate::setUpVideoRendering):
        (WebCore::MediaPlayerPrivate::tearDownVideoRendering):
        (WebCore::MediaPlayerPrivate::load):
        (WebCore::MediaPlayerPrivate::cancelLoad):
        (WebCore::MediaPlayerPrivate::setVisible):
        (WebCore::MediaPlayerPrivate::paint):
        (-[WebCoreMovieObserver newImageAvailable:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Use KJS::List::getSlice instead of reimplementing it

        Rubberstamped and suggested by Sam Weinig.

        * bindings/js/JSConsoleCustom.cpp:
        (WebCore::JSConsole::assertCondition):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33949 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Jan Michael Alonzo  <jmalonzo@webkit.org>

        Reviewed by Alp Toker.

        Fix for previous autotools change.

        * configure.ac:




git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixes a couple performance issues with the profiler. Also fixes
a regression where some nodes wouldn't be added to the tree.

Reviewed by Kevin McCullough.

* profiler/ProfileNode.cpp:
(KJS::ProfileNode::addChild): Compare callIdentifier instead
of functionName.
* profiler/ProfileNode.h:
(CallIdentifier.operator==): Compare the CallIdentifiers in
an order that fails sooner for non-matches.
(CallIdentifier.callIdentifier): Return the CallIdentifier by
reference to prevent making a new copy each time.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Tim.

        Added all of my personal manual tests for the profiler.

        * manual-tests/inspector/profiler-test-anonymous-event-handler.html: Added.
        * manual-tests/inspector/profiler-test-anonymous-function-called-from-different-contexts.html: Added.
        * manual-tests/inspector/profiler-test-anonymous-function-calls-built-in-functions.html: Added.
        * manual-tests/inspector/profiler-test-anonymous-function-calls-eval.html: Added.
        * manual-tests/inspector/profiler-test-apply.html: Added.
        * manual-tests/inspector/profiler-test-built-in-function-calls-anonymous.html: Added.
        * manual-tests/inspector/profiler-test-built-in-function-calls-user-defined-function.html: Added.
        * manual-tests/inspector/profiler-test-call.html: Added.
        * manual-tests/inspector/profiler-test-dead-time.html: Added.
        * manual-tests/inspector/profiler-test-event-handler.html: Added.
        * manual-tests/inspector/profiler-test-execution-context-and-eval-on-same-line.html: Added.
        * manual-tests/inspector/profiler-test-inline-event-handler.html: Added.
        * manual-tests/inspector/profiler-test-many-calls-in-the-same-scope.html: Added.
        * manual-tests/inspector/profiler-test-multiple-and-different-scoped-anonymous-function-calls.html: Added.
        * manual-tests/inspector/profiler-test-multiple-and-different-scoped-function-calls.html: Added.
        * manual-tests/inspector/profiler-test-multiple-frames.html: Added.
        * manual-tests/inspector/profiler-test-multiple-windows.html: Added.
        * manual-tests/inspector/profiler-test-nested-anonymous-functon.html: Added.
        * manual-tests/inspector/profiler-test-nested-start-and-stop-profiler.html: Added.
        * manual-tests/inspector/profiler-test-no-execution-context.html: Added.
        * manual-tests/inspector/profiler-test-one-execution-context.html: Added.
        * manual-tests/inspector/profiler-test-profile-calls-in-included-file.html: Added.
        * manual-tests/inspector/profiler-test-profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html: Added.
        * manual-tests/inspector/profiler-test-profiling-from-a-nested-location.html: Added.
        * manual-tests/inspector/profiler-test-start-and-stop-profiler-multiple-times.html: Added.
        * manual-tests/inspector/profiler-test-two-execution-contexts.html: Added.
        * manual-tests/inspector/profiler-test-user-defined-function-calls-built-in-functions.html: Added.
        * manual-tests/inspector/resources: Added.
        * manual-tests/inspector/resources/other-frame.html: Added.
        * manual-tests/inspector/resources/other-window.html: Added.
        * manual-tests/inspector/resources/profiler-test-JS-resources.js: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed by Darin Adler.
        
Rename wxWebFrame -> wxWebBrowserShell in preparation to introduce a WebFrame counterpart in wx port. (Frame typically means 'top level window' in wx terms.)
        
https://bugs.webkit.org/show_bug.cgi?id=19041



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-21  Ariya Hidayat  <ariya.hidayat@trolltech.com>

        Reviewed by Simon.

        For the Qt port, allow building without NPAPI plugin support.

        * WebCore.pro:
        * plugins/PluginView.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-21  Ariya Hidayat  <ariya.hidayat@trolltech.com>

        Reviewed by Simon.

        For the Qt port, fix building with Qt for Embedded Linux.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2008-05-20  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Tim.

        <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
        profile node.
        - Implements focus by adding the idea of a profileNode being visible and
        adding the ability to reset all of the visible flags.

        * profiler/Profile.h: 
        (KJS::Profile::focus):
        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::ProfileNode): Initialize the visible flag.
        (KJS::ProfileNode::setTreeVisible): Set the visibility of this node and
        all of its descendents.
        (KJS::ProfileNode::focus): Determine if this node should be visible when
        focusing, if the functionName matches this node's function name or if any
        of this node's children are visible.
        (KJS::ProfileNode::restoreAll): Restore all nodes' visible flag.
        (KJS::ProfileNode::debugPrintData):
        * profiler/ProfileNode.h:
        (KJS::ProfileNode::visible):
        (KJS::ProfileNode::setVisible):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33965 268f45cc-cd09-0410-ab3c-d52691b4dbfc