Rubberstamped by Oliver.

        * bridge/JavaScriptStatistics.cpp: Added missing header for
        correctness.



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

        Reviewed by Beth.

        Test for http://bugs.webkit.org/show_bug.cgi?id=13087
        <rdar://problem/5064316> REGRESSION: Allow setting the checked attribute in js and in markup for unnamed radio buttons (dominos.com)

        * fast/forms/radio_checked_name-expected.txt: Added.
        * fast/forms/radio_checked_name.html: Added.

WebCore:

        Reviewed by Beth.

        Fix for http://bugs.webkit.org/show_bug.cgi?id=13087
        <rdar://problem/5064316> REGRESSION: Allow setting the checked attribute in js and in markup for unnamed radio buttons (dominos.com)

        Test: fast/forms/radio_checked_name.html

        We were matching a WinIE quirk that does not allow a user to check and uncheck an unnamed radio button.  But they still
        allow the checked attribute to be set in html, and changed in javascript.  So this change matches that behavior.

        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::parseMappedAttribute): We no longer need a special call to setChecked when parsing the name
         attribute, since we setChecked will now work with unnamed radio buttons.
        (WebCore::HTMLInputElement::preDispatchEventHandler): Added comment.
        (WebCore::HTMLInputElement::setChecked): Don't check for the unnamed radio button case here.
        (WebCore::HTMLInputElement::postDispatchEventHandler): Don't call setChecked for unnamed radio buttons.
        (WebCore::HTMLInputElement::defaultEventHandler): ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by John Sullivan.

        Fixed <rdar://problem/5073380> REGRESSION: Crash occurs at WTF::fastFree() 
        when reloading liveconnect page (applet)
        
        Best to use free when you use malloc, especially when malloc and delete
        use completely different libraries.

        * bindings/jni/jni_runtime.cpp:
        (JavaMethod::~JavaMethod):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Speculative fix for why ASSERT_MAIN_THREAD didn't work for me. (The
        documentation says "non-zero," not "1."

        * Misc/WebKitLogging.m:
        (WebKitRunningOnMainThread):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        * kjs/value.h: Roll ~JSValue change out. It was causing problems. I'll do it right later.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Dave Hyatt.

        <rdar://problem/5067983>
        iSale: Crash occurs at WebFrameLoaderClient::dispatchDecidePolicyForMIMEType() when attempting to load a HTML template
        
        Restore old behavior (broke in r14533) where the resource load and download delegates are retained for as long as the 
        data source is loading.
        
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::createDocumentLoader):
        * WebView/WebDocumentLoaderMac.h:
        * WebView/WebDocumentLoaderMac.mm:
        (WebDocumentLoaderMac::setDataSource):
        (WebDocumentLoaderMac::decreaseLoadCount):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=13107
        XPath should raise an exception when trying to parse an unknown function

        Test: fast/xpath/invalid-functions.html

        * xml/XPathFunctions.cpp:
        (WebCore::XPath::createFunction): Return 0 if the function couldn't be created.
        * xml/XPathGrammar.y: Handle nulls returned from createFunction().



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-03-19  Oliver Hunt  <oliver@apple.com>

        Reviewed by Ada.

        Protect against possibility of JS detaching a frame (and losing its view)
        midway through a mouse move.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMouseMoveEvent):
        


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Adam.

        Stub out a couple of CFNetwork backend functions.
        
        * platform/network/ResourceHandle.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor fonts a bit for portability.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        * page/EventHandler.cpp: (WebCore::EventHandler::handleMouseMoveEvent):
        Fix obvious typo in the change from last night -- forgot to assign to the variable.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20342 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-03-21  Mark Rowe  <mrowe@apple.com>

        Reviewed by Tim Hatcher.

        Fix for http://bugs.webkit.org/show_bug.cgi?id=13129.
        Bug 13129: Democracy Player dies in NSException from WebScriptObject on startup.

        Some cross-language scripting bridges use the presence of -(int)count to determine
        whether to treat objects as sequence-like.  All WebScriptObject's exposed this method
        which lead to non-collection WebScriptObject's being mishandled by PyObjC.  We now
        expose -count only when the object we wrap looks like a collection from a JavaScript
        point of view (eg, it has a length property).

        * bindings/objc/WebScriptObject.mm:
        (-[WebScriptObject _shouldRespondToCount]):
        (-[WebScriptObject methodForSelector:]):
        (-[WebScriptObject respondsToSelector:]):
        (-[WebScriptObject _count]):
        * bindings/objc/WebScriptObjectPrivate.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-03-21  Mark Rowe  <mrowe@apple.com>

        Build fix.

        * bindings/objc/WebScriptObject.mm:
        (-[WebScriptObject methodForSelector:]):
        (-[WebScriptObject respondsToSelector:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=12497
        Implement XPath result ordering.

WebCore:
        XPath::NodeVector typedef is replaced with a real XPath::NodeSet class that knows how 
        to sort itself, and can remember whether it has been already sorted.

        * CMakeLists.txt:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        Added XPathNodeSet files.

        * xml/XPathExpression.cpp: Fixed includes.

        * xml/XPathFunctions.cpp:
        (WebCore::XPath::FunId::evaluate): Mark the resulting node-set as unsorted.
        (WebCore::XPath::FunLocalName::evaluate): Replacing NodeVector with NodeSet.
        (WebCore::XPath::FunNamespaceURI::evaluate): Ditto.
        (WebCore::XPath::FunName::evaluate): Ditto.
        (WebCore::XPath::FunCount::evaluate): Ditto.
        (WebCore::XPath::FunSum::evaluate): Ditto.

        * xml/XPathNodeSet.cpp: Added.
        (WebCore::XPath::parentWithDepth):
        (WebCore::XPath::sortBlock):
        (WebCore::XPath::NodeSet::sort): Sort the node-set in document order.
        (WebCore::XPath::NodeSet::reverse): Reverse the order (useful for making axes such as 
        parent or ancestor sorted).
        (WebCore::XPath::NodeSet::firstNode): Returns the first node in document order; currently
        implemented via fully sorting the node-set, but this can obviously be optimized.
        (WebCore::XPath::NodeSet::anyNode): Added for symmetry with firstNode().
        
        * xml/XPathNodeSet.h: Added.
        (WebCore::XPath::NodeSet::NodeSet):
        (WebCore::XPath::NodeSet::operator=):
        (WebCore::XPath::NodeSet::size):
        (WebCore::XPath::NodeSet::isEmpty):
        (WebCore::XPath::NodeSet::operator[]):
        (WebCore::XPath::NodeSet::reserveCapacity):
        (WebCore::XPath::NodeSet::clear):
        (WebCore::XPath::NodeSet::swap):
        (WebCore::XPath::NodeSet::append):
        (WebCore::XPath::NodeSet::markSorted):
        (WebCore::XPath::NodeSet::isSorted):
        Most of these methods just call Vector counterparts. 

        * xml/XPathParser.cpp: Updated the copyright notice.

        * xml/XPathPath.cpp:
        (WebCore::XPath::Filter::evaluate): Replacing NodeVector with NodeSet.
        (WebCore::XPath::Path::evaluate): Ditto.
        (WebCore::XPath::LocationPath::evaluate): Replacing NodeVector with NodeSet. This function
        always marks the result as unsorted, because it is hard to tell whether a step breaks node order.
        Identifying and implementing special cases when it is not necessary to do so is an important
        future optimization.

        * xml/XPathPath.h: Replacing NodeVector with NodeSet.
        * xml/XPathPredicate.cpp:
        (WebCore::XPath::EqTestOp::compare): Replacing NodeVector with NodeSet.
        (WebCore::XPath::Union::evaluate): Replacing NodeVector with NodeSet. Currently, Union just
        marks the result as unordered; we can consider using merge sort to avoid this.

        * xml/XPathResult.cpp:
        (WebCore::XPathResult::XPathResult): Replacing NodeVector with NodeSet.
        (WebCore::XPathResult::singleNodeValue): Ditto.
        (WebCore::XPathResult::snapshotLength): Ditto.
        (WebCore::XPathResult::iterateNext): Ditto.
        (WebCore::XPathResult::snapshotItem): Ditto.
        (WebCore::XPathResult::convertTo): Ditto. Sort the result when requested to.

        * xml/XPathResult.h: Replacing NodeVector with NodeSet.

        * xml/XPathStep.cpp:
        (WebCore::XPath::Step::evaluate): If the input is not sorted, mark the output as such, too.
        (WebCore::XPath::Step::nodesInAxis): Fixed a number of bugs when enumerating with an
        attribute context node.
        (WebCore::XPath::Step::nodeTestMatches): Replacing NodeVector with NodeSet.
        * xml/XPathStep.h: Ditto.

        * xml/XPathUtil.cpp:
        (WebCore::XPath::isValidContextNode): XPath data model doesn't put attribute data into child
        nodes, so passing such node as a context could cause problems.

        * xml/XPathUtil.h: Removed NodeVector typedef.

        * xml/XPathValue.cpp:
        (WebCore::XPath::Value::Value):
        (WebCore::XPath::Value::toNodeSet):
        (WebCore::XPath::Value::toBoolean):
        (WebCore::XPath::Value::toNumber):
        (WebCore::XPath::Value::toString):
        * xml/XPathValue.h:
        (WebCore::XPath::Value::):
        (WebCore::XPath::Value::isNodeSet):
        Replacing NodeVector with NodeSet.

LayoutTests:
        * fast/xpath/document-order-expected.txt: Added.
        * fast/xpath/document-order.html: Added.

        * fast/xpath/text-nodes-expected.txt:
        * fast/xpath/text-nodes.html:
        * fast/xpath/4XPath/Core/test_step-expected.txt:
        Updated results for tests that now pass.

        * fast/xpath/xpath-test-pre.js: Added.
        * fast/xpath/4XPath/Core/test.js:
        Moved checkSnapshot() to a separate file.

        * fast/xpath/4XPath/Core/test_core_functions.html:
        * fast/xpath/4XPath/Core/test_location_path.html:
        * fast/xpath/4XPath/Core/test_nodeset_expr.html:
        * fast/xpath/4XPath/Core/test_parser.html:
        * fast/xpath/4XPath/Core/test_predicate_list.html:
        * fast/xpath/4XPath/Core/test_step.html:
        Load xpath-test-pre.js for checkSnapshot().



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

        Reviewed by darin
        
        <rdar://problem/5071074> 
        REGRESSION: Links are pasted as plain text at certain positions

        * editing/pasteboard/5071074-2-expected.checksum: Added.
        * editing/pasteboard/5071074-2-expected.png: Added.
        * editing/pasteboard/5071074-2-expected.txt: Added.
        * editing/pasteboard/5071074-2.html: Added.

WebCore:

        Reviewed by darin

        <rdar://problem/5071074> 
        REGRESSION: Links are pasted as plain text at certain positions
        
        moveParagraphs calls createMarkup without annotation, which leaves
        out anchor elements that aren't fully selected.

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::moveParagraphs): We don't want 
        createMarkup to do full annotation here.  Doing so could include 
        special ancestor blocks, which would prevent the copied content 
        from appearing in the destination paragraph when it's re-inserted.  
        Annotation would also inline styles from style sheets,  which is 
        unnecessary because the content is being moved to the same 
        document it's being moved from.
        Added a new bool to createMarkup that when true allows markup for 
        special ancestors as long as they are inline when annotation is off.
        * editing/markup.cpp:
        (WebCore::createMarkup): Don't set specialCommonAncestor if annotation
        is off, unless it's inline and we've been told it's ok to include such
        elements.
        * editing/markup.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by John Sullivan

        Add some very helpful logging to the IconLoader's SubresourceLoaderClient impl.

        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::didReceiveResponse):
        (WebCore::IconLoader::didReceiveData):
        (WebCore::IconLoader::didFail):
        (WebCore::IconLoader::didFinishLoading):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Geoff.

        Covered by existing test case.

        Fix for <rdar://problem/5072678> Crash in 
        RenderLayer::scrollRectToVisible with MallocScribble enabled

        This removes some code that was added with http://bugs.webkit.org/
        show_bug.cgi?id=8360. This code was not needed to fix that bug, but 
        the idea behind it was that there are times when it is safe for 
        scheduleEvent() to propagate the event immediately. The 
        MallocScribble crash revealed that this assumption was a bit too 
        broad; the cause of the crash was that we were propagating events 
        immediately when it was not safe. Mitz and I discussed this online 
        and we agree that the safest solution is to revert to the old 
        behavior here, and always delay the propagation of the event. 

        * page/FrameView.cpp:
        (WebCore::FrameViewPrivate::FrameViewPrivate):
        (WebCore::FrameView::layout):
        (WebCore::FrameView::scheduleEvent):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20348 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Darin.

        - fix http://bugs.webkit.org/show_bug.cgi?id=10747
        REGRESSION: Using two fingers on a trackpad to scroll inside a text area makes the whole page move
        <rdar://problem/5045710>
        
        Eat smooth scroll events in WebCore if pointer is over scrollable area. Not
        really a good fix, smooth scrolling should be supported properly. It should do for now.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleWheelEvent):
        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::isScrollable):
        * rendering/RenderListBox.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::isScrollable):
        * rendering/RenderObject.h:
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::isScrollable):
        * rendering/RenderTextControl.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by John

        <rdar://5071341> - Crash in IconLoader::finishLoading()
        
        Though the reproducibility of the crash is still elusive, there's been a crasher likely uncovered 
        Hyatt's recent caching changings to the IconLoader.  This crash tends to hit on sites without favicons,
        that serve up complex 404 pages, often when the load is cancelled or redirected.  Occasionally, it *seems*
        the IconLoader is getting failed/cancelled twice.
        
        This patch adds some assertions and a "fail gracefully in a release build" check that will have to
        serve us until we know more about the cause.

        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::didFail): Add an assertion to catch this case
        (WebCore::IconLoader::finishLoading): Add an assertion to catch the case, and fail
          gracefully in debug builds.  Also add an efficiency check to not commit to the DB if there is no
          IconURL


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Geoff and Adam.
        
        - make USE(MULTIPLE_THREADS) support more portable
        http://bugs.webkit.org/show_bug.cgi?id=13069
        
        - fixed a threadsafety bug discovered by testing this
        
        - enhanced threadsafety assertions in collector

        * API/JSCallbackObject.cpp:
        (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't
        DropAllLocks around the finalize callback, because it gets called
        from garbage collection and we can't let other threads collect!

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * kjs/JSLock.cpp:
        (KJS::JSLock::currentThreadIsHoldingLock): Added new function
        to allow stronger assertions than just that the lock is held
        by some thread (you can now assert that the current thread is
        holding it, given the new JSLock design).
        * kjs/JSLock.h:
        * kjs/collector.cpp: Refactored for portability plus added some
        stronger assertions.
        (KJS::Collector::allocate):
        (KJS::currentThreadStackBase):
        (KJS::Collector::registerAsMainThread):
        (KJS::onMainThread):
        (KJS::PlatformThread::PlatformThread):
        (KJS::getCurrentPlatformThread):
        (KJS::Collector::Thread::Thread):
        (KJS::destroyRegisteredThread):
        (KJS::Collector::registerThread):
        (KJS::Collector::markCurrentThreadConservatively):
        (KJS::suspendThread):
        (KJS::resumeThread):
        (KJS::getPlatformThreadRegisters):
        (KJS::otherThreadStackPointer):
        (KJS::otherThreadStackBase):
        (KJS::Collector::markOtherThreadConservatively):
        (KJS::Collector::markStackObjectsConservatively):
        (KJS::Collector::protect):
        (KJS::Collector::unprotect):
        (KJS::Collector::collectOnMainThreadOnly):
        (KJS::Collector::markMainThreadOnlyObjects):
        (KJS::Collector::collect):
        * kjs/collector.h:
        * wtf/FastMalloc.cpp:
        (WTF::fastMallocSetIsMultiThreaded):
        * wtf/FastMallocInternal.h:
        * wtf/Platform.h:



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