2007-09-12 Holger Hans Peter Freyther <zecke@selfish.org>

        Reviewed by Mark.

        Implement the FileChooser for the WebKit/Gtk+ port by using
        the GtkFileChooserDialog and g_path_get_basename to get the
        basename for the current filename.

        * WebCore.pro:
        * platform/gdk/FileChooserGdk.cpp: Added.
        (WebCore::FileChooser::FileChooser):
        (WebCore::FileChooser::~FileChooser):
        (WebCore::FileChooser::openFileChooser):
        (WebCore::FileChooser::basenameForWidth):
        * platform/gdk/TemporaryLinkStubs.cpp:


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

        Fix leaks in mac DumpRenderTree.

        * DumpRenderTree/FrameLoadDelegate.mm:
        (-[FrameLoadDelegate init]): Initalize in the correct order.
        (-[FrameLoadDelegate processWork:]): Delete WorkQueueItem's after dequeueing them.
        * DumpRenderTree/LayoutTestController.cpp:
        (decodeHostNameCallback): Put return value in a temporary JSRetainPtr to ensure it gets released.
        (encodeHostNameCallback): ditto.
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/LayoutTestControllerMac.mm:
        (LayoutTestController::copyDecodedHostName): Rename function to signal that it follows the Create rule.
        (LayoutTestController::copyEncodedHostName): ditto
        (LayoutTestController::queueLoad): Use a JSRetainPtr to ensure the url gets released.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Reviewed, tweaked and landed by Anders.

        <rdar://problem/5461153> 
        http://bugs.webkit.org/show_bug.cgi?id=15143
        Crash seen on Windows
        
        Null check frame before calling Frame::settings.
        
        * loader/PluginDocument.cpp:
        (WebCore::PluginTokenizer::writeRawData):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-09-12  Geoff Garen  <ggaren@apple.com>

        Reviewed by Sam Weinig.

        Fixed <rdar://problem/5429064> 141885 Safari JavaScript: Math.random() slightly less randomly distributed than on Safari / Mac

        Math.random was skewed slightly upward because it assumed that RAND_MAX was outside the range of
        values that rand() might return. This problem was particularly pronounced on Windows because
        the range of values returned by rand() on Windows is 2^16 smaller than the range of values
        return by rand() on Mac.

        Fixed by accounting for RAND_MAX return values. Also, switched Windows over to rand_s, which has
        a range that's equal to rand()'s range on Mac.

        * kjs/config.h:

        * kjs/math_object.cpp:
        (MathFuncImp::callAsFunction): Use the new new thing.

        * wtf/MathExtras.h: Platform abstraction for random numbers, to cover over differences on Windows.
        (wtf_random_init):
        (wtf_random):




git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Try to fix GDK build.

        * wtf/MathExtras.h:
        (wtf_random_init):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Win32 font improvements.

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

        Make DumpRenderTree more cross platform ready.
        - Convert GCController to use the JSCore API instead of the WebScriptObject.
        - Use CF types instead of NS objects.
        - General cleanup.

        * DumpRenderTree/DumpRenderTree.h:
        * DumpRenderTree/DumpRenderTree.mm:
        (dumpRenderTree):
        (dump):
        (runTest):
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
        * DumpRenderTree/EditingDelegate.m:
        * DumpRenderTree/FrameLoadDelegate.h:
        * DumpRenderTree/FrameLoadDelegate.mm:
        (-[FrameLoadDelegate init]):
        (-[FrameLoadDelegate dealloc]):
        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
        * DumpRenderTree/GCController.cpp: Added.
        (GCController::GCController):
        (GCController::~GCController):
        (collectCallback):
        (collectOnAlternateThreadCallback):
        (getJSObjectCountCallback):
        (GCController::makeWindowObject):
        (GCController::getJSClass):
        (GCController::staticFunctions):
        * DumpRenderTree/GCController.h:
        * DumpRenderTree/GCController.mm:
        (GCController::collect):
        (GCController::collectOnAlternateThread):
        (GCController::getJSObjectCount):
        * DumpRenderTree/LayoutTestController.cpp:
        (LayoutTestController::makeWindowObject):
        (LayoutTestController::getJSClass):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/LayoutTestControllerMac.mm:
        (LayoutTestController::addDisallowedURL):
        (waitUntilDoneWatchdogFired):
        (LayoutTestController::waitUntilDone):
        * DumpRenderTree/ResourceLoadDelegate.m:
        (-[ResourceLoadDelegate webView:resource:willSendRequest:redirectResponse:fromDataSource:]):



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

        Reviewed by Geof, Sam, Adam, Hyatt, Darin.

        - <rdar://problem/5480234> JS setTimeout function requires a second argument
        - Removed check for number of arguments in setTimeout to behave like other browsers.
        - Added layoutTest setTimeout-no-arguments.html

        * bindings/js/kjs_window.cpp:
        (KJS::WindowFunc::callAsFunction):

