2007-10-26  Alp Toker  <alp@atoker.com>

        Reviewed by Mark Rowe.

        http://bugs.webkit.org/show_bug.cgi?id=15693
        [GTK] Paging does not work when widget is added to a GtkScrolledWindow

        Eliminate MagicGtkScrollConstant in favour of the same calculations as
        GtkTextView for step and page increments. This also makes paging work,
        as the page increment was previously always 0.

        * platform/gtk/ScrollViewGtk.cpp:
        (WebCore::ScrollView::updateScrollbars):



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

        Fixed <rdar://5549689> 2 tests in fast/forms fail when run with other tests on Windows

        Moving destructor into platform-specific files
        * DumpRenderTree/LayoutTestController.cpp:
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::~LayoutTestController):
        * DumpRenderTree/qt/jsobjects.cpp:
        (LayoutTestController::~LayoutTestController):

        LayoutTestController wasn't being destroyed
        * DumpRenderTree/win/DumpRenderTree.cpp:
        (runTest):

        Added declspec
        * DumpRenderTree/win/EditingDelegate.h:

        Reset certain values on the webview (or related delegate) that might 
        have changed while running a test
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::~LayoutTestController):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Weak link against WebCore so DumpRenderTree can be bundled with production roots.

        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:

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

        - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider

        * kjs/nodes.cpp:
        (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
        adding any value over toNumber() here.
        (KJS::valueForReadModifyAssignment): Ditto.
        (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
        and branches.
        (KJS::lessThanEq): Ditto.
        * JavaScriptCore.exp: Export new functions as needed.
        * kjs/value.h:
        (KJS::JSValue::toPrimitive): Fixed formatting.
        (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
        to number and tells you whether a toPrimitive() conversion with a Number hint
        would have given a string.
        * kjs/internal.cpp:
        (KJS::StringImp::getPrimitiveNumber): Implemented. 
        (KJS::NumberImp::getPrimitiveNumber): ditto
        (KJS::GetterSetterImp::getPrimitiveNumber): ditto
        (KJS::StringImp::toPrimitive): Fixed formatting.
        (KJS::NumberImp::toPrimitive): ditto
        (KJS::GetterSetterImp::toPrimitive): ditto
        * kjs/internal.h:
        * kjs/object.cpp:
        (KJS::JSObject::getPrimitiveNumber): Implemented.
        * kjs/object.h:



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

        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:

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

        * Scripts/make-js-test-wrappers: Don't generate a wrapper for intersectsNode.js.
        * Scripts/prepare-ChangeLog: Add a special case for prefix of empty string.



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

        Reviewed by Maciej.

        Fix builds with code coverage enabled.

        * Scripts/build-webkit: Don't overwrite the existing value of OTHER_LDFLAGS.


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

        Qt build fix.  r27084 added a destructor implementation for LayoutTestController
        to the Qt port on the assumption that it was an implementation of the cross-platform
        LayoutTestController class.  It is not, so it did not need to be changed.

        * DumpRenderTree/qt/jsobjects.cpp: Remove empty destructor.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Maciej Stachowiak.
        
        Tweaked the inner hashtable lookup loop to remove a branch in the "not 
        found" case. .5% speedup on SunSpider.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * wtf/HashTable.h:
        (WTF::::lookup):



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

        Update expected results.

        * platform/mac/fast/overflow/clip-rects-fixed-ancestor-expected.txt:


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

        Reviewed by Maciej.

        - http://bugs.webkit.org/show_bug.cgi?id=15703
          fix numeric functions -- improve correctness and speed

        Gives about 1% gain on SunSpider.

        * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
        (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
        with both immediate and number values.
        (KJS::JSValue::toUInt32): Ditto.
        * kjs/value.cpp:
        (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
        differences. One is that it now correctly returns 0 for NaN, and another is that
        there's no special case for 0 or infinity, since the general case already handles
        those correctly.
        (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
        check for NaN.
        (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
        truncation done by the typecast already does the necessary truncation that
        roundValue was doing.
        (KJS::JSValue::toUInt32SlowCase): Ditto.
        (KJS::JSValue::toUInt16): Removed.

        * kjs/internal.h: Removed roundValue.
        * kjs/internal.cpp: Ditto.

        * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
        code to handle NaN in Array.slice; toInteger now never returns NaN as specified.

        * kjs/date_object.cpp:
        (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
        toNumber as specified.
        (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
        with a call to toNumber and timeClip as specified.
        (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
        where the default behavior of toInt32 (returning 0) was already correct. Replaced
        call to roundValue with a call to toNumber as specified.
        (KJS::DateObjectFuncImp::callAsFunction): Ditto.

        * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
        cases for the pow function that the library already handles correctly.

        * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
        call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
        The real toInteger now returns 0 for NaN. Took out unneeded special case in
        ToFixed for undefined; was only needed because our toInteger was wrong. Same
        thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.

        * kjs/string_object.cpp:
        (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
        cases for undefined that were only needed because toInteger was wrong. Same in
        IndexOf, and was able to remove some special cases. In LastIndexOf, used
        toIntegerPreserveNaN, but was able to remove some special cases there too.
        Changed Substr implementation to preserve correct behavior with the change
        to toInteger and match the specification. Also made sure we weren't converting
        an out of range double to an int.
        (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
        toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
        no reason to have toUInt16 as a second, less-optimized function that's only
        called at this one call site.

        * wtf/MathExtras.h: Added trunc function for Windows.

LayoutTests:

        Reviewed by Maciej.

        - test changes for http://bugs.webkit.org/show_bug.cgi?id=15703
          fix numeric functions -- improve correctness and speed

        * fast/js/resources/char-at.js: Updated test to expect that we get the first
        character if we pass NaN to charAt and charCodeAt; it's what the specification
        asks for and matches other browsers too.
        * fast/js/char-at-expected.txt: Updated.



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

        Windows build fix.

        * kjs/string_object.cpp:
        (KJS::StringObjectFuncImp::callAsFunction):


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

        Reviewed by Oliver.
        
        - moved Context class into ExecState.{h,cpp} in preparation for merging 
        ExecState and Context classes.

        * kjs/ExecState.h: Moved CodeType enum and Context class here in
        preparation for merging ExecState and Context.
        * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
        (KJS::Context::Context):
        (KJS::Context::~Context):
        (KJS::Context::mark):
        * kjs/context.h: Removed.
        * kjs/Context.cpp: Removed.
        * kjs/function.h: Removed CodeType enum.
        * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
        * kjs/internal.h: Removed LabelStack.
        * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
        * kjs/collector.cpp: Fixed includes.
        * kjs/function.cpp: ditto
        * kjs/internal.cpp: ditto
        * kjs/interpreter.cpp: ditto
        * kjs/lookup.h: ditto
        * kjs/nodes.cpp: ditto

WebCore:

        Reviewed by Oliver.

        - update for JavaScriptCore header changes

        * bindings/objc/WebScriptObject.mm:
        * bridge/mac/WebCoreScriptDebugger.mm:



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

        Gtk build fix.

        * JavaScriptCore.pri:
        * kjs/ExecState.cpp:


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

        Windows build fix.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Windows build fix.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:



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

        Gtk build fix.

        * kjs/ExecState.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix ChangeLog ordering.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed by Oliver.
        
        - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.

        * kjs/value.h:
        (KJS::JSValue::getUInt32):
        (KJS::JSValue::getTruncatedInt32):
        (KJS::JSValue::toNumber):
        * wtf/PassRefPtr.h:
        (WTF::PassRefPtr::~PassRefPtr):
        * wtf/RefPtr.h:
        (WTF::RefPtr::operator->):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Rubber Stamped by Oliver.

        - fix build

        * bridge/mac/WebCoreScriptDebugger.mm:
        (-[WebCoreScriptCallFrame scopeChain]):
        (-[WebCoreScriptCallFrame functionName]):
        (-[WebCoreScriptCallFrame evaluateWebScript:]):



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