1efc3518a9f467e1e2d52c4f83bf840f04e82aef
[WebKit-https.git] / WebCore / ChangeLog
1 2007-09-18  Dave Hyatt  <hyatt@apple.com>
2
3         Fix a bug in my previous patch.  Make sure to select the old font back into the HDC and to also release the HDC.
4        
5         Reviewed by aroben
6
7         * platform/win/FontCacheWin.cpp:
8         (WebCore::FontCache::getFontDataForCharacters):
9
10 2007-09-18  Sam Weinig  <sam@webkit.org>
11
12         Reviewed by Darin.
13
14         Patch for <rdar://problem/5488478> Safari crashes when passing null to Range.insertNode()
15
16         Test: fast/dom/Range-insertNode-crash.html
17
18         * dom/Range.cpp:
19         (WebCore::Range::insertNode): Null check the passed in node to insert.
20
21 2007-09-18  Mike Fenton  <mike@staikos.net>
22
23         Reviewed by George Staikos.
24
25         Retain the pen properties when changing one aspect of the pen.
26
27         * html/CanvasStyle.cpp:
28         (WebCore::CanvasStyle::applyStrokeColor):
29
30 2007-09-18  Mike Fenton  <mike@staikos.net>
31
32         Reviewed by George Staikos.
33
34         Make <canvas> work in more cases by restarting the painter after we
35         finish painting, and restoring the pen and opacity.
36
37         * html/HTMLCanvasElement.cpp:
38         (WebCore::HTMLCanvasElement::paint):
39
40 2007-09-18  Mitz Pettel  <mitz@webkit.org>
41
42         Reviewed by Darin.
43
44         - fix http://bugs.webkit.org/show_bug.cgi?id=15169
45           Freeze on Google maps using the "Dig a hole" tool
46           <rdar://problem/5477414>
47
48         Test: fast/dom/CSSStyleDeclaration-empty-string-property.html
49
50         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
51         (WebCore::cssPropertyName): Added an early return if the property name
52         is the empty string, thus avoiding a loop that is not prepared for that
53         case.
54
55 2007-09-19  Darin Adler <darin@apple.com>
56
57         Reviewed by Adam.
58
59         - fix <rdar://problem/5415734> <select> draws incorrectly if size of menu options
60           is changed after it pops up once
61
62         * platform/win/PopupMenuWin.cpp:
63         (WebCore::PopupMenu::PopupMenu): Removed unnecessary initialization of IntRect.
64         (WebCore::PopupMenu::show): Check that the clientRect is empty instead of checking
65         the entire windowRect -- this fixes a bug where we pop up a tiny 2-pixel high black
66         box when you click on an empty menu.
67         (WebCore::PopupMenu::visibleItems): Base the number of items on the client rect
68         instead of the window rect. Rounding down means this would have worked anyway, but
69         it's more correct to do it this way.
70         (WebCore::PopupMenu::paint): Deallocate the bitmap so it gets reallocated if it
71         has the wrong width or height (or if GetObject returns false, which should not
72         happen in practice).
73
74 2007-09-18  David Harrison  <harrison@apple.com>
75
76         Reviewed by Darin.
77
78         <rdar://problem/5486974> REGRESSION(r25373): 1/4 second to doubleclick word in GMail when using Kotoeri IM, also slow in other IMs (15163)
79
80         Updated tests:
81         * fast/dom/Window/window-xy-properties-expected.txt:
82         * fast/dom/plugin-attributes-enumeration-expected.txt:
83         * fast/events/onerror-bubbling-expected.txt:
84         * fast/events/related-target-expected.txt:
85         * fast/forms/select-namedItem-expected.txt:
86         * fast/table/incomplete-table-in-fragment-2-expected.txt:
87         * fast/table/incomplete-table-in-fragment-hang-expected.txt:
88         * fast/table/large-rowspan-crash-expected.txt:
89         * plugins/embed-attributes-setting-expected.txt:
90
91         * editing/TextIterator.cpp:
92         (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
93         Avoid VisiblePosition check if the current node is a descendant
94         of the start container and the start offset was 0. In that case
95         we already had enough context to correctly decide whether to emit
96         a newline after a preceding block. We chose not to emit
97         (m_haveEmitted is false), so don't second guess that.
98             
99         (WebCore::TextIterator::exitNode):
100         Changed some comments.
101
102 2007-09-17  Geoffrey Garen  <ggaren@apple.com>
103
104         Reviewed by Darin Adler.
105
106         Speculative fix for <rdar://problem/5479443> REGRESSION: Hang due to 
107         infinite JS recursion on close @ engadget.com (onunload-based ad)
108         
109         If page is NULL, shouldInterruptScript now returns true, so you can't 
110         get stuck in a state in which a script executes forever without putting 
111         up a UI to ask if it should stop.
112
113         * bindings/js/kjs_binding.cpp:
114         (KJS::ScriptInterpreter::shouldInterruptScript):
115
116 2007-09-17  Dave Hyatt  <hyatt@apple.com>
117
118         Fix for bug 14743, missing glyphs on many international sites because of MLang's tiny cache.
119         
120         Bypass Mlang's cache entirely.  Get the mapped font from MLang, obtain the font name, and then feed
121         the name back into our own system so that it gets created and cached again without MLang being involved.
122         Then free up the font obtained from MLang immediately so that its cache just remains empty.
123            
124         Reviewed by aroben
125
126         * platform/FontData.h:
127         (WebCore::FontData::isSystemFont):
128         * platform/win/FontCacheWin.cpp:
129         (WebCore::FontCache::getFontDataForCharacters):
130         * platform/win/FontDataWin.cpp:
131         (WebCore::FontData::platformInit):
132         (WebCore::FontData::platformDestroy):
133         * platform/win/UniscribeController.cpp:
134         (WebCore::UniscribeController::shapeAndPlaceItem):
135         
136 2007-09-17  Adam Roben  <aroben@apple.com>
137
138         Fix <rdar://5423441> Should get focus ring color from SafariTheme
139
140         Reviewed by Hyatt.
141
142         No regression test possible.
143
144         * WebCore.vcproj/WebCore.vcproj: Added ColorSafari.cpp.
145         * platform/graphics/win/ColorSafari.cpp: Added.
146         (WebCore::makeRGBAFromCGColor): Added.
147         (WebCore::focusRingColor): Added. Gets the focus ring color from
148         SafariTheme if SafariTheme has support for it.
149         (WebCore::setFocusRingColorChangeFunction): Added.
150         * platform/win/TemporaryLinkStubs.cpp: Removed focus ring color
151         functions.
152
153 2007-09-17  Anders Carlsson  <andersca@apple.com>
154
155         Fix Windows build.
156
157         * WebCore.vcproj/WebCore.vcproj:
158         * loader/NetscapePlugInStreamLoader.h:
159
160 2007-09-17  Anders Carlsson  <andersca@apple.com>
161
162         Fix Mac build.
163         
164         * loader/NetscapePlugInStreamLoader.cpp:
165         * loader/NetscapePlugInStreamLoader.h:
166         * loader/win/NetscapePlugInStreamLoaderWin.cpp: Copied from loader/NetscapePlugInStreamLoader.cpp.
167
168 2007-09-17  Anders Carlsson  <andersca@apple.com>
169
170         Reviewed by Adam.
171
172         <rdar://problem/5483346>
173         crash at vw.com WebCore::PluginViewWin::disconnectStream.
174         
175         The following events would lead to this crash:
176         
177         1. a plug-in stream finishes loading and calls NPP_DestroyStream.
178         2. the DestroyStream handler calls NPN_Evaluate, submitting a form through JavaScript.
179         3. A new page is going to be loaded and DocumentLoader::stopLoading is called.
180         4. DocumentLoader::stopLoading will stop all loader, including the one that is done loading!
181         
182         The fix is to port NetscapePluginStreamLoader over from the Mac code and use it instead. This fixes the crash
183         because it disassociates the stream loader with the document loader _before_ calling NPP_DestroyStream, whereas
184         SubresourceLoader does this _after_ calling NPP_DestroyStream. 
185         
186         * loader/NetscapePlugInStreamLoader.cpp:
187         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
188         (WebCore::NetscapePlugInStreamLoader::~NetscapePlugInStreamLoader):
189         (WebCore::NetscapePlugInStreamLoader::create):
190         (WebCore::NetscapePlugInStreamLoader::isDone):
191         (WebCore::NetscapePlugInStreamLoader::releaseResources):
192         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
193         (WebCore::NetscapePlugInStreamLoader::didReceiveData):
194         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
195         (WebCore::NetscapePlugInStreamLoader::didFail):
196         (WebCore::NetscapePlugInStreamLoader::didCancel):
197         * loader/NetscapePlugInStreamLoader.h:
198         (WebCore::NetscapePlugInStreamLoaderClient::didFinishLoading):
199         * plugins/win/PluginStreamWin.cpp:
200         (WebCore::PluginStreamWin::start):
201         (WebCore::PluginStreamWin::didReceiveResponse):
202         (WebCore::PluginStreamWin::didReceiveData):
203         (WebCore::PluginStreamWin::didFail):
204         (WebCore::PluginStreamWin::didFinishLoading):
205         * plugins/win/PluginStreamWin.h:
206         * plugins/win/PluginViewWin.cpp:
207         (WebCore::PluginViewWin::load):
208
209 2007-09-17  Anders Carlsson  <andersca@apple.com>
210
211         Reviewed by Adam.
212
213         <rdar://problem/5483839>
214         Crash loading http://www.microsoft.com if Silverlight 1.0 is installed.
215         
216         Work around a problem in our NPRuntime implementation by never unloading the silverlight plug-in dll.
217         
218         * plugins/win/PluginViewWin.cpp:
219         (WebCore::PluginViewWin::~PluginViewWin):
220         (WebCore::PluginViewWin::determineQuirks):
221         * plugins/win/PluginViewWin.h:
222         (WebCore::):
223
224 2007-09-17  Brady Eidson  <beidson@apple.com>
225
226         Reviewed by John Sullivan
227
228         Fix for http://bugs.webkit.org/show_bug.cgi?id=15178
229         and
230         <rdar://problem/5474001>
231
232         The stress test proves that this was an overzealous ASSERT.  It is very possible to mark an icon
233         for addition to the on-disk database and then mark it for removal before it is ever written out.  
234         This is not an error and was already handled gracefully
235
236         * loader/icon/IconDatabase.cpp:
237         (WebCore::IconDatabase::removeIconFromSQLDatabase): Don't ASSERT of log if the icon wasn't on disk
238
239 2007-09-17  Brady Eidson  <beidson@apple.com>
240
241         Reviewed by Oliver
242
243         <rdar://problem/5487048> - ASSERT in stress test in IconDatabase
244
245         If a PageURLRecord went away, it never clears its URL from the IconRecord it retained.
246
247         * loader/icon/PageURLRecord.cpp:
248         (WebCore::PageURLRecord::~PageURLRecord): Set the icon record to 0, clearing the page url
249         * loader/icon/PageURLRecord.h: Add the destructor
250
251 2007-09-17  Antti Koivisto  <antti@apple.com>
252
253         Reviewed by Darin.
254         
255         Fix <rdar://problem/5480050>
256         Leopard9A551 with Dashcode 112: Dashcode crash when dragging image into canvas.
257         
258         If @import stylesheet was modified through CSS DOM style selector would not get updated. This
259         could lead to crashes.
260
261         Test: fast/css/import-style-update.html
262
263         * css/CSSStyleSheet.cpp:
264         (WebCore::CSSStyleSheet::styleSheetChanged):
265
266 2007-09-17  Anders Carlsson  <andersca@apple.com>
267
268         Reviewed by Adam.
269
270         <rdar://problem/5421997>
271         http://bugs.webkit.org/show_bug.cgi?id=14247
272         Display problem with Flash - image does not stop changing
273         
274         Port the manual load code over from the Mac version.
275
276         * plugins/win/PluginDatabaseWin.cpp:
277         (WebCore::PluginDatabaseWin::createPluginView):
278         * plugins/win/PluginDatabaseWin.h:
279         Add load manually parameter.
280         
281         * plugins/win/PluginStreamWin.cpp:
282         (WebCore::PluginStreamWin::stop):
283         If we're loading manually, cancel the main resource load.
284          
285         (WebCore::PluginStreamWin::destroyStream):
286         Don't disconnect the stream if we're loading manually.
287         
288         * plugins/win/PluginViewWin.cpp:
289         (WebCore::PluginViewWin::setFrameGeometry):
290         Always call updateWindow()
291         
292         (WebCore::PluginViewWin::PluginViewWin):
293         Initialize loadManually.
294         
295         (WebCore::PluginViewWin::init):
296         Don't set the width and height of the window here since it will make the plug-in HWND show briefly
297         before it's been positioned.
298         
299         (WebCore::PluginViewWin::didReceiveResponse):
300         Create the manual stream.
301         
302         (WebCore::PluginViewWin::didReceiveData):
303         (WebCore::PluginViewWin::didFinishLoading):
304         (WebCore::PluginViewWin::didFail):
305         Call through to the manual stream.
306         
307         * plugins/win/PluginViewWin.h:
308
309 2007-09-16  Sam Weinig  <sam@webkit.org>
310
311         Reviewed by Maciej.
312
313         Fix for http://bugs.webkit.org/show_bug.cgi?id=14693
314         document.width/height doesn't force layout
315
316         Test: fast/dom/document-width-height-force-layout.html
317
318         * html/HTMLDocument.cpp:
319         (WebCore::HTMLDocument::width): Force layout.
320         (WebCore::HTMLDocument::height): ditto.
321         * html/HTMLDocument.h:
322
323 2007-09-15  Holger Hans Peter Freyther  <zecke@selfish.org>
324
325         Reviewed by Mark.
326
327         Convert the filenames from WebCore::String to the filesystem encoding
328         and vice versa using g_filename_{from,to}_utf8 functions. Also add the needed NULL
329         checks for the return values where glib and gtk+ can return NULL.
330
331         * platform/gdk/FileChooserGdk.cpp:
332         (WebCore::convertToStringByAdoptingTheFilesystemRepresentation):
333         (WebCore::FileChooser::openFileChooser):
334         (WebCore::FileChooser::basenameForWidth):
335
336 2007-09-15  Holger Hans Peter Freyther  <zecke@selfish.org>
337
338         Reviewed by Mark.
339
340         Use the new WebCore::String::fromUTF8 function to create
341         the labels.
342
343         * platform/gdk/LocalizedStringsGdk.cpp:
344         (WebCore::submitButtonDefaultLabel):
345         (WebCore::inputElementAltText):
346         (WebCore::resetButtonDefaultLabel):
347         (WebCore::searchableIndexIntroduction):
348         (WebCore::fileButtonChooseFileLabel):
349         (WebCore::fileButtonNoFileSelectedLabel):
350         (WebCore::contextMenuItemTagOpenLinkInNewWindow):
351         (WebCore::contextMenuItemTagDownloadLinkToDisk):
352         (WebCore::contextMenuItemTagCopyLinkToClipboard):
353         (WebCore::contextMenuItemTagOpenImageInNewWindow):
354         (WebCore::contextMenuItemTagDownloadImageToDisk):
355         (WebCore::contextMenuItemTagCopyImageToClipboard):
356         (WebCore::contextMenuItemTagOpenFrameInNewWindow):
357         (WebCore::contextMenuItemTagCopy):
358         (WebCore::contextMenuItemTagGoBack):
359         (WebCore::contextMenuItemTagGoForward):
360         (WebCore::contextMenuItemTagStop):
361         (WebCore::contextMenuItemTagReload):
362         (WebCore::contextMenuItemTagCut):
363         (WebCore::contextMenuItemTagPaste):
364         (WebCore::contextMenuItemTagNoGuessesFound):
365         (WebCore::contextMenuItemTagIgnoreSpelling):
366         (WebCore::contextMenuItemTagLearnSpelling):
367         (WebCore::contextMenuItemTagSearchWeb):
368         (WebCore::contextMenuItemTagLookUpInDictionary):
369         (WebCore::contextMenuItemTagOpenLink):
370         (WebCore::contextMenuItemTagIgnoreGrammar):
371         (WebCore::contextMenuItemTagSpellingMenu):
372         (WebCore::contextMenuItemTagShowSpellingPanel):
373         (WebCore::contextMenuItemTagCheckSpelling):
374         (WebCore::contextMenuItemTagCheckSpellingWhileTyping):
375         (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
376         (WebCore::contextMenuItemTagFontMenu):
377         (WebCore::contextMenuItemTagBold):
378         (WebCore::contextMenuItemTagItalic):
379         (WebCore::contextMenuItemTagUnderline):
380         (WebCore::contextMenuItemTagOutline):
381         (WebCore::contextMenuItemTagWritingDirectionMenu):
382         (WebCore::contextMenuItemTagDefaultDirection):
383         (WebCore::contextMenuItemTagLeftToRight):
384         (WebCore::contextMenuItemTagRightToLeft):
385         (WebCore::contextMenuItemTagInspectElement):
386         (WebCore::searchMenuNoRecentSearchesText):
387         (WebCore::searchMenuRecentSearchesText):
388         (WebCore::searchMenuClearRecentSearchesText):
389
390 2007-09-15  Holger Hans Peter Freyther  <zecke@selfish.org>
391
392         Reviewed by Mark.
393
394         Add WebCore::String::fromUTF8 to convert from UTF-8
395         to a WebCore::String. This is meant to be used by
396         the Gtk+ port and the signature and implementation
397         is similiar to the one of DeprecatedString.
398
399         * platform/PlatformString.h:
400         * platform/String.cpp:
401         (WebCore::String::fromUTF8):
402
403 2007-09-13  Holger Hans Peter Freyther  <zecke@selfish.org>
404
405         Reviewed by Anders.
406
407         Implement the fileExists and deleteFile functions
408         using glib.
409
410         * WebCore.pro:
411         * platform/gdk/FileSystemGdk.cpp: Added.
412         (WebCore::fileExists):
413         * platform/gdk/TemporaryLinkStubs.cpp:
414
415 2007-09-16  David Harrison  <harrison@apple.com>
416
417         Reviewed by Darin.
418
419         <rdar://problem/5472125> REGRESSION (9A535-9A548): No VO cursor shown when navigating in a mail message body
420
421         The problem was that the visible units code was mishandling non-editable content, generating null
422         VisiblePositions instead of the actual boundary VisiblePositions.
423         
424         Updated tests:
425         * fast/dom/Window/window-xy-properties-expected.txt:
426         * fast/dom/plugin-attributes-enumeration-expected.txt:
427         * fast/events/onerror-bubbling-expected.txt:
428         * fast/events/related-target-expected.txt:
429         * fast/forms/select-namedItem-expected.txt:
430         * fast/table/incomplete-table-in-fragment-2-expected.txt:
431         * fast/table/incomplete-table-in-fragment-hang-expected.txt:
432         * fast/table/large-rowspan-crash-expected.txt:
433         * plugins/embed-attributes-setting-expected.txt:
434        
435         Source Changes:
436         * editing/VisiblePosition.cpp:
437         (WebCore::VisiblePosition::next):
438         (WebCore::VisiblePosition::previous):
439         (WebCore::VisiblePosition::honorEditableBoundaryAtOrBefore):
440         (WebCore::VisiblePosition::honorEditableBoundaryAtOrAfter):
441         Rename firstEditablePositionAtOrAfter to honorEditableBoundaryAtOrAfter.
442         Rename firstEditablePositionAtOrBefore to honorEditableBoundaryAtOrBefore.
443         Changed these two functions to handle non-editable positions.
444         
445         * editing/VisiblePosition.h:
446         * editing/visible_units.cpp:
447         (WebCore::previousWordPosition):
448         (WebCore::nextWordPosition):
449         (WebCore::positionAvoidingFirstPositionInTable):
450         (WebCore::startPositionForLine):
451         (WebCore::startOfLine):
452         (WebCore::endOfLine):
453         (WebCore::previousSentencePosition):
454         (WebCore::nextSentencePosition):
455         Rename firstEditablePositionAtOrAfter to honorEditableBoundaryAtOrAfter.
456         Rename firstEditablePositionAtOrBefore to honorEditableBoundaryAtOrBefore.
457         Also, startOfLine() now calls positionAvoidingFirstPositionInTable() in the empty block early return case.
458         positionAvoidingFirstPositionInTable() was the logic startOfLine() used in the normal case. Now in a reusable function.
459
460 2007-09-14  Oliver Hunt  <oliver@apple.com>
461
462         Reviewed by Adam.
463
464         Mac doesn't have any kind of not implemented macro, so we'll actually implement
465         fileSize.
466
467         * platform/mac/FileSystemMac.mm:
468         (WebCore::fileSize):
469
470 2007-09-14  Timothy Hatcher  <timothy@apple.com>
471
472         Initialize m_dialogArguments to 0. Fixes the newly crashing layout tests.
473
474         * bindings/js/kjs_window.cpp:
475         (KJS::WindowPrivate::WindowPrivate):
476
477 2007-09-14  Oliver Hunt  <oliver@apple.com>
478
479         Reviewed by Brady, John H.
480
481         <rdar://problem/5483632> File system operation wrappers are unimplemented on windows
482         
483         Implement Windows versions of fileExists and deleteFile. 
484         Also corrects fileSize to use a 64-bit version of stat.
485
486         * platform/win/FileSystemWin.cpp:
487         (WebCore::fileSize):  
488           Renamed argument to be more consistent with others.
489           And converted to _stat32i64 to allow 64-bit filesizes
490         (WebCore::fileExists):
491         (WebCore::deleteFile):
492         * platform/win/TemporaryLinkStubs.cpp:
493
494 2007-09-14  Oliver Hunt  <oliver@apple.com>
495
496         Reviewed by Sam and Geoff.
497
498         <rdar://problem/5333272> Cannot upload files when path contains 
499         non-ascii/multibyte characters
500
501         We can't use _stat to determine file size on Windows as it may not 
502         correctly handle multibyte characters, so we have to use _wstat.
503         
504         In deference to the fact that we may one day use the FormDataStreamCFNet.cpp
505         on Mac i've wrapped the call to _wstat with a generic fileSize
506         method in FileSystem.h
507
508         * WebCore.vcproj/WebCore.vcproj:
509         * platform/FileSystem.h:
510         * platform/network/cf/FormDataStreamCFNet.cpp:
511         * platform/win/FileSystemWin.cpp: Added.
512         (WebCore::setHTTPBody):
513         * platform/gdk/TemporaryLinkStubs.cpp:
514         * platform/mac/FileSystemMac.mm:
515         (WebCore::fileSize):
516         * platform/qt/TemporaryLinkStubs.cpp:
517
518 2007-09-14  Timothy Hatcher  <timothy@apple.com>
519
520         Reviewed by Sam.
521
522         <rdar://problem/5472970> REGRESSION (r24276): TinyMCE popups show an empty window with no content
523
524         Accessing the document of a window before the load finished would cause the window
525         object to hold onto the initial empty document, and never switch over to the real document
526         once the load finished. This regression was caused by r24276 which added a check to prevent
527         clearing the window object when the load finished. The absence of this clear allowed the
528         dialogArguments set with showModalDialog to persist on the window after the load. However,
529         not clearing the window would keep other properties (and the empty document object) around.
530
531         So the fix is to store away the dialog arguments that were passed to showModalDialog and
532         put them back on the window object in the dialogArguments property each time
533         the window is cleared.
534
535         * bindings/js/kjs_window.cpp:
536         (KJS::createWindow): No longer put dialogArguments on the window here.
537         (KJS::showModalDialog): Put dialogArguments on the window and call
538         setDialogArgumentsAndReturnValueSlot to remember the arguments.
539         (KJS::Window::clear): Put m_dialogArguments back on the window as dialogArguments.
540         (KJS::WindowFunc::callAsFunction): Call the new setDialogArgumentsAndReturnValue.
541         (KJS::Window::setDialogArgumentsAndReturnValue): Store the arguments in m_dialogArguments.
542         * bindings/js/kjs_window.h: Rename setReturnValueSlot to setDialogArgumentsAndReturnValueSlot.
543         * manual-tests/modal-dialog-arguments.html: Confirmed that this test still passes.
544
545         Reverted r24276 which was all the changes in FrameLoader.cpp and FrameLoader.h.
546
547         * loader/FrameLoader.cpp:
548         (WebCore::FrameLoader::FrameLoader): Remove m_shouldClearWindowProperties.
549         (WebCore::FrameLoader::createWindow): Remove the call to setShouldClearWindowProperties.
550         (WebCore::FrameLoader::clear): No longer check m_shouldClearWindowProperties, clear the
551         window whenever clearWindowProperties is set.
552         (WebCore::FrameLoader::begin): Remove m_shouldClearWindowProperties.
553         (WebCore::FrameLoader::open): Ditto.
554         * loader/FrameLoader.h: Remove m_shouldClearWindowProperties.
555
556 2007-09-14  Brady Eidson  <beidson@apple.com>
557
558         How about a build fix that works on *all* platforms?
559
560         * platform/Threading.h:
561         (WebCore::initializeThreading):
562
563 2007-09-14  Brady Eidson  <beidson@apple.com>
564
565         Roll out my previous build fix and just make the stupid thing inline
566         (I knew there was something easier but oh boy, no coffee yet... weinig?)
567
568 2007-09-14  Brady Eidson  <beidson@apple.com>
569
570         Rubberstamped by Mark Rowe
571
572         Add the logging channel I just created to the initialize list on Mac
573
574         * platform/mac/LoggingMac.mm:
575         (WebCore::InitializeLoggingChannelsIfNecessary):
576
577 2007-09-14  Brady Eidson  <beidson@apple.com>
578
579         Build fix
580
581         That method can't go in the header, apparently
582
583         * platform/Threading.h:
584         * platform/gdk/TemporaryLinkStubs.cpp:
585         (WebCore::initializeThreading):
586         * platform/mac/Threading.mm:
587         (WebCore::initializeThreading):
588         * platform/qt/TemporaryLinkStubs.cpp:
589         (WebCore::initializeThreading):
590
591 2007-09-14  Brady Eidson  <beidson@apple.com>
592
593         Reviewed by Darin
594
595         -Add callOnMainThread() implementation to Windows
596
597         * WebCore.vcproj/WebCore.vcproj:
598         
599         * loader/icon/IconDatabase.cpp:
600         (WebCore::IconDatabase::open): Call initializeThreading() from the main thread before kicking off the secondary thread
601         
602         * platform/Logging.cpp: Added Threading logging channel
603         (WebCore::):
604         * platform/Logging.h: Ditto
605         
606         * platform/Threading.h:
607         (WebCore::initializeThreading): Added - only needs Windows impl for now
608         * platform/win/ThreadingWin.cpp: Added.
609         (WebCore::callFunctionsOnMainThread): Calls each function currently in the main-thread queue
610         (WebCore::ThreadingWindowWndProc):
611         (WebCore::initializeThreading): Creates a message-only window to use for callOnMainThread()
612         (WebCore::callOnMainThread): Queues the function to be called and posts a message to the threading
613           window such that the function-call-queue can be addressed
614         
615         * platform/win/TemporaryLinkStubs.cpp:
616         (WebCore::signedPublicKeyAndChallengeString):
617         
618 2007-09-14  Anders Carlsson  <andersca@apple.com>
619
620         Reviewed by Adam.
621
622         <rdar://problem/5316743>
623         Safari does not handle filename parameter of content-disposition
624         
625         Use CFURLResponseCopySuggestedFilename instead of our own hand-rolled implementation. 
626         
627         While we do return the correct filename in all cases I've tried, using CFNetwork is better because
628         it might handle corner cases that we don't.
629         
630         * platform/network/cf/ResourceResponseCFNet.cpp:
631         (WebCore::ResourceResponse::doUpdateResourceResponse):
632         
633 2007-09-14  Geoffrey Garen  <ggaren@apple.com>
634
635         Reviewed by Adam Roben.
636
637         Fixed http://bugs.webkit.org/show_bug.cgi?id=15209
638         Sometimes removing an iframe from the DOM does not remove its frame 
639         from the page
640
641         * loader/FrameLoader.cpp:
642         (WebCore::FrameLoader::requestFrame): Use the contentFrame pointer
643         directly instead of searching for a frame by the frame element's name, 
644         because the frame element's name may have changed. (Another reason to do
645         this is that it's just plain more straight-forward and efficient.)
646
647 2007-09-14  Darin Adler  <darin@apple.com>
648
649         Reviewed by Mitz and Kevin Decker.
650
651         - fix http://bugs.webkit.org/show_bug.cgi?id=15197
652           <rdar://problem/5478271> REGRESSION: Some Yahoo text entry fields
653           render as lines rather than text entry boxes
654
655         Test: fast/forms/textarea-rows-cols.html
656
657         * html/HTMLTextAreaElement.cpp:
658         (WebCore::HTMLTextAreaElement::HTMLTextAreaElement): Use constants for the default number
659         of rows and columns.
660         (WebCore::HTMLTextAreaElement::parseMappedAttribute): If rows/cols attribute has a value
661         that's missing, non-numeric, or zero, then use the default value. Also check for the
662         case where the effective value of the attribute isn't changing.
663
664 2007-09-14  Sven Herzberg  <sven@imendio.com>
665
666         Reviewed by George.
667
668         Don't maintain obsolete code, fixes:
669         http://bugs.webkit.org/show_bug.cgi?id=15215
670
671         * platform/gdk/FontPlatformData.cpp: remove static
672         FontPlatformData::list() (isn't used at any place)
673
674 2007-09-14  Sven Herzberg  <sven@imendio.com>
675
676         Reviewed by Adam Roben.
677
678         Don't use fontconfig types if necessary, fixes:
679         http://bugs.webkit.org/show_bug.cgi?id=15203
680
681         * platform/gdk/FontPlatformData.cpp: don't use an FcBool to store the
682         initialized state, use a plain c++ bool instead
683
684 2007-09-13  Brady Eidson  <beidson@apple.com>
685
686         Reviewed by Maciej
687
688         <rdar://problem/5480437> - No site icon at launch and related error messages
689
690         The error message was actually indicative of a larger bug that might've resulted in icons getting
691         improperly pruned because they were never added to the set of retained page URLs.
692
693         To solve the no-icon-at-launch problem, we send the "didReceiveIcon:" delegate call for every page 
694         load that has an icon, whether the icon comes in from network, from disk, or was already in ram
695
696         * loader/FrameLoader.cpp:
697         (WebCore::FrameLoader::startIconLoader): Always send the didReceiveIcon delegate call when an icon's 
698           image data is known
699
700         * loader/icon/IconDatabase.cpp:
701         (WebCore::IconDatabase::retainIconForPageURL): Much more accurately track the set of retained pages by
702           adding them when their retain count moves from 0 to 1
703
704         * loader/icon/PageURLRecord.h:
705         (WebCore::PageURLRecord::retain): Correctly distinguish the "retain count just went from 0 to 1" case
706           in the return value
707
708 2007-09-13  Brady Eidson  <beidson@apple.com>
709
710         Rubberstamped by Geoff and Maciej
711
712         Fix MSVC build warning due to out of range data in a char array
713
714         * loader/icon/IconDatabase.cpp:
715         (WebCore::IconDatabase::defaultIcon): The buffer is now unsigned data
716
717         * platform/SharedBuffer.cpp:
718         (WebCore::SharedBuffer::SharedBuffer): Add the "unsigned char*" c'tor
719         * platform/SharedBuffer.h:
720
721 2007-09-13  Darin Adler  <darin@apple.com>
722
723         Reviewed by Oliver.
724
725         - fix <rdar://problem/5470457> REGRESSION: Input method inline hole is mishandled in text
726           <input> elements with maxlength limit
727
728         * editing/Editor.h: Moved MarkedTextUnderline here and renamed it CompositionUnderline.
729         Moved the rest of the marked text API here and used the term that will be more familiar
730         to those on platforms other than Macintosh, "composition". This helps prevent confusion
731         with the other kinds of mark -- the emacs "mark" and spelling/grammar marks. Also
732         cleaned up the conditionals a bit for the Macintosh-specific parts of this header.
733
734         * editing/Editor.cpp:
735         (WebCore::Editor::Editor): Updated for name change.
736         (WebCore::Editor::clear): Added. To be called by FrameLoader::clear().
737         (WebCore::Editor::insertTextWithoutSendingTextEvent): Removed code to make inserted
738         text replace the marked text range -- we now deal with this explicitly by not
739         calling this function to replace marked text. Also removed unneeded code that was
740         specific to the use of this to replace the marked text.
741         (WebCore::Editor::selectComposition): Renamed from selectMarkedText. Updated since
742         the composition range is not stored as a Range.
743         (WebCore::Editor::confirmComposition): Added. To be called when changing a composition
744         into actual text. Unlike the old code path, deletes the composition first, then inserts
745         the text, triggering the normal insertion code path and events. This is helpful because
746         it means the inserted text will be truncated by the <input> element, for example.
747         (WebCore::Editor::confirmCompositionWithoutDisturbingSelection): Added.
748         (WebCore::Editor::setComposition): Added. To be called when changing the composition.
749         Takes parameters for the underlines and selection. Unlike the old code path, this passes
750         a flag down that indicates the inserted text is part of a composition. This is helpful
751         because we don't send the event that will cause the <input> element to do truncation.
752         It's also a better API for future improvements to our input method handling.
753         (WebCore::Editor::revealSelectionAfterEditingOperation): Updated for name change.
754         (WebCore::Editor::setIgnoreCompositionSelectionChange): Ditto.
755         (WebCore::Editor::compositionRange): Added. Needed now that the composition is not
756         stored as a Range.
757         (WebCore::Editor::getCompositionSelection): Added.
758
759         * editing/TypingCommand.h:
760         * editing/TypingCommand.cpp: (WebCore::TypingCommand::insertText):
761         Added an insertedTextIsComposition parameter, and don't send the BeforeTextInsertedEvent
762         if it's true.
763
764         * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Replaced the Macintosh-specific
765         call to setMarkedTextRange with a call to the new Editor::clear().
766
767         * page/Frame.h:
768         * page/Frame.cpp:
769         * page/FramePrivate.h:
770         * page/mac/FrameMac.mm:
771         Removed the marked text code. It was streamlined and moved to Editor, except for the
772         Mac-specific code, which was moved into WebKit.
773
774         * page/mac/WebCoreFrameBridge.h:
775         * page/mac/WebCoreFrameBridge.mm: Removed some now-unneeded marked text code.
776         (-[WebCoreFrameBridge markedTextNSRange]): Updated for name/API change.
777
778         * rendering/InlineTextBox.h:
779         * rendering/InlineTextBox.cpp:
780         (WebCore::InlineTextBox::paint): Updated marked text code for name changes, and also
781         streamlined the code a bit for the case where there is no composition.
782         (WebCore::InlineTextBox::paintCompositionBackground): Name change.
783         (WebCore::InlineTextBox::paintCompositionUnderline): Ditto.
784
785         * rendering/RenderTextControl.h:
786         * rendering/RenderTextControl.cpp:
787         (WebCore::RenderTextControl::finishText): Added. Helper function shared by the
788         (WebCore::RenderTextControl::text):
789         (WebCore::getNextSoftBreak):
790         (WebCore::RenderTextControl::textWithHardLineBreaks):
791
792         * platform/CharacterNames.h: Added newlineCharacter.
793
794         * dom/Range.h: Remove the now-unneeded version of toString that converts <br>
795         elements into newlines.
796         * dom/Range.cpp:
797         (WebCore::Range::toString): Changed this to use a Vector<UChar> instead of
798         a String so it will not have pathological reallocation performance, and removed
799         the <br> feature.
800         (WebCore::Range::pastEndNode): Made this return 0 when there is no start node.
801         This bit of extra robustness guarantees you can't do a null dereference if the
802         start node is 0 and the end node is not. Not sure this case really exists.
803
804         * page/ContextMenuController.cpp: (ContextMenuController::contextMenuItemSelected):
805         Removed a semi-bogus use of Range::toString(true). The right function to use here
806         is plainText().
807
808         * bridge/EditorClient.h: Removed obsolete markedTextAbandoned function.
809
810         * WebCore.exp: Updated for above changes. 
811
812 2007-09-13  Anders Carlsson  <andersca@apple.com>
813
814         Reviewed by Adam and Geoff.
815
816         <rdar://problem/5304000>
817         Windows Safari doesn't always call NPP_SetWindow() for NPAPI plugins.
818         
819         This does two things:
820         
821         1. Makes sure that the plug-in get the correct initial size.
822         
823         2. Always updates the size of the HWND, even if the widget size didn't change. This is because
824         the widget size can be different before the HWND has been created.
825         
826         * plugins/win/PluginDatabaseWin.cpp:
827         (WebCore::PluginDatabaseWin::createPluginView):
828         * plugins/win/PluginDatabaseWin.h:
829         * plugins/win/PluginViewWin.cpp:
830         (WebCore::PluginViewWin::setFrameGeometry):
831         (WebCore::PluginViewWin::PluginViewWin):
832         * plugins/win/PluginViewWin.h:
833
834 2007-09-13  Kevin McCullough  <kmccullough@apple.com>
835
836         Reviewed by Geof, Sam, Adam, Hyatt, Darin.
837
838         - <rdar://problem/5480234> JS setTimeout function requires a second argument
839         - Removed check for number of arguments in setTimeout to behave like other browsers.
840         - Added layoutTest setTimeout-no-arguments.html
841
842         * bindings/js/kjs_window.cpp:
843         (KJS::WindowFunc::callAsFunction):
844
845 2007-09-13   Dave Hyatt  <hyatt@apple.com>
846
847         Some minor Windows font improvements before I make the larger changes.
848         
849         Reviewed by aroben, weinig
850
851         * platform/win/FontCacheWin.cpp:
852         (WebCore::FontCache::getFontDataForCharacters):
853         Don't use the currently selected font in the HDC when passing priority code pages to MLANG.  Make
854         sure to use ACP code pages instead so that there won't be any confusion regarding traditional vs.
855         simplified chinese, etc.
856
857         * platform/win/FontDataWin.cpp:
858         (WebCore::FontData::containsCharacters):
859         Rewrite containsCharacters so that it isn't glyph-dependent (since CG doesn't shape, this call is
860         rejecting fonts that it shouldn't).  Re-implement this method in terms of MLang and use code page
861         testing.
862         
863         * platform/win/UniscribeController.cpp:
864         (WebCore::UniscribeController::itemizeShapeAndPlace):
865         Add some comments to explain the additional item in the items array.
866        
867         (WebCore::UniscribeController::shape):
868         Fix up the missing glyph check when doing uniscribe shaping.  Only wgDefault matters as far as doing
869         font fallback.
870         
871 2007-09-13  kuchhal  <kuchhal@yahoo.com>
872
873         Reviewed, tweaked and landed by Anders.
874
875         <rdar://problem/5461153> 
876         http://bugs.webkit.org/show_bug.cgi?id=15143
877         Crash seen on Windows
878         
879         Null check frame before calling Frame::settings.
880         
881         * loader/PluginDocument.cpp:
882         (WebCore::PluginTokenizer::writeRawData):
883
884 2007-09-12  Holger Hans Peter Freyther  <zecke@selfish.org>
885
886         Reviewed by Mark.
887
888         Implement the FileChooser for the WebKit/Gtk+ port by using
889         the GtkFileChooserDialog and g_path_get_basename to get the
890         basename for the current filename.
891
892
893         * WebCore.pro:
894         * platform/gdk/FileChooserGdk.cpp: Added.
895         (WebCore::FileChooser::FileChooser):
896         (WebCore::FileChooser::~FileChooser):
897         (WebCore::FileChooser::openFileChooser):
898         (WebCore::FileChooser::basenameForWidth):
899         * platform/gdk/TemporaryLinkStubs.cpp:
900
901 2007-09-12  Holger Hans Peter Freyther  <zecke@selfish.org>
902
903         Reviewed by Mark.
904
905         Move the "string" functions from the TemporaryLinkStubs.cpp
906         to LocalizedStringsGdk.cpp and implement them using the text
907         from the win port and glib-i18n (gettext).
908
909         * platform/gdk/LocalizedStringsGdk.cpp: Added.
910         (WebCore::submitButtonDefaultLabel):
911         (WebCore::inputElementAltText):
912         (WebCore::resetButtonDefaultLabel):
913         (WebCore::searchableIndexIntroduction):
914         (WebCore::fileButtonChooseFileLabel):
915         (WebCore::fileButtonNoFileSelectedLabel):
916         (WebCore::contextMenuItemTagOpenLinkInNewWindow):
917         (WebCore::contextMenuItemTagDownloadLinkToDisk):
918         (WebCore::contextMenuItemTagCopyLinkToClipboard):
919         (WebCore::contextMenuItemTagOpenImageInNewWindow):
920         (WebCore::contextMenuItemTagDownloadImageToDisk):
921         (WebCore::contextMenuItemTagCopyImageToClipboard):
922         (WebCore::contextMenuItemTagOpenFrameInNewWindow):
923         (WebCore::contextMenuItemTagCopy):
924         (WebCore::contextMenuItemTagGoBack):
925         (WebCore::contextMenuItemTagGoForward):
926         (WebCore::contextMenuItemTagStop):
927         (WebCore::contextMenuItemTagReload):
928         (WebCore::contextMenuItemTagCut):
929         (WebCore::contextMenuItemTagPaste):
930         (WebCore::contextMenuItemTagNoGuessesFound):
931         (WebCore::contextMenuItemTagIgnoreSpelling):
932         (WebCore::contextMenuItemTagLearnSpelling):
933         (WebCore::contextMenuItemTagSearchWeb):
934         (WebCore::contextMenuItemTagLookUpInDictionary):
935         (WebCore::contextMenuItemTagOpenLink):
936         (WebCore::contextMenuItemTagIgnoreGrammar):
937         (WebCore::contextMenuItemTagSpellingMenu):
938         (WebCore::contextMenuItemTagShowSpellingPanel):
939         (WebCore::contextMenuItemTagCheckSpelling):
940         (WebCore::contextMenuItemTagCheckSpellingWhileTyping):
941         (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
942         (WebCore::contextMenuItemTagFontMenu):
943         (WebCore::contextMenuItemTagBold):
944         (WebCore::contextMenuItemTagItalic):
945         (WebCore::contextMenuItemTagUnderline):
946         (WebCore::contextMenuItemTagOutline):
947         (WebCore::contextMenuItemTagWritingDirectionMenu):
948         (WebCore::contextMenuItemTagDefaultDirection):
949         (WebCore::contextMenuItemTagLeftToRight):
950         (WebCore::contextMenuItemTagRightToLeft):
951         (WebCore::contextMenuItemTagInspectElement):
952         (WebCore::searchMenuNoRecentSearchesText):
953         (WebCore::searchMenuRecentSearchesText):
954         (WebCore::searchMenuClearRecentSearchesText):
955         (WebCore::unknownFileSizeText):
956         * platform/gdk/TemporaryLinkStubs.cpp:
957
958 2007-09-10  Holger Hans Peter Freyther  <zecke@selfish.org>
959
960         Reviewed by Mark.
961
962         EventHandlerGdk::createDraggingClipboard must succeed otherwise an
963         ASSERT is hit. Add Clipboard stubs for the Gdk/Gtk+ port and
964         instantiate ClipboardGdk from the EventHandlerGdk to make the ASSERT
965         go away. In contrast to the Windows and Mac port this clipboard is not
966         inheriting CachedResourceClient. This was proposed by Oliver.
967
968         * WebCore.pro:
969         * page/gdk/EventHandlerGdk.cpp:
970         * platform/gdk/ClipboardGdk.cpp: Added.
971         (WebCore::ClipboardGdk::ClipboardGdk):
972         (WebCore::ClipboardGdk::~ClipboardGdk):
973         (WebCore::ClipboardGdk::clearData):
974         (WebCore::ClipboardGdk::clearAllData):
975         (WebCore::ClipboardGdk::getData):
976         (WebCore::ClipboardGdk::setData):
977         (WebCore::ClipboardGdk::types):
978         (WebCore::ClipboardGdk::dragLocation):
979         (WebCore::ClipboardGdk::dragImage):
980         (WebCore::ClipboardGdk::setDragImage):
981         (WebCore::ClipboardGdk::dragImageElement):
982         (WebCore::ClipboardGdk::setDragImageElement):
983         (WebCore::ClipboardGdk::createDragImage):
984         (WebCore::ClipboardGdk::declareAndWriteDragImage):
985         (WebCore::ClipboardGdk::writeURL):
986         (WebCore::ClipboardGdk::writeRange):
987         (WebCore::ClipboardGdk::hasData):
988         * platform/gdk/ClipboardGdk.h: Added.
989
990 2007-09-12  Oliver Hunt  <oliver@apple.com>
991
992         Reviewed by Adam.
993
994         Corrections missed in previous revision
995
996         * platform/Cursor.h:
997         * platform/win/CursorWin.cpp:
998         (WebCore::loadCursorByName):
999
1000 2007-09-12  Oliver Hunt  <oliver@apple.com>
1001
1002         Reviewed by Adam.
1003
1004         Fixing 
1005             <rdar://problem/5018591> Windows doesn't have a standard vertical text cursor
1006             <rdar://problem/5224996> Add zoom in and zoom out cursors
1007
1008         Added SharedCursor for CursorWin so we can correctly track lifetime of custom/image
1009         based cursors, such as the vertical text and zooming cursors.
1010
1011         * platform/Cursor.h:
1012         (WebCore::SharedCursor::SharedCursor):
1013         (WebCore::SharedCursor::~SharedCursor):
1014         (WebCore::SharedCursor::nativeCursor):
1015         * platform/win/CursorWin.cpp:
1016         (WebCore::Cursor::Cursor):
1017         (WebCore::loadCursorByName):
1018         (WebCore::loadSharedCursor):
1019         (WebCore::pointerCursor):
1020         (WebCore::crossCursor):
1021         (WebCore::handCursor):
1022         (WebCore::iBeamCursor):
1023         (WebCore::waitCursor):
1024         (WebCore::helpCursor):
1025         (WebCore::eastResizeCursor):
1026         (WebCore::northResizeCursor):
1027         (WebCore::northEastResizeCursor):
1028         (WebCore::northWestResizeCursor):
1029         (WebCore::southResizeCursor):
1030         (WebCore::southEastResizeCursor):
1031         (WebCore::southWestResizeCursor):
1032         (WebCore::westResizeCursor):
1033         (WebCore::northSouthResizeCursor):
1034         (WebCore::eastWestResizeCursor):
1035         (WebCore::northEastSouthWestResizeCursor):
1036         (WebCore::northWestSouthEastResizeCursor):
1037         (WebCore::columnResizeCursor):
1038         (WebCore::rowResizeCursor):
1039         (WebCore::moveCursor):
1040         (WebCore::verticalTextCursor):
1041         (WebCore::progressCursor):
1042         (WebCore::notAllowedCursor):
1043         (WebCore::zoomInCursor):
1044         (WebCore::zoomOutCursor):
1045         * platform/win/WidgetWin.cpp:
1046         (WebCore::Widget::setCursor):
1047
1048 2007-09-12  Brady Eidson  <beidson@apple.com>
1049
1050         Reviewed by Geoff Garen
1051
1052         <rdar://problem/5478577> - Further improve cold launch time with Icon Database changes
1053
1054         * loader/icon/IconDatabase.cpp:
1055         (WebCore::IconDatabase::open): Store the directory and full path for later usage and access in the API, respectively
1056           Move the makeAllDirectories() call to the background thread.
1057         (WebCore::IconDatabase::IconDatabase): Don't set up the timer here...
1058         (WebCore::IconDatabase::scheduleOrDeferSyncTimer): Create the timer on demand
1059         (WebCore::IconDatabase::iconDatabaseSyncThread): makeAllDirectories() here where it's not as expensive
1060         (WebCore::IconDatabase::cleanupSyncThread): Cleanup the directory as well as full path
1061
1062         * loader/icon/IconDatabase.h: m_syncTimer becomes an OwnPtr, and we add the database directory
1063           as a member to set it on the main thread and act with it on the background thread
1064
1065 2007-09-12  Justin Garcia  <justin.garcia@apple.com>
1066
1067         Reviewed by Tristan.
1068
1069         <rdar://problem/5469868> 
1070         GoogleDocs: A hang occurs when applying list styling to a selection in a <table>
1071         
1072         When list insertion moves selected paragraphs into list items, it relies on 
1073         the selection preservation code inside moveParagraphs to iterate over the 
1074         selected paragraphs.  If a selection is ever restored incorrectly (before
1075         the original, or inside the original) list insertion will go into an infinite loop.
1076         
1077         In this hang, a table was selected and the selection preservation code incorrectly
1078         restored a selection, placing it inside the table.
1079         
1080         The bug was that a TextIterator, when being used for selection preservation, must
1081         emit a character between every VisiblePosition in the Range used to create the
1082         iterator.
1083         
1084         * editing/TextIterator.cpp:
1085         (WebCore::TextIterator::TextIterator): Renamed the boolean that we use for 
1086         selection preservation.  It used to be m_emitForReplacedElements because
1087         we believed that replaced elements were the only case where TextIterators
1088         should have emitted differently when used for selection preservation.
1089         (WebCore::TextIterator::handleReplacedElement): Ditto.
1090         (WebCore::TextIterator::shouldRepresentNodeOffsetZero): Represent the 
1091         position before block tables, but only if we are emitting for selection 
1092         preservation.
1093         (WebCore::TextIterator::shouldEmitSpaceBeforeAndAfterNode): We should emit 
1094         a space before and after block tables if we are emitting for selection 
1095         preservation (because we have VisiblePositions before and after them).
1096         (WebCore::TextIterator::handleNonTextNode): Use a renamed variable.
1097         * editing/TextIterator.h: Made shouldEmitSpaceBeforeAndAfterNode a member
1098         function, because whether or not we emit spaces before and after a block
1099         table depends we're emitting for selection preservation.
1100
1101 2007-09-12  Beth Dakin  <bdakin@apple.com>
1102
1103         Reviewed by Hyatt.
1104
1105         Fix for <rdar://problem/5464998> REGRESSION (9A543): Using Sort 
1106         options takes you back to search screen on zappos.com
1107
1108         The current mechanism for preserving form elements across removes 
1109         did not work in the case where the input was moved by the parser to 
1110         be out of scope of the form. This fixes that problem by having the 
1111         parser keep track of the preserve boolean rather than the current 
1112         form element.
1113
1114         * dom/Tokenizer.h:
1115         (WebCore::Tokenizer::isHTMLTokenizer): New function.
1116         * html/HTMLFormElement.cpp:
1117         (WebCore::HTMLFormElement::HTMLFormElement): Get rid of 
1118         m_preserveAcrossRemove.
1119         * html/HTMLFormElement.h:
1120         (WebCore::HTMLFormElement::isMalformed): Get rid of 
1121         m_preserveAcrossRemove.
1122         * html/HTMLGenericFormElement.cpp:
1123         (WebCore::HTMLGenericFormElement::removedFromTree): Ask the parser 
1124         if it is currently handling residual style rather than asking the 
1125         form if it wants to preserveAcrossRemove.
1126         * html/HTMLParser.cpp:
1127         (WebCore::HTMLParser::HTMLParser): New boolean to initialize.
1128         (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): Set 
1129         m_handlingResidualStyleAcrossBlocks to true at the beginning and 
1130         false at the end.
1131         * html/HTMLParser.h:
1132         (WebCore::HTMLParser::isHandlingResidualStyleAcrossBlocks):
1133         * html/HTMLTokenizer.h:
1134         (WebCore::HTMLTokenizer::isHTMLTokenizer):
1135         (WebCore::HTMLTokenizer::htmlParser):
1136
1137 2007-09-12  George Staikos  <staikos@kde.org>
1138
1139         Fix compilation in some configurations for patch I reviewed and missed
1140         this option on.
1141
1142         * platform/qt/CursorQt.cpp:
1143         (WebCore::Cursor::Cursor):
1144
1145 2007-09-12  Brady Eidson  <beidson@apple.com>
1146
1147         Reviewed by Tim Hatcher and Kevin Decker
1148
1149         <rdar://problem/5367045> - Launch time regression due to accessing resource from a different bundle
1150
1151         When the default icon was moved from WebKit to WebCore, we had to access an entirely new bundle on launch which
1152         measurably increased time during launch accessing the disk.
1153
1154         Instead of moving it back to the WebKit bundle, lets make launch time even faster by compiling in the icon.
1155
1156         * Resources/urlIcon.tiff: Removed.
1157
1158         * WebCore.xcodeproj/project.pbxproj: Removed urlIcon.tiff
1159
1160         * loader/icon/IconDatabase.cpp:
1161         (WebCore::IconDatabase::defaultIcon): Compile in the icon data here.
1162
1163 2007-09-12  Adam Roben  <aroben@apple.com>
1164
1165         Always specify that slider thumbs are small when painting with SafariTheme
1166
1167         This is the only size we support.
1168
1169         Reviewed by Sam.
1170
1171         * rendering/RenderThemeSafari.cpp:
1172         (WebCore::RenderThemeSafari::paintSliderThumb):
1173
1174 2007-09-12  Brady Eidson  <beidson@apple.com>
1175
1176         Reviewed by Darin
1177
1178         <rdar://problem/5474753> - ASSERT in IconDatabase ReadySQLStatement
1179
1180         * loader/icon/IconDatabase.cpp:
1181         (WebCore::readySQLStatement): This is a LOG_ERROR situation, not really an ASSERT situation
1182
1183 2007-09-12  Adam Roben  <aroben@apple.com>
1184
1185         Don't ask SafariTheme to draw focus rings around text controls
1186
1187         We do this ourselves.
1188
1189         Reviewed by Oliver.
1190
1191         * rendering/RenderThemeSafari.cpp:
1192
1193 2007-09-11  Brady Eidson  <beidson@apple.com>
1194
1195         Reviewed by Darin
1196
1197         <rdar://problem/5475639> and http://bugs.webkit.org/show_bug.cgi?id=15185 -
1198         Prevent two WebKits from fighting over the database schema in the future in case it ever changes again
1199
1200         By telling the "older schema" WebKit to simply close itself and not bother to do any icon related stuff
1201         if the database schema is newer, we prevent the possibility of an older webkit run side-by-side with a newer
1202         WebKit causing icon database issues.
1203
1204         * loader/icon/IconDatabase.cpp:
1205         (WebCore::IconDatabase::defaultDatabaseFilename): Rev the icon database filename to be "WebpageIcons.db"  The name is
1206           more appropriate for what is actually stored in the file, and since we're already not converting v5 to v6 icons, 
1207           making this leap now makes sense and gives us a good "future-proof" baseline
1208         (WebCore::isValidDatabase): Change the validity check to be "less then" instead of "not equal to" - the
1209           "greater than" case is now handled in performOpenInitialization()
1210         (WebCore::IconDatabase::performOpenInitialization): If the schema version is greater than the current, then
1211           close the database as to not conflict with the newer version.  Also noted that the integrity check failure 
1212           should actually close the sql database, not the icondatabase
1213         (WebCore::IconDatabase::syncThreadMainLoop): If termination has already been requested, skip straight to cleanup
1214         (WebCore::IconDatabase::cleanupSyncThread): More correctly set the "sync thread running" flag to false here,
1215           as the thread can now decide to exit on its own
1216
1217 2007-09-12  Mike Fenton <mike@staikos.net>
1218
1219         Reviewed by George Staikos.
1220
1221         Patch from Mike Fenton to allow custom cursors.
1222
1223         * platform/qt/CursorQt.cpp:
1224
1225 2007-09-11  Kevin Decker <kdecker@apple.com>
1226
1227         Reviewed by Oliver Hunt.
1228
1229         Fixed: <rdar://problem/5472402> crash due to infinite recursion in expandUseElementsInShadowTree on SVG from wikipedia
1230
1231         * ksvg2/svg/SVGUseElement.cpp: Added SVG_EXPERIMENTAL #ifdef for expandUseElementsInShadowTree().
1232         (WebCore::SVGUseElement::buildPendingResource): Ditto.
1233         (WebCore::SVGUseElement::associateInstancesWithShadowTreeElements): Tweaked an ASSERT to not fire on non-experimental builds.
1234         * ksvg2/svg/SVGUseElement.h: Added SVG_EXPERIMENTAL #ifdef for expandUseElementsInShadowTree().
1235
1236 2007-09-11  Brady Eidson  <beidson@apple.com>
1237
1238         Reviewed by Maciej
1239
1240         Fix for <rdar://problem/5473046> - Crash when resetting all icons
1241
1242         Originally I'd written the "reset all icons" to be synchronous on the main thread, but it
1243         was decided that it should be async since it involved I/O.  Turns out it needs to be... both!
1244         Synchronous removal of all in-memory records of icons, and then continue and clean up the 
1245         on-disk database on the background thread.
1246
1247         Also, it turns out that resetting all the page url retain counts should *not* be part of 
1248         "reset all icons" because it breaks various contracts the API makes about maintaining retain counts.
1249
1250         The problem that occured here was removing all the icons, then all the history items that were 
1251         removed as part of "Reset Safari..." would try to release their icon, but their icon doesn't exist
1252         anymore.
1253
1254         We get around this by simply leaving the in-memory page url records and retain counts alone - they
1255         are still wiped from disk.
1256
1257         * loader/icon/IconDatabase.cpp:
1258         (WebCore::IconDatabase::removeAllIcons): Clear in-memory records of all icons then tell the thread to
1259           wipe the on-disk tables
1260         (WebCore::IconDatabase::removeAllIconsOnThread): Only do the disk cleanup - in-memory maintenance is
1261           handled on the main thread
1262         (WebCore::IconDatabase::cleanupSyncThread): Now that it's possible for new "icons to be written to disk"
1263           to appear while on-disk deleting is occuring, let the cleanup procedure perform 1 final write *after*
1264           it does the remove all icons
1265         * loader/icon/IconDatabase.h: Removed unused lock and condition
1266
1267         * loader/icon/PageURLRecord.cpp:
1268         (WebCore::PageURLRecord::setIconRecord): Allow setting a NULL icon record, so a PageURLRecord can be
1269           cleared as part of removeAllIcons()
1270
1271 2007-09-11  Tristan O'Tierney  <tristan@apple.com>
1272
1273         Reviewed by David Harrison.
1274         
1275         <rdar://problem/5467203> CrashTracer: [USER] 1 crash in Mail at <unknown binary>: WebCore::Range::startContainer const
1276
1277         * editing/SelectionController.cpp:
1278         (WebCore::SelectionController::addRange):
1279         (WebCore::SelectionController::setSelectedRange):
1280         Added a check to make sure the passed in Range* value is not null
1281         before performing operations on it.
1282
1283 2007-09-11  Justin Garcia  <justin.garcia@apple.com>
1284
1285         Reviewed by Maciej.
1286         
1287         <rdar://problem/5458246> 
1288         GoogleDocs: A hang occurs when applying list styling to selection that contains a <HR>
1289         
1290         List insertion moves selected paragraphs into list items, and relies on the selection
1291         preservation code inside moveParagraphs to iterate over the selected paragraphs.
1292         When list insertion would try to listify a paragraph that came after a list item 
1293         containing an <hr>, the selection preservation code would set an incorrect ending 
1294         selection because of a TextIterator bug, and we would try to listify the same 
1295         paragraph over and over.
1296         
1297         * editing/CompositeEditCommand.cpp:
1298         (WebCore::CompositeEditCommand::moveParagraphs): Pass range compliant equivalents to
1299         the Range constructor here.  The position [hr, 0] is not a valid DOM Range endpoint 
1300         for example.
1301         * editing/TextIterator.cpp:
1302         (WebCore::shouldEmitSpaceForNode): Added.
1303         (WebCore::TextIterator::handleNonTextNode): Emit a space to represent a horizontal rule,
1304         since it has VisiblePositions before and after it, but only for TextIterators used for
1305         selection preservation, so innerText will be unaffected.
1306
1307 2007-09-11  Ada Chan  <adachan@apple.com>
1308
1309         <rdar://problem/5472130> Support NTLM authentication via CFNetwork.
1310
1311         Reviewed by Darin.
1312
1313         * platform/network/ProtectionSpace.h:
1314         (WebCore::):
1315         * platform/network/cf/AuthenticationCF.cpp:
1316         (WebCore::createCF):
1317         (WebCore::core):
1318
1319 2007-09-11  Darin Adler  <darin@apple.com>
1320
1321         Rubber-stamped by Dave Harrison.
1322
1323         - fixed pasteboard types here to match WebKit and use constants instead of
1324           WebKitSystemInterface
1325
1326         * platform/mac/PasteboardMac.mm: Use constants for all pasteboard type strings.
1327
1328         * platform/mac/WebCoreSystemInterface.h: Removed wkCreateURLPasteboardFlavorTypeName
1329         and wkCreateURLNPasteboardFlavorTypeName.
1330
1331 2007-09-11  Sven Herzberg  <sven@imendio.com>
1332
1333         Reviewed by Mark.
1334
1335         Remove unnecessary fields in FontPlatformData
1336         http://bugs.webkit.org/show_bug.cgi?id=15177
1337
1338         * platform/gdk/FontDataGdk.cpp: removed the destroy code of the fields
1339         that have been removed
1340         * platform/gdk/FontPlatformData.h: removed m_fontFace, m_fontMatrix
1341         and m_options; hask on m_scaledFont
1342         * platform/gdk/FontPlatformDataGdk.cpp: simplified setFont() by using
1343         m_scaledFont only; turned the former struct members into local
1344         variables
1345
1346 2007-09-11  George Staikos  <staikos@kde.org>
1347
1348         Reviewed by Anders.
1349
1350         Work around gcc bug with some old gcc versions.
1351
1352         * platform/qt/WidgetQt.cpp:
1353         (WebCore::Widget::convertToContainingWindow):
1354         (WebCore::Widget::convertFromContainingWindow):
1355
1356 2007-09-10  Mitz Pettel  <mitz@webkit.org>
1357
1358         Reviewed by Maciej Stachowiak.
1359
1360         - fix http://bugs.webkit.org/show_bug.cgi?id=15157
1361           Image defined in background-position: top center gets unexpectedly truncated
1362           <rdar://problem/5469095>
1363
1364         Test: fast/repaint/body-background-image.html
1365
1366         * rendering/RenderBox.cpp:
1367         (WebCore::RenderBox::imageChanged): Refined the logic for when the root takes
1368         over painting the background, to match paintBoxDecorations(). In particular,
1369         if the root has defined a background, the body should paint its own background.
1370
1371 2007-09-10  David Harrison  <harrison@apple.com>
1372
1373         Reviewed by Kevin and Tristan.
1374
1375         Tests added:
1376         * editing/pasteboard/paste-into-anchor-text.html: Added.
1377         * editing/pasteboard/paste-table-cells.html: Added.
1378
1379         Source changes:
1380         * editing/CompositeEditCommand.cpp:
1381         (WebCore::CompositeEditCommand::positionAvoidingSpecialElementBoundary):
1382         Nil check enclosingAnchor.
1383         
1384         * editing/ReplaceSelectionCommand.cpp:
1385         (WebCore::ReplaceSelectionCommand::removeNodeAndPruneAncestors):
1386         New. Keeps m_firstNodeInserted and m_lastLeafInserted updated.
1387         
1388         (WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance):
1389         Added a comment.
1390         
1391         (WebCore::ReplaceSelectionCommand::removeRedundantStyles):
1392         Let ReplaceSelectionCommand::removeNodeAndPruneAncestors() update the nodes.
1393          
1394         (WebCore::ReplaceSelectionCommand::doApply):
1395         Pass originalVisPosBeforeEndBR to shouldRemoveEndBR()
1396         
1397         (WebCore::ReplaceSelectionCommand::shouldRemoveEndBR):
1398         Don't remove the br if nothing was inserted.
1399         
1400         * editing/ReplaceSelectionCommand.h:
1401         Add VisiblePosition parameter to shouldRemoveEndBR()
1402         
1403         * editing/markup.cpp:
1404         (WebCore::createMarkup):
1405         Wrap orphan tr element with a table element, just like we were doing
1406         for tobody elements.
1407
1408 2007-09-10  David Kilzer  <ddkilzer@apple.com>
1409
1410         Rubberstamped by Kevin Decker.
1411
1412         No test required since there is no change in functionality.
1413
1414         * history/BackForwardList.cpp:
1415         (WebCore::BackForwardList::BackForwardList): Fix misspelling of DefaultCapacitiy to DefaultCapacity.
1416
1417 2007-09-10  Mitz Pettel  <mitz@webkit.org>
1418
1419         Reviewed by Adele Peterson.
1420
1421         - fix http://bugs.webkit.org/show_bug.cgi?id=15156
1422           REGRESSION (r24594-r24668): The bottom of styled <select> button text is clipped out
1423           <rdar://problem/5464301>
1424
1425         Test: fast/forms/menulist-clip.html
1426
1427         * rendering/RenderMenuList.cpp:
1428         (WebCore::RenderMenuList::controlClipRect): Use correct coordinates for
1429         the inner block's content rect.
1430
1431 2007-09-10  Brady Eidson  <beidson@apple.com>
1432
1433         Reviewed by Darin, Sam, Oliver, Geoff, probably others - what a fun one to review!
1434
1435         <rdar://problem/5471641> - URLs get the wrong icon
1436
1437         Turns out sqlite3_reset() doesn't clear bindings, so previously bound icons were being
1438         written out for pages without icons.  Easy fix!
1439
1440         * loader/icon/IconDatabase.cpp:
1441         (WebCore::IconDatabase::writeIconSnapshotToSQLDatabase): For null icons, manually
1442           bind NULL - otherwise, the previously bound icon will be written out to disk
1443
1444         * loader/icon/SQLStatement.cpp:
1445         (WebCore::SQLStatement::bindNull): Access to sqlite3_bind_null
1446         * loader/icon/SQLStatement.h:
1447
1448 2007-09-10  Anders Carlsson  <andersca@apple.com>
1449
1450         Reviewed by Oliver and Darin.
1451
1452         <rdar://problem/5468613>
1453         Using shockwave pages first time after plugin install crashed safari in PluginPing.
1454         
1455         Only restore the window proc if the plugin didn't override it.
1456         
1457         * plugins/win/PluginViewWin.cpp:
1458         (WebCore::PluginViewWin::stop):
1459
1460 2007-09-10  Justin Garcia  <justin.garcia@apple.com>
1461
1462         Reviewed by Darin.
1463
1464         <rdar://problem/5467405> 
1465         Revert back behavior of -webkit-user-select to fix widget selection problems
1466         
1467         Rolled out r25086 and r25057.  I will be re-opening:
1468         <rdar://problem/5333725> -webkit-user-select: none makes selection difficult
1469         Which we will either to defer or fix by introducing a new value of -webkit-user-select.
1470         <rdar://problem/5370059> REGRESSION: Cannot type into edit fields on a form (sccsheriff.org)
1471         Which we will either defer or fix with Adele's patch that doesn't involve making 
1472         -webkit-user-select inherited.
1473
1474         * css/CSSComputedStyleDeclaration.cpp:
1475         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
1476         * css/CSSStyleSelector.cpp:
1477         (WebCore::CSSStyleSelector::adjustRenderStyle):
1478         (WebCore::CSSStyleSelector::applyProperty):
1479         * editing/SelectionController.cpp:
1480         (WebCore::SelectionController::selectAll):
1481         * page/EventHandler.cpp:
1482         (WebCore::EventHandler::selectClosestWordFromMouseEvent):
1483         (WebCore::EventHandler::handleMousePressEventTripleClick):
1484         (WebCore::EventHandler::handleMousePressEventSingleClick):
1485         (WebCore::EventHandler::updateSelectionForMouseDrag):
1486         (WebCore::EventHandler::selectCursor):
1487         (WebCore::EventHandler::canMouseDownStartSelect):
1488         * page/EventHandler.h:
1489         * rendering/RenderObject.cpp:
1490         (WebCore::selectStartNode):
1491         (WebCore::RenderObject::canSelect):
1492         (WebCore::RenderObject::shouldSelect):
1493         (WebCore::RenderObject::draggableNode):
1494         * rendering/RenderObject.h:
1495         * rendering/RenderStyle.cpp:
1496         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1497         (WebCore::StyleRareNonInheritedData::operator==):
1498         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1499         (WebCore::StyleRareInheritedData::operator==):
1500         (WebCore::RenderStyle::diff):
1501         * rendering/RenderStyle.h:
1502         (WebCore::):
1503         (WebCore::RenderStyle::userSelect):
1504         (WebCore::RenderStyle::setUserSelect):
1505         (WebCore::RenderStyle::initialUserSelect):
1506
1507 2007-09-10  Antti Koivisto  <antti@apple.com>
1508
1509         Reviewed by Kevin.
1510
1511         Fix <rdar://problem/5444866>
1512         REGRESSION: missing text in Acrobat "Getting Started" screen due to change in load ordering of large resources
1513         
1514         Make external scripts loaded using file: wait until all style sheet loads have completed before executing. 
1515         Fixes a class of problems where there is a dependency between script and stylesheet and results would effectively 
1516         get randomized based on which order the resources arrived. In Tiger file loads were effectively serialized by
1517         lower level components, which is why this regressed. 
1518
1519         Test: http/tests/local/stylesheet-and-script-load-order.html
1520
1521         * dom/Document.cpp:
1522         (WebCore::Document::removePendingSheet):
1523         * dom/Tokenizer.h:
1524         (WebCore::Tokenizer::executeScriptsWaitingForStylesheets):
1525         * html/HTMLTokenizer.cpp:
1526         (WebCore::HTMLTokenizer::HTMLTokenizer):
1527         (WebCore::HTMLTokenizer::begin):
1528         (WebCore::HTMLTokenizer::executeScriptsWaitingForStylesheets):
1529         (WebCore::HTMLTokenizer::notifyFinished):
1530         * html/HTMLTokenizer.h:
1531
1532 2007-09-08  David Smith  <catfish.man@gmail.com>
1533
1534         Reviewed by Maciej Stachowiak.
1535         
1536         http://bugs.webkit.org/show_bug.cgi?id=15148
1537         Bug 15148: Poor performance on crazy DOM raytracer
1538         
1539         Switch data structures to avoid quadratic behavior.
1540
1541         * rendering/RenderBlock.cpp:
1542         (WebCore::RenderBlock::layoutPositionedObjects): Update for ListHashSet
1543         (WebCore::RenderBlock::markPositionedObjectsForLayout): Update for ListHashSet
1544         (WebCore::RenderBlock::insertPositionedObject): Use ListHashSet to avoid expensive uniqueing
1545         (WebCore::RenderBlock::removePositionedObject): Update for ListHashSet
1546         (WebCore::RenderBlock::removePositionedObjects): Update for ListHashSet
1547         (WebCore::RenderBlock::lowestPosition): Update for ListHashSet
1548         (WebCore::RenderBlock::rightmostPosition): Update for ListHashSet
1549         (WebCore::RenderBlock::leftmostPosition): Update for ListHashSet
1550         (WebCore::RenderBlock::rightBottom): Update for ListHashSet
1551         * rendering/RenderBlock.h: Change m_positionedObjects from DeprecatedPtrList to ListHashSet
1552
1553 2007-09-09  Brady Eidson <beidson@apple.com>
1554
1555         Rubberstamped by Darin
1556
1557         pthread_main_np() is a Darwin thing, not a Mac thing
1558
1559         * loader/icon/IconDatabase.cpp:
1560         (WebCore::IconDatabase::IconDatabase):
1561
1562 2007-09-09  Holger Hans Peter Freyther  <zecke@selfish.org>
1563
1564         Build fix for Gtk+ by adding WebCore::callOnMainThread to the TemporaryLinkStubs.
1565
1566         * platform/gdk/TemporaryLinkStubs.cpp:
1567         (WebCore::callOnMainThread):
1568
1569 2007-09-08  George Staikos  <staikos@kde.org>
1570
1571         Reviewed by Olliej.
1572
1573         Separate out and implement FileSystem functions,  and stub out the
1574         icondatabase function for future implementation.
1575
1576         * WebCore.pro:
1577         * platform/qt/FileSystemQt.cpp: Added.
1578         (WebCore::fileExists):
1579         (WebCore::deleteFile):
1580         * platform/qt/TemporaryLinkStubs.cpp:
1581         * platform/qt/ThreadingQt.cpp: Added.
1582         (WebCore::callOnMainThread):
1583
1584 2007-09-08  Mark Rowe  <mrowe@apple.com>
1585
1586         Build fix for when ENABLE(ICONDATABASE) is not set.
1587
1588         * loader/icon/IconDatabaseNone.cpp:
1589         (WebCore::IconDatabase::~IconDatabase):
1590
1591 2007-09-08  Mark Rowe  <mrowe@apple.com>
1592
1593         More fixes for the Qt and Gtk builds.
1594
1595         * WebCore.pro: Update for file changes.
1596         * loader/icon/IconDatabase.cpp: Include errno.h for EDEADLK.
1597         * loader/icon/PageURLRecord.h:
1598
1599 2007-09-08  Justin Garcia  <justin.garcia@apple.com>
1600
1601         Backing my change back in without the changes to VisiblePosition::next 
1602         and previous that weren't necessary to fix the bug and were causing some
1603         layout test failures.  Most of the failures appeared to be fixes but I
1604         want more time to investigate and have to move to on to another task.
1605
1606         * editing/Selection.cpp:
1607         (WebCore::Selection::validate):
1608         * editing/visible_units.cpp:
1609         (WebCore::endOfWord):
1610
1611 2007-09-08  Brady Eidson  <beidson@apple.com>
1612
1613         Reviewed by Mark Rowe
1614
1615         Fix the _NSAutoreleaseNoPool() errors on launch - We were using NSFileManager on the secondary
1616         thread with no NSAutoreleasePool in place
1617
1618         * loader/icon/IconDatabase.cpp:
1619         (WebCore::IconDatabase::iconDatabaseSyncThread):
1620
1621 2007-09-08  Sam Weinig  <sam@webkit.org>
1622
1623         Add fix to the correct file.
1624
1625         * loader/icon/SQLDatabase.h:
1626         * loader/icon/SQLStatement.h:
1627
1628 2007-09-08  Sam Weinig  <sam@webkit.org>
1629
1630         Fix Windows build.
1631
1632         * loader/icon/SQLStatement.h: Disable boolean conversion warning.
1633
1634 2007-09-08  Brady Eidson  <beidson@apple.com>
1635
1636         Build fix for non-Mac platforms that use Icon Database
1637
1638         * loader/icon/IconDatabase.cpp:
1639         (WebCore::IconDatabase::IconDatabase): Apparently only Mac has the beauty that is pthread_main_np()
1640
1641 2007-09-08  Mark Rowe  <mrowe@apple.com>
1642
1643         Build fix.
1644
1645         * WebCore.xcodeproj/project.pbxproj: Headers used up in WebKit need to be be "private" rather than "project".
1646
1647 2007-09-08  Brady Eidson  <beidson@apple.com>
1648
1649         Reviewed by Darin
1650
1651         <rdar://problem/5434431> - Asynchronous Icon Database
1652
1653         The IconDatabase API was originally designed to be fully asynchronous - if an icon wasn't read in from disk
1654         when you asked for it, you would be notified when it was.
1655
1656         Safari 2 did writes on a background thread, but reads blocked the main thread.
1657
1658         The current WebCore implementation using SQLite attempted to get rid of the background thread by defering expensive 
1659         writes via timers, but falls short in moderate to extreme usage cases
1660
1661         Time to make the IconDatabase live up to it's fully asynchronous destiny.
1662
1663         This should -
1664         - Make the browser instantly usable while converting Safari 2 icons in the background occurs
1665         - Remedy any UI slowness/blocking when on slow network home directories
1666         - Remedy random UI slowness, pauses, and stutters do to random I/O occurring at the exact wrong time or under heavy
1667           disk usage from swapping or other apps on the system
1668         - Allow certain long-running procedures to be interruptible (Safari 2 import, reading icons in from disk when trying to quit, etc)
1669
1670         This will have a noticeable effect on current Safari 2 and Safari 3 beta browsers, including icons not appearing in bookmarks, history,
1671         or the location field the first time they're asked for, as current released Safari's don't properly listen for these async notifations.  
1672         The second time such a menu or view is brought up, the icon should be there.
1673
1674         Additionally this includes a SQLite schema change which will be a lot more efficient but will result in the loss of current SQLite icons.
1675         Converting from Safari 2 style icons will still work.
1676
1677         WebCore, welcome to multi-threadedness
1678
1679         * WebCore.exp:
1680         * WebCore.xcodeproj/project.pbxproj:
1681         * WebCore.vcproj/WebCore.vcproj:
1682
1683         * loader/DocumentLoader.cpp:
1684         (WebCore::DocumentLoader::iconLoadDecisionAvailable): Called when an Icon becomes available that was requested by this 
1685           DocumentLoader (to support the webView:didReceiveIcon: delegate call in WebKit)
1686         * loader/DocumentLoader.h:
1687
1688         * loader/FrameLoader.cpp:
1689         (WebCore::FrameLoader::iconLoadDecisionAvailable): Called from the DocumentLoaders who get notified - if the FrameLoader 
1690           ends up not caring because the WebView has transitioned to a new page, nothing occurs.  Otherwise, the FrameLoader possibly
1691           starts it Icon Loader and possibly sends the webView:didReceiveIcon: delegate call
1692         (WebCore::FrameLoader::startIconLoader): Instead of "Yes, load the icon now" or "No, don't load it" there is a third possibility -
1693           "You might be asked to load your icon later."  Add supporting logic for receiving this state, and being called a second time
1694           when the load decision is finally available.
1695         * loader/FrameLoader.h:
1696
1697         * loader/FrameLoaderClient.h: Added "registerForIconNotification" which is a way to tell WebViews "The icon you are interested in might
1698           become available via the generic WebIconDatabaseDidAddIconNotification instead of a targeted delegate call"
1699           A WebView can then receive the generic notification and pass on it's own targeted delegate call.
1700
1701         * loader/icon/IconDataCache.cpp: Removed.
1702         * loader/icon/IconDataCache.h: Removed.
1703
1704         * loader/icon/IconDatabase.cpp:
1705         (WebCore::urlForLogging): Cut a URL down in length for sane logging and debugging
1706         (WebCore::defaultClient): Return the default, empty IconDatabaseClient incase the API doesn't set one.
1707
1708         Following block of methods are for the Main thread's usage -
1709         (WebCore::IconDatabase::setClient):
1710         (WebCore::makeAllDirectories): Small optimization that checks to see if the entire path exists already, and doesn't try to loop
1711           through each patch component if the full path is already present
1712         (WebCore::IconDatabase::open): Makes all directories to the target path and kicks off the background thread - nothing more.
1713         (WebCore::IconDatabase::close): Signals the thread to quit and waits for it to do so
1714         (WebCore::IconDatabase::removeAllIcons): Purge the icon database
1715         (WebCore::IconDatabase::iconForPageURL):
1716         (WebCore::IconDatabase::readIconForPageURLFromDisk):
1717         (WebCore::IconDatabase::iconURLForPageURL):
1718         (WebCore::IconDatabase::defaultIcon):
1719         (WebCore::IconDatabase::retainIconForPageURL):
1720         (WebCore::IconDatabase::releaseIconForPageURL):
1721         (WebCore::IconDatabase::setIconDataForIconURL):
1722         (WebCore::IconDatabase::setIconURLForPageURL):
1723         (WebCore::IconDatabase::loadDecisionForIconURL): Determine if an icon loader should load now.  If the decision is "maybe later", then
1724           mark the DocumentLoader to be notified later when the final decision is available.
1725         (WebCore::IconDatabase::iconDataKnownForIconURL): Determine if the actual image data has been read from disk (or set from the loader) for 
1726           icon URL in question
1727         (WebCore::IconDatabase::setEnabled):
1728         (WebCore::IconDatabase::isEnabled):
1729         (WebCore::IconDatabase::setPrivateBrowsingEnabled):
1730         (WebCore::IconDatabase::isPrivateBrowsingEnabled):
1731         (WebCore::IconDatabase::delayDatabaseCleanup): Restore this method from a year ago, as asynchronous pruning of icons can now occur on a 
1732           background thread.
1733         (WebCore::IconDatabase::allowDatabaseCleanup):
1734         (WebCore::IconDatabase::checkIntegrityBeforeOpening):
1735         (WebCore::IconDatabase::pageURLMappingCount):
1736         (WebCore::IconDatabase::retainedPageURLCount):
1737         (WebCore::IconDatabase::iconRecordCount):
1738         (WebCore::IconDatabase::iconRecordCountWithData):
1739         (WebCore::IconDatabase::IconDatabase):
1740         (WebCore::IconDatabase::~IconDatabase):
1741         (WebCore::IconDatabase::notifyPendingLoadDecisions): Tell all the registered DocumentLoaders "Hey, we've read in all URL mappings from disk,
1742           so check to see if you are interested in any of them"
1743         (WebCore::IconDatabase::notifyPendingLoadDecisionsInternal):
1744         (WebCore::IconDatabase::wakeSyncThread): Wake the sync thread, if it is idle
1745         (WebCore::IconDatabase::scheduleOrDeferSyncTimer): Even though we're on a background thread, we still defer writing out to disk during
1746           periods of high activity
1747         (WebCore::IconDatabase::syncTimerFired): Call wakeSyncThread()
1748
1749         Following block of methods may be used by either thread -
1750         (WebCore::IconDatabase::isOpen):
1751         (WebCore::IconDatabase::databasePath):
1752         (WebCore::IconDatabase::defaultDatabaseFilename):
1753         (WebCore::IconDatabase::getOrCreateIconRecord):
1754         (WebCore::IconDatabase::getOrCreatePageURLRecord):
1755
1756         Following block of methods are used by the secondary thread only -
1757         (WebCore::IconDatabase::importIconURLForPageURL): For the Safari 2 import procedure - write a URL mapping directly out to disk
1758         (WebCore::IconDatabase::importIconDataForIconURL): For the Safari 2 import procedure - write an Icon directly out to disk
1759         (WebCore::IconDatabase::shouldStopThreadActivity): To check and see if the thread should stop what it is doing now to do something
1760           more important (such as quit, or delete all icons)
1761         (WebCore::IconDatabase::iconDatabaseSyncThreadStart):
1762         (WebCore::IconDatabase::iconDatabaseSyncThread): Entry point for the background thread
1763         (WebCore::databaseVersionNumber):
1764         (WebCore::isValidDatabase):
1765         (WebCore::createDatabaseTables):
1766         (WebCore::IconDatabase::performOpenInitialization): Open and validate the SQLite database, making sure it's schema jives with what
1767           is expected
1768         (WebCore::IconDatabase::checkIntegrity):
1769         (WebCore::IconDatabase::performURLImport): Import all the Page URL -> Icon URL mappings from the database.  Done "1st thing" on startup,
1770           this is necessary to be able to give the loader decisions about whether or not it should load icons from the network
1771         (WebCore::IconDatabase::syncThreadMainLoop): Main loop - sleeps until woken up, then does a read cycle and a write cycle until both cycles
1772           do no work - then it goes back to sleep.
1773         (WebCore::IconDatabase::readFromDatabase): Reads icons from the database that clients are waiting on
1774         (WebCore::IconDatabase::writeToDatabase): Writes any changes page -> icon url mappings to disk, as well as any new image data that has 
1775           been received from the loader
1776         (WebCore::IconDatabase::pruneUnretainedIcons): Done only once, and only after the first write to the database, this procedure removes all
1777           icons and page URLs from disk that haven't been retained by any client.  Note that the prune can be delayed by utilizing delayDatabaseCleanup()
1778         (WebCore::IconDatabase::checkForDanglingPageURLs): Usually part of the prune procedure, prunes any pages who point to icons that no longer exist 
1779           in the database
1780         (WebCore::IconDatabase::removeAllIconsOnThread): Completely purge both the on-disk and in memory records of all icons
1781         (WebCore::IconDatabase::deleteAllPreparedStatements): Part of removeAllIcons and the thread cleanup procedure
1782         (WebCore::IconDatabase::cleanupSyncThread): Write out any last remaining writes to disk, close the database, and then end the thread
1783         (WebCore::IconDatabase::imported): Checks the DB to see if the Safari 2 import has occured
1784         (WebCore::IconDatabase::setImported): Sets the "Safari 2 imported" flag
1785         (WebCore::readySQLStatement):
1786         (WebCore::IconDatabase::setIconURLForPageURLInSQLDatabase): This and the following "SQLDatabase" suffixed methods are pretty self explanatory
1787         (WebCore::IconDatabase::setIconIDForPageURLInSQLDatabase):
1788         (WebCore::IconDatabase::removePageURLFromSQLDatabase):
1789         (WebCore::IconDatabase::getIconIDForIconURLFromSQLDatabase):
1790         (WebCore::IconDatabase::addIconURLToSQLDatabase):
1791         (WebCore::IconDatabase::getImageDataForIconURLFromSQLDatabase):
1792         (WebCore::IconDatabase::removeIconFromSQLDatabase):
1793         (WebCore::IconDatabase::writeIconSnapshotToSQLDatabase):
1794         * loader/icon/IconDatabase.h:
1795
1796         * loader/icon/IconDatabaseClient.h: Added.
1797         (WebCore::IconDatabaseClient::~IconDatabaseClient):
1798         (WebCore::IconDatabaseClient::performImport): Perform the Safari 2 import, implemented by WebKit
1799         (WebCore::IconDatabaseClient::dispatchDidRemoveAllIcons): Send the API notification
1800         (WebCore::IconDatabaseClient::dispatchDidAddIconForPageURL): Ditto
1801
1802         * loader/icon/IconDatabaseNone.cpp: Best attempt to keep non icon-DB platforms building
1803         (WebCore::IconDatabase::defaultDatabaseFilename):
1804         (WebCore::IconDatabase::readIconForPageURLFromDisk):
1805         (WebCore::IconDatabase::loadDecisionForIconURL):
1806         (WebCore::IconDatabase::iconDataKnownForIconURL):
1807         (WebCore::IconDatabase::setIconURLForPageURL):
1808         (WebCore::IconDatabase::isEnabled):
1809         (WebCore::IconDatabase::delayDatabaseCleanup):
1810         (WebCore::IconDatabase::allowDatabaseCleanup):
1811         (WebCore::IconDatabase::setClient):
1812
1813         * loader/icon/IconRecord.cpp: Added.
1814         (WebCore::IconRecord::IconRecord): IconRecord used to be "IconDataCache" - it is merely a container for the url, timestamp, and image for a site icon.
1815           It is Shared, and therefore ref counted - PageURLRecords are the owning containers.  This is a tricky way to track how many page urls are retaining 
1816           an IconRecord and therefore tracking when we should try to get rid of one.
1817         (WebCore::IconRecord::~IconRecord):
1818         (WebCore::IconRecord::image):
1819         (WebCore::IconRecord::setImageData):
1820         (WebCore::IconRecord::loadImageFromResource):
1821         (WebCore::IconRecord::imageDataStatus): Return whether the image data hasn't been read yet, exists in memory, or is absent (site with no icon)
1822         (WebCore::IconRecord::snapshot): Returns a snapshot of the icon's data - url, timestamp, and image data - to be written to disk
1823         * loader/icon/IconRecord.h: Added.
1824         (WebCore::IconSnapshot::IconSnapshot):
1825         (WebCore::IconRecord::getTimestamp):
1826         (WebCore::IconRecord::setTimestamp):
1827         (WebCore::IconRecord::iconURL):
1828         (WebCore::IconRecord::retainingPageURLs):
1829
1830         * loader/icon/PageURLRecord.cpp: Added.
1831         (WebCore::PageURLRecord::PageURLRecord): PageURLRecord is fundamentally a pairing of a Page URL to an Icon.  It has manual ref counting for the sake
1832           of "retainIconForPageURL" and "releaseIconForPageURL", and can provide a quick snapshot of it's Page URL -> Icon URL mapping for writing to
1833           the database
1834         (WebCore::PageURLRecord::setIconRecord):
1835         (WebCore::PageURLRecord::snapshot):
1836         * loader/icon/PageURLRecord.h: Added.
1837         (WebCore::PageURLSnapshot::PageURLSnapshot):
1838         (WebCore::PageURLRecord::url):
1839         (WebCore::PageURLRecord::PageURLRecord::iconRecord):
1840         (WebCore::PageURLRecord::retain):
1841         (WebCore::PageURLRecord::release):
1842         (WebCore::PageURLRecord::retainCount):
1843
1844         * platform/SharedBuffer.cpp:
1845         (WebCore::SharedBuffer::copy): Added a deep copy method for the purposes of handing icon data across the thread boundary into the icon database
1846         * platform/SharedBuffer.h:
1847
1848         * platform/graphics/svg/SVGImageEmptyClients.h:
1849         (WebCore::SVGEmptyFrameLoaderClient::registerForIconNotification):
1850
1851         * platform/win/TemporaryLinkStubs.cpp:
1852         (WebCore::callOnMainThread): Only other IconDatabase utilizing platform - keep their build going
1853
1854 2007-09-07  David Kilzer  <ddkilzer@apple.com>
1855
1856         Reviewed by Timothy Hatcher.
1857
1858         Housekeeping.  No test required.
1859
1860         * bindings/objc/WebScriptObjectInternal.h: Removed unused file.
1861         * bindings/objc/WebScriptObjectPrivate.h: Updated copyright statement.
1862
1863 2007-09-07  Justin Garcia  <justin.garcia@apple.com>
1864         
1865         Rolling out my changes from r25421 while I investigate the layout test failures
1866         they caused.
1867         
1868         * editing/Selection.cpp:
1869         (WebCore::Selection::validate):
1870         * editing/VisiblePosition.cpp:
1871         (WebCore::VisiblePosition::next):
1872         (WebCore::VisiblePosition::previous):
1873         (WebCore::VisiblePosition::lastEditablePositionAtOrBefore):
1874         (WebCore::VisiblePosition::firstEditablePositionAtOrAfter):
1875         * editing/VisiblePosition.h:
1876         * editing/visible_units.cpp:
1877         (WebCore::endOfWord):
1878         (WebCore::previousWordPosition):
1879         (WebCore::nextWordPosition):
1880         (WebCore::startOfLine):
1881         (WebCore::endOfLine):
1882         (WebCore::previousSentencePosition):
1883         (WebCore::nextSentencePosition):
1884
1885 2007-09-05  Geoffrey Garen  <ggaren@apple.com>
1886
1887         Reviewed by Darin Adler, Maciej Stachowiak, Mark Rowe, Tim Hatcher.
1888         
1889         Fixed <rdar://problem/5326009> Make non-browser WebKit clients have no 
1890         memory cache, or a very tiny one
1891
1892         Added a client callback to notify WebKit when the first navigation has
1893         taken place. "Navigation" here means a transition from one page to 
1894         another that ends up in the back/forward list.
1895         
1896         WebKit Mac uses this notification to grow its cache model under certain
1897         circumstances.
1898         
1899         * loader/FrameLoader.cpp:
1900         (WebCore::FrameLoader::addBackForwardItemClippedAtTarget):
1901         * loader/FrameLoaderClient.h:
1902
1903         * platform/graphics/svg/SVGImageEmptyClients.h:
1904         (WebCore::SVGEmptyFrameLoaderClient::didPerformFirstNavigation): Ah, 
1905         SVGEmptyFrameLoaderClient, my old friend. 
1906
1907 2007-09-07  Adele Peterson  <adele@apple.com>
1908
1909         Reviewed by Dave Harrison.
1910
1911         Fix for <rdar://problem/5428427> Wrong characters are re-converted after doing reconversion with Kotoeri
1912
1913         Revert change for<rdar://problem/5279521> and add nil checks for the result of TextIterator::rangeFromLocationAndLength
1914         TextIterator::exitNode shouldn't require the m_lastTextNode to be true, but we can't change that without making the logic in _web_attributedStringFromRange match.
1915         We'll get that for free when we switch to use TextIterator in _web_attributedStringFromRange.
1916
1917         * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::applyBlockStyle): Added nil checks.
1918         * editing/IndentOutdentCommand.cpp: (WebCore::IndentOutdentCommand::indentRegion): ditto.
1919         * editing/TextIterator.cpp: (WebCore::TextIterator::exitNode): Re-added check for m_lastTextNode before emitting newline.
1920
1921 2007-09-07  Ada Chan  <adachan@apple.com>
1922
1923         <rdar://problem/5395928> Need to be able to handle context menu item selection by index
1924         
1925         Reviewed by Beth.
1926
1927         * platform/ContextMenu.h: Added method to retrieve context menu item by index
1928         * platform/win/ContextMenuWin.cpp:
1929         (WebCore::ContextMenu::ContextMenu): call setPlatformDescription() since that will handle
1930         adding the MNS_NOTIFYBYPOS style to the context menu.
1931         (WebCore::contextMenuItemByIdOrPosition): helper method so we don't have to duplicate code
1932         between itemWithAction() and itemAtIndex().
1933         (WebCore::ContextMenu::itemWithAction):
1934         (WebCore::ContextMenu::itemAtIndex):
1935         (WebCore::ContextMenu::setPlatformDescription): add MNS_NOTIFYBYPOS style to the context menu
1936         so we will get notified by menu position through WM_MENUCOMMAND when the item is selected.
1937
1938 2007-09-07  Justin Garcia  <justin.garcia@apple.com>
1939
1940         Reviewed by Darin.
1941         
1942         <rdar://problem/5057506> Double-clicking after ToDo content doesn't select the paragraph break
1943         
1944         * editing/Selection.cpp:
1945         (WebCore::Selection::validate):
1946         Moved the code that moves across a paragraph boundary
1947         when expanding selections by word granularity from
1948         endOfWord to here.
1949         In the word and paragraph granularity cases, if the 
1950         end of the selection is at the end of the last paragraph 
1951         in the last cell of a block table, expand it so that 
1952         it ends at the start of the paragraph after the table, 
1953         instead of just after the table, so that ToDo content 
1954         gets the same double/tripled click behavior that normal 
1955         paragraphs get (added two testcases).
1956         When expanding the selection to include paragraph
1957         breaks, pass VisiblePosition::next true so that it
1958         doesn't change editability.
1959         * editing/VisiblePosition.cpp:
1960         (WebCore::VisiblePosition::next): Renamed the bool because it's now also
1961         used to keep non-editable positions non-editable.
1962         (WebCore::VisiblePosition::previous): Ditto.
1963         (WebCore::VisiblePosition::lastPositionWithSameEditabilityAtOrBefore):
1964         Renamed this function and made it also work with non-editable positions.
1965         (WebCore::VisiblePosition::firstPositionWithSameEditabilityAtOrAfter):
1966         Ditto.
1967         * editing/VisiblePosition.h:
1968         * editing/visible_units.cpp:
1969         (WebCore::endOfWord): Called the renamed function.
1970         (WebCore::previousWordPosition): Ditto.
1971         (WebCore::nextWordPosition): Ditto.
1972         (WebCore::startOfLine): Ditto.
1973         (WebCore::endOfLine): Ditto.
1974         (WebCore::previousSentencePosition): Ditto.
1975         (WebCore::nextSentencePosition): Ditto.
1976
1977 2007-09-07  Brady Eidson  <beidson@apple.com>
1978
1979         Reviewed by Sam
1980
1981         <rdar://problem/5089241> - ASSERT and other funky effects in IconLoader with large 404 pages
1982
1983         There were two problems:
1984         1 - I originally didn't expect SubresourceLoader to keep pulling in data after it received a 404 response,
1985             but if the server sends back a complex 404 page, the loader did just that.  That could result in the 
1986             IconLoader "finishing" twice
1987         2 - In this case, the long messy 404 page would be committed to the database as image data.  This would 
1988             result in wasted space on disk, wasted space in RAM, and wasting processor time trying to parse 50k+
1989             of HTML as image data
1990
1991         Fix is two parts - 1, monitor the "m_loadIsInProgress" flag and 2, make ::finishLoading() take an actual 
1992         SharedBuffer argument that is what should be committed to the database so the ResourceHandle is unnecessary
1993
1994         * loader/icon/IconLoader.cpp:
1995         (WebCore::IconLoader::didReceiveResponse): If the response is not valid, commit null data 
1996         (WebCore::IconLoader::didFail): If we've already finished loading once (the 404 response), don't
1997           finish again!
1998         (WebCore::IconLoader::didFinishLoading): Ditto
1999         (WebCore::IconLoader::finishLoading): Take a SharedBuffer argumnt as the actual data to commit
2000         * loader/icon/IconLoader.h: Add a SharedBuffer arg to ::finishLoading()
2001
2002 2007-09-07  Brady Eidson  <beidson@apple.com>
2003
2004         Reviewed by Darin
2005
2006         Inline the in-header definitions for non-Mac platforms
2007
2008         * platform/AutodrainedPool.h:
2009         (WebCore::AutodrainedPool::AutodrainedPool):
2010         (WebCore::AutodrainedPool::~AutodrainedPool):
2011         (WebCore::AutodrainedPool::cycle):
2012
2013 2007-09-07  Brady Eidson  <beidson@apple.com>
2014
2015         Reviewed by Darin
2016
2017         Add some AutoreleasePool and Threading utilities in preparation for the multi-threaded
2018         fix for <rdar://problem/5434431>
2019
2020         AutodrainedPool wraps an NSAutoreleasePool and tracks a "cycle" count.  This allows clients
2021         in WebCore to simply call ::cycle() and after a preset number of iterations the pool will drain
2022         and recreate the underlying NSAutoreleasePool
2023    
2024         Threading utilities include C++ wrappers for pthread mutexes and conditions, as well as a generic
2025         "callOnMainThread()" function for any non-main thread to use.
2026
2027         * platform/AutodrainedPool.h: Added.  
2028         (WebCore::AutodrainedPool::AutodrainedPool): Empty implementations for all non-mac platforms
2029         (WebCore::AutodrainedPool::~AutodrainedPool): ditto
2030         (WebCore::AutodrainedPool::cycle): ditto
2031         * platform/mac/AutodrainedPool.mm: Added.
2032         (WebCore::AutodrainedPool::AutodrainedPool): 
2033         (WebCore::AutodrainedPool::~AutodrainedPool):
2034         (WebCore::AutodrainedPool::cycle): Keep track of number of cycles, and drain/recreate the pool if the
2035           cycle limit is hit
2036
2037         * platform/Threading.h: Added.
2038         (WebCore::Mutex::Mutex): C++ wrapper for pthread_mutex
2039         (WebCore::Mutex::~Mutex):
2040         (WebCore::Mutex::lock):
2041         (WebCore::Mutex::tryLock):
2042         (WebCore::Mutex::unlock):
2043         (WebCore::MutexLocker::MutexLocker): Handles automatically locking/unlocking a Mutex (for early returns
2044           from a function, for example)
2045         (WebCore::MutexLocker::~MutexLocker):
2046         (WebCore::ThreadCondition::ThreadCondition): C++ wrapper for pthread_condition
2047         (WebCore::ThreadCondition::~ThreadCondition):
2048         (WebCore::ThreadCondition::wait):
2049         (WebCore::ThreadCondition::signal):
2050         (WebCore::ThreadCondition::broadcast):
2051         * platform/mac/Threading.mm: Added.
2052         (-[WebCoreFunctionWrapper initWithFunction:]): Obj-C implementation of "callOnMainThread"
2053         (-[WebCoreFunctionWrapper _call]):
2054         (WebCore::callOnMainThread):
2055
2056 2007-09-07  George Staikos  <staikos@kde.org>
2057
2058         Fix typo.
2059
2060         * loader/ProgressTracker.h:
2061         (WebCore::ProgressTracker::totalPageAndResourceBytesToLoad):
2062
2063 2007-09-07  Qing Zhao  <qing@staikos.net>
2064
2065         Reviewed by Anders and George.
2066
2067         Add accessors for these two variables.
2068
2069         * loader/ProgressTracker.h:
2070         (WebCore::ProgressTracker::totalPageAndResourseBytesToLoad):
2071         (WebCore::ProgressTracker::totalBytesReceived):
2072
2073 2007-09-06  Tristan O'Tierney  <tristan@apple.com>
2074
2075         Reviewed by Maciej Stachowiak.
2076         
2077         <rdar://problem/5333496> Back button stopped working on sfgate.com (14957)
2078         
2079         This fix is specifically targted to address sfgate.com and reuters.com with minimal
2080         impact to other areas of the frameloader.  It does not cause any regression tests to fail.
2081         I've added two layout tests: One to detect this particular bug, and one to address
2082         a secondary issue: if an iframe navigation occurs during onload by a timeout an
2083         additional history item is added, similarly to firefox.  We tried to match firefox
2084         more than IE with this fix but did gain a little bit of IE compatability.
2085
2086         Tests: http/tests/navigation/onload-navigation-iframe-timeout.html
2087                http/tests/navigation/onload-navigation-iframe.html
2088
2089         * dom/Document.h:
2090         (WebCore::Document::processingLoadEvent):
2091         Return the m_processingLoadEvent boolean so FrameLoader knows
2092         that the document is in the middle of calling <body onload>
2093         
2094         * html/HTMLFrameOwnerElement.cpp:
2095         (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement):
2096         * html/HTMLFrameOwnerElement.h:
2097         (WebCore::HTMLFrameOwnerElement::createdByParser):
2098         (WebCore::HTMLFrameOwnerElement::setCreatedByParser):
2099         Added support for a new member variable of frame elements: m_createdByParser.
2100         This lets us specifically target the fix to only iframes created via JS
2101         and not in-document.
2102         
2103         * loader/FrameLoader.cpp:
2104         (WebCore::FrameLoader::FrameLoader):
2105         Initialize m_navigationDuringLoad to false
2106         
2107         (WebCore::FrameLoader::provisionalLoadStarted):
2108         Determine if the load we're about to start is occuring during
2109         an onload.
2110         
2111         (WebCore::FrameLoader::updateHistoryForStandardLoad):
2112         If the current frameloader is for a child frame, and the navigation is occuring
2113         during an onload update the current history item rather than adding a new one.
2114         
2115         * loader/FrameLoader.h:
2116         Added a new member variable, m_navigationDuringLoad to track
2117         the navigation status during the on load, rather than trying to determine
2118         the status after (which is nearly impossible due to a new runloop spin).
2119
2120 2007-09-06  David Kilzer  <ddkilzer@apple.com>
2121
2122         Reviewed by Darin.
2123
2124         The implementation of BackForwardList::clearPageCache() was removed in r21793.
2125         It's now safe to remove it from the header.
2126
2127         * history/BackForwardList.h: Removed clearPageCache().
2128
2129 2007-09-06  Anders Carlsson  <andersca@apple.com>
2130
2131         Reviewed by Ada.
2132
2133         <rdar://problem/5457844>
2134         Crash when using mouse wheel with plug-ins disabled.
2135
2136         Null check the widget.
2137
2138         * page/EventHandler.cpp:
2139         (WebCore::EventHandler::handleWheelEvent):
2140
2141 2007-09-06  Anders Carlsson  <andersca@apple.com>
2142
2143         Reviewed by Mitz.
2144
2145         Small tweak.
2146         
2147         * plugins/win/PluginStreamWin.cpp:
2148         (WebCore::PluginStreamWin::startStream):
2149
2150 2007-09-06  Anders Carlsson  <andersca@apple.com>
2151
2152         Reviewed by Adam and Steve.
2153
2154         <rdar://problem/5459321>
2155         ADOBE: Safari 3 on Windows is passing bogus values in stream->headers in NPP_NewStream, causing Flash Player to crash.
2156         
2157         Serialize the headers into a stream and pass it to NPP_NewStream in stream->headers.
2158         
2159         * plugins/win/PluginStreamWin.cpp:
2160         (WebCore::PluginStreamWin::startStream):
2161         * plugins/win/PluginStreamWin.h:
2162
2163 2007-09-06  Darin Adler  <darin@apple.com>
2164
2165         Reviewed by Hyatt.
2166
2167         - fix http://bugs.webkit.org/show_bug.cgi?id=15153
2168           REGRESSION: Assertion failure in FrameView::scheduleRelayout() (m_frame->view() == this)
2169
2170         Back out the willRemove() part of the previous patch.
2171         It was incorrect and not needed to fix the bug anyway.
2172
2173         * dom/Document.cpp: (WebCore::Document::detach): Remove willRemove().
2174
2175         * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Put the willRemove() call
2176         back here where it was originally before the previous fix.
2177
2178         * history/CachedPage.cpp: (WebCore::CachedPage::clear):
2179         * page/Frame.cpp:
2180         (WebCore::Frame::setView):
2181         (WebCore::Frame::setDocument):
2182         Added FIXMEs about the fact that we call detach() on the document but not willRemove().
2183
2184 2007-09-05  Timothy Hatcher  <timothy@apple.com>
2185
2186         Reviewed by Darin.
2187
2188         Changed the blocked exception log message to match AppKit's blocked exception message.
2189
2190         * platform/mac/BlockExceptions.mm:
2191         (ReportBlockedObjCException):
2192
2193 2007-09-06  Darin Adler  <darin@apple.com>
2194
2195         Reviewed by Hyatt.
2196
2197         - <rdar://problem/5457865> REGRESSION (9A527): Safari crashes when opening a page
2198           that immediately redirects to a PDF
2199
2200         I don't know how to make an automated test that trips over this.
2201
2202         The immediate cause of this regression was making a back/forward list entry in
2203         this case. Earlier, the quick redirect would not results in a separate entry.
2204         That's possibly a bug too, but it's better to fix the crash first.
2205
2206         The page cache was putting the document into a strange state: Still attached but
2207         with the renderer set to 0. There was no good reason to do this, so got rid of it.
2208         Moved the responsibility to the caller of not calling detach() when moving into
2209         the page cache. This is more of a frame loader thing than a document thing.
2210
2211         * dom/Document.cpp: (WebCore::Document::detach): Added assertions that this is
2212         only called on a document that's attached and not in the page cache. Also moved
2213         the call to willRemove in here, so that callers can't make the mistake of not
2214         calling that function. Removed the incorrectly-positioned code that made this
2215         function do less if it was called on a document in the page cache.
2216
2217         * history/CachedPage.cpp: (WebCore::CachedPage::clear): Removed the code to handle
2218         a document with a renderer of 0. There was no need to put the document into this
2219         state. Any document in the page cache will always be "attached".
2220
2221         * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Added a check to prevent
2222         from calling an unnecessary cancelParsing() on a document that's in the page cache
2223         and guard the call to detach() with a check of attached(), like all other calls to
2224         detach() on DOM objects.
2225
2226         * page/Frame.cpp:
2227         (WebCore::Frame::setView): Added a missing check of attached(), like all other
2228         calls to detach() on DOM objects. Also added code to not call detach() on the
2229         document when it's in the page cache.
2230         (WebCore::Frame::setDocument): This call site already had the attached() check,
2231         but was missing the page cache check.
2232
2233 2007-09-05  David Harrison  <harrison@apple.com>
2234
2235         Reviewed by Darin.
2236
2237         Follow up on my fix for <rdar://problem/5306171>.
2238         My first patch (r25373) broke svg/custom/stroke-width-click.svg.
2239
2240         * editing/TextIterator.cpp:
2241         (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
2242         Add currPos.isNotNull() check because positions in non-html content (like svg)
2243         do not have visible positions, and we don't want to emit for them either.
2244
2245 2007-09-06  Mitz Pettel  <mitz@webkit.org>
2246
2247         Reviewed by Adam Roben.
2248
2249         - fix http://bugs.webkit.org/show_bug.cgi?id=14685
2250           <rdar://problem/5349755> text-align affects <select> button but not its drop-down menu
2251
2252         * platform/PlatformString.h:
2253         (WebCore::String::defaultWritingDirection):
2254         * platform/StringImpl.cpp:
2255         (WebCore::StringImpl::defaultWritingDirection): Moved textDirectionForParagraph()
2256         from RenderMenuList.cpp here.
2257         * platform/StringImpl.h:
2258         * platform/win/PopupMenuWin.cpp:
2259         (WebCore::PopupMenu::itemWritingDirectionIsNatural): Changed to return 'true'.
2260         (WebCore::PopupMenu::paint): Changed to use natural directionality for menu
2261         items.
2262         * rendering/RenderMenuList.cpp:
2263         (WebCore::RenderMenuList::adjustInnerStyle): Use defaultWritingDirection.
2264
2265 2007-09-06  Maciej Stachowiak  <mjs@apple.com>
2266
2267         Reviewed by Oliver Hunt.
2268
2269         - fixed <rdar://problem/5455457> REGRESSION (9A527-9A535): Colloquy crash on launch in WebCoreScriptDebugger initWithDelegate (with announce.js plug-in installed)
2270
2271         * page/mac/FrameMac.mm:
2272         (WebCore::Frame::windowScriptObject): Ensure that -[WebView
2273         windowScriptObject] and -[WebFrame windowObject] return null until
2274         the windowScriptObjectAvailable: delegate method is sent.
2275
2276 2007-09-05  David Harrison  <harrison@apple.com>
2277
2278         Reviewed by Kevin Decker.
2279
2280         <rdar://problem/5306171> Mail: The first return after an attachment in multipart/mixed message is lost
2281
2282         Test added: editing/selection/toString-1.html
2283         
2284         Source changes:
2285         * editing/TextIterator.cpp:
2286         (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
2287         - Remove outdated and erroneous check for m_lastTextNode.
2288         - Fix VisiblePosition check to look for line diff. Simple position diff gives the
2289         wrong answer when the start is table/0 and the current is the first position
2290         inside the content of the table.
2291
2292 2007-09-04  Marvin Decker  <marv.decker@gmail.com>
2293
2294         Reviewed by Maciej Stachowiak.
2295
2296         http://bugs.webkit.org/show_bug.cgi?id=15072
2297         Bug 15072: Fix ImageDecoder.cpp to not copy incoming data
2298
2299         Change ImageDecoder::setData to take a SharedBuffer*.
2300
2301         * platform/graphics/cairo/ImageSourceCairo.cpp:
2302         (WebCore::ImageSource::setData):
2303         * platform/image-decoders/ImageDecoder.h:
2304         (WebCore::RGBA32Buffer::bytes):
2305         (WebCore::RGBA32Buffer::height):
2306         (WebCore::ImageDecoder::setData):
2307         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2308         (WebCore::GIFImageDecoder::setData):
2309         (WebCore::GIFImageDecoder::frameCount):
2310         (WebCore::GIFImageDecoder::decode):
2311         (WebCore::GIFImageDecoder::decodingHalted):
2312         (WebCore::GIFImageDecoder::initFrameBuffer):
2313         * platform/image-decoders/gif/GIFImageDecoder.h:
2314         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2315         (WebCore::JPEGImageDecoder::setData):
2316         (WebCore::JPEGImageDecoder::decode):
2317         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2318         * platform/image-decoders/png/PNGImageDecoder.cpp:
2319         (WebCore::PNGImageDecoder::setData):
2320         (WebCore::PNGImageDecoder::decode):
2321         (WebCore::PNGImageDecoder::headerAvailable):
2322         (WebCore::PNGImageDecoder::rowAvailable):
2323         * platform/image-decoders/png/PNGImageDecoder.h:
2324
2325 2007-09-04  David Hyatt  <hyatt@apple.com>
2326
2327         Fix for <rdar://problem/5271213>, resizing iChat window is slower than in
2328         Tiger. This patch implements a fast scaling mode that can be used by
2329         WebViews, e.g., during window resizing.
2330
2331         Reviewed by John Sullivan
2332
2333         * WebCore.exp:
2334         * WebCore.xcodeproj/project.pbxproj:
2335         * page/Frame.cpp:
2336         (WebCore::FramePrivate::FramePrivate):
2337         * page/Page.cpp:
2338         (WebCore::Page::Page):
2339         (WebCore::Page::inLowQualityImageInterpolationMode):
2340         (WebCore::Page::setInLowQualityImageInterpolationMode):
2341         * page/Page.h:
2342         * platform/graphics/GraphicsContext.cpp:
2343         (WebCore::GraphicsContext::drawImage):
2344         * platform/graphics/GraphicsContext.h:
2345         (WebCore::GraphicsContext::setUseLowQualityImageInterpolation):
2346         (WebCore::GraphicsContext::useLowQualityImageInterpolation):
2347         * platform/graphics/cg/GraphicsContextCG.cpp:
2348         (WebCore::GraphicsContext::setUseLowQualityImageInterpolation):
2349         (WebCore::GraphicsContext::useLowQualityImageInterpolation):
2350         * rendering/RenderImage.cpp:
2351         (WebCore::RenderImage::paint):
2352
2353 2007-09-04  Brady Eidson  <beidson@apple.com>
2354
2355         Reviewed by Adam
2356
2357         Some SQLite tweaks for debugging
2358         -In debug builds, track the thread that opened the database and enforce that any statements
2359          that operate on the SQLDatabase do so from the thread that opened it
2360         -Track whether or not a transaction is in progress for the SQLDatabase to find cases where
2361          someone opens a new transaction while there is still one outstanding (a SQLite logic error)
2362
2363         * loader/icon/SQLDatabase.cpp:
2364         (WebCore::SQLDatabase::SQLDatabase): 
2365         (WebCore::SQLDatabase::open): Track the opening thread.  Also, return false if the DB failed to
2366           open instead of trying to run a PRAGMA on it!
2367         (WebCore::SQLDatabase::close): Reset the opening thread
2368         * loader/icon/SQLDatabase.h:
2369         (WebCore::SQLDatabase::transactionInProgress): 
2370         (WebCore::SQLDatabase::sqlite3Handle): For access to the raw sqlite3* handle to do a thread
2371           safety check
2372
2373         * loader/icon/SQLStatement.cpp:
2374         (WebCore::SQLStatement::prepare): Use the new sqlite3Handle accessor
2375         (WebCore::SQLStatement::step): Ditto
2376
2377         * loader/icon/SQLTransaction.cpp:
2378         (WebCore::SQLTransaction::SQLTransaction): Removed the c'tor form that could automatically
2379           begin the transaction - never used and shouldn't be in practice!
2380         (WebCore::SQLTransaction::begin): Maintain the transaction-in-progress flag on the DB
2381         (WebCore::SQLTransaction::commit): Ditto
2382         (WebCore::SQLTransaction::rollback): Ditto
2383         * loader/icon/SQLTransaction.h:
2384
2385 2007-09-04  David Harrison  <harrison@apple.com>
2386
2387         Reviewed by Maciej and John.
2388
2389         <rdar://problem/5452675> CrashTracer: [USER] 10 crashes in Mail at com.apple.WebCore: WebCore::Node::nodeIndex const + 6
2390
2391         * editing/InsertParagraphSeparatorCommand.cpp:
2392         (WebCore::InsertParagraphSeparatorCommand::doApply):
2393         Adjust pos to pos.downstream() after the refNode is calculated, but before the insertion. Doing it earlier
2394         undid the logic of positionAvoidingSpecialElementBoundary(). The downstream is still needed just to set the
2395         ending selection.
2396
2397 2007-09-04  Antti Koivisto  <antti@apple.com>
2398
2399         Reviewed by Maciej.
2400         
2401         Fix <rdar://problem/5452112>
2402         REGRESSION: Initially focused textfield on www.mac.com login page has no insertion point, and doesn't accept typed characters
2403         
2404         Use updateLayoutIgnorePendingStylesheets() instead of updateLayout(). We need to have rendering to set input focus.
2405
2406         Test: fast/forms/focus-style-pending.html
2407
2408         * dom/Element.cpp:
2409         (WebCore::Element::focus):
2410
2411 2007-09-04  Girish Ramakrishnan  <girish@trolltech.com>
2412
2413         Reviewed by Simon.
2414
2415         Fixed Qt build on Windows
2416
2417         * html/HTMLFormElement.cpp:
2418         (WebCore::pathGetFilename):
2419
2420 2007-09-03  David Harrison  <harrison@apple.com>
2421
2422         Reviewed by Kevin Decker.
2423
2424         <rdar://problem/5456785> REGRESSION (r15963-r15970): Heading text not placed in VoiceOver Item Chooser (15132)
2425
2426         * bridge/mac/WebCoreAXObject.mm:
2427         (-[WebCoreAXObject title]):
2428         For headings, return the text under the element instead of nil.
2429
2430 2007-08-20  Oleg Sukhodolsky <son.two@gmail.com>
2431
2432         Reviewed by Mark.
2433
2434         WebKitQt/WebCoreSupport should not be added to INCLUDEPATH for gdk-port
2435
2436         * WebCore.pro:
2437
2438 2007-09-03  Mark Rowe  <mrowe@apple.com>
2439
2440         Reviewed by Tim Hatcher.
2441
2442         <rdar://problem/5452164> Production build with in symbols directory has no debug info
2443
2444         Enable debug symbol generation on all build configurations.  Production builds are stripped
2445         of symbols by Xcode during deployment post-processing.
2446
2447         * Configurations/Base.xcconfig:
2448         * WebCore.xcodeproj/project.pbxproj:
2449
2450 2007-09-02  Brady Eidson  <beidson@apple.com>
2451
2452         Reviewed by John Sullivan and Mark Rowe
2453
2454         Groundwork for support for monitoring IconDatabase in-memory statistics
2455
2456         * WebCore.exp:
2457         * loader/icon/IconDatabase.cpp:
2458         (WebCore::IconDatabase::pageURLMappingCount): Stub for now
2459         (WebCore::IconDatabase::retainedPageURLCount): Ditto
2460         (WebCore::IconDatabase::iconRecordCount): Ditto
2461         (WebCore::IconDatabase::iconRecordCountWithData): Ditto
2462         * loader/icon/IconDatabase.h:
2463
2464 2007-09-02  Mark Rowe  <mrowe@apple.com>
2465
2466         Reviewed by Antti.
2467
2468         <rdar://problem/5454704> WebKit seems to get too-narrow widths for "Monotype Corsiva", so lays out incorrectly
2469
2470         * platform/mac/FontDataMac.mm:
2471         (WebCore::FontData::determinePitch): Work around NSFont incorrectly reporting Monotype Corsiva as fixed pitch.
2472
2473 2007-09-01  Darin Adler  <darin@apple.com>
2474
2475         - rolled out fix for bug 12988 because it broke getElementById in a layout test
2476           I'm working on a new fix.
2477
2478         * dom/Document.cpp: Rolled out.
2479
2480 2007-09-01  Oliver Hunt  <oliver@apple.com>
2481
2482         Reviewed by Sam.
2483
2484         <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
2485
2486         Adding a new EditorClient method so it is possible to inform WebKit of focus changes.
2487         Also added new virtual method Node::shouldUseInputMethod to allow us to trivially check
2488         whether an input method should be used when processing input for the currently focused
2489         Node.
2490
2491         * bridge/EditorClient.h:
2492         * dom/Node.cpp:
2493         (WebCore::Node::shouldUseInputMethod):
2494         * dom/Node.h:
2495         * html/HTMLInputElement.cpp:
2496         (WebCore::HTMLInputElement::shouldUseInputMethod):
2497         * html/HTMLInputElement.h:
2498         * html/HTMLTextAreaElement.cpp:
2499         (WebCore::HTMLTextAreaElement::shouldUseInputMethod):
2500         * html/HTMLTextAreaElement.h:
2501         * page/FocusController.cpp:
2502         (WebCore::FocusController::setFocusedNode):
2503         * platform/graphics/svg/SVGImageEmptyClients.h:
2504         (WebCore::SVGEmptyEditorClient::setInputMethodState):
2505
2506 2007-09-01  Rob Buis  <buis@kde.org>
2507
2508         Reviewed by Darin.
2509
2510         http://bugs.webkit.org/show_bug.cgi?id=12988
2511         First element (in document order) is not returned when other duplicate ID-ed elements were created first
2512
2513         Reset the element id cache when id's are added or removed and there
2514         are duplicates for that id.
2515
2516         Tests: fast/dom/duplicate-ids-document-order.html
2517
2518         * dom/Document.cpp:
2519         (WebCore::Document::getElementById):
2520         (WebCore::Document::addElementById):
2521         (WebCore::Document::removeElementById):
2522
2523 2007-09-01  Rob Buis  <buis@kde.org>
2524
2525         Reviewed by Darin.
2526
2527         http://bugs.webkit.org/show_bug.cgi?id=15083
2528         Some symbols in WebKit do not need to be exported
2529
2530         Do not export these symbols.
2531
2532         * dom/QualifiedName.cpp:
2533         (WebCore::hashComponents):
2534         * dom/XMLTokenizer.cpp:
2535         (WebCore::toString):
2536         (WebCore::getTokenizer):
2537         * history/HistoryItem.cpp:
2538         (WebCore::defaultNotifyHistoryItemChanged):
2539         * platform/Arena.cpp:
2540         (WebCore::CeilingLog2):
2541         * platform/graphics/Color.cpp:
2542         (WebCore::calcHue):
2543         * platform/graphics/Path.cpp:
2544         (WebCore::pathLengthApplierFunction):
2545         * platform/graphics/cg/PathCG.cpp:
2546         (WebCore::CGPathToCFStringApplierFunction):
2547         (WebCore::CFStringFromCGPath):
2548         * rendering/RenderText.cpp:
2549         (WebCore::isSpaceAccordingToStyle):
2550
2551 2007-08-31  Alice Liu  <alice.liu@apple.com>
2552
2553         Reviewed by Tim Hatcher.
2554
2555         Fixed <rdar://problem/5420682> Mail crashes at WebCore::InsertLineBreakCommand::doApply() after dropping a selected image over container's close box
2556
2557         * editing/DeleteButtonController.cpp:
2558         (WebCore::DeleteButtonController::show):
2559         Factored out the code in ::show() that created and styled the elements of the Deletion UI
2560
2561         (WebCore::DeleteButtonController::createDeletionUI):
2562         Neglecting to move the append of the deletionUI elements into the same clause that handles the creation
2563         of them ended up creating multiple elements at were repeatedly appended to the target, resulting in a 
2564         bloated table deletion UI which was slow to show and hide. 
2565
2566         * editing/DeleteButtonController.h:
2567         (WebCore::DeleteButtonController::enabled):
2568         Restore this function to how it used to be pre-r25305, sans asserts
2569
2570         * editing/EditCommand.cpp:
2571         Add disable/enable sandwich when undoing/redoing commands too
2572         (WebCore::EditCommand::unapply):
2573         (WebCore::EditCommand::reapply):
2574
2575 2007-08-31  Antti Koivisto  <antti@apple.com>
2576
2577         Reviewed by Anders.
2578
2579         Fix <rdar://problem/5452943>
2580         REGRESSION (r25283): Reproducible crash in HTMLObjectElement::getInstance under guard malloc
2581         
2582         Calling updateLayoutIgnorePendingStylesheets() may do arbitrary things to render tree so
2583         no RenderObjects can be cached over it.
2584
2585         * html/HTMLEmbedElement.cpp:
2586         (WebCore::findWidgetRenderer):
2587         (WebCore::HTMLEmbedElement::getInstance):
2588         * html/HTMLObjectElement.cpp:
2589         (WebCore::HTMLObjectElement::getInstance):
2590
2591 2007-08-31  Anders Carlsson  <andersca@apple.com>
2592
2593         Reviewed by Mitz.
2594
2595         <rdar://problem/5443936>
2596         Crash after QT movie completes playback at apple.com/imac
2597         
2598         If the plug-in or one of its children have focus, set it to NULL to prevent the web view window from getting the focus, 
2599         which can cause a layout to happen while in HTMLObjectElement::detach. (This is what we do on the Mac).
2600         
2601         * plugins/win/PluginViewWin.cpp:
2602         (WebCore::PluginViewWin::setParent):
2603
2604 2007-08-30  Adele Peterson  <adele@apple.com>
2605
2606         Reviewed by Justin.
2607
2608         Fix for <rdar://problem/5450600> REGRESSION: can't paste in textfield if its in a body that has user-select:none set (affects widgets)
2609
2610         Test: editing/pasteboard/paste-plaintext-user-select-none.html
2611
2612         * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::insertFragmentForTestRendering):
2613           Copy the user-select style from the current selection node and apply it so it is considered during the test rendering.
2614           This is important since we recently changed user-select to be inherited.  When we consider valid VisiblePositions for the test rendering,
2615           we need to have the correct user-select value that will actually be used for the real insertion.
2616
2617 2007-08-31  Anders Carlsson  <andersca@apple.com>
2618
2619         Reviewed by Oliver.
2620
2621         <rdar://problem/5423939>
2622         http://bugs.webkit.org/show_bug.cgi?id=15013
2623         ASSERTION FAILED !m_inDestructor in WebCore::Shared<WebCore::PluginStreamWin>::ref() on Windows
2624         
2625         Protect the stream in case it's destroyed by the plug-in.
2626         
2627         * plugins/win/PluginStreamWin.cpp:
2628         (WebCore::PluginStreamWin::didReceiveData):
2629
2630 a2007-08-31  Darin Adler  <darin@apple.com>
2631
2632         Reviewed by Anders.
2633
2634         - http://bugs.webkit.org/show_bug.cgi?id=15122
2635
2636         * editing/htmlediting.cpp: (WebCore::avoidIntersectionWithNode):
2637         Change assertion so that it only fires when actually modifying the selection.
2638         This isn't nearly as helpful, because the old assertion could catch potential
2639         problems in more cases, but it's not obvious how to do better.
2640
2641 2007-08-30  Oliver Hunt  <oliver@apple.com>
2642
2643         Reviewed by Adam.
2644         
2645         <rdar://problem/5430772> REGRESSION(303-310A5) list items do not show with mouse over on istweb.apple.com/quack.apple.com
2646         
2647         VC++ treats bitfields as signed members, so Node::m_styleChange would be
2648         sign extended if it was assigned the value FullStyleChange.  This caused
2649         style recalculation to stop propagating.  
2650         
2651         We work around this VC++ oddity by storing the enum as an unsigned, and
2652         casting back to StyleChangeType in the getter.
2653                 
2654         Test: fast/css/hover-affects-child.html
2655
2656         * dom/Node.h:
2657         (WebCore::Node::styleChangeType):
2658
2659 2007-08-29  Justin Garcia  <justin.garcia@apple.com>
2660
2661         Reviewed by Darin.
2662
2663         <rdar://problem/5368833> 
2664         REGRESSION: Pasting a triple-clicked line of quoted text at the top of a message adds an extra, quoted line
2665
2666         * editing/CompositeEditCommand.cpp:
2667         (WebCore::CompositeEditCommand::insertParagraphSeparator): Added an option for
2668         using a plain div to hold the new paragraph, instead of a clone of the previous
2669         block.
2670         * editing/CompositeEditCommand.h:
2671         * editing/InsertParagraphSeparatorCommand.cpp: Ditto.
2672         (WebCore::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): Ditto.
2673         (WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
2674         * editing/InsertParagraphSeparatorCommand.h:
2675         * editing/ReplaceSelectionCommand.cpp:
2676         (WebCore::ReplaceSelectionCommand::doApply): Use a default block element when creating
2677         new paragraphs, so that empty paragraphs don't contain the block style of the previous
2678         one.
2679         Don't expand collapsed brs at the end of inserted content, this was the root of the bug.
2680         We'd copy <blockquote>hello<br></blockquote><br class="Apple-interchange-newline">
2681         and get an extra paragraph.  The removed code used to make sure that if the copied 
2682         selection ends with a paragraph break that is represented in the copied markup by a 
2683         regular br (not an interchange newline br), that that paragraph break appears in the 
2684         pasted content, but shouldMergeEnd, which was introduced after this code was written, 
2685         now takes care of that.
2686         (WebCore::ReplaceSelectionCommand::shouldRemoveEndBR): Inserted content should always
2687         displace placeholder brs, even if that inserted content ends with a br.
2688         * editing/markup.cpp:
2689         (WebCore::needInterchangeNewlineAfter): This code failed to add an interchange newline
2690         if the user copied <div>hello</div><br>, only don't add an interchange newline when
2691         copying ^hello<br>^<br>, because then the copied paragraph break will already be 
2692         represented in the copied markup by a br.
2693         (WebCore::createMarkup):
2694
2695 2007-08-30  David Harrison  <harrison@apple.com>
2696
2697         Reviewed by Darin.
2698
2699         <rdar://problem/5423900> Seed: safari crashes on submit feedback page in -[WebCoreAXObject isAttachment]
2700
2701         * bridge/mac/WebCoreAXObject.mm:
2702         (-[WebCoreAXObject isAttachment]):
2703         Add nil check since element could be detached.
2704
2705 2007-08-30  Mitz Pettel  <mitz@webkit.org>
2706
2707         Reviewed by Dave Hyatt.
2708
2709         - fix http://bugs.webkit.org/show_bug.cgi?id=13282
2710           <rdar://problem/5126392> REGRESSION (NativePopUp): Rightmost character cut off in pop-up menu
2711
2712         * rendering/RenderMenuList.cpp:
2713         (WebCore::RenderMenuList::updateOptionsWidth): When measuring option text, use
2714         the same WebCore run rounding behavior that is used to draw it in the popup button.
2715
2716 2007-08-30  Riku Voipio  <riku.voipio@iki.fi>
2717
2718         Reviewed by Dave Kilzer.
2719
2720         Better ARM defines.
2721
2722         * platform/DeprecatedString.h: Update comments to reflect the
2723         change and update test to fit changes to Platform.h.
2724
2725 2007-08-30  Darin Adler  <darin@apple.com>
2726
2727         Reviewed by Tim Hatcher.
2728
2729         - fix http://bugs.webkig.org/show_bug.cgi?id=14981
2730           DEBUG builds of WebKit hang videwing Yahoo! Mail messages
2731           with ~5 MB text attachment
2732
2733         * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::checkConsistency):
2734         * rendering/RenderFlow.cpp: (WebCore::RenderFlow::checkConsistency):
2735         * rendering/RenderText.cpp: (WebCore::RenderText::checkConsistency):
2736         Put the actual consistency check inside an ifdef. If you need it you can
2737         turn it on. There's still some function call overhead in builds that don't
2738         have NDEBUG defined, but that's worth it so we can turn this on and off
2739         without recompiling the world.
2740
2741         - small code style improvement to recently changed function
2742
2743         * editing/TextIterator.cpp: (WebCore::plainTextToMallocAllocatedBuffer):
2744         Use a typedef and make_pair to make the code dealing with the pair simpler to read.
2745
2746 2007-08-30  Simon Hausmann  <hausmann@kde.org>
2747
2748         Reviewed by Zack.
2749
2750         Fix Qt/Gdk build. gcc on Linux at least doesn't like initializing
2751         variables between jumps with goto ("jump to label foo crosses
2752         initialization of bar").
2753
2754         * editing/TextIterator.cpp:
2755         (WebCore::plainTextToMallocAllocatedBuffer):
2756
2757 2007-08-30  Darin Adler  <darin@apple.com>
2758
2759         Reviewed by Antti.
2760  
2761         - fix <rdar://problem/5423270> CrashTracer: [USER] 1 crash in Safari at com.apple.WebCore:
2762           WebCore::plainTextToMallocAllocatedBuffer + 762
2763
2764         * editing/TextIterator.cpp: (WebCore::plainTextToMallocAllocatedBuffer):
2765         Check for a malloc failure and exit the function if it failed.
2766
2767 2007-08-29  Anders Carlsson  <andersca@apple.com>
2768
2769         Reviewed by Oliver.
2770
2771         <rdar://problem/5404329>
2772         Plugin content starves WM_TIMER events on UI thread (affects idle behavior of app) on http://www.vincent-vella.com/, http://www.sagmeister.com/
2773         
2774         Add a tiny delay to invalidation timer to prevent it from starving other timers.
2775         
2776         * plugins/win/PluginViewWin.cpp:
2777         (WebCore::PluginViewWin::invalidateRect):
2778
2779 2007-08-29  Darin Adler  <darin@apple.com>
2780
2781         Reviewed by Adele.
2782
2783         * editing/htmlediting.cpp: (WebCore::avoidIntersectionWithNode):
2784         Fix an assert that was firing for me all the time when doing editing operations.
2785
2786 2007-08-29  Anders Carlsson <andersca@apple.com>
2787
2788         Reviewed by Adam.
2789
2790         <rdar://problem/5386098>
2791         Repro hang with some Flash plugin content (http://dougmccune.com/blog/2007/07/25/coming-to-flexcamp-at-adobe/)
2792         
2793         In some cases, Flash ends up starving the main loop by sending a lot of WM_USER + 1 messages. Throttle these
2794         messages so they won't end up hanging the web browser.
2795         
2796         * plugins/win/PluginViewWin.cpp:
2797         (WebCore::PluginMessageThrottlerWin::PluginMessageThrottlerWin):
2798         (WebCore::PluginMessageThrottlerWin::~PluginMessageThrottlerWin):
2799         (WebCore::PluginMessageThrottlerWin::appendMessage):
2800         (WebCore::PluginMessageThrottlerWin::messageThrottleTimerFired):
2801         (WebCore::PluginMessageThrottlerWin::allocateMessage):
2802         (WebCore::PluginMessageThrottlerWin::isInlineMessage):
2803         (WebCore::PluginMessageThrottlerWin::freeMessage):
2804         (WebCore::PluginViewWndProc):
2805         (WebCore::PluginViewWin::wndProc):
2806         (WebCore::PluginViewWin::determineQuirks):
2807         * plugins/win/PluginViewWin.h:
2808         (WebCore::):
2809         (WebCore::PluginViewWin::pluginWndProc):
2810
2811 2007-08-29  Beth Dakin  <bdakin@apple.com>
2812
2813         Reviewed by Hyatt.
2814
2815         Fix for <rdar://problem/5436800> REGRESSION: PLT is 1.5% slower due 
2816         to r24593 and r25098
2817
2818         In r25098, we only called setCreatedByParser for XML! This patch 
2819         calls it for HTML too, and takes care of the performance 
2820         regression.
2821
2822         * html/HTMLElementFactory.cpp:
2823         (WebCore::styleConstructor):
2824
2825 2007-08-29  Antti Koivisto  <antti@apple.com>
2826
2827         Reviewed by Mitz.
2828         
2829         Fix <rdar://problem/5425951>
2830         REGRESSION: change to updateLayoutIgnorePendingStylesheets causes SAP Portal page to render wrong
2831         
2832         If new nodes have been added or style recalc has been done with style sheets still pending, some nodes 
2833         may not have had their real style calculated yet. Normally this state gets cleaned when style sheets arrive 
2834         but in updateLayoutIgnorePendingStylesheets() we need to do full style recalc to get up-to-date style immediatly.
2835         
2836         Added a document flag to track if there are any nodes that did not have their real style calculated due to
2837         pending stylesheets.
2838
2839         Test: fast/dynamic/style-access-late-stylesheet-load.html
2840
2841         * css/CSSStyleSelector.cpp:
2842         (WebCore::CSSStyleSelector::styleForElement):
2843         * dom/Document.cpp:
2844         (WebCore::Document::Document):
2845         (WebCore::Document::recalcStyle):
2846         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2847         * dom/Document.h:
2848         (WebCore::Document::setHasNodesWithPlaceholderStyle):
2849
2850 2007-08-29  Alice Liu  <alice.liu@apple.com>
2851
2852         Reviewed by Maciej.
2853
2854         We disable the DeleteButton UI before applying any editing commands.
2855         This patch simply moves those disable/enable calls to a more correct place, closer to the actual application of the editing command. 
2856
2857         * editing/EditCommand.cpp:
2858         (WebCore::EditCommand::apply):
2859         (WebCore::applyCommand):
2860
2861 2007-08-28  Alice Liu  <alice.liu@apple.com>
2862
2863         fixed <rdar://problem/5420682> Mail crashes at WebCore::InsertLineBreakCommand::doApply() 
2864                                        after dropping a selected image over container's close box
2865
2866         Reviewed by Darin and Maciej.
2867
2868         * editing/DeleteButtonController.cpp:
2869         (WebCore::DeleteButtonController::show):
2870         (WebCore::DeleteButtonController::hide):
2871         * editing/DeleteButtonController.h:
2872         (WebCore::DeleteButtonController::enabled):
2873         General changes made to DeleteButtonController: when hiding, it's not necessary to clear out 
2874         the m_containerElement and m_target, especially since to fix this bug we need to keep 
2875         their values around.  It's sufficient to just detach the container from target.
2876
2877         * editing/EditCommand.cpp:
2878         (WebCore::EditCommand::EditCommand):
2879         Move the selection out of the deletion UI since we don't want to expose the deletion UI to any editing.
2880
2881         * editing/Editor.cpp:
2882         (WebCore::Editor::rangeForPoint):
2883         Move the range out of the deletion UI since we don't want to expose the deletion UI to any editing.
2884
2885         * editing/htmlediting.cpp:
2886         * editing/htmlediting.h:
2887         (WebCore::avoidIntersectionWithNode):
2888         Moved function that operates on Range from markup.cpp to here
2889         Added new implementation for function that operates on Selection
2890
2891         * editing/markup.cpp:
2892         (WebCore::createMarkup):
2893         Moved function out of this file to htmlediting.cpp, and renamed to avoidIntersectionWithNode
2894
2895 2007-08-29  David Hyatt  <hyatt@apple.com>
2896
2897         Fix for 5441281, remove our dependency on cursor rects and drag margins
2898         in AppKit for a large performance boost on the PLT and iBench.
2899
2900         Reviewed by darin
2901
2902         * platform/mac/WidgetMac.mm:
2903         (WebCore::safeRemoveFromSuperview):
2904         (WebCore::Widget::addToSuperview):
2905         Suppress the resetting of drag margins when views are added and removed.
2906
2907         (WebCore::Widget::setCursor):
2908         Just use NSCursor's set method to immediately set the cursor.  We no longer
2909         rely on NSScrollView/NSClipView setDocumentCursor, since that is implemented
2910         using cursor rects.
2911
2912 2007-08-29  Rick  <rick@writhe.org.uk>
2913
2914         Reviewed by Tim Hatcher.
2915
2916         Fix http://bugs.webkit.org/show_bug.cgi?id=14853
2917         Bug 14853: Incorrect implementation of ArrayImpl's equality operator
2918
2919         * platform/ArrayImpl.cpp:
2920         (WebCore::ArrayImpl::operator==):
2921         Fixed typo so that correct variable is used in equality comparison.
2922
2923 2007-08-29  Peter Kasting  <zerodpx@gmail.com>
2924
2925         Reviewed by Maciej.
2926
2927         - fix http://bugs.webkit.org/show_bug.cgi?id=15096
2928         Move the GIF frame duration minimum check into the various
2929         ImageSource*.cpp backends and use the same values as
2930         ImageSourceCG.cpp.
2931
2932         * platform/graphics/cairo/ImageSourceCairo.cpp:
2933         (WebCore::ImageSource::frameDurationAtIndex):
2934         * platform/graphics/qt/ImageSourceQt.cpp:
2935         (WebCore::ImageSource::frameDurationAtIndex):
2936         * platform/image-decoders/gif/GIFImageReader.cpp:
2937         (GIFImageReader::read):
2938
2939 2007-08-29  Peter Kasting  <zerodpx@gmail.com>
2940
2941         Reviewed by Maciej.
2942
2943         - fix http://bugs.webkit.org/show_bug.cgi?id=15097
2944         Make PNGImageDecoder.cpp size its frame buffer vector in its
2945         constructor, so it never throws decoded image data away no matter
2946         what order its functions are called in.
2947
2948         * platform/image-decoders/png/PNGImageDecoder.cpp:
2949         (WebCore::PNGImageDecoder::PNGImageDecoder):
2950         (WebCore::PNGImageDecoder::frameBufferAtIndex):
2951         (WebCore::PNGImageDecoder::decode):
2952         (WebCore::PNGImageDecoder::rowAvailable):
2953         (WebCore::PNGImageDecoder::pngComplete):
2954
2955 2007-08-29  Peter Kasting  <zerodpx@gmail.com>
2956
2957         Reviewed by Maciej.
2958
2959         - fix http://bugs.webkit.org/show_bug.cgi?id=15104
2960         Don't double-compensate for sizeof(unsigned) when making a buffer
2961         overflow check in the GIF decoder.  Now interlaced GIFs don't
2962         sometimes get nothing/garbage in some of the bottom rows.
2963
2964         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2965         (WebCore::GIFImageDecoder::haveDecodedRow):
2966
2967 2007-08-28  Sam Weinig  <sam@webkit.org>
2968
2969         Reviewed by Darin.
2970
2971         Update fix landed in r25249 to account for XMLHttpRequest, which can also be EventTargets.
2972
2973         Tests: http/tests/security/listener/xss-XMLHttpRequest-addEventListener.html
2974                http/tests/security/listener/xss-XMLHttpRequest-shortcut.html
2975
2976         * bindings/js/JSXMLHttpRequest.cpp:
2977         (KJS::JSXMLHttpRequest::putValueProperty): Use the Window object associated with document's frame, not the active Window.
2978         (KJS::JSXMLHttpRequestPrototypeFunction::callAsFunction): ditto
2979         * xml/XMLHttpRequest.h:
2980         (WebCore::XMLHttpRequest::document): Expose Document member so bindings can access the correct frame.
2981
2982 2007-08-28  Anders Carlsson  <andersca@apple.com>
2983
2984         Reviewed by Darin.
2985
2986         <rdar://problem/5424866> Bottom portion of any Web Clip widget appears transparent
2987
2988         Restore the previous behavior, creating plug-ins on attach, for WebKit plug-ins. Netscape plug-ins
2989         are still created during the first layout.
2990         
2991         * html/HTMLEmbedElement.cpp:
2992         (WebCore::HTMLEmbedElement::getInstance):
2993         Only call layout if the renderer doesn't have a widget.
2994         
2995         * html/HTMLObjectElement.cpp:
2996         (WebCore::HTMLObjectElement::getInstance):
2997         Likewise.
2998         
2999         * loader/FrameLoader.cpp:
3000         (WebCore::FrameLoader::shouldUsePlugin):
3001         Update for enum change.
3002         
3003         * loader/FrameLoaderTypes.h:
3004         Add ObjectContentNetscapePlugin and ObjectContentOtherPlugin.
3005         
3006         * page/mac/WebCoreFrameBridge.h:
3007         Get rid of the enum here, we can use the one in FrameLoaderTypes.h
3008         
3009         * rendering/RenderPartObject.cpp:
3010         (WebCore::RenderPartObject::updateWidget):
3011         Only create the plug-in if it's not a Netscape plug-in.
3012         
3013         (WebCore::RenderPartObject::layout):
3014         Fix indentation.
3015         
3016 2007-08-28  David Harrison  <harrison@apple.com>
3017
3018         Reviewed by Darin.
3019
3020         <rdar://problem/5415006> Command Left in a To Do causes caret to disappear
3021
3022         The selection was ending up inside non-editable content at the To Do Options
3023         arrow image, rather then at the editable position just to the left of that image.
3024         The problem was that startPositionForLine looked only at line boxes, and there
3025         is no linebox for the editable position at the far left of a To Do, which is
3026         a table. Addressed by having startPositionForLine use table offset 0 instead
3027         of the first VisiblePosition inside the table.
3028         
3029         Found and fixed the similar case with option-left (move by word position).
3030         
3031         Test cases:
3032         * editing/selection/mixed-editability-8.html: Added.
3033         * editing/selection/mixed-editability-9.html: Added.
3034
3035         Source changes:
3036         * editing/SelectionController.cpp:
3037         (WebCore::SelectionController::modifyMovingLeftBackward):
3038         
3039         * editing/VisiblePosition.cpp:
3040         (WebCore::VisiblePosition::next):
3041         (WebCore::VisiblePosition::previous):
3042         (WebCore::VisiblePosition::stayInEditableContentLeft):
3043         (WebCore::VisiblePosition::stayInEditableContentRight):
3044         Factored stayInEditableContentLeft() and stayInEditableContentRight()
3045         out of previous() and next().
3046         
3047         * editing/VisiblePosition.h:
3048         Declare stayInEditableContentLeft() and stayInEditableContentRight().
3049
3050         * editing/visible_units.cpp:
3051         (WebCore::previousWordPosition):
3052         (WebCore::nextWordPosition):
3053         (WebCore::startOfLine):
3054         (WebCore::endOfLine):
3055         (WebCore::previousSentencePosition):
3056         (WebCore::nextSentencePosition):
3057         Call stayInEditableContentLeft() or stayInEditableContentRight(), as 
3058         appropriate, so prevent crossing from editable content into
3059         uneditable content.
3060         
3061         (WebCore::startPositionForLine):
3062         Use table offset 0 instead of the first VisiblePosition in the table.
3063         
3064 2007-08-28  Mark Rowe  <mrowe@apple.com>
3065
3066         Reviewed by Darin Adler.
3067
3068         <rdar://problem/5443453> Decreasing history expiration time from 1 year to 1 week can lead to long hang while icon database syncs
3069
3070         Perform the sync inside a SQLite transaction.  This drops the time taken for the sync from over 90s to under half a second in the
3071         extreme case of over 90,000 URLs being pruned.
3072
3073         * loader/icon/IconDatabase.cpp:
3074         (WebCore::IconDatabase::syncDatabase):
3075
3076 2007-08-28  Mark Rowe  <mrowe@apple.com>
3077
3078         Reviewed by Darin Adler.
3079
3080         <rdar://problem/5437983> Loading history containing 100,000 entries adds 20s to Safari's startup
3081
3082         Add a new constructor for HistoryItem that initializes the alternate title.  This prevents WebHistoryItem
3083         in WebKit from having explicitly set the display title, which triggers a history item changed notification
3084         to be posted, for each history item loaded.
3085
3086         * WebCore.exp:
3087         * history/HistoryItem.cpp:
3088         (WebCore::HistoryItem::HistoryItem):
3089         * history/HistoryItem.h:
3090
3091 2007-08-28  Anders Carlsson  <andersca@apple.com>
3092
3093         Reviewed by Darin.
3094
3095         <rdar://problem/5298296> XMLHttpRequest readyState 3 & responseText buffer issues
3096         
3097         Add a shouldContentSniff flag to ResourceLoader and ResourceHandle and have XMLHttpRequest 
3098         pass in false when creating its subresource loader.
3099         
3100         * WebCore.exp:
3101         * loader/MainResourceLoader.cpp:
3102         (WebCore::MainResourceLoader::MainResourceLoader):
3103         (WebCore::MainResourceLoader::loadNow):
3104         * loader/ResourceLoader.cpp:
3105         (WebCore::ResourceLoader::ResourceLoader):
3106         (WebCore::ResourceLoader::load):
3107         * loader/ResourceLoader.h:
3108         * loader/SubresourceLoader.cpp:
3109         (WebCore::SubresourceLoader::SubresourceLoader):
3110         (WebCore::SubresourceLoader::create):
3111         * loader/SubresourceLoader.h:
3112         * loader/mac/NetscapePlugInStreamLoaderMac.mm:
3113         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
3114         * platform/mac/WebCoreSystemInterface.h:
3115         * platform/mac/WebCoreSystemInterface.mm:
3116         * platform/network/ResourceHandle.cpp:
3117         (WebCore::ResourceHandle::ResourceHandle):
3118         (WebCore::ResourceHandle::create):
3119         * platform/network/ResourceHandle.h:
3120         * platform/network/ResourceHandleInternal.h:
3121         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3122         * platform/network/mac/ResourceHandleMac.mm:
3123         (WebCore::ResourceHandle::start):
3124         * xml/XMLHttpRequest.cpp:
3125         (WebCore::XMLHttpRequest::send):
3126
3127 2007-08-27  Steve Falkenburg  <sfalken@apple.com>
3128
3129         Added getter for committedFirstRealDocumentLoad.
3130         
3131         Reviewed by Maciej.
3132
3133         * loader/FrameLoader.h: Added committedFirstRealDocumentLoad.
3134         (WebCore::FrameLoader::committedFirstRealDocumentLoad): Added.
3135
3136 2007-08-27  Antti Koivisto  <antti@apple.com>
3137
3138         Reviewed by Maciej.
3139         
3140         Fix <rdar://problem/5433144>
3141         REGRESSION: Unable to click "Select" link at Expedia for car rentals
3142         
3143         javascript: URLs need special handling when serializing. Escaping them like
3144         normal attribute values can do bad things. Try hard to not escape anything,
3145         escape quote characters only if really necessary. Try to match Firefox.
3146
3147         Test: fast/innerHTML/javascript-url.html
3148
3149         * editing/markup.cpp:
3150         (WebCore::urlAttributeToQuotedString):
3151         (WebCore::startMarkup):
3152
3153 2007-08-27  David Hyatt  <hyatt@apple.com>
3154
3155         Fix for 5441224, micro-optimizations to improve the PLT by 1%.
3156
3157         Reviewed by Darin
3158
3159         * css/CSSStyleSelector.cpp:
3160         (WebCore::CSSStyleSelector::canShareStyleWithElement):
3161         * platform/mac/FontMac.mm:
3162         (WebCore::Font::drawGlyphs):
3163         * rendering/RenderInline.cpp:
3164         (WebCore::RenderInline::requiresLayer):
3165         * rendering/RenderObject.cpp:
3166         (WebCore::RenderObject::isBody):
3167         * rendering/RenderObject.h:
3168         (WebCore::RenderObject::renderArena):
3169         (WebCore::RenderObject::isRoot):
3170
3171 2007-08-27  Mitz Pettel  <mitz@webkit.org>
3172
3173         Reviewed by Darin.
3174
3175         - fix http://bugs.webkit.org/show_bug.cgi?id=15091
3176           Crash in RenderBlock::skipWhitespace during layout <rdar://problem/5439631> 
3177
3178         Test: fast/replaced/applet-disabled-positioned.html
3179
3180         * html/HTMLAppletElement.cpp:
3181         (WebCore::HTMLAppletElement::createRenderer): Changed to call
3182         RenderObject::createObject(), which accounts for style.
3183
3184 2007-08-26  Antti Koivisto  <antti@apple.com>
3185
3186         Reviewed by Darin.
3187         
3188         Fix for <rdar://problem/5433726>
3189         Mail crash at WebCore::Frame::styleForSelectionStart() when deleting a selection in a HTML message (http://www.yahoo.com/)
3190
3191         Test: editing/style/temporary-span-crash.html
3192
3193         * page/Frame.cpp:
3194         (WebCore::Frame::styleForSelectionStart):
3195         Temporary span created here might not have renderer if document has style sheet that makes it display:none.
3196         Set display:inline explicitly in spans style attribute. This temporary span does not need to get its display 
3197         value from actual document style sheets. Null check the renderer too to be sure.
3198
3199
3200 2007-08-24  Sam Weinig  <sam@webkit.org>
3201
3202         Reviewed by Adele.
3203
3204         Fix for <rdar://problem/5426142>
3205
3206         Use the EventTarget's frame when creating the EventListener.
3207
3208         Tests: http/tests/security/listener/xss-JSTargetNode-onclick-addEventListener.html
3209                http/tests/security/listener/xss-JSTargetNode-onclick-shortcut.html
3210                http/tests/security/listener/xss-window-onclick-addEventListener.html
3211                http/tests/security/listener/xss-window-onclick-shortcut.html
3212
3213         * bindings/js/JSEventTargetNode.cpp:
3214         (WebCore::JSEventTargetNode::setListener):
3215         (WebCore::JSEventTargetNodePrototypeFunction::callAsFunction):
3216         * bindings/js/kjs_window.cpp:
3217         (KJS::WindowFunc::callAsFunction):
3218
3219 2007-08-25  Mitz Pettel  <mitz@webkit.org>
3220
3221         Reviewed by Sam Weinig.
3222
3223         - fix http://bugs.webkit.org/show_bug.cgi?id=15077
3224           REGRESSION: Cannot drag selected text out of a background window
3225
3226         * manual-tests/drag-out-of-background-window.html: Added.
3227         * page/EventHandler.cpp:
3228         (WebCore::EventHandler::eventMayStartDrag): Added missing coordinate
3229         conversion.
3230
3231 2007-08-25  Rob Buis  <buis@kde.org>
3232
3233         Reviewed by Darin.
3234
3235         http://bugs.webkit.org/show_bug.cgi?id=14848
3236         DOM table rules are not updated when changed
3237
3238         On a dynamic rules attr change, mark the table cells and
3239         their ancestors (up to and including the table tag) as
3240         changed.
3241
3242         Tests: fast/table/rules-attr-dynchange1.html
3243                fast/table/rules-attr-dynchange2.html
3244
3245         * html/HTMLTableElement.cpp:
3246         (WebCore::isTableCellAncestor):
3247         (WebCore::setTableCellsChanged):
3248         (WebCore::HTMLTableElement::parseMappedAttribute):
3249
3250 2007-08-25  Adele Peterson  <adele@apple.com>
3251
3252         Reviewed by Mitz.
3253
3254         Fix for http://bugs.webkit.org/show_bug.cgi?id=15073
3255         <rdar://problem/5426557> REGRESSION: Can no longer drag text from textareas
3256         
3257         Test: fast/forms/drag-out-of-textarea.html
3258
3259         * rendering/RenderTextControl.cpp: (WebCore::RenderTextControlInnerBlock::nodeAtPoint):
3260           Only restricts hit testing if the placeholder text is visible.
3261         * rendering/RenderTextControl.h: (WebCore::RenderTextControl::placeholderIsVisible): Added. 
3262
3263 2007-08-25  Peter Kasting <zerodpx@gmail.org>
3264
3265         Reviewed by Sam Weinig.
3266
3267         Part 2 of http://bugs.webkit.org/show_bug.cgi?id=14967.
3268         Eliminate all remaining implicit conversions of wtf::Vector<T> to T*.  Where code was
3269         previously checking that the Vector's data pointer was non-NULL, check !Vector::isEmpty()
3270         instead.
3271
3272         * bindings/js/kjs_navigator.cpp:
3273         (KJS::PluginBase::cachePluginDataIfNecessary):
3274         * loader/mac/LoaderNSURLExtras.m:
3275         (suggestedFilenameWithMIMEType):
3276         * page/FrameView.cpp:
3277         (WebCore::FrameView::~FrameView):
3278         (WebCore::FrameView::pauseScheduledEvents):
3279         (WebCore::FrameView::resumeScheduledEvents):
3280         (WebCore::FrameView::dispatchScheduledEvents):
3281         * platform/mac/PlugInInfoStoreMac.mm:
3282         (WebCore::PlugInInfoStore::createPluginInfoForPluginAtIndex):
3283
3284 2007-08-25  Mitz Pettel  <mitz@webkit.org>
3285
3286         Rubber-stamped by Adam Roben
3287
3288         - remove unused file
3289
3290         * platform/win/MouseEventWin.cpp: Removed.
3291
3292 2007-08-25  Jasper Bryant-Greene  <m@ni.ac.nz>
3293
3294         Reviewed by Oliver Hunt.
3295
3296         Set paintingDisabled to true in Cairo's GraphicsContext constructor
3297         when passed a null PlatformGraphicsContext.
3298
3299         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3300         (WebCore::GraphicsContext::GraphicsContext):
3301
3302 2007-08-25  Mitz Pettel  <mitz@webkit.org>
3303
3304         Reviewed by Dave Hyatt.
3305
3306         - fix http://bugs.webkit.org/show_bug.cgi?id=15056
3307           REGRESSION (r21472): Digg Podcasts Episodes Render "Digg" counter incorrectly
3308
3309         Covered by fast/parser/residual-style-close-across-n-blocks.html
3310
3311         * html/HTMLParser.cpp:
3312         (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): If the
3313         residual style was closed before anything else in the block (so it does
3314         not apply to anything inside the block) avoid creating an empty element for
3315         it inside the block.
3316
3317 2007-08-25  Mitz Pettel  <mitz@webkit.org>
3318
3319         Reviewed by Dave Hyatt.
3320
3321         - fix http://bugs.webkit.org/show_bug.cgi?id=14972
3322           Moving cursor down in contentEditable section fails if styled line-height:1em
3323
3324         Test: editing/selection/move-by-line-003.html
3325
3326         * rendering/RenderText.cpp:
3327         (WebCore::RenderText::positionForCoordinates): Changed hit testing so that each
3328         line is tested for hits between its overflow top and the next line's overflow top.
3329         This matches RenderBlock::positionForCoordinates.
3330
3331 2007-08-25  Mitz Pettel  <mitz@webkit.org>
3332
3333         Reviewed by Justin.
3334
3335         - fix http://bugs.webkit.org/show_bug.cgi?id=14792
3336           <rdar://problem/5367763> REGRESSION: Copy inserts carriage return in middle of selection
3337
3338         Test: editing/pasteboard/newlines-around-floating-or-positioned.html
3339
3340         * editing/TextIterator.cpp:
3341         (WebCore::shouldEmitNewlinesBeforeAndAfterNode): Do not emit newlines around
3342         floating or positioned blocks. This behavior seems to match WinIE's.
3343
3344 2007-08-23  Justin Garcia  <justin.garcia@apple.com>
3345
3346         Reviewed by Darin.
3347         
3348         <rdar://problem/5432254> GoogleDocs: A hang occurs when applying list style to selected table
3349         
3350         * editing/DeleteSelectionCommand.cpp:
3351         (WebCore::DeleteSelectionCommand::handleGeneralDelete): If the position
3352         that marked the start of the range to delete has been removed from the
3353         document, and it was inside the node that holds the position that marks
3354         the end of the range to delete, don't remove any children of that node,
3355         because we don't know how many to remove.  For example, if the end is
3356         [a, 5] and the start was in some descendant of a and was removed, don't
3357         remove any of the children of a.  We will now refuse to remove some content
3358         incorrectly, but that's less dangerous than removing content incorrectly.
3359         Long term we need to update these positions as we remove content from the 
3360         document, but that seems like a more risky change.  Added a testcase.
3361         * editing/InsertListCommand.cpp:
3362         (WebCore::InsertListCommand::modifyRange): If the end of the selection to 
3363         modify is just after a table, and if the start of the selection is inside 
3364         that table, the last paragraph that we'll want modify is the last one inside 
3365         the table, not the paragraph that contains the table itself. Adjust 
3366         startOfLastParagraph here to avoid infinite recursion.
3367
3368 2007-08-24  Anders Carlsson  <andersca@apple.com>
3369
3370         Reviewed by Geoff.
3371
3372         <rdar://problem/5430165>
3373         REGRESSION: Dynamically loaded images fail to load
3374
3375         * html/HTMLImageLoader.cpp:
3376         (WebCore::HTMLImageLoader::HTMLImageLoader):
3377         Initialize the m_elementIsProtected member.
3378
3379         (WebCore::HTMLImageLoader::~HTMLImageLoader):
3380         Assert that the element is not protected.
3381         
3382         (WebCore::HTMLImageLoader::setLoadingImage):
3383         If the image is not null, protect the element. Otherwise, unprotect it.
3384         
3385         (WebCore::HTMLImageLoader::dispatchLoadEvent):
3386         Unprotect the element here.
3387
3388         (WebCore::HTMLImageLoader::protectElement):
3389         (WebCore::HTMLImageLoader::unprotectElement):
3390         New methods which protect and unprotect the element.
3391         
3392         * html/HTMLImageLoader.h:
3393
3394 2007-08-24  Kevin McCullough  <kmccullough@apple.com>
3395
3396         - Updated ChangeLog
3397
3398 2007-08-24  Beth Dakin  <bdakin@apple.com>
3399
3400         Reviewed by Hyatt and Adele.
3401
3402         Fix for <rdar://problem/5417203> Google Gmail 1.0 widget - unread 
3403         count is missing
3404
3405         * rendering/FixedTableLayout.cpp:
3406         (WebCore::FixedTableLayout::calcWidthArray): Calc pref widths for 
3407         our cells, if needed.
3408
3409 2007-08-24  Kevin McCullough  <kmccullough@apple.com>
3410
3411         Reviewed by Darin.
3412
3413         <rdar://problem/5437038> 1 credential object leaked for each call to credentialWithUser:password:persistence
3414         - Use initWithUser instead of credentialWithUser because credentialWithUser leaks.
3415
3416         * platform/network/mac/AuthenticationMac.mm:
3417         (WebCore::mac):
3418         * platform/network/mac/ResourceHandleMac.mm:
3419         (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
3420         (-[WebCoreSynchronousLoader connection:didReceiveAuthenticationChallenge:]):
3421
3422 2007-08-24  Jon Honeycutt  <jhoneycutt@apple.com>
3423
3424         Reviewed by Darin.
3425
3426         <rdar://problem/5433236> Print preview of empty txt file crashes Safari
3427         Fix: Adjust computePageRectsForFrame to always return at least one 
3428         page rect, even if document height is zero.
3429
3430         * WebCore.vcproj/WebCore.vcproj:
3431         * bridge/win/FrameWin.h: Added Vector& parameter to 
3432         computePagesRectsForFrame; changed its return type to void.
3433         * bridge/win/FrameWin.cpp:
3434         (WebCore::computePageRectsForFrame): Reordered the loop that inserts
3435         rects into the vector.
3436
3437 2007-08-24  Antti Koivisto  <antti@apple.com>
3438
3439         Reviewed by Oliver
3440
3441         Fix <rdar://problem/5393758>
3442         Crash in WebCore::FontData::platformInit
3443         
3444         Null check glyph page. 
3445         
3446         If font has somehow failed to initialize it is possible to have null glyph page. Based on
3447         crash dumps this seems to occasionally happen when running Mail under guard malloc. 
3448         
3449         No test case, I don't know how to get to this state.
3450
3451         * platform/FontData.cpp:
3452         (WebCore::FontData::FontData):
3453         * platform/mac/FontDataMac.mm:
3454         (WebCore::FontData::platformInit):
3455
3456 2007-08-24  George Wright  <george.wright@collabora.co.uk>
3457
3458         Reviewed by Oliver.
3459
3460         http://bugs.webkit.org/show_bug.cgi?id=15071
3461         [cairo] SVG skews are incorrect
3462
3463         Fix Cairo implementation of AffineTransform::shear so that shearing is
3464         done in the correct direction.
3465
3466         * platform/graphics/cairo/AffineTransformCairo.cpp:
3467         (WebCore::AffineTransform::shear):
3468
3469 2007-08-23  Anders Carlsson  <andersca@apple.com>
3470
3471         Reviewed by Steve.
3472
3473         If necessary, re-set the window proc after each call to NPP_SetWindow. This is to ensure that
3474         our window proc is always run even if a plug-in subclasses the window and replaces the window proc.
3475         
3476         Also, make sure that the default window proc is of type ASCII so we can eliminate the 
3477         * plugins/win/PluginViewWin.cpp:
3478         (WebCore::registerPluginView):
3479         (WebCore::PluginViewWndProc):
3480         (WebCore::PluginViewWin::setNPWindowRect):
3481         (WebCore::PluginViewWin::stop):
3482         (WebCore::PluginViewWin::determineQuirks):
3483         (WebCore::PluginViewWin::PluginViewWin):
3484         (WebCore::PluginViewWin::init):
3485         * plugins/win/PluginViewWin.h:
3486         (WebCore::):
3487         (WebCore::PluginViewWin::pluginWndProc):
3488
3489 2007-08-23  Justin Garcia  <justin.garcia@apple.com>
3490
3491         Reviewed by Adele.
3492
3493         <rdar://problem/5156801> REGRESSION: Crash at DeleteSelectionCommand::doApply() when deleting table content
3494
3495         * editing/DeleteSelectionCommand.cpp:
3496         (WebCore::DeleteSelectionCommand::handleGeneralDelete): Use a RefPtr
3497         for node.  If the node to be removed contains the selection, and if
3498         the next node to be removed (nextNode) is inside the deletion UI,
3499         removing node will remove nextNode from the document.  nextNode is
3500         a RefPtr, but node isn't and when nextNode falls out of scope the node
3501         that node points to will be destroyed and we'll end up using a stale pointer.
3502         Long term we should probably just disable the deletion UI before editing 
3503         operations because the undo of the removal of node in the situation 
3504         described above relies on the presence of the deletion UI, but it isn't 
3505         present because its added and removed in a non-undoable way.
3506
3507 2007-08-23  Mitz Pettel  <mitz@webkit.org>