LayoutTests:

        Reviewed by Geof, Sam, Adam, Hyatt, Darin.

        - <rdar://problem/5480234> JS setTimeout function requires a second argument
        - Removed check for number of arguments in setTimeout to behave like other browsers.

        * fast/dom/Window/setTimeout-no-arguments-expected.txt: Added.
        * fast/dom/Window/setTimeout-no-arguments.html: Added.



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

        <rdar://problem/5304000>
        Windows Safari doesn't always call NPP_SetWindow() for NPAPI plugins.
        
        This does two things:
        
        1. Makes sure that the plug-in get the correct initial size.
        
        2. Always updates the size of the HWND, even if the widget size didn't change. This is because
        the widget size can be different before the HWND has been created.
        
        * plugins/win/PluginDatabaseWin.cpp:
        (WebCore::PluginDatabaseWin::createPluginView):
        * plugins/win/PluginDatabaseWin.h:
        * plugins/win/PluginViewWin.cpp:
        (WebCore::PluginViewWin::setFrameGeometry):
        (WebCore::PluginViewWin::PluginViewWin):
        * plugins/win/PluginViewWin.h:



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

        Reviewed by Oliver.

        - fix <rdar://problem/5470457> REGRESSION: Input method inline hole is mishandled in text
          <input> elements with maxlength limit

        * editing/Editor.h: Moved MarkedTextUnderline here and renamed it CompositionUnderline.
        Moved the rest of the marked text API here and used the term that will be more familiar
        to those on platforms other than Macintosh, "composition". This helps prevent confusion
        with the other kinds of mark -- the emacs "mark" and spelling/grammar marks. Also
        cleaned up the conditionals a bit for the Macintosh-specific parts of this header.

        * editing/Editor.cpp:
        (WebCore::Editor::Editor): Updated for name change.
        (WebCore::Editor::clear): Added. To be called by FrameLoader::clear().
        (WebCore::Editor::insertTextWithoutSendingTextEvent): Removed code to make inserted
        text replace the marked text range -- we now deal with this explicitly by not
        calling this function to replace marked text. Also removed unneeded code that was
        specific to the use of this to replace the marked text.
        (WebCore::Editor::selectComposition): Renamed from selectMarkedText. Updated since
        the composition range is not stored as a Range.
        (WebCore::Editor::confirmComposition): Added. To be called when changing a composition
        into actual text. Unlike the old code path, deletes the composition first, then inserts
        the text, triggering the normal insertion code path and events. This is helpful because
        it means the inserted text will be truncated by the <input> element, for example.
        (WebCore::Editor::confirmCompositionWithoutDisturbingSelection): Added.
        (WebCore::Editor::setComposition): Added. To be called when changing the composition.
        Takes parameters for the underlines and selection. Unlike the old code path, this passes
        a flag down that indicates the inserted text is part of a composition. This is helpful
        because we don't send the event that will cause the <input> element to do truncation.
        It's also a better API for future improvements to our input method handling.
        (WebCore::Editor::revealSelectionAfterEditingOperation): Updated for name change.
        (WebCore::Editor::setIgnoreCompositionSelectionChange): Ditto.
        (WebCore::Editor::compositionRange): Added. Needed now that the composition is not
        stored as a Range.
        (WebCore::Editor::getCompositionSelection): Added.

        * editing/TypingCommand.h:
        * editing/TypingCommand.cpp: (WebCore::TypingCommand::insertText):
        Added an insertedTextIsComposition parameter, and don't send the BeforeTextInsertedEvent
        if it's true.

        * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Replaced the Macintosh-specific
        call to setMarkedTextRange with a call to the new Editor::clear().

        * page/Frame.h:
        * page/Frame.cpp:
        * page/FramePrivate.h:
        * page/mac/FrameMac.mm:
        Removed the marked text code. It was streamlined and moved to Editor, except for the
        Mac-specific code, which was moved into WebKit.

        * page/mac/WebCoreFrameBridge.h:
        * page/mac/WebCoreFrameBridge.mm: Removed some now-unneeded marked text code.
        (-[WebCoreFrameBridge markedTextNSRange]): Updated for name/API change.

        * rendering/InlineTextBox.h:
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paint): Updated marked text code for name changes, and also
        streamlined the code a bit for the case where there is no composition.
        (WebCore::InlineTextBox::paintCompositionBackground): Name change.
        (WebCore::InlineTextBox::paintCompositionUnderline): Ditto.

        * rendering/RenderTextControl.h:
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::finishText): Added. Helper function shared by the
        (WebCore::RenderTextControl::text):
        (WebCore::getNextSoftBreak):
        (WebCore::RenderTextControl::textWithHardLineBreaks):

        * platform/CharacterNames.h: Added newlineCharacter.

        * dom/Range.h: Remove the now-unneeded version of toString that converts <br>
        elements into newlines.
        * dom/Range.cpp:
        (WebCore::Range::toString): Changed this to use a Vector<UChar> instead of
        a String so it will not have pathological reallocation performance, and removed
        the <br> feature.
        (WebCore::Range::pastEndNode): Made this return 0 when there is no start node.
        This bit of extra robustness guarantees you can't do a null dereference if the
        start node is 0 and the end node is not. Not sure this case really exists.

        * page/ContextMenuController.cpp: (ContextMenuController::contextMenuItemSelected):
        Removed a semi-bogus use of Range::toString(true). The right function to use here
        is plainText().

        * bridge/EditorClient.h: Removed obsolete markedTextAbandoned function.

        * WebCore.exp: Updated for above changes. 

WebKit:

        Reviewed by Oliver.

        - fix <rdar://problem/5470457> REGRESSION: Input method inline hole is mishandled in text
          <input> elements with maxlength limit

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _selectionChanged]): Tweaked code a bit.
        (-[WebHTMLView markedRange]): Simplified logic, since markedTextNSRange works when there's
        no composition range.
        (-[WebHTMLView hasMarkedText]): Call directly to Editor instead of bridge.
        (-[WebHTMLView unmarkText]): Call new confirmComposition to make it clear that this is
        confirming text, not just unmarking it to discard it.
        (extractUnderlines): Added. Converts directly from an NSAttributedString to the
        CompositionUnderline vector that's used by WebCore.
        (-[WebHTMLView setMarkedText:selectedRange:]): Changed to use the new setComposition.
        (-[WebHTMLView insertText:]): Changed to use confirmComposition when appropriate, instead
        of relying on special behavior of Editor::insertText.
        (-[WebHTMLView _updateSelectionForInputManager]): Rewrote to use getCompositionSelection
        and confirmCompositionWithoutDisturbingSelection.

        * WebCoreSupport/WebEditorClient.h:
        * WebCoreSupport/WebEditorClient.mm:
        Removed obsolete markedTextAbandoned function.

win:

        Reviewed by Oliver.

        - fix <rdar://problem/5470457> REGRESSION: Input method inline hole is mishandled in text
          <input> elements with maxlength limit

        * WebView.cpp:
        (WebView::resetIME): Change to use confirmCompositionWithoutDisturbingSelection.
        (WebView::updateSelectionForIME): Update for name changes, and to use new functions
        in Editor.
        (WebView::onIMEStartComposition): Removed unneeded call to unmarkText.
        (compositionToUnderlines): Removed startOffset parameter, since setComposition now
        handles this.
        (WebView::onIMEComposition): Changed to use confirmComposition and setComposition.
        Logic gets a lot cleaner.
        (WebView::onIMEEndComposition): Removed unneeded calls to Editor.
        (WebView::onIMERequestCharPosition): Updated for name changes.

LayoutTests:

        Reviewed by Oliver.

        - updated test results changed by change in input manager logic

        * platform/mac/editing/input/firstrectforcharacterrange-styled-expected.txt:
        * platform/mac/editing/input/text-input-controller-expected.txt:
        * platform/mac/editing/input/wrapped-line-char-rect-expected.txt:
        Updated. Small changes in which delegate methods are called.



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

        - Moved isPaused into the JS for efficiency and simplicity.

        * Drosera/DebuggerDocument.cpp:
        (DebuggerDocument::DebuggerDocument):
        (DebuggerDocument::pauseCallback):
        (DebuggerDocument::resumeCallback):
        (DebuggerDocument::isPaused):
        (DebuggerDocument::staticFunctions):
        * Drosera/DebuggerDocument.h:
        * Drosera/console.js:
        * Drosera/debugger.js:
        * Drosera/mac/DebuggerClient.mm:
        (-[DebuggerClient validateUserInterfaceItem:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Rubberstamped by Geoff and Maciej

        Fix MSVC build warning due to out of range data in a char array

        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::defaultIcon): The buffer is now unsigned data

        * platform/SharedBuffer.cpp:
        (WebCore::SharedBuffer::SharedBuffer): Add the "unsigned char*" c'tor
        * platform/SharedBuffer.h:



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

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

        <rdar://problem/5480437> - No site icon at launch and related error messages

        The error message was actually indicative of a larger bug that might've resulted in icons getting
        improperly pruned because they were never added to the set of retained page URLs.

        To solve the no-icon-at-launch problem, we send the "didReceiveIcon:" delegate call for every page 
        load that has an icon, whether the icon comes in from network, from disk, or was already in ram

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::startIconLoader): Always send the didReceiveIcon delegate call when an icon's 
          image data is known

        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::retainIconForPageURL): Much more accurately track the set of retained pages by
          adding them when their retain count moves from 0 to 1

        * loader/icon/PageURLRecord.h:
        (WebCore::PageURLRecord::retain): Correctly distinguish the "retain count just went from 0 to 1" case
          in the return value



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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Bump version for submit

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-09-14  Sven Herzberg  <sven@imendio.com>

        Reviewed by Adam Roben.

        Don't use fontconfig types if necessary, fixes:
        http://bugs.webkit.org/show_bug.cgi?id=15203

        * platform/gdk/FontPlatformData.cpp: don't use an FcBool to store the
        initialized state, use a plain c++ bool instead



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

        Reviewed by Mitz and Kevin Decker.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15197
          <rdar://problem/5478271> REGRESSION: Some Yahoo text entry fields
          render as lines rather than text entry boxes

        Test: fast/forms/textarea-rows-cols.html

        * html/HTMLTextAreaElement.cpp:
        (WebCore::HTMLTextAreaElement::HTMLTextAreaElement): Use constants for the default number
        of rows and columns.
        (WebCore::HTMLTextAreaElement::parseMappedAttribute): If rows/cols attribute has a value
        that's missing, non-numeric, or zero, then use the default value. Also check for the
        case where the effective value of the attribute isn't changing.

LayoutTests:

        Reviewed by Mitz and Kevin Decker.

        - test for http://bugs.webkit.org/show_bug.cgi?id=15197
          <rdar://problem/5478271> REGRESSION: Some Yahoo text entry fields
          render as lines rather than text entry boxes

        * fast/forms/textarea-rows-cols.html: Added.
        * platform/mac/fast/forms/textarea-rows-cols-expected.checksum: Added.
        * platform/mac/fast/forms/textarea-rows-cols-expected.png: Added.
        * platform/mac/fast/forms/textarea-rows-cols-expected.txt: Added.



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

        Reviewed by Adam Roben.

        Fixed http://bugs.webkit.org/show_bug.cgi?id=15209
        Sometimes removing an iframe from the DOM does not remove its frame 
        from the page

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::requestFrame): Use the contentFrame pointer
        directly instead of searching for a frame by the frame element's name, 
        because the frame element's name may have changed. (Another reason to do
        this is that it's just plain more straight-forward and efficient.)

LayoutTests:

        Reviewed by Adam Roben.
        
        Layout test for http://bugs.webkit.org/show_bug.cgi?id=15209
        Sometimes removing an iframe from the DOM does not remove its frame 
        from the page.

        * fast/frames/iframe-remove-after-id-change-expected.txt: Added.
        * fast/frames/iframe-remove-after-id-change.html: Added.

        Updated results in this test. New results indicate that the frame's
        contents are preserved between removal and reinsertion, which matches
        Firefox.

        * fast/frames/iframe-option-crash-expected.checksum:
        * fast/frames/iframe-option-crash-expected.png:
        * fast/frames/iframe-option-crash-expected.txt:
        * fast/frames/iframe-option-crash.xhtml:



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

        - Changing Win version of Drosera work with recent changes.

        * Drosera/DebuggerDocument.cpp:
        * Drosera/DebuggerDocument.h:
        * Drosera/mac/DebuggerDocumentPlatform.mm:
        (NSStringCreateWithJSStringRef):
        (JSValueRefCreateWithNSString):
        * Drosera/win/DebuggerClient.cpp:
        (DebuggerClient::stepInto):
        * Drosera/win/Drosera.vcproj/Drosera.vcproj:



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