236c34346cda18d2bd0c638acb54c6772d0da62c
[WebKit-https.git] / WebCore / ChangeLog
1 2007-03-17  Adele Peterson  <adele@apple.com>
2
3         Reviewed by Hyatt.
4
5         Fix for <rdar://problem/4990050> REGRESSION: onchange gets fired when clicking on a programmatically selected element in a listbox
6         http://bugs.webkit.org/show_bug.cgi?id=12725
7
8         Test: updated fast/forms/listbox-onchange.html
9
10         Added HTMLSelectElement::saveLastSelection that is called before changing a selection that could result
11         in onChange being called.  m_lastOnChangeIndex and m_lastOnChangeSelection no longer have to be up-to date all the time, 
12         they just have to be up-to-date before we execute an action that may trigger onChange.
13
14         * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::setSelectedState): Added.
15           The HTMLSelectElement will only set an option's selected state with this method.  This ensures
16           that notifyOptionSelected won't get called when the call originates from the select element.
17         * html/HTMLOptionElement.h:
18
19         * html/HTMLSelectElement.cpp:
20         (WebCore::HTMLSelectElement::deselectItems): Calls setSelectedState.
21         (WebCore::HTMLSelectElement::setSelectedIndex): ditto. Don't update the last selection variables here.  Scroll to the new selection.
22          The scrolling call used to only be in notifyOptionSelected.  There's no reason we shouldn't scroll when the selection is set through
23          the HTMLSelectElement.
24         (WebCore::HTMLSelectElement::setValue): Call setSelectedIndex to update all options selected state.
25         (WebCore::HTMLSelectElement::restoreState): Call setSelectedState.
26         (WebCore::HTMLSelectElement::selectAll): Call saveLastSelection before making the selection, and calling onChange.
27         (WebCore::HTMLSelectElement::recalcListItems): Call setSelectedState.  Don't need to save selection here anymore, 
28          since it will get saved before we call onChange.
29         (WebCore::HTMLSelectElement::reset): ditto.
30         (WebCore::HTMLSelectElement::dispatchFocusEvent): Added. Call saveLastSelection for menu lists, since onChange can be fired
31          on blur.
32         (WebCore::HTMLSelectElement::dispatchBlurEvent): Call menuListOnChange.
33         (WebCore::HTMLSelectElement::menuListDefaultEventHandler): Call saveLastSelection before showing the popup window.
34         (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):  Call saveLastSelection during mousedown (to prepare for an 
35          onchange during mouseup, or after autoscroll).
36         (WebCore::HTMLSelectElement::updateListBoxSelection): Call setSelectedState.
37
38         (WebCore::HTMLSelectElement::menuListOnChange): Added. Compares the m_lastOnChangeIndex to the selectedIndex().
39         (WebCore::HTMLSelectElement::listBoxOnChange): Move the m_lastOnChangeSelection creation to saveLastSelection.
40         (WebCore::HTMLSelectElement::saveLastSelection): Added. Sets m_lastOnChangeIndex or m_lastOnChangeSelection.
41         * html/HTMLSelectElement.h:
42         * platform/PopupMenu.h:
43
44 2007-03-16  Oliver Hunt  <oliver@apple.com>
45
46         Reviewed by Hyatt.
47
48         The old canSaveAsWebArchive call was necessary as stand alone
49         images used to be rendered by ImageDocument.
50
51         Fixes rdar://problem/5061252
52
53         * dom/Clipboard.cpp:
54         * dom/Clipboard.h:
55         (WebCore::Clipboard::setDragHasStarted):
56         * page/DragClient.h:
57         (WebCore::DragClient::declareAndWriteDragImage):
58         * platform/mac/ClipboardMac.mm:
59         (WebCore::ClipboardMac::declareAndWriteDragImage):
60
61 2007-03-16  Anders Carlsson  <acarlsson@apple.com>
62
63         Reviewed by Maciej.
64
65         <rdar://problem/4869095>
66         default content type changed for XMLHttpRequest POSTs changed (breaks Flickrator 0.1 widget)
67         
68         * xml/xmlhttprequest.cpp:
69         (WebCore::XMLHttpRequest::send):
70
71 2007-03-16  Brady Eidson  <beidson@apple.com>
72
73         Rubberstamped by Tim Hatcher
74
75         Update the hash table header for Window object properties
76
77         * bindings/js/kjs_window.cpp:
78
79 2007-03-16  Brady Eidson  <beidson@apple.com>
80
81         Reviewed by Anders
82
83         <rdar://problem/5061826> and
84         http://bugs.webkit.org/show_bug.cgi?id=12863
85         Implement window.stop()
86
87         * bindings/js/kjs_window.cpp:
88         (KJS::WindowFunc::callAsFunction): Add case Window::Stop
89         * bindings/js/kjs_window.h:
90         (KJS::Window::): Add "Stop"
91
92 2007-03-16  Geoffrey Garen  <ggaren@apple.com>
93
94         Reviewed by Brady Eidson.
95
96         Fixed dir creation to account for already existing dirs and missing leading
97         dirs in path.
98         
99         * loader/icon/IconDatabase.cpp:
100         (WebCore::makeAllDirectories):
101
102 2007-03-16  David Hyatt  <hyatt@apple.com>
103
104         Fix for 13084, assertion failure in the Cache.  Convert the client list
105         to a HashCountedSet so that multiple refs and derefs are allowed.
106
107         Fix RenderImage so that if it has the same image used as a background/border
108         and as the foreground that it will repaint properly (can be tested using
109         border-image and a foreground image).
110
111         Optimize list marker so that it doesn't waste time in the base class method,
112         since list markers don't support background or border images.
113
114         Reviewed by andersca
115
116         * ChangeLog:
117         * loader/CachedResource.cpp:
118         (WebCore::CachedResource::ref):
119         * loader/CachedResource.h:
120         * loader/CachedResourceClientWalker.cpp:
121         (WebCore::CachedResourceClientWalker::CachedResourceClientWalker):
122         * loader/CachedResourceClientWalker.h:
123         * rendering/RenderImage.cpp:
124         (WebCore::RenderImage::imageChanged):
125         * rendering/RenderListMarker.cpp:
126         (WebCore::RenderListMarker::imageChanged):
127
128 2007-03-16  Geoffrey Garen  <ggaren@apple.com>
129
130         Reviewed by Anders Carlsson.
131         
132         Fixed <rdar://problem/5065399> REGRESSION: leaks in Frame::bindingRootObject 
133         seen on buildbot
134
135         The problem was that we were initializing the same WebScriptObject twice.
136         This caused it to leak its original set of ivars.
137         
138         I think some refactoring could prevent this situation from arising in the
139         first place, but I'm just adding a check at the call site for now, to do 
140         the simplest thing.
141
142         * bindings/objc/WebScriptObject.mm:
143         (-[WebScriptObject _setImp:originRootObject:rootObject:]): Added ASSERTs
144         against multiple calls.
145
146         * bindings/objc/WebScriptObjectPrivate.h: Renamed _initializeWithObjectImp
147         to setImp because "init" vs "initialize" was a too subtle indication that
148         one was a Cocoa initializer and one was not.
149
150 2007-03-16  Lars Knoll <lars@trolltech.com>
151
152         don't use #import in .cpp files.
153
154         * editing/qt/EditorQt.cpp:
155
156 2007-03-16  Lars Knoll <lars@trolltech.com>
157
158         Fix the Qt build once again.
159
160         * platform/qt/PasteboardQt.cpp:
161         (WebCore::Pasteboard::Pasteboard):
162         (WebCore::Pasteboard::writeSelection):
163         (WebCore::Pasteboard::plainText):
164         (WebCore::Pasteboard::documentFragment):
165         (WebCore::Pasteboard::writeURL):
166         (WebCore::Pasteboard::writeImage):
167         (WebCore::Pasteboard::clear):
168
169 2007-03-15  Shrikant Gangoda  <shrikant.gangoda@celunite.com>
170
171         Gdk build fix.
172
173         * loader/gdk/FrameLoaderClientGdk.cpp:
174         (WebCore::FrameLoaderClientGdk::blockedError):
175         * loader/gdk/FrameLoaderClientGdk.h:
176
177 2007-03-15  Beth Dakin  <bdakin@apple.com>
178
179         Reviewed by Geoff.
180
181         Fix for http://bugs.webkit.org/show_bug.cgi?id=13088 REGRESSION
182         (r19761-19779): Copy image no longer includes image address 
183         (rdar://5067927)
184
185         writeURL() does not need an isImage parameter. Now that it accepts 
186         the types as a parameter, we can just declare the appropriate image 
187         types within writeImage and send them to writeURL(). Also, 
188         declaring the types twice is what broke this.
189
190         * platform/Pasteboard.h:
191         * platform/mac/PasteboardMac.mm:
192         (WebCore::Pasteboard::writeURL):
193         (WebCore::Pasteboard::writeImage):
194
195 2007-03-15  Adele Peterson  <adele@apple.com>
196
197         Reviewed by Kevin Decker.
198
199         Fix for <rdar://problem/4926179> Text in menulist control should never update if menu is open
200
201         * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::updateFromElement):
202           Only setTextFromOption if the menu isn't visible.
203
204 2007-03-15  Brady Eidson  <beidson@apple.com>
205
206         Reviewed by Oliver
207
208         A few platform specific tweaks
209
210         * platform/cf/RetainPtr.h:
211         (WebCore::RetainPtr::releaseRef): Fixed releaseRef to work with CF
212         
213         * platform/network/ResourceHandle.h: Added a "releaseRef" style call
214
215 2007-03-15  Maciej Stachowiak  <mjs@apple.com>
216
217         Reviewed by Geoff and Steve.
218
219         * config.h: Remove unneeded hack.
220
221 2007-03-15  Justin Garcia  <justin.garcia@apple.com>
222
223         Reviewed by john
224         
225         <rdar://problem/5062376> 
226         REGRESSION: In Mail and Gmail, can't change alignment to text after it has been applied
227         
228         Bring back the remove step in applyBlockStyle.  It's 
229         necessary because addBlockStyleIfNeeded assumes that 
230         the properties it adds aren't already on the block that 
231         it adds them to.
232
233         * editing/ApplyStyleCommand.cpp:
234         (WebCore::ApplyStyleCommand::applyBlockStyle): 
235         Bring back the remove step (added a testcase).
236         Don't do the add step if m_removeOnly is true (no testcase
237         because there aren't any clients using removeOnly functionality
238         to remove styles yet, only styled elemets).
239         Moved the code for creating new blocks up one level
240         to this function so that we can pass blocks to removeCSSStyle.
241         When converting VisiblePositions to indices and vice versa,
242         use the highest node in the shadow tree if we're in one as
243         the scope (working on a testcase).
244         (WebCore::ApplyStyleCommand::addBlockStyle): Moved code to
245         applyBlockStyle.
246         * editing/ApplyStyleCommand.h: 
247
248 2007-03-15  Brady Eidson  <beidson@apple.com>
249
250         Reviewed by Maciej
251
252         <rdar://problem/4429701>
253         Implements a port blocking black list that matches Firefox's
254
255         * loader/FrameLoader.cpp:
256         (WebCore::FrameLoader::blockedError): Call through to the client for blockedError 
257         * loader/FrameLoader.h:
258
259         * loader/FrameLoaderClient.h: Get the "port blocked" error for the current platform
260
261         * loader/ResourceLoader.cpp:
262         (WebCore::ResourceLoader::wasBlocked): ResourceHandleClient method to pass on the didFail(error)
263         (WebCore::ResourceLoader::blockedError): Following the pattern of "CancelledError()", get the 
264           error to fail with for the didFail() call
265         * loader/ResourceLoader.h:
266
267         * platform/graphics/svg/SVGImageEmptyClients.h:
268         (WebCore::SVGEmptyFrameLoaderClient::blockedError): Added stub
269
270         * platform/network/ResourceHandle.cpp:
271         (WebCore::ResourceHandle::create): If the port is blocked, create the handle but schedule it for
272           deferred failure on a timer
273         (WebCore::ResourceHandle::scheduleBlockedFailure): Do the timer scheduling
274         (WebCore::ResourceHandle::fireBlockedFailure): Fire the timer here
275         (WebCore::ResourceHandle::portAllowed): Implements checking of Mozilla's
276         * platform/network/ResourceHandle.h:
277         * platform/network/ResourceHandleClient.h:
278         (WebCore::ResourceHandleClient::wasBlocked): Virtual for clients to get the "blocked" message
279
280 2007-03-15  Beth Dakin  <bdakin@apple.com>
281
282         Reviewed by Hyatt.
283
284         Fix for <rdar://problem/5065396> REGRESSION: leaks in 
285         RenderBlock::layoutInlineChildren seen on buildbot
286
287         This leak appeared after http://trac.webkit.org/projects/webkit/
288         changeset/20188. This change shifted line boxes around in 
289         removeChild(). But since removeChild() calls 
290         setNeedsLayoutAndMinMaxRecalc(), all of the line boxes will be 
291         removed once we actually lay out anyway. So this patch fixes the 
292         leak by deleting the line boxes instead of shifting them around. 
293
294         * editing/IndentOutdentCommand.cpp:
295         (WebCore::IndentOutdentCommand::outdentParagraph): Call into 
296         updateLayout(). This fixes an assertion I got in editing/
297         execCommand/4976800.html This is very similar to the line box fix I 
298         made recently (http://trac.webkit.org/projects/webkit/changeset/
299         20177). We need to update layout before relying on VisiblePositions 
300         after removing a node.
301         * rendering/RenderBlock.cpp:
302         (WebCore::RenderBlock::deleteLinesForBlock): New helper function 
303         since this functionality is needed in three places now.
304         (WebCore::RenderBlock::makeChildrenNonInline): Call into new 
305         deleteLinesForBlock().
306         (WebCore::RenderBlock::removeChild): Same.
307         * rendering/RenderBlock.h:
308
309 2007-03-15  Timothy Hatcher  <timothy@apple.com>
310
311         Reviewed by John.
312
313         * Factored out most of our common build settings into .xcconfig files. Anything that was common in
314           each build configuration was factored out into the shared .xcconfig file.
315         * Adds a Version.xcconfig file to define the current framework version, to be used in other places.
316         * Use the new $(BUNDLE_VERSION) (defined in Version.xcconfig) in the preprocessed Info.plist.
317         * Use the versions defined in Version.xcconfig to set $(DYLIB_CURRENT_VERSION).
318
319         * Configurations/Base.xcconfig: Added.
320         * Configurations/DebugRelease.xcconfig: Added.
321         * Configurations/Version.xcconfig: Added.
322         * Configurations/WebCore.xcconfig: Added.
323         * Info.plist:
324         * WebCore.xcodeproj/project.pbxproj:
325
326 2007-03-15  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
327
328         Not reviewed - gdk build fixes.
329
330         * platform/gdk/EditorClientGdk.cpp:
331         (WebCore::EditorClientGdk::handleKeypress):
332         * platform/graphics/cairo/ImageSourceCairo.cpp:
333         (WebCore::ImageSource::setData):
334         * platform/graphics/gdk/ImageGdk.cpp:
335         (WebCore::Image::loadPlatformResource):
336
337 2007-03-14  Justin Garcia  <justin.garcia@apple.com>
338
339         Reviewed by john
340         
341         ~2x speed up of 5k rich text paste:
342         http://shakespeare.mit.edu/hamlet/full.html        
343
344         * editing/ReplaceSelectionCommand.cpp:
345         (WebCore::ReplaceSelectionCommand::doApply): Remove the top 
346         level style span if its unnecessary before inserting
347         into the document, its faster than doing it after.
348         * editing/ReplaceSelectionCommand.h: Exposed 
349         ReplacementFragment::removeNodePreservingChildren so that
350         the style span can be removed using non-undoable removes,
351         like the rest of the removes done on the ReplacementFragment.
352         * editing/markup.cpp:
353         (WebCore::createMarkup): Make the style span the top level
354         element, otherwise it's useless.  This also facilitates the
355         optimization mentioned above.
356         When including markup for a fully selected root, include markup
357         for all the nodes beneath that fully selected root, to preserve 
358         the structure and appearance of the copied markup.  Did this
359         by merging with the code for adding markup for descendants of
360         special commonAncestorBlocks.
361
362 2007-03-15  Beth Dakin  <bdakin@apple.com>
363
364         Rubber-stamped by Adele.
365
366         Rolling out http://trac.webkit.org/projects/webkit/changeset/20148 
367         (which is a fix for http://bugs.webkit.org/show_bug.cgi?id=12595 
368         and rdar://4722863) because it causes a horrible memory-trasher. 
369
370         * bindings/js/JSHTMLFormElementCustom.cpp:
371         (WebCore::JSHTMLFormElement::canGetItemsForName):
372         (WebCore::JSHTMLFormElement::nameGetter):
373         * bindings/js/kjs_dom.cpp:
374         (KJS::):
375         (KJS::DOMNamedNodesCollection::DOMNamedNodesCollection):
376         (KJS::DOMNamedNodesCollection::lengthGetter):
377         (KJS::DOMNamedNodesCollection::indexGetter):
378         (KJS::DOMNamedNodesCollection::getOwnPropertySlot):
379         * bindings/js/kjs_dom.h:
380         (KJS::DOMNamedNodesCollection::classInfo):
381         * bindings/js/kjs_html.cpp:
382         (KJS::JSHTMLCollection::getNamedItems):
383         * dom/ChildNodeList.cpp:
384         (WebCore::ChildNodeList::ChildNodeList):
385         (WebCore::ChildNodeList::length):
386         (WebCore::ChildNodeList::item):
387         (WebCore::ChildNodeList::nodeMatches):
388         * dom/ChildNodeList.h:
389         * dom/NameNodeList.cpp:
390         (WebCore::NameNodeList::NameNodeList):
391         (WebCore::NameNodeList::item):
392         (WebCore::NameNodeList::nodeMatches):
393         * dom/NameNodeList.h:
394         (WebCore::NameNodeList::rootNodeAttributeChanged):
395         * dom/Node.cpp:
396         (WebCore::TagNodeList::TagNodeList):
397         (WebCore::TagNodeList::nodeMatches):
398         (WebCore::Node::registerNodeList):
399         (WebCore::Node::unregisterNodeList):
400         * dom/Node.h:
401         * dom/NodeList.cpp:
402         (WebCore::NodeList::NodeList):
403         (WebCore::NodeList::~NodeList):
404         (WebCore::NodeList::recursiveLength):
405         (WebCore::NodeList::itemForwardsFromCurrent):
406         (WebCore::NodeList::itemBackwardsFromCurrent):
407         (WebCore::NodeList::recursiveItem):
408         (WebCore::NodeList::itemWithName):
409         (WebCore::NodeList::rootNodeChildrenChanged):
410         * dom/NodeList.h:
411         (WebCore::NodeList::rootNodeAttributeChanged):
412         * html/HTMLFormElement.cpp:
413         (WebCore::HTMLFormElement::HTMLFormElement):
414         (WebCore::HTMLFormElement::~HTMLFormElement):
415         (WebCore::HTMLFormElement::formData):
416         (WebCore::HTMLFormElement::parseMappedAttribute):
417         (WebCore::HTMLFormElement::removeFormElement):
418         * html/HTMLFormElement.h:
419         * html/HTMLGenericFormElement.cpp:
420         (WebCore::HTMLGenericFormElement::parseMappedAttribute):
421         (WebCore::HTMLGenericFormElement::insertedIntoTree):
422         * html/HTMLGenericFormElement.h:
423         * html/HTMLInputElement.cpp:
424         (WebCore::HTMLInputElement::parseMappedAttribute):
425
426 2007-03-15  Geoffrey Garen  <ggaren@apple.com>
427
428         Added an assert to help catch a bug. Hopefully someone will hit it!
429         
430         * bindings/js/kjs_proxy.cpp:
431         (WebCore::KJSProxy::~KJSProxy):
432
433 2007-03-14  Oliver Hunt  <oliver@apple.com>
434
435         Reviewed by Adele.
436
437         Fix for rdar://problem/5061737.
438         
439         This was a regression from the original Objective-C -> C++ conversion
440         for the drag logic.  We don't need to call Range::startNode as we just
441         need the document that contains the range.   
442
443         * page/DragController.cpp:
444         (WebCore::documentFragmentFromDragData):
445
446 2007-03-14  Mitz Pettel  <mitz@webkit.org>
447
448         Reviewed by Hyatt.
449
450         - http://bugs.webkit.org/show_bug.cgi?id=13071
451           REGRESSION: Plain text files no longer wrap lines longer than the width of the browser window
452
453         Test: fast/loader/text-document-wrapping.html
454
455         * loader/TextDocument.cpp:
456         (WebCore::TextTokenizer::write): Specified word-wrap:break-word for the <pre> element.
457
458 2007-03-14  Mitz Pettel  <mitz@webkit.org>
459
460         Reviewed by Hyatt.
461
462         - fix http://bugs.webkit.org/show_bug.cgi?id=13072
463           REGRESSION (r15617): white-space: pre-wrap breaks off the last character of a wide word
464
465         Test: fast/text/whitespace/pre-wrap-last-char.html
466
467         * rendering/bidi.cpp:
468         (WebCore::RenderBlock::findNextLineBreak): Undid the change from r15617.
469
470 2007-03-14  David Hyatt  <hyatt@apple.com>
471
472         Add asserts to help catch double refs and double derefs of CachedResources.
473
474         Reviewed by mjs
475
476         * loader/CachedResource.cpp:
477         (WebCore::CachedResource::ref):
478         (WebCore::CachedResource::deref):
479
480 2007-03-14  Alice Liu  <alice.liu@apple.com>
481
482         Rubber-stamped by Hyatt.
483
484         Adding null check to prevent the crash that happens on 2nd run of iBench HTML load test
485
486         * loader/icon/IconDataCache.cpp:
487         (WebCore::IconDataCache::writeToDatabase):
488
489 === Safari-5522.4 ===
490
491 2007-03-14  Adele Peterson  <adele@apple.com>
492
493         Reviewed by Adam.
494
495         Fix for <rdar://problem/5062898> REGRESSION: autocomplete window in text fields doesn't come up
496
497         When we moved the initialization of a bunch of variables in the HTMLFormElement constructor, m_autocomplete accidently got initialized to false.
498
499         * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::HTMLFormElement):
500
501 2007-03-14  Steve Falkenburg  <sfalken@apple.com>
502
503         Reviewed by Adam.
504
505         Added missing null check in case this is called on a subframe
506         that hasn't started loading.
507
508         * page/Frame.cpp:
509         (WebCore::Frame::setMarkedTextMatchesAreHighlighted): Check for a null document.
510
511 2007-03-14  Antti Koivisto  <antti@apple.com>
512
513         Reviewed by Geoff.
514
515         Fix http://bugs.webkit.org/show_bug.cgi?id=13060
516         REGRESSION: Repro ASSERT failure in Cache::adjustSize running layout tests
517         <rdar://5060208>
518         
519         Script evaluation may have dereffed the CachedScript object already, causing double deref and
520         eventually m_liveResourcesSize underflow.
521
522         * html/HTMLScriptElement.cpp:
523         (WebCore::HTMLScriptElement::notifyFinished):
524
525 2007-03-14  Adele Peterson  <adele@apple.com>
526
527         Reviewed by Darin.
528
529         Added InsertTab, InsertBacktab, InsertLineBreak, and InsertNewline to the editing command table.
530         Added Event parameter to execCommand, and to all of the enabled and exec functions.  Right now,
531         the event is only used by the newly added commands.  But in the future, many (and possibly all) of
532         these editing commands will need to consider the event so they are applied to the correct selection.
533
534         * WebCore.exp:
535         * editing/Editor.cpp:
536         (WebCore::execCopy):
537         (WebCore::execCut):
538         (WebCore::execDelete):
539         (WebCore::execBackwardDelete):
540         (WebCore::execForwardDelete):
541         (WebCore::execMoveBackward):
542         (WebCore::execMoveBackwardAndModifySelection):
543         (WebCore::execMoveUpByPageAndModifyCaret):
544         (WebCore::execMoveDown):
545         (WebCore::execMoveDownAndModifySelection):
546         (WebCore::execMoveForward):
547         (WebCore::execMoveForwardAndModifySelection):
548         (WebCore::execMoveDownByPageAndModifyCaret):
549         (WebCore::execMoveLeft):
550         (WebCore::execMoveLeftAndModifySelection):
551         (WebCore::execMoveRight):
552         (WebCore::execMoveRightAndModifySelection):
553         (WebCore::execMoveToBeginningOfDocument):
554         (WebCore::execMoveToBeginningOfDocumentAndModifySelection):
555         (WebCore::execMoveToBeginningOfSentence):
556         (WebCore::execMoveToBeginningOfSentenceAndModifySelection):
557         (WebCore::execMoveToBeginningOfLine):
558         (WebCore::execMoveToBeginningOfLineAndModifySelection):
559         (WebCore::execMoveToBeginningOfParagraph):
560         (WebCore::execMoveToBeginningOfParagraphAndModifySelection):
561         (WebCore::execMoveToEndOfDocument):
562         (WebCore::execMoveToEndOfDocumentAndModifySelection):
563         (WebCore::execMoveToEndOfSentence):
564         (WebCore::execMoveToEndOfSentenceAndModifySelection):
565         (WebCore::execMoveToEndOfLine):
566         (WebCore::execMoveToEndOfLineAndModifySelection):
567         (WebCore::execMoveToEndOfParagraph):
568         (WebCore::execMoveToEndOfParagraphAndModifySelection):
569         (WebCore::execMoveParagraphBackwardAndModifySelection):
570         (WebCore::execMoveParagraphForwardAndModifySelection):
571         (WebCore::execMoveUp):
572         (WebCore::execMoveUpAndModifySelection):
573         (WebCore::execMoveWordBackward):
574         (WebCore::execMoveWordBackwardAndModifySelection):
575         (WebCore::execMoveWordForward):
576         (WebCore::execMoveWordForwardAndModifySelection):
577         (WebCore::execMoveWordLeft):
578         (WebCore::execMoveWordLeftAndModifySelection):
579         (WebCore::execMoveWordRight):
580         (WebCore::execMoveWordRightAndModifySelection):
581         (WebCore::execPaste):
582         (WebCore::execSelectAll):
583         (WebCore::execToggleBold):
584         (WebCore::execToggleItalic):
585         (WebCore::execRedo):
586         (WebCore::execUndo):
587         (WebCore::execInsertTab):
588         (WebCore::execInsertBacktab):
589         (WebCore::execInsertNewline):
590         (WebCore::execInsertLineBreak):
591         (WebCore::enabled):
592         (WebCore::canPaste):
593         (WebCore::hasEditableSelection):
594         (WebCore::hasEditableRangeSelection):
595         (WebCore::hasRangeSelection):
596         (WebCore::hasRichlyEditableSelection):
597         (WebCore::canRedo):
598         (WebCore::canUndo):
599         (WebCore::CommandEntry::):
600         (WebCore::Editor::toggleBold):
601
602         (WebCore::Editor::execCommand): Added optional event parameter.
603         (WebCore::Editor::insertText): Added.  Calls handleTextInputEvent.
604         (WebCore::Editor::insertTextWithoutSendingTextEvent): Renamed from insertText.
605          Performs the actual insertion without dispatching any event.
606         * editing/Editor.h:
607         * page/EventHandler.cpp: (WebCore::EventHandler::defaultTextInputEventHandler):
608           Call insertTextWithoutSendingTextEvent.
609
610 2007-03-14  Justin Garcia  <justin.garcia@apple.com>
611
612         Reviewed by darin
613         
614         ~3x speedup pasting 5k lines of rich text:
615         http://shakespeare.mit.edu/hamlet/full.html
616         ~2x speedup pasting 10k lines of plain text
617         
618         * css/CSSComputedStyleDeclaration.cpp:
619         (WebCore::computedStyle): Added for convenience.
620         * css/CSSComputedStyleDeclaration.h:
621         * editing/ReplaceSelectionCommand.cpp:
622         (WebCore::ReplaceSelectionCommand::removeRedundantStyles):
623         The code that pushed down the top level style span had
624         a bug in it that made it do unnecessary work.  Instead of
625         fixing the bug I removed the code because it was used to 
626         help see more redundancies in second level style spans, but 
627         createMarkup now *only* creates a top level style span.
628         Only remove redundant styles from style spans and only remove
629         unstyled elements if they are style spans.  FF doesn't
630         remove redundant styles from elements, or remove redundant 
631         font tags on copy/paste.  We could offer this functionality 
632         through a separate "cleanup" command.
633         * editing/markup.cpp:
634         (WebCore::createMarkup): Only add markup for ancestors of 
635         lastClosed if we're including markup for acommonAncestorBlock 
636         (we do this for commonAncestorBlocks like tables and lists),
637         otherwise it's unnecessary/redundant.
638
639 2007-03-14  Anders Carlsson  <acarlsson@apple.com>
640
641         Reviewed by Ada.
642
643         Make sure to call ResourceLoader::didReceiveData to ensure that there's a shared buffer with the resource
644         data, since SubresourceLoaderClients now make use of that buffer.
645         
646         * loader/SubresourceLoader.cpp:
647         (WebCore::SubresourceLoader::didReceiveData):
648
649 2007-03-14  Administrator  <acarlsson@apple.com>
650
651         Get the size from the shared buffer.
652         
653         * platform/graphics/cg/ImageSourceCG.cpp:
654         (WebCore::ImageSource::setData):
655         * platform/graphics/cg/PDFDocumentImage.cpp:
656         (WebCore::PDFDocumentImage::dataChanged):
657
658 2007-03-14  Mitz Pettel  <mitz@webkit.org>
659
660         Reviewed by Hyatt, thumbs up by Darin.
661
662         - fix http://bugs.webkit.org/show_bug.cgi?id=12782
663           Reproducible crash in BidiContext::deref
664
665         Test: fast/dynamic/anonymous-block-orphaned-lines.html
666
667         * rendering/InlineBox.cpp:
668         (WebCore::InlineBox::root): Added an assertion that we return a root inline box.
669         * rendering/RenderBlock.cpp:
670         (WebCore::RenderBlock::removeChild): Added code to adopt the line boxes of
671         anonymous blocks being destroyed instead of leaving them orphaned, which
672         is what caused this crash. The boxes will be deleted on the next layout, but
673         this ensures consistency in the mean time.
674
675 2007-03-14  Lars Knoll <lars@trolltech.com>
676
677         Reviewed by Antti.
678
679         Fix the Qt build.
680         Add a getter to SharedBuffer that returns a reference to the internal
681         Vector to avoid an extra copy of the data.
682
683         * platform/SharedBuffer.h:
684         (WebCore::SharedBuffer::buffer):
685         * platform/graphics/qt/ImageQt.cpp:
686         (WebCore::Image::loadPlatformResource):
687         * platform/graphics/qt/ImageSourceQt.cpp:
688         (WebCore::detectImageFormat):
689         (WebCore::createDecoder):
690         (WebCore::ImageSource::setData):
691
692 2007-03-14  Antti Koivisto  <antti@apple.com>
693
694         Reviewed by Mitz.
695         
696         Fix <rdar://problem/5058774>
697         REGRESSION: In Mail, caret appears oversized when typing in a To Do note
698         
699         Horizontal and vertical were switched. Was regression from
700         http://trac.webkit.org/projects/webkit/changeset/20103
701
702         * rendering/RootInlineBox.cpp:
703         (WebCore::RootInlineBox::addHighlightOverflow):
704
705 2007-03-14  David Hyatt  <hyatt@apple.com>
706
707         Tweak the data() functions of stylesheets and scripts to be internally consistent.
708
709         * loader/CachedCSSStyleSheet.cpp:
710         (WebCore::CachedCSSStyleSheet::data):
711         * loader/CachedScript.cpp:
712         (WebCore::CachedScript::data):
713         * loader/CachedXSLStyleSheet.cpp:
714         (WebCore::CachedXSLStyleSheet::data):
715
716 2007-03-14  David Hyatt  <hyatt@apple.com>
717
718         Fix Radar 5050688.  
719
720         For large animated GIFs, destroy and recreate the source for every animation frame.  This keeps
721         the memory consumption down while giant images are animating.
722
723         Reviewed by andersca
724
725         * platform/graphics/BitmapImage.cpp:
726         (WebCore::BitmapImage::BitmapImage):
727         (WebCore::BitmapImage::destroyDecodedData):
728         (WebCore::BitmapImage::dataChanged):
729         (WebCore::BitmapImage::advanceAnimation):
730         * platform/graphics/BitmapImage.h:
731
732 2007-03-14  David Hyatt  <hyatt@apple.com>
733
734         Make sure to use CFDataCreateWithBytesNoCopy where we can.
735
736         Reviewed by andersca
737
738         * platform/graphics/cg/ImageSourceCG.cpp:
739         (WebCore::ImageSource::setData):
740         * platform/graphics/cg/PDFDocumentImage.cpp:
741         (WebCore::PDFDocumentImage::dataChanged):
742
743 2007-03-13  David Hyatt  <hyatt@apple.com>
744
745         Fix for bugzilla bug 13050 and also radar p1 5050645.
746
747         This patch reworks resource loading to avoid having redundant buffers in the icon database and in cached
748         images in the WebCore cache.  It also avoids overcopying in top-level image documents and in the icon
749         database.
750
751         There is now only one SharedBuffer for a resource and everybody observes that buffer now instead of ever
752         making their own.  Even ImageIO uses the SharedBuffer while decoding.
753
754         The page in 13050 dropped from 145mb down to 45mb of memory use with this change for a stunning savings
755         of 100mb.
756
757         Reviewed by olliej, mjs
758
759         * WebCore.exp:
760         * loader/CachedCSSStyleSheet.cpp:
761         (WebCore::CachedCSSStyleSheet::data):
762         * loader/CachedCSSStyleSheet.h:
763         * loader/CachedImage.cpp:
764         (WebCore::CachedImage::data):
765         * loader/CachedImage.h:
766         * loader/CachedResource.cpp:
767         (WebCore::CachedResource::CachedResource):
768         (WebCore::CachedResource::~CachedResource):
769         * loader/CachedResource.h:
770         (WebCore::CachedResource::data):
771         * loader/CachedScript.cpp:
772         (WebCore::CachedScript::data):
773         * loader/CachedScript.h:
774         * loader/CachedXSLStyleSheet.cpp:
775         (WebCore::CachedXSLStyleSheet::data):
776         * loader/CachedXSLStyleSheet.h:
777         * loader/DocLoader.cpp:
778         (WebCore::DocLoader::checkCacheObjectStatus):
779         * loader/ImageDocument.cpp:
780         (WebCore::ImageTokenizer::writeRawData):
781         (WebCore::ImageTokenizer::finish):
782         * loader/icon/IconDataCache.cpp:
783         (WebCore::IconDataCache::setImageData):
784         (WebCore::IconDataCache::writeToDatabase):
785         * loader/icon/IconDataCache.h:
786         * loader/icon/IconDatabase.cpp:
787         (WebCore::IconDatabase::imageDataForIconURL):
788         (WebCore::IconDatabase::iconForPageURL):
789         (WebCore::IconDatabase::setIconDataForIconURL):
790         (WebCore::IconDatabase::setHaveNoIconForIconURL):
791         (WebCore::IconDatabase::imageDataForIconURLQuery):
792         * loader/icon/IconDatabase.h:
793         * loader/icon/IconLoader.cpp:
794         (WebCore::IconLoader::startLoading):
795         (WebCore::IconLoader::didReceiveResponse):
796         (WebCore::IconLoader::didReceiveData):
797         (WebCore::IconLoader::didFail):
798         (WebCore::IconLoader::finishLoading):
799         (WebCore::IconLoader::clearLoadingState):
800         * loader/icon/IconLoader.h:
801         * loader/icon/SQLStatement.cpp:
802         (WebCore::SQLStatement::getColumnBlobAsVector):
803         (WebCore::SQLStatement::isExpired):
804         * loader/icon/SQLStatement.h:
805         * loader/loader.cpp:
806         (WebCore::Loader::didFinishLoading):
807         (WebCore::Loader::didReceiveData):
808         * page/mac/WebCoreFrameBridge.mm:
809         (-[WebCoreFrameBridge getData:andResponse:forURL:]):
810         (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
811         * platform/SharedBuffer.h:
812         (WebCore::SharedBuffer::isEmpty):
813         * platform/graphics/BitmapImage.cpp:
814         (WebCore::BitmapImage::destroyDecodedData):
815         (WebCore::BitmapImage::dataChanged):
816         * platform/graphics/BitmapImage.h:
817         * platform/graphics/Image.cpp:
818         (WebCore::Image::setData):
819         * platform/graphics/Image.h:
820         (WebCore::Image::dataChanged):
821         (WebCore::Image::data):
822         * platform/graphics/ImageSource.h:
823         * platform/graphics/cg/ImageSourceCG.cpp:
824         (WebCore::ImageSource::setData):
825         * platform/graphics/cg/PDFDocumentImage.cpp:
826         (WebCore::PDFDocumentImage::dataChanged):
827         * platform/graphics/cg/PDFDocumentImage.h:
828         * platform/graphics/mac/ImageMac.mm:
829         (WebCore::Image::loadPlatformResource):
830         * platform/graphics/svg/SVGImage.cpp:
831         (WebCore::SVGImage::setData):
832         * platform/mac/PasteboardMac.mm:
833         (WebCore::fileWrapperForImage):
834
835 2007-03-13  Justin Garcia  <justin.garcia@apple.com>
836
837         Reviewed by darin
838         
839         <rdar://problem/5046875> 
840         Gmail Editor: Applying alignment to selected text in message also applies alignment to signature
841
842         * editing/ApplyStyleCommand.cpp:
843         (WebCore::ApplyStyleCommand::doApply): Don't call applyBlockStyle unless
844         there is a block style to apply.
845         (WebCore::ApplyStyleCommand::applyBlockStyle): Don't do the remove step.
846         It was unnecessary and removed properties from blocks that could contain 
847         content outside the range being operated on (added a testcase).
848         (WebCore::ApplyStyleCommand::addBlockStyleIfNeeded): Used an early return
849         instead of if-nesting.
850         * editing/ApplyStyleCommand.h:
851         * editing/CompositeEditCommand.cpp:
852         (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
853         Return the new block, if one was created.  Use moveParagraphs to move
854         paragraphs into the new block, instead of moving nodes.  The old code moved
855         too much (added a testcase).
856         * editing/CompositeEditCommand.h:
857
858 2007-03-13  Oliver Hunt  <oliver@apple.com>
859
860         Reviewed by Brady.
861
862         To fix <rdar://problem/5044366> we now pass a NSString
863         representation of the URL extracted with _web_originalDataAsString
864         instead of relying on [NSURL absoluteString] in the bridge
865
866         * page/mac/WebCoreFrameBridge.h:
867         * page/mac/WebCoreFrameBridge.mm:
868         (-[WebCoreFrameBridge getData:andResponse:forURL:]):
869
870 2007-03-13  Brady Eidson  <beidson@apple.com>
871
872         Reviewed by Anders
873
874         <rdar://problem/5048818> - REGRESSION: Incompletely loaded resources being saved to the object cache
875
876         Due to a subtle change in loader behavior back in 10904, we would stop all loaders before calling 
877         didFail() on them in the Cache loader.  As a result, we basically cleared all of the Subresource Loaders 
878         out of the Cache loader before more properly failing them as errored out.  The result?  Partially loaded
879         resources being cached.
880         
881         Since Loader::didFail() both calls error() on the object *and* removes the loader, the solution is to call 
882         didFail() for all cancelled loaders instead of *only* removing them from the set of active loaders.
883         
884         In addition, pages that didn't completely load were being saved to the back/forward cache.  To fix that,
885         I added a null check on the DocumentLoader's error to see if the page ended in an error, or did indeed 
886         completely load.
887
888         Note that the layout test for this - if possible - will require other enhancements including possibly adding
889         support for window.stop().  That task is documented in <rdar://problem/5061826>
890
891         * loader/FrameLoader.cpp:
892         (WebCore::FrameLoader::provisionalLoadStarted): Fixed a few bugs relating to my original BFCache rewrite to
893           more perfectly restore the original behavior - including only caching HTML documents via the 
894           m_client->canCachePage() call
895         (WebCore::FrameLoader::canCachePage): Don't make the call to m_client->canCachePage() as that serves a different
896           purpose
897           - Check the mainDocumentError to see if the load ended in error as a further criteria in determining the 
898           cachability of a page
899
900         * loader/loader.cpp:
901         (WebCore::Loader::cancelRequests): Call didFail(cancelledError()) instead of just removing the loaders from the 
902           loaders-in-progress set.  This adds the effect of properly cleaning up the cached object.
903
904 2007-03-13  Beth Dakin  <bdakin@apple.com>
905
906         Rendering part reviewed by Hyatt. Editing part consulted with and 
907         rubber stamped by Justin and Harrison.
908
909         Fix for <rdar://problem/5025925> A hang occurs in Safari when 
910         attempting to print page at http://www.pcadvisor.co.uk
911
912         * rendering/RenderBlock.cpp:
913         (WebCore::RenderBlock::makeChildrenNonInline): 
914         RenderBlock::makeChildrenNonInline() takes a block's inline 
915         children and turns them into block children. If the children had 
916         line boxes, those boxes were being leaked. In the layout test I 
917         added with the change (and at pcadvisor.co.uk during printing) 
918         children were being made non-inline, and then they were being made 
919         inline again. This meant that some of the children ended up 
920         pointing to totally stale line boxes that are normally just leaked. 
921         This caused an infinite loop in RenderFlow::destroy(). This patch 
922         simply deletes everyone's line boxes in 
923         RenderBlock::makeChildrenNonInline()
924
925         * editing/InsertParagraphSeparatorCommand.cpp:
926         (WebCore::InsertParagraphSeparatorCommand::doApply): The other part 
927         of this fix is that I added a call to updateLayout in 
928         InsertParagraphSeparatorCommand::doApply(). One layout test 
929         (editing/spelling/spelling.html) was changed by my patch to 
930         RenderBlock. doApply() inserts a node into the render tree. In at 
931         least one case in spelling.html, that caused some line boxes to be 
932         deleted. Back in doApply() this meant that the RenderTree was out-
933         of-date, and we mistakenly thought we were at the end of the 
934         paragraph. This caused us to insert a RenderBR() at the end of the 
935         tree instead of an empty RenderText(). No one seems to know exactly 
936         why we insert either, or if the change is necessarily a problem. It 
937         is clear, though, that the RenderTree in doApply() is out-of-date 
938         after inserting the node and deleting some line boxes, so it seems 
939         prudent to call into updateLayout().
940
941 2007-03-13  Adam Roben  <aroben@apple.com>
942
943         Reviewed by Anders.
944
945         * platform/FontData.h: Added m_isSystemFont parameter to match NSFont.
946
947 2007-03-13  Beth Dakin  <bdakin@apple.com>
948
949         Reviewed by Maciej.
950
951         Export DocumentLoader::setFrame(). Part of fix for <rdar://
952         problem/4277074> 8F32: Help Viewer crashed on clicking link - 
953         KHTMLView::viewportMouseReleaseEvent (12647)
954
955         * WebCore.exp:
956
957 2007-03-13  Darin Adler  <darin@apple.com>
958
959         Reviewed by Maciej.
960
961         - fix http://bugs.webkit.org/show_bug.cgi?id=12794
962           <rdar://problem/5028154> REGRESSION: TripTik planner at aaa.com never
963           finishes loading due to unclosed canvas tag (12794)
964
965         Change <canvas> elements so that their contents are parsed normally,
966         but not rendered. This change fixes the bug, because normal parsing
967         rules close the <canvas> element in that case. The special parser
968         stuff was just getting in the way.
969
970         Also do some basic cleanup to the HTML parser. This was motivated by
971         an earlier version of this patch that made even more changes to the
972         parser, but the cleanup is still worth landing.
973
974         Test: fast/canvas/canvas-hides-fallback.html
975         Test: fast/canvas/script-inside-canvas-fallback.html
976         Test: fast/canvas/unclosed-canvas-1.html
977         Test: fast/canvas/unclosed-canvas-2.html
978         Test: fast/canvas/unclosed-canvas-3.html
979         Test: fast/canvas/unclosed-canvas-4.html
980
981         * html/HTMLCanvasElement.h: Added a data member to keep track of whether the
982         renderer is a RenderHTMLCanvas or not.
983         * html/HTMLCanvasElement.cpp:
984         (WebCore::HTMLCanvasElement::createRenderer): If JavaScript is enabled, create
985         a RenderHTMLCanvas. If it's not, let the default code create the default type
986         of renderer, which will result in fallback content being visible. The
987         RenderHTMLCanvas class already hides all of its children. Set the m_rendererIsCanvas
988         boolean accordingly. Since the actual storage for the canvas is allocated lazily
989         when you actually get a drawing context, we don't need to do anything special
990         to prevent it when JavaScript is disabled; the relevant functions won't be called.
991         (WebCore::HTMLCanvasElement::reset): Protect the code that manipulates the
992         RenderHTMLCanvas with a check of m_rendererIsCanvas. This is the only code inside
993         the DOM element that relies on the renderer type.
994
995         * html/HTMLParser.h: Removed unneeded includes. Marked HTMLParser as
996         Noncopyable. Changed the Document parameter to the constructor to instead
997         be HTMLDocument. Renamed discard_until to m_skipModeTag for clarity.
998         Removed unused noSpaces function and unneeded public doc() function.
999         Moved data members all down to the end so you can see them together in order.
1000         Renamed map to m_currentMapElement and isindex to m_isindexElement.
1001         Removed unused end and headLoaded data members.  Renamed m_fragment to
1002         m_isParsingFragment to make it clearer that it's a boolean, not a fragment.
1003
1004         * html/HTMLParser.cpp:
1005         (WebCore::HTMLParser::HTMLParser): Changed to use member construction
1006         syntax instead of calling reset(). This is especially helpful in the
1007         fragment case, where calling reset() later on is illegal, so not using
1008         it in the constructor lets us assert.
1009         (WebCore::HTMLParser::~HTMLParser): Did an explicit deref instead of
1010         calling setCurrent for its side effect.
1011         (WebCore::HTMLParser::reset): Updated for member name changes and removal
1012         and to use document instead of doc().
1013         (WebCore::HTMLParser::setCurrent): Use document instead of doc().
1014         (WebCore::HTMLParser::setSkipMode): Added. No longer inline. Now sets the
1015         m_inCanvasBeforeFirstOpenTag data member to false.
1016         (WebCore::HTMLParser::parseToken): Tightened up the skip mode logic at the
1017         top of the function, and added a FIXME about the strange case there where
1018         we don't skip yet stay in skip mode. Updated for renaming and doc().
1019         (WebCore::HTMLParser::insertNode): Updated for renaming and doc().
1020         (WebCore::HTMLParser::handleError): Ditto.
1021         (WebCore::HTMLParser::framesetCreateErrorCheck): Ditto.
1022         (WebCore::HTMLParser::isindexCreateErrorCheck): Changed to use RefPtr.
1023         (WebCore::HTMLParser::noscriptCreateErrorCheck): Updated for renaming and doc().
1024         (WebCore::HTMLParser::mapCreateErrorCheck): Ditto.
1025         (WebCore::HTMLParser::getNode): Removed the special case for canvas here.
1026         Canvas fallback is now handled in the DOM, not the parser. Updated for
1027         renaming and doc().
1028         (WebCore::HTMLParser::allowNestedRedundantTag): Changed a #define into a C++
1029         constant.
1030         (WebCore::HTMLParser::processCloseTag): Updated for renaming and doc().
1031         (WebCore::HTMLParser::isInline): Ditto.
1032         (WebCore::HTMLParser::tagIsOnStack): Added. Used by new canvas logic.
1033         (WebCore::HTMLParser::popBlock): Updated for renaming and doc(). Also renamed
1034         the local variable Elem to elem.
1035         (WebCore::HTMLParser::createHead): Ditto.
1036         (WebCore::HTMLParser::handleIsindex): Changed to use RefPtr.
1037         (WebCore::HTMLParser::startBody): Updated for renaming and doc().
1038         (WebCore::HTMLParser::finished): Ditto.
1039
1040 2007-03-13  David Hyatt  <hyatt@apple.com>
1041
1042         Two more cleanup fixes to the cache.  Don't call destroyDecodedData in the BitmapImage destructor, since
1043         clearing the image source and calling setData on it again causes it to do an extra copy of the encoded
1044         data.  Since we're about to be destroyed this is just wasteful.
1045
1046         When the cache prunes, don't allow it to destroy the decoded data of an image that is still actively loading,
1047         since we've established that ImageIO can actually crash if you yank the rug out from under it like that.
1048
1049         Reviewed by ggaren
1050
1051         * loader/Cache.cpp:
1052         (WebCore::Cache::prune):
1053         * platform/graphics/BitmapImage.cpp:
1054         (WebCore::BitmapImage::~BitmapImage):
1055
1056 2007-03-13  Anders Carlsson  <acarlsson@apple.com>
1057
1058         Try fixing the Qt build.
1059         
1060         * editing/Editor.h:
1061         (WebCore::Editor::setStartNewKillRingSequence):
1062
1063 2007-03-13  David Harrison  <harrison@apple.com>
1064
1065         Reviewed by Justin.
1066
1067         <rdar://problem/5031181> cntl-k at end of paragraph adds nothing to the kill ring
1068         <rdar://problem/5031189> REGRESSION: cntl-y yanks only the most recently killed content
1069
1070         For rdar://5031181, properly extend the selection before the killring handling, and
1071         make sure plainText of that selection returns a linefeed.
1072         
1073         For rdar://5031189, restore Editor::deleteRange() code that continued current killring,
1074         even though the range deletion implicitly stopped it via changing the selection.
1075         
1076         A byproduct of this change is the elimination of RUNDFINDER vs CONTENT TextIterator. The
1077         only difference between the two was whether to emit a newline when the range started
1078         with a blockflow element. No callers actually need that any more.
1079
1080         Tests added:
1081         * editing/pasteboard/emacs-ctrl-k-y-001-expected.checksum: Added.
1082         * editing/pasteboard/emacs-ctrl-k-y-001-expected.png: Added.
1083         * editing/pasteboard/emacs-ctrl-k-y-001-expected.txt: Added.
1084         * editing/pasteboard/emacs-ctrl-k-y-001.html: Added.
1085
1086         * editing/Editor.cpp:
1087         (WebCore::Editor::deleteRange):
1088         Clear the "start new kill ring sequence" setting, because it was set to true
1089         when the selection was updated by deleting the range.
1090         
1091         (WebCore::Editor::deleteWithDirection):
1092         If extending the selection to the end of paragraph resulted in a caret selection,
1093         extend by character, to handle the case when the selection started as a caret at
1094         the end of paragraph.
1095         
1096         * editing/TextIterator.cpp:
1097         (WebCore::TextIterator::TextIterator):
1098         Initialize new member variables for tracking handling of the beginning of the range.
1099         
1100         (WebCore::TextIterator::advance):
1101         Call representNodeOffsetZero on the m_endContainer.
1102         Move visibility checks into handleTextNode and handleReplacedElement.
1103         
1104         (WebCore::TextIterator::handleTextNode):
1105         (WebCore::TextIterator::handleTextBox):
1106         Call emitText.
1107         
1108         (WebCore::TextIterator::handleReplacedElement):
1109         Moved visibility check into here.
1110         
1111         (WebCore::shouldEmitNewlinesBeforeAndAfterNode):
1112         
1113         (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
1114         (WebCore::TextIterator::representNodeOffsetZero):
1115         New. Emits proper sequence when encountering offset 0 of a node, including the
1116         m_endContainer. Started with code from handleNonTextNode.
1117         
1118         (WebCore::TextIterator::handleNonTextNode):
1119         Call representNodeOffsetZero.
1120         
1121         (WebCore::TextIterator::exitNode):
1122         Similar to shouldRepresentNodeOffsetZero, do not emit the newline if the node
1123         was collapsed, and before any other emitted content.
1124         
1125         (WebCore::TextIterator::emitCharacter):
1126         
1127         (WebCore::TextIterator::emitText):
1128         New. Consolidates code used by handleText and handleTextBox.
1129         
1130         (WebCore::CharacterIterator::CharacterIterator):
1131         Removed RUNFINDER.
1132
1133         (WebCore::WordAwareIterator::WordAwareIterator):
1134         Removed RUNFINDER.
1135         
1136         (WebCore::WordAwareIterator::advance):
1137         Formatting.
1138
1139         (WebCore::TextIterator::rangeLength):
1140         Formatting.
1141         
1142         * editing/TextIterator.h:
1143         Added member variables for tracking handling of the beginning of the range.
1144         Eliminated concept of RUNDFINDER vs CONTENT TextIterator.
1145         
1146         * editing/visible_units.cpp:
1147         (WebCore::nextBoundary):
1148         Eliminated concept of RUNDFINDER vs CONTENT TextIterator.
1149
1150 2007-03-13  David Hyatt  <hyatt@apple.com>
1151
1152         Clean up the null image case in CachedImage::data to make sure the size totals will stay accurate.
1153         I'm not convinced this case can even be hit, but I'm cleaning it up just in case.
1154
1155         * loader/CachedImage.cpp:
1156         (WebCore::CachedImage::data):
1157
1158 2007-03-13  David Hyatt  <hyatt@apple.com>
1159
1160         Reorder the call to allReferencesRemoved, since otherwise the live object size will become
1161         incorrect.
1162
1163         * loader/CachedResource.cpp:
1164         (WebCore::CachedResource::deref):
1165
1166 2007-03-13  Antti Koivisto  <antti@apple.com>
1167
1168         Reviewed by Darin.
1169         
1170         Fix http://bugs.webkit.org/show_bug.cgi?id=11083
1171         REGRESSION: Typing tab key fails to insert a tab character in Google Docs editable area
1172         <rdar://problem/4757650>
1173         
1174         Allow inserting tabs in designMode. Backtab behaves like before (matches FF).
1175
1176         * page/EventHandler.cpp:
1177         (WebCore::EventHandler::defaultTabEventHandler):
1178
1179 2007-03-13  David Hyatt  <hyatt@apple.com>
1180
1181         Fix two counting errors in the decoded size of objects in the WebCore cache.  We need to explicitly
1182         destroy decoded data when clearing out a partially loaded image that had an error, since the destructor
1183         (although it does destroy the data) disconnects the observer so that the notification doesn't happen.
1184
1185         Some CachedImages aren't in the cache (like image documents).  When the decoded size of such an image
1186         changes we should not notify the cache, since - newsflash - we aren't actually in it.
1187
1188         Reviewed by ggaren
1189
1190         * loader/CachedImage.cpp:
1191         (WebCore::CachedImage::clear):
1192         (WebCore::CachedImage::decodedSizeChanged):
1193
1194 2007-03-13  Darin Adler  <darin@apple.com>
1195
1196         Reviewed by Tim Hatcher and John Sullivan.
1197
1198         - fix <rdar://problem/4915303> CrashTracer: 36 crashes in Safari at
1199           com.apple.AppKit: -[NSView getRectsBeingDrawn:count:] + 502
1200
1201         * page/mac/FrameMac.mm: (WebCore::Frame::imageFromRect):
1202         This was calling drawRect: directly, but NSView's getRectsBeingDrawn:count:
1203         method was never really safe to call unless it was AppKit that called your
1204         drawRect: method. Changed it to call drawSingleRect: instead. A little ugly,
1205         but seems to work and will almost certainly fix the bug.
1206
1207 2007-03-13  Nikolas Zimmermann  <zimmermann@kde.org>
1208
1209         Reviewed by Maciej.
1210
1211         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12974
1212
1213         Call forgetGenericContext in JSSVGPathSeg destructor, otherwhise
1214         we'll hit an ASSERT in a debug build, when running svg/custom/js-update-path-changes.svg
1215         a few dozen times in a single WebKit instance. The ASSERT is good and just warns that
1216         there was already a generic context pointer registered, and the new "to be registered"
1217         object already exists, but pointing to a different object. That's because garbage collection
1218         calls the JSSVGPathSeg destructor, but that didn't cleanup the generic context map.
1219
1220         Only JSSVGPathSeg is hit by this problem, as it's the only non SVGAnimated* type
1221         using the generic context system while using a custom JSSVGPathSegList implementation.
1222
1223         Also cleanup JSSVGPathSegListCustom code to call the static forgetGenericContext
1224         method instead of doing the same using custom code.
1225
1226         * bindings/js/JSSVGPathSegListCustom.cpp:
1227         (WebCore::removeFromPathSegContextMap):
1228         (WebCore::JSSVGPathSegList::clear):
1229         (WebCore::JSSVGPathSegList::removeItem):
1230         * bindings/scripts/CodeGeneratorJS.pm:
1231
1232 2007-03-13  Darin Adler  <darin@apple.com>
1233
1234         Reviewed by Adele.
1235
1236         - fix http://bugs.webkit.org/show_bug.cgi?id=12595
1237           <rdar://problem/4722863> REGRESSION: Can't add item to cart at lnt.com
1238           (JS type error) (12595)
1239
1240         Test: fast/forms/old-names.html
1241
1242         * bindings/js/JSHTMLFormElementCustom.cpp:
1243         (WebCore::JSHTMLFormElement::canGetItemsForName): If the form collection has
1244         nothing for a given name, try the form's oldNamedElement function.
1245         (WebCore::JSHTMLFormElement::nameGetter): Ditto.
1246
1247         * bindings/js/kjs_dom.h: Removed the DOMNamedNodesCollection. Instead we will use
1248         a class derived from NodeList.
1249         * bindings/js/kjs_dom.cpp: Ditto.
1250
1251         * bindings/js/kjs_html.cpp:
1252         (KJS::VectorNodeList::VectorNodeList): Added. Constructor for a new class derived
1253         from NodeList to be used for the named items result from a collection -- uses a
1254         vector of node pointers.
1255         (KJS::VectorNodeList::length): Added.
1256         (KJS::VectorNodeList::item): Added.
1257         (KJS::JSHTMLCollection::getNamedItems): Use VectorNodeList and the existing wrapper
1258         for NodeList rather than a custom JavaScript class, DOMNamedNodesCollection.
1259
1260         * dom/ChildNodeList.h:
1261         * dom/ChildNodeList.cpp:
1262         (WebCore::ChildNodeList::ChildNodeList): Updated to derive from TreeNodeList,
1263         since NodeList is now a simpler class.
1264         (WebCore::ChildNodeList::elementMatches): Updated for name and parameter change.
1265
1266         * dom/NameNodeList.h:
1267         * dom/NameNodeList.cpp:
1268         (WebCore::NameNodeList::NameNodeList): Updated to derive from TreeNodeList,
1269         since NodeList is now a simpler class.
1270         (WebCore::NameNodeList::rootNodeAttributeChanged): Updated for name and
1271         parameter change.
1272
1273         * dom/Node.h: Change register/unregister functions to take TreeNodeList.
1274         * dom/Node.cpp:
1275         (WebCore::TagNodeList::TagNodeList): Updated to derive from TreeNodeList,
1276         since NodeList is now a simpler abstract class.
1277         (WebCore::TagNodeList::elementMatches): Updated for name and parameter change.
1278         (WebCore::Node::registerNodeList): Changed type from NodeList to TreeNodeList.
1279         (WebCore::Node::unregisterNodeList): Ditto.
1280
1281         * dom/NodeList.h: Broke NodeList into a simpler base class and a derived class
1282         with the machinery for iterating a tree, called TreeNodeList.
1283         * dom/NodeList.cpp:
1284         (WebCore::NodeList::~NodeList): Added.
1285         (WebCore::NodeList::itemWithName): Factored out of the old itemWithName.
1286         (WebCore::TreeNodeList::TreeNodeList): Renamed from NodeList.
1287         (WebCore::TreeNodeList::~TreeNodeList): Ditto.
1288         (WebCore::TreeNodeList::recursiveLength): Ditto.
1289         (WebCore::TreeNodeList::itemForwardsFromCurrent): Ditto.
1290         (WebCore::TreeNodeList::itemBackwardsFromCurrent): Ditto.
1291         (WebCore::TreeNodeList::recursiveItem): Ditto.
1292         (WebCore::TreeNodeList::itemWithName): Factored half of this into this function,
1293         the other half in NodeList::itemWithName.
1294         (WebCore::TreeNodeList::rootNodeAttributeChanged): Added. No longer inline.
1295         (WebCore::TreeNodeList::rootNodeChildrenChanged): Renamed from NodeList.
1296
1297         * html/HTMLFormElement.h: Added formElementNameChanged and oldNamedElement
1298         fucntions, and a map called m_oldNames. Also removed m_boundary, which I
1299         thought I had already done.
1300         * html/HTMLFormElement.cpp:
1301         (WebCore::HTMLFormElement::HTMLFormElement): Initialize m_oldNames to 0.
1302         Switched the rest of the members to initialization syntax.
1303         (WebCore::HTMLFormElement::~HTMLFormElement): Delete m_oldNames.
1304         (WebCore::HTMLFormElement::formElementNameChanged): Added. Stores a reference
1305         to one element under each of its old names.
1306         (WebCore::HTMLFormElement::oldNamedElement): Added. Returns the old element
1307         that once had a given name.
1308
1309         * html/HTMLGenericFormElement.h:
1310         * html/HTMLGenericFormElement.cpp:
1311         (WebCore::HTMLGenericFormElement::parseMappedAttribute): When the name
1312         attribute changes, tell the form about the old name.
1313         (WebCore::HTMLGenericFormElement::insertedIntoTree): When telling a form
1314         about an element, also store away the old name so that we can use it
1315         when the name changes later.
1316
1317         * html/HTMLInputElement.cpp:
1318         (WebCore::HTMLInputElement::parseMappedAttribute): Added a call to the
1319         base class in the nameAttr case, so the code in HTMLGenericFormElement
1320         above will get called in the input element case.
1321
1322 2007-03-13  Antti Koivisto  <antti@apple.com>
1323
1324         Reviewed by Alexey.
1325
1326         Alexey spotted a DOS by using string of 64k unbreakable character in
1327         fix for http://bugs.webkit.org/show_bug.cgi?id=12833
1328
1329         * dom/Text.cpp:
1330         (WebCore::Text::createWithLengthLimit):
1331
1332 2007-03-13  Lars Knoll <lars@trolltech.com>
1333
1334         Fix the Qt build
1335
1336         * WebCore.pro:
1337
1338 2007-03-13  Rob Buis  <buis@kde.org>
1339
1340         Reviewed by Darin.
1341
1342         http://bugs.webkit.org/show_bug.cgi?id=12576
1343         WebKit does not support xlink:show attributes
1344
1345         Make an exception for non-empty targets, these should be opened
1346         in a new window, unless the value is _self.
1347
1348         * ksvg2/svg/SVGAElement.cpp:
1349         (WebCore::SVGAElement::defaultEventHandler):
1350
1351 2007-03-13  David Hyatt  <hyatt@apple.com>
1352
1353         - fix cache issues seen in http://bugs.webkit.org/show_bug.cgi?id=13050
1354           6 objects and ~200MB leaked after opening then closing tab
1355           <rdar://problem/5058714>
1356
1357         Double the encoded size of images for now.  We do this to account for a bug in ImageIO where they hold
1358         a separate copy of image data.  See <rdar://problem/5050645>.
1359
1360         Reviewed by aroben.
1361
1362         * loader/CachedImage.cpp:
1363         (WebCore::CachedImage::data):
1364
1365 2007-03-12  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1366
1367         Not reviewed - gdk build fix.
1368
1369         * platform/gdk/TemporaryLinkStubs.cpp:
1370         (SearchPopupMenu::enabled): add missing stub.
1371
1372 2007-03-12  David Kilzer  <ddkilzer@kilzer.net>
1373
1374         Reviewed by Darin.
1375
1376         - fix http://bugs.webkit.org/show_bug.cgi?id=13045
1377           REGRESSION: Blackboard CourseWare Error with Nightlies after Mar 8
1378
1379         * html/HTMLFormElement.cpp:
1380         (WebCore::getUniqueBoundaryString): Speculative fix: remove dashes from
1381         the boundary prefix that appear after non-dash characters.
1382
1383 2007-03-12  Mitz Pettel  <mitz@webkit.org>
1384
1385         Reviewed by Anders.
1386
1387         - fix http://bugs.webkit.org/show_bug.cgi?id=13015
1388           REGRESSION (r17233-r17241): Repro crash when leaving a page whose unload handler submits a form
1389
1390         Test: fast/loader/onunload-form-submit-crash-2.html
1391
1392         * loader/DocumentLoader.cpp:
1393         (WebCore::DocumentLoader::finishedLoading): Added null check.
1394
1395 2007-03-12  Anders Carlsson  <acarlsson@apple.com>
1396
1397         Reviewed by Darin.
1398
1399         <rdar://problem/4900071>
1400         http://bugs.webkit.org/show_bug.cgi?id=6454
1401         ASSERTION: Navigating 'back' in frameset: !_private->previousItem (6454)
1402
1403         Change back the behavior of checkLoadComplete to traverse the entire frame tree instead of
1404         just the parent frames of the current frame. This is needed in order to reset the previous history item
1405         for all frames when doing a frame navigation. (This was changed in revision 11819)
1406         
1407         * loader/FrameLoader.cpp:
1408         (WebCore::FrameLoader::recursiveCheckLoadComplete):
1409         (WebCore::FrameLoader::checkLoadComplete):
1410         * loader/FrameLoader.h:
1411
1412 2007-03-12  Justin Garcia  <justin.garcia@apple.com>
1413
1414         Reviewed by darin
1415         
1416         <rdar://problem/5056619> 
1417         REGRESSION: Gmail Editor: Dragging text into Reply (textarea) field results in a crash at WebCore::InsertNodeBeforeCommand::doApply()
1418         
1419         * editing/SelectionController.cpp:
1420         (WebCore::removingNodeRemovesPosition): Added.
1421         (WebCore::SelectionController::nodeWillBeRemoved): Clear the
1422         selection if it's inside a shadow tree.
1423         * page/DragController.cpp:
1424         (WebCore::setSelectionToDragCaret): Return false to signal to
1425         clients that a drop shouldn't be performed if the second attempt
1426         to set a selection ends up in non-editable content.
1427
1428 2007-03-12  Darin Adler  <darin@apple.com>
1429
1430         Reviewed by Tim Hatcher.
1431
1432         - fixed JavaScript wrapper classes to be correct for a variety of cases
1433           that a new test uncovered: was broken for at least 5 classes
1434
1435         - fixed Objective-C wrapper classes to be correct for a variety of cases
1436           that a test case uncovered: was broken for ast least 50 classes
1437
1438         - added missing DOM API for creating OverflowEvent and WheelEvent instances
1439
1440         Test: fast/dom/wrapper-classes.html
1441
1442         * DerivedSources.make: Added missing bindings: HTMLCanvasElement for ObjC,
1443         CDATASection, Comment, and EntityReference for JavaScript.
1444         * WebCore.xcodeproj/project.pbxproj: Added those new generated files.
1445
1446         * bindings/js/JSHTMLElementWrapperFactory.cpp:
1447         (WebCore::createJSHTMLWrapper): Corrected the wrapper classes for <keygen>,
1448         which needs an HTMLSelectElement wrapper, and <xmp>, which needs an
1449         HTMLPreElement wrapper.
1450
1451         * bindings/objc/DOMInternal.h: Updated for new naming scheme.
1452         Also moved createDOMWrapper from the KJS namespace to the WebCore namespace.
1453         * bindings/objc/DOMUtility.mm:
1454         (KJS::createDOMWrapper): Broke the core function into a separate one, and
1455         left it in the KJS namespace because Objective-C++ rules make it impossible
1456         for it to work in the WebCore namespace. Used a macro-based implementation
1457         to cut down on repeated code, and added missing cases for Counter,
1458         HTMLOptionsCollection, Range, XPathExpression, XPathResult, Event, RGBColor,
1459         Rect, Window, DOMImplementation, NodeIterator, TreeWalker, and HTMLCollection.
1460         (WebCore::createDOMWrapper): The other half of the function.
1461
1462         * bindings/objc/DOM.mm:
1463         (WebCore::createElementClassMap): Corrected the wrapper classes for
1464         <canvas>, which needs a DOMHTMLCanvasElement wrapper, <del>, which needs
1465         a DOMHTMLModElement wrapper, <embed>, which needs a DOMHTMLEmbedElement
1466         wrapper, <ins>, which needs a DOMHTMLModElement wrapper, <th>, which needs
1467         a DOMHTMLTableCellElement wrapper, and <xmp>, which needs an
1468         DOMHTMLPreElement wrapper.
1469         (+[DOMNode _wrapNode:]): Updated for new naming scheme.
1470         (+[DOMNode _wrapEventTarget:]): Ditto.
1471         (+[DOMNodeFilter _wrapNodeFilter:]): Ditto.
1472         (ObjCNodeFilterCondition::acceptNode): Ditto.
1473         (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]): Ditto.
1474         (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]): Ditto.
1475         (WebCore::ObjCEventListener::handleEvent): Ditto.
1476
1477         * dom/Document.cpp: (WebCore::Document::createEvent):
1478         Added cases for OverflowEvent and WheelEvent.
1479
1480         * dom/OverflowEvent.h: Added empty constructor and initOverflowEvent.
1481         * dom/OverflowEvent.cpp:
1482         (WebCore::OverflowEvent::OverflowEvent): Added.
1483         (WebCore::OverflowEvent::initOverflowEvent): Added.
1484         * dom/OverflowEvent.idl: Added initOverflowEvent.
1485
1486         * bindings/objc/PublicDOMInterfaces.h: Added initOverflowEvent.
1487
1488         * bindings/objc/DOMCSS.mm:
1489         (+[DOMStyleSheet _wrapStyleSheet:]): Updated for new naming scheme.
1490         (+[DOMCSSRule _wrapCSSRule:]): Corrected wrapper for CSSUnknownRule.
1491         (+[DOMCSSValue _wrapCSSValue:]): Updated for new naming scheme.
1492
1493         * bindings/js/kjs_css.h:
1494         (KJS::DOMRGBColor::impl): Added. Used when making an ObjC wrapper.
1495         (KJS::DOMRect::impl): Ditto.
1496
1497         * bindings/js/kjs_dom.cpp: (KJS::toJS): Corrected the wrapper classes for
1498         CDATASection, Comment, and EntityReference.
1499
1500         * bindings/js/kjs_html.cpp: Corrected the class name for HTMLElement
1501         (was "DOMHTMLElement") and HTMLCollection (was "Collection").
1502
1503         * bindings/objc/DOMImplementationFront.h:
1504         * bindings/objc/DOMImplementationFront.cpp:
1505         (WebCore::implementationFront): Added new overload that returns a front given
1506         a JavaScript wrapper. Needed by the code that makes the Objective-C wrapper.
1507
1508         * bindings/objc/WebScriptObject.mm:
1509         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
1510         Updated since createDOMWrapper is now in the WebCore namespace.
1511
1512         * bindings/scripts/CodeGeneratorObjC.pm: Update the naming scheme for the
1513         wrapper creation functions to use _wrapElement: rather then _elementWith:
1514         style. Removed now-unneeded special cases for things that needed to stay
1515         upper-case, since we don't have to do the whole lcfirst thing.
1516
1517         * html/HTMLCanvasElement.idl: Added #if so we can successfully generate the
1518         Objective-C wrapper for this class, even though we can't yet handle the
1519         DOMObject return type.
1520
1521         * html/HTMLOptionsCollection.idl: Added GenerateNativeConverter so we get
1522         an appropriate toJS function.
1523
1524         * bindings/objc/DOMEvents.mm:
1525         (+[DOMEvent _wrapEvent:]):
1526         * bindings/objc/DOMHTML.mm:
1527         (-[DOMHTMLDocument createDocumentFragmentWithMarkupString:baseURL:]):
1528         (-[DOMHTMLDocument createDocumentFragmentWithText:]):
1529         * bindings/objc/DOMObject.mm:
1530         (-[DOMObject sheet]):
1531         * bindings/objc/DOMRGBColor.mm:
1532         (-[DOMRGBColor red]):
1533         (-[DOMRGBColor green]):
1534         (-[DOMRGBColor blue]):
1535         (-[DOMRGBColor alpha]):
1536         (+[DOMRGBColor _wrapRGBColor:]):
1537         * bindings/objc/DOMSVGPathSegInternal.mm:
1538         (+[DOMSVGPathSeg _wrapSVGPathSeg:]):
1539         * bindings/objc/DOMXPath.mm:
1540         (+[DOMNativeXPathNSResolver _wrapXPathNSResolver:]):
1541         * page/mac/WebCoreFrameBridge.mm:
1542         (-[WebCoreFrameBridge nodesFromList:]):
1543         (-[WebCoreFrameBridge elementWithName:inForm:]):
1544         (-[WebCoreFrameBridge formForElement:]):
1545         (-[WebCoreFrameBridge currentForm]):
1546         (-[WebCoreFrameBridge controlsInForm:]):
1547         (-[WebCoreFrameBridge rangeByAlteringCurrentSelection:SelectionController::direction:SelectionController::granularity:]):
1548         (-[WebCoreFrameBridge convertNSRangeToDOMRange:]):
1549         (-[WebCoreFrameBridge markDOMRange]):
1550         (-[WebCoreFrameBridge markedTextDOMRange]):
1551         (-[WebCoreFrameBridge smartDeleteRangeForProposedRange:]):
1552         (-[WebCoreFrameBridge documentFragmentWithMarkupString:baseURLString:]):
1553         (-[WebCoreFrameBridge documentFragmentWithText:inContext:]):
1554         (-[WebCoreFrameBridge documentFragmentWithNodesAsParagraphs:]):
1555         (-[WebCoreFrameBridge replaceSelectionWithNode:selectReplacement:smartReplace:matchStyle:]):
1556         (-[WebCoreFrameBridge replaceSelectionWithText:selectReplacement:smartReplace:]):
1557         (-[WebCoreFrameBridge increaseSelectionListLevel]):
1558         (-[WebCoreFrameBridge increaseSelectionListLevelOrdered]):
1559         (-[WebCoreFrameBridge increaseSelectionListLevelUnordered]):
1560         (-[WebCoreFrameBridge dragCaretDOMRange]):
1561         (-[WebCoreFrameBridge editableDOMRangeForPoint:]):
1562         (-[WebCoreFrameBridge characterRangeAtPoint:]):
1563         (-[WebCoreFrameBridge typingStyle]):
1564         (-[WebCoreFrameBridge rangeOfCharactersAroundCaret]):
1565         * platform/mac/ClipboardMac.mm:
1566         (WebCore::ClipboardMac::declareAndWriteDragImage):
1567         * platform/mac/PasteboardMac.mm:
1568         (WebCore::Pasteboard::writeSelection):
1569         Updated for new naming scheme.
1570
1571 2007-03-12  Timothy Hatcher  <timothy@apple.com>
1572
1573         Reviewed by Darin.
1574
1575         <rdar://problem/4990691> REGRESSION: Selecting text in Adium's Messages field causes horizontal shift
1576
1577         Corrected the recursive point conversion and scrolling done in scrollPointRecursively to use the
1578         document view of each NSClipView.
1579
1580         * platform/mac/ScrollViewMac.mm:
1581         (WebCore::ScrollView::scrollPointRecursively): Call convertPoint:fromView: on the document views,
1582         not the clip views as we encounter them. Then call constrainScrollPoint: on the converted point to
1583         constrain to the document view bounds. And finally call scrollPoint: on the document view, not the clip view.
1584
1585 2007-03-12  Antti Koivisto  <antti@apple.com>
1586
1587         Reviewed by Alexey.
1588
1589         Fix http://bugs.webkit.org/show_bug.cgi?id=12833
1590         REGRESSION: Selecting text in 6.6MB txt file is sluggish as of the Feb 19th nightly
1591         <rdar://problem/5028159>
1592         
1593         Divide large text blocks (>64kB) over multiple text nodes. This limits linebox searches to
1594         a manageable subset.
1595         
1596         * dom/Text.cpp:
1597         (WebCore::Text::createWithLengthLimit):
1598         * dom/Text.h:
1599         * html/HTMLParser.cpp:
1600         (WebCore::HTMLParser::parseToken):
1601         * loader/TextDocument.cpp:
1602         (WebCore::TextTokenizer::write):
1603
1604 2007-03-12  David Hyatt  <hyatt@apple.com>
1605
1606         Fix a regression in printing.  Printer fonts need to be part of the
1607         font cache key, since printer fonts have different glyph widths.
1608         (Integer antialiasing is used for screen fonts but not for printer fonts.)
1609
1610         Reviewed by aroben
1611
1612         * platform/FontCache.cpp:
1613         (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
1614         (WebCore::FontPlatformDataCacheKey::operator==):
1615         (WebCore::computeHash):
1616         (WebCore::FontCache::getCachedFontPlatformData):
1617
1618 2007-03-12  Lars Knoll <lars@trolltech.com>
1619
1620         add missing symbol to fix the Qt build again.
1621
1622         * platform/qt/SearchPopupMenuQt.cpp:
1623         (WebCore::SearchPopupMenu::enabled):
1624
1625 2007-03-12  Adele Peterson  <adele@apple.com>
1626
1627         Reviewed by Oliver.
1628
1629         Adding the ability to enable or disable a SearchPopupMenu.
1630
1631         * platform/SearchPopupMenu.h:
1632         * platform/mac/SearchPopupMenuMac.mm: (WebCore::SearchPopupMenu::enabled):
1633         * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::showPopup):
1634
1635 2007-03-12  Rob Buis  <buis@kde.org>
1636
1637         Reviewed by Nikolas Zimmermann.
1638
1639         http://bugs.webkit.org/show_bug.cgi?id=12500
1640         SVG fails to correctly handle all link style selectors
1641         http://bugs.webkit.org/show_bug.cgi?id=12567
1642         <text> elements ignore <a> children
1643
1644         Allow <a> inside svg text and handle xlink:show.
1645
1646         * ksvg2/svg/SVGAElement.cpp:
1647         (WebCore::SVGAElement::createRenderer):
1648         (WebCore::SVGAElement::defaultEventHandler):
1649         (WebCore::SVGAElement::childShouldCreateRenderer):
1650         * ksvg2/svg/SVGAElement.h:
1651         * ksvg2/svg/SVGElement.h:
1652         (WebCore::SVGElement::isTextContent):
1653         * ksvg2/svg/SVGTextContentElement.h:
1654         (WebCore::SVGTextContentElement::isTextContent):
1655         * ksvg2/svg/SVGTextElement.cpp:
1656         (WebCore::SVGTextElement::childShouldCreateRenderer):
1657         * rendering/SVGInlineFlowBox.cpp:
1658         (WebCore::translateBox):
1659         (WebCore::placePositionedBoxesHorizontally):
1660         (WebCore::placeBoxesVerticallyWithAbsBaseline):
1661
1662 2007-03-12  Adele Peterson  <adele@apple.com>
1663
1664         Reviewed by Oliver.
1665
1666         Add a missing parameter to the constructor.
1667
1668         * platform/PlatformKeyboardEvent.h:
1669         * platform/win/KeyEventWin.cpp: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
1670
1671 2007-03-12  Lars Knoll <lars@trolltech.com>
1672
1673         Fix the Qt build. I still get crashes though :/
1674
1675         * platform/graphics/qt/ImageDecoderQt.cpp:
1676         (WebCore::ImageDecoderQt::clearFrame):
1677         * platform/graphics/qt/ImageDecoderQt.h:
1678         * platform/graphics/qt/ImageSourceQt.cpp:
1679         (WebCore::ImageSource::setData):
1680         (WebCore::ImageSource::frameIsCompleteAtIndex):
1681         (WebCore::ImageSource::clear):
1682         (WebCore::ImageSource::destroyFrameAtIndex):
1683         * platform/qt/ClipboardQt.cpp:
1684         (WebCore::ClipboardQt::ClipboardQt):
1685         * platform/qt/ClipboardQt.h:
1686         * platform/qt/DragDataQt.cpp:
1687         (WebCore::DragData::createClipboard):
1688
1689 2007-03-11  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1690
1691         Not reviewed - gdk build fixes.
1692
1693         * platform/gdk/EditorClientGdk.cpp:
1694         (WebCore::EditorClientGdk::respondToChangedSelection): add stub
1695         * platform/gdk/EditorClientGdk.h:
1696         * platform/gdk/FrameGdk.cpp:
1697         * platform/gdk/TemporaryLinkStubs.cpp:
1698         (Editor::markMisspellings): add stub
1699
1700 2007-03-11  Alexey Proskuryakov  <ap@webkit.org>
1701
1702         Reviewed by Adele.
1703
1704         http://bugs.webkit.org/show_bug.cgi?id=12560
1705         W3C XPath test Text_Nodes.svg fails
1706
1707         * xml/XPathStep.cpp:
1708         (WebCore::XPath::Step::nodeTestMatches): Revert the fix, as the behavior doesn't appear 
1709         all that desirable as it did at first glance.
1710
1711 2007-03-11  Oliver Hunt  <oliver@apple.com>
1712
1713         Reviewed by hyatt.
1714
1715         Fix for <rdar://problem/5055690> ASSERTION failure on drop into 
1716         editable element with content changed on drop 
1717
1718         After setting the selection for a drop into an editable region 
1719         we make sure the we succeeded.  If we didn't we assume a focus handler
1720         or similar altered the element contents and try again, if the second
1721         attempt fails we bail out.
1722
1723         * page/DragController.cpp:
1724         (WebCore::setSelectionToDragCaret):
1725         (WebCore::DragController::concludeDrag):
1726
1727 2007-03-11  Oliver Hunt  <oliver@apple.com>
1728
1729         Reviewed by Adele.
1730
1731         Moving Frame{Mac}::respondToChangedSelection to Frame.cpp
1732         Added new EditorClient method to handle old bridge function
1733         
1734         * bridge/EditorClient.h:
1735            Added respondToChangedSelection to replace old bridge function
1736         * editing/Editor.cpp:
1737         (WebCore::Editor::respondToChangedSelection):
1738            Add client call to replace old bridge call from Frame::respondToChangedSelection
1739         * editing/SelectionController.cpp:
1740         (WebCore::SelectionController::setSelection):
1741            No longer directly call Editor as Frame::respondToChangedSelection
1742            makes the call
1743         * page/Frame.cpp:
1744         (WebCore::Frame::respondToChangedSelection):
1745            Moved from FrameMac, replaced bridge call with call to Editor
1746         * page/mac/FrameMac.mm:
1747            Moved respondToChangedSelection to Frame.cpp
1748         * page/mac/WebCoreFrameBridge.h:
1749            Removed respondToChangedSelection from bridge
1750         * page/qt/FrameQt.cpp:
1751            Remove stub method for respondToChangedSelection
1752
1753 2007-03-11  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1754
1755         Reviewed by Brady Eidson.
1756
1757         Linux/gdk fix.
1758
1759         * loader/gdk/FrameLoaderClientGdk.cpp:
1760         (WebCore::FrameLoaderClientGdk::shouldGoToHistoryItem): return true so
1761         that FrameLoader:goBackOrForwards() works.
1762
1763 2007-03-10  Geoffrey Garen  <ggaren@apple.com>
1764
1765         Reviewed by Darin Adler.
1766
1767         Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and 
1768         JSCore causes a hang @ www.panoramas.dk
1769         
1770         See JavaScriptCore ChangeLog for details.
1771         
1772         * bindings/objc/WebScriptObject.mm:
1773         (_didExecute): Added helpful ASSERT.
1774         (+[WebScriptObject throwException:]): Added missing JSLock.
1775
1776 2007-03-11  Antti Koivisto  <antti@apple.com>
1777
1778         Reviewed by Hyatt.
1779
1780         Optimize linebox memory consumption:
1781         - move all bitfields to baseclass compacting them
1782         - make InlineTextBox::m_truncation unsigned short and make it relative to m_start
1783         - remove extremely rarely used EllipsisBox pointer from RootInlineBox and instead
1784           use a global hashmap to store it if needed
1785         - use minimum required number of bits to store BidiStatus enum variables in RootInlineBox
1786         - move overflow variables in RootInlineBox to a separate struct that is instantiated
1787           only if any of the variables is set to a value that can't trivially be derived from 
1788           box x, y, width and height
1789           
1790         As a result line box objects shrink:
1791             InlineBox: 44 -> 44 bytes
1792             InlineTextBox: 68 -> 60 bytes
1793             InlineFlowBox: 68 -> 64 bytes
1794             RootInlineBox: 128 -> 88 bytes
1795             
1796         The optimizations possiblity was noticed when debugging http://bugs.webkit.org/show_bug.cgi?id=12833
1797         Bug 12833: REGRESSION: Selecting text in 6.6MB txt file is sluggish as of the Feb 19th nightly
1798         <rdar://problem/5028159>
1799         
1800         On that page the patch saves 11.5MB or some 21% of linebox memory consumption. It also
1801         actually improves selection performance somewhat by improving memory locality.
1802
1803         * rendering/InlineBox.h:
1804         (WebCore::InlineBox::InlineBox):
1805         * rendering/InlineFlowBox.h:
1806         (WebCore::InlineFlowBox::InlineFlowBox):
1807         * rendering/InlineTextBox.cpp:
1808         (WebCore::InlineTextBox::placeEllipsisBox):
1809         (WebCore::InlineTextBox::nodeAtPoint):
1810         (WebCore::InlineTextBox::paint):
1811         (WebCore::InlineTextBox::paintDecoration):
1812         (WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
1813         (WebCore::InlineTextBox::paintMarkedTextUnderline):
1814         * rendering/InlineTextBox.h:
1815         (WebCore::InlineTextBox::InlineTextBox):
1816         * rendering/RootInlineBox.cpp:
1817         (WebCore::throw):
1818         (WebCore::RootInlineBox::Overflow::operator delete):
1819         (WebCore::RootInlineBox::Overflow::destroy):
1820         (WebCore::RootInlineBox::destroy):
1821         (WebCore::RootInlineBox::detachEllipsisBox):
1822         (WebCore::RootInlineBox::clearTruncation):
1823         (WebCore::RootInlineBox::placeEllipsis):
1824         (WebCore::RootInlineBox::paintEllipsisBox):
1825         (WebCore::RootInlineBox::addHighlightOverflow):
1826         (WebCore::RootInlineBox::nodeAtPoint):
1827         (WebCore::RootInlineBox::adjustPosition):
1828         (WebCore::RootInlineBox::selectionTop):
1829         (WebCore::RootInlineBox::setLineBreakInfo):
1830         (WebCore::RootInlineBox::ellipsisBox):
1831         (WebCore::RootInlineBox::setVerticalOverflowPositions):
1832         (WebCore::RootInlineBox::setHorizontalOverflowPositions):
1833         (WebCore::RootInlineBox::setVerticalSelectionPositions):
1834         * rendering/RootInlineBox.h:
1835         (WebCore::RootInlineBox::RootInlineBox):
1836         (WebCore::RootInlineBox::topOverflow):
1837         (WebCore::RootInlineBox::bottomOverflow):
1838         (WebCore::RootInlineBox::leftOverflow):
1839         (WebCore::RootInlineBox::rightOverflow):
1840         (WebCore::RootInlineBox::lineBreakBidiStatus):
1841         (WebCore::RootInlineBox::selectionBottom):
1842         (WebCore::RootInlineBox::Overflow::Overflow):
1843
1844 2007-03-11  Alexey Proskuryakov  <ap@webkit.org>
1845
1846         Reviewed by Darin.
1847
1848         A partial fix for http://bugs.webkit.org/show_bug.cgi?id=13021
1849         XPath can be very slow
1850
1851         * xml/XPathExpression.cpp:
1852         (WebCore::XPathExpression::evaluate): Cache evaluationContext in a local variable.
1853
1854         * xml/XPathExpressionNode.cpp:
1855         (WebCore::XPath::Expression::evaluationContext):
1856         * xml/XPathExpressionNode.h:
1857         (WebCore::XPath::Expression::addSubExpression):
1858         (WebCore::XPath::Expression::subExprCount):
1859         (WebCore::XPath::Expression::subExpr):
1860         * xml/XPathFunctions.cpp:
1861         * xml/XPathFunctions.h:
1862         (WebCore::XPath::Function::setName):
1863         (WebCore::XPath::Function::arg):
1864         (WebCore::XPath::Function::argCount):
1865         (WebCore::XPath::Function::name):
1866         Made one-liners critical for performance inline.
1867
1868         * xml/XPathGrammar.y: Fully parse NodeTests, so that strings are no longer passed for what is
1869         essentially an enum. Use LocationPath accessors to add steps, instead of directly manipulating
1870         internal data members.
1871
1872         * xml/XPathParser.cpp:
1873         (WebCore::XPath::Parser::parseStatement):
1874         (WebCore::XPath::Parser::registerNodeTest):
1875         (WebCore::XPath::Parser::deleteNodeTest):
1876         * xml/XPathParser.h:
1877         Added support methods for changes in XPathGrammar.y.
1878
1879         * xml/XPathPath.cpp:
1880         (WebCore::XPath::Filter::evaluate): Cache evaluationContext in a local variable. Use swap() to avoid
1881         performing vector assignments.
1882         (WebCore::XPath::LocationPath::evaluate): Use swap() to avoid performing vector assignments.
1883         (WebCore::XPath::LocationPath::optimizeStepPair): This new method is called during LocationPath construction, 
1884         to simplify the path as it's being built. Currently, the only optimized case is "//*" - it is a basis for
1885         important operations that cannot be efficiently written in XPath 1.0, but can be optimized with a little bit
1886         of XPath 2.0.
1887         (WebCore::XPath::LocationPath::appendStep): A new accessor that modifies m_steps and calls optimizeStepPair().
1888         (WebCore::XPath::LocationPath::insertFirstStep): Ditto.
1889         * xml/XPathPath.h:
1890         (WebCore::XPath::LocationPath::setAbsolute): A new accessor.
1891
1892         * xml/XPathStep.h:
1893         (WebCore::XPath::Step::NodeTest::):
1894         (WebCore::XPath::Step::NodeTest::NodeTest):
1895         (WebCore::XPath::Step::NodeTest::kind):
1896         (WebCore::XPath::Step::NodeTest::data):
1897         Step::NodeTest is a new sub-class that represents a fully parsed NodeTest.
1898         (WebCore::XPath::Step::axis):
1899         (WebCore::XPath::Step::nodeTest):
1900         (WebCore::XPath::Step::nodeTestData):
1901         (WebCore::XPath::Step::namespaceURI):
1902         (WebCore::XPath::Step::predicates):
1903         (WebCore::XPath::Step::setAxis):
1904         (WebCore::XPath::Step::setNodeTest):
1905         (WebCore::XPath::Step::setNodeTestData):
1906         (WebCore::XPath::Step::setNamespaceURI):
1907         (WebCore::XPath::Step::setPredicates):
1908         New accessors that let optimizeStepPair() manipulate Step data.
1909
1910         * xml/XPathStep.cpp:
1911         (WebCore::XPath::Step::Step): Use the new NodeTest class.
1912         (WebCore::XPath::Step::evaluate): Cache evaluationContext in a local variable. Use swap() to avoid
1913         performing unneeded vector assignments.
1914         (WebCore::XPath::Step::nodesInAxis): Cosmetic changes.
1915         (WebCore::XPath::Step::nodeTestMatches): Use NodeTest instead of parsing the test from string each time.
1916         Added a partial implementation of XPath 2.0 element() node test.
1917
1918 2007-03-10  Alexey Proskuryakov  <ap@webkit.org>
1919
1920         Reviewed by Darin.
1921
1922         http://bugs.webkit.org/show_bug.cgi?id=12249
1923         FCKeditor: <hr>, <ul> and <ol> have id="undefined"
1924
1925         This fixes the attached reduction, but not the original issue.
1926
1927         Test: editing/execCommand/default-parameters.html
1928
1929         * dom/Document.h:
1930         * dom/Document.idl:
1931         Make second and third execCommand() parameters optional.
1932
1933 2007-03-10  Adele Peterson  <adele@apple.com>
1934
1935         Reviewed by Maciej.
1936
1937         Fix for http://bugs.webkit.org/show_bug.cgi?id=13028
1938         REGRESSION: textField:doCommandBySelector:inFrame: not being called properly
1939
1940         * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler):
1941           Before calling the base class defaultEventHandler, which will call handleKeypress, call doTextFieldCommandFromEvent.        
1942
1943 2007-03-10  Mitz Pettel  <mitz@webkit.org>
1944
1945         Reviewed by Darin.
1946
1947         - fix http://bugs.webkit.org/show_bug.cgi?id=13013
1948           REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key
1949
1950         Test: fast/forms/listbox-typeahead-scroll.html
1951
1952         * html/HTMLSelectElement.cpp:
1953         (WebCore::HTMLSelectElement::setSelectedIndex): Reordered to set the active selection's
1954         anchor and end before selecting the option, since the active selection is used to
1955         decide where to scroll when the selection is made.
1956         (WebCore::HTMLSelectElement::defaultEventHandler): Removed redundant check.
1957
1958 2007-03-10  Mitz Pettel  <mitz@webkit.org>
1959
1960         Reviewed by Darin.
1961
1962         - fix http://bugs.webkit.org/show_bug.cgi?id=12973
1963           REGRESSION: Reproducible assert while loading this test file if css is already in the cache
1964
1965         Test: fast/dom/css-cached-import-rule.html
1966
1967         Replaced some direct calls to document->stylesheetLoaded() with calls to
1968         the sheet's checkLoaded(). The latter calls back to the element's sheetLoaded() --
1969         which notifies the document of the load -- and then updates the sheet's
1970         loadCompleted() flag, ensuring that it stays in sync with whether the stylesheet
1971         is still considered pending by the document.
1972
1973         * dom/ProcessingInstruction.cpp:
1974         (WebCore::ProcessingInstruction::parseStyleSheet):
1975         * dom/StyleElement.cpp:
1976         (WebCore::StyleElement::childrenChanged):
1977         * html/HTMLLinkElement.cpp:
1978         (WebCore::HTMLLinkElement::process):
1979         (WebCore::HTMLLinkElement::setCSSStyleSheet):
1980         * ksvg2/svg/SVGStyleElement.cpp:
1981         (WebCore::SVGStyleElement::sheetLoaded):
1982         * ksvg2/svg/SVGStyleElement.h:
1983
1984 2007-03-10  David Kilzer  <ddkilzer@webkit.org>
1985
1986         Reviewed by Darin.
1987
1988         - fix http://bugs.webkit.org/show_bug.cgi?id=9609
1989           REGRESSION: Missing image icon needs to be moved back to WebKit
1990
1991         * WebCore.exp: Export WebCore::Image::loadPlatformResource(const char*) for use in
1992         [WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:].
1993
1994 2007-03-09  Darin Adler  <darin@apple.com>
1995
1996         Reviewed by Justin.
1997
1998         - fix http://bugs.webkit.org/show_bug.cgi?id=8928
1999           <rdar://problem/5045708> REPRODUCIBLE ASSERT: Cannot paste HTML into a
2000           contenteditable region in an XHTML document (8928)
2001
2002         Test: editing/pasteboard/paste-xml.xhtml
2003
2004         * editing/markup.cpp: (WebCore::createFragmentFromMarkup): Added a check for 0
2005         here, since createContextualFragment can return 0 for XML documents that fail
2006         to parse. In my testing, callers all seem equipped to handle 0.
2007
2008 2007-03-09  Mitz Pettel  <mitz@webkit.org>
2009
2010         Reviewed by Darin.
2011
2012         - fix http://bugs.webkit.org/show_bug.cgi?id=9929
2013           REGRESSION: crash on logging in on mijnpostbank.nl
2014
2015         Test: http/tests/misc/onload-remove-iframe-crash-2.html
2016
2017         The resulted from an iframe's load event handler removing the iframe
2018         from the document.
2019
2020         * dom/Document.cpp:
2021         (WebCore::Document::implicitClose): Bail out early if an event handler
2022         removed the frame.
2023         * loader/FrameLoader.cpp:
2024         (WebCore::FrameLoader::FrameLoader):
2025         (WebCore::FrameLoader::clear):
2026         (WebCore::FrameLoader::checkCompleted): Protect the frame from deletion
2027         by event handlers.
2028         (WebCore::FrameLoader::checkCompletedTimerFired):
2029         (WebCore::FrameLoader::scheduleCheckCompleted):
2030         (WebCore::FrameLoader::detachFromParent): Schedule a completion check
2031         on the parent (in case the child is what has been keeping it from completing).
2032         * loader/FrameLoader.h:
2033
2034 2007-03-08  David Kilzer  <ddkilzer@webkit.org>
2035
2036         Reviewed by Beth.
2037
2038         - fix http://bugs.webkit.org/show_bug.cgi?id=13019
2039           REGRESSION (r20074): Forms don't submit on a variety of websites
2040
2041         No tests added since LayoutTests/fast/forms/document-write.html was timing out
2042         and causing a layout test failure.
2043
2044         * html/HTMLFormElement.cpp:
2045         (WebCore::HTMLFormElement::submit): Removed stray code.
2046
2047 2007-03-08  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
2048
2049         Not reviewed - gdk build fix.
2050
2051         * platform/graphics/cairo/ImageSourceCairo.cpp:
2052         (WebCore::ImageSource::frameIsCompleteAtIndex): add empty stub
2053
2054 2007-03-08  Justin Garcia  <justin.garcia@apple.com>
2055
2056         Reviewed by harrison
2057         
2058         <rdar://problem/4903193> 
2059         On particular page, Copy is so slow it seems like a hang
2060         
2061         ~2x speedup copying:
2062         http://shakespeare.mit.edu/henryviii/full.html 
2063         Also produces less bloated markup.
2064
2065         * editing/markup.cpp:
2066         (WebCore::startMarkup): Don't wrap text nodes in style spans.
2067         For Elements, don't inline styles inherited from ancestors.
2068         (WebCore::createMarkup): No longer necessary to find 
2069         the root's default style and pass it to startMarkup.
2070         Add a wrapper span around the markup with the styles
2071         that all nodes in the markup inherit (the inheritable 
2072         styles from the common ancestor container's computed style).
2073         Added a FIXME about unecessary markup for inline ancestors 
2074         up to the commonAncestorBlock.
2075
2076 2007-03-08  Darin Adler  <darin@apple.com>
2077
2078         Reviewed by Adele.
2079
2080         - <rdar://problem/4470381> multipart/form-data boundary security vulnerability
2081
2082         By making the form data boundary a string with some random data in it, we reduce
2083         the possibility that anyone could take advantage of it by creating a file that
2084         intentionally has the boundary string in it.
2085
2086         * html/HTMLFormElement.h: Removed boundary(), setBoundary(), and m_boundary.
2087         Marked a lot more stuff private.
2088         * html/HTMLFormElement.cpp:
2089         (WebCore::HTMLFormElement::HTMLFormElement): Removed code to initialize
2090         m_boundary.
2091         (WebCore::randomNumber): Added. Function that returns a random number, including
2092         seeding the random number generator the first time it's called. For now, usees the more
2093         random function random() on Mac OS X and the more-standard rand() on other platforms.
2094         (WebCore::HTMLFormElement::formData): Take a parameter with the form boundary string,
2095         and use that instead of m_boundary.
2096         (WebCore::getUniqueBoundaryString): Added. Makes a boundary string using random numbers
2097         and base 64 encoding.
2098         (WebCore::HTMLFormElement::submit): Call getUniqueBoundaryString and pass the boundary
2099         string into formData for multipart form posts.
2100
2101 2007-03-08  Maciej Stachowiak  <mjs@apple.com>
2102
2103         Reviewed by Adele.
2104         
2105         <rdar://problem/4646563> REGRESSION: Unable to send text message from Verizon text message website: vtext.com (12588)
2106         http://bugs.webkit.org/show_bug.cgi?id=12588
2107
2108         Carefully revised which focus operations restore previous selection, which clear it, and which
2109         select the whole control contents.
2110         
2111         Tests:
2112         fast/forms/focus-selection-input.html
2113         fast/forms/focus-selection-textarea.html
2114         
2115         * dom/Element.cpp:
2116         (WebCore::Element::focus):
2117         * dom/Element.h:
2118         * html/HTMLInputElement.cpp:
2119         (WebCore::HTMLInputElement::focus):
2120         (WebCore::HTMLInputElement::accessKeyAction):
2121         * html/HTMLInputElement.h:
2122         * html/HTMLLabelElement.cpp:
2123         (WebCore::HTMLLabelElement::focus):
2124         (WebCore::HTMLLabelElement::accessKeyAction):
2125         * html/HTMLLabelElement.h:
2126         * html/HTMLLegendElement.cpp:
2127         (WebCore::HTMLLegendElement::focus):
2128         * html/HTMLLegendElement.h:
2129         * html/HTMLTextAreaElement.cpp:
2130         (WebCore::HTMLTextAreaElement::focus):
2131         * html/HTMLTextAreaElement.h:
2132         * page/FocusController.cpp:
2133         (WebCore::FocusController::advanceFocus):
2134
2135 2007-03-08  Justin Garcia  <justin.garcia@apple.com>
2136
2137         Reviewed by harrison
2138
2139         <http://bugs.webkit.org/show_bug.cgi?id=12244>
2140         FCKeditor: Find dialog doesn't work
2141
2142         * bindings/js/kjs_window.cpp:
2143         (KJS::Window::find): Added.  This function doesn't yet 
2144         support whole word searches, searching in subframes, or
2145         opening the find dialog.
2146         (KJS::WindowFunc::callAsFunction):
2147         * bindings/js/kjs_window.h:
2148         (KJS::Window::):
2149
2150 2007-03-08  David Hyatt  <hyatt@apple.com>
2151
2152         Fix regression from throwing away frames of large animated images.  Alter
2153         animated images so that they refuse to advance the animation until the
2154         current displayed frame has been fully decoded.
2155
2156         Reviewed by ggaren
2157
2158         * platform/graphics/BitmapImage.cpp:
2159         (WebCore::BitmapImage::startAnimation):
2160         (WebCore::BitmapImage::advanceAnimation):
2161         * platform/graphics/ImageSource.h:
2162         * platform/graphics/cg/ImageSourceCG.cpp:
2163         (WebCore::ImageSource::frameIsCompleteAtIndex):
2164
2165 2007-03-08  David Hyatt  <hyatt@apple.com>
2166
2167         Fix 2% performance regression on the PLT.  Increase the large animated
2168         image cutoff from 1MB to 5MB.
2169
2170         In addition when pruning we will aggressively discard image sources.
2171
2172         Reviewed by ggaren
2173
2174         * platform/graphics/BitmapImage.cpp:
2175         (WebCore::BitmapImage::destroyDecodedData):
2176
2177 2007-03-08  Timothy Hatcher  <timothy@apple.com>
2178
2179         Reviewed by John.
2180
2181         <rdar://problem/4664697> highlighter SPI needs a node parameter to give more context
2182
2183         Pass the RenderObject's node to customHighlightLineRect and paintCustomHighlight.
2184
2185         * page/Frame.h:
2186         * page/mac/FrameMac.mm:
2187         (WebCore::Frame::customHighlightLineRect):
2188         (WebCore::Frame::paintCustomHighlight):
2189         * page/mac/WebCoreFrameBridge.h:
2190         * rendering/InlineTextBox.cpp:
2191         (WebCore::InlineTextBox::paintCustomHighlight):
2192         * rendering/RenderBox.cpp:
2193         (WebCore::RenderBox::paintCustomHighlight):
2194         * rendering/RootInlineBox.cpp:
2195         (WebCore::RootInlineBox::addHighlightOverflow):
2196         (WebCore::RootInlineBox::paintCustomHighlight):
2197
2198 2007-03-08  Justin Garcia  <justin.garcia@apple.com>
2199
2200         Reviewed by harrison
2201         
2202         <http://bugs.webkit.org/show_bug.cgi?id=13000>
2203         Range.createContextualFragment is not supported
2204
2205         * dom/Range.cpp:
2206         (WebCore::Range::createContextualFragment): The
2207         "startContainer" may not be a container, if the
2208         range starts inside text.  In that case, look
2209         to the parent of the start node for an HTMLElement.
2210
2211 2007-03-08  Justin Garcia  <justin.garcia@apple.com>
2212
2213         Reviewed by harrison
2214         
2215         <rdar://problem/5049671>
2216         Gmail Editor: With linked text, Remove Formatting doesn't always remove underline
2217
2218         * editing/Editor.cpp:
2219         (WebCore::Editor::removeFormattingAndStyle): Clear removed
2220         anchors after the deletion.
2221
2222 2007-03-08  David Kilzer  <ddkilzer@webkit.org>
2223
2224         Reviewed by NOBODY (build fix).
2225
2226         Added missing file for r20059:
2227         <rdar://problem/4708689> -- REGRESSION: Some symbols with 2-byte display as garbage in Hotmail.
2228
2229         File was taken from this svn repository which contained versions of ucnv.h and ucnv_err.h
2230         that were identical to ours:
2231         http://source.icu-project.org/repos/icu/icu/tags/release-3-2/source/common/unicode/ucnv_cb.h
2232
2233         * icu/unicode/ucnv_cb.h: Added.
2234
2235 2007-03-08  Shrikant Gangoda  <shrikant.gangoda@celunite.com>
2236
2237         Gdk build fix.
2238
2239         * platform/graphics/cairo/ImageSourceCairo.cpp:
2240         (WebCore::ImageSource::~ImageSource):
2241         (WebCore::ImageSource::clear):
2242
2243 2007-03-08  Oliver Hunt  <oliver@apple.com>
2244
2245         Reviewed by Adam.
2246
2247         To match old TEC behaviour when using ICU we need to use 
2248         a few manual fallback encodings for the GBK/EUC-CN charsets
2249
2250         <rdar://problem/4708689> -- REGRESSION: Some symbols with 2-byte display as garbage in Hotmail.
2251
2252         * platform/TextCodecICU.cpp:
2253         (WebCore::TextCodecICU::TextCodecICU):
2254         (WebCore::TextCodecICU::createICUConverter):
2255         (WebCore::gbkEscapes):
2256         (WebCore::gbkCallbackEscape):
2257         (WebCore::gbkCallbackSubstitute):
2258         (WebCore::TextCodecICU::encode):
2259         * platform/TextCodecICU.h:
2260         (WebCore::TextCodecICU::needsGBKFallbacks):
2261         (WebCore::TextCodecICU::setNeedsGBKFallbacks):
2262
2263 2007-03-08  Alexey Proskuryakov  <ap@webkit.org>
2264
2265         Build fix.
2266
2267         * xml/XPathUtil.cpp:
2268         (WebCore::XPath::stringValue):
2269
2270 2007-03-08  David Hyatt  <hyatt@apple.com>
2271
2272         This patch dramatically reduces the memory consumed by animated images.  For large animated GIFs (defined for
2273         now as >1mb in terms of decoded frame buffer size), we will now aggressively flush previous frames of the
2274         animated GIF and just re-decode them on the fly if the animation loops.
2275
2276         Whenever a large animated GIF has its animation reset, we will also just throw out everything and start
2277         the animation over (in order to get rid of any cached detritus held in the ImageSource).
2278
2279         With this patch and the sample GIF used to test, WebKit's memory consumption went from 160MB down to 16MB.
2280
2281         Reviewed by mjs
2282
2283         * platform/graphics/BitmapImage.cpp:
2284         (WebCore::BitmapImage::destroyDecodedData):
2285         (WebCore::BitmapImage::resetAnimation):
2286         (WebCore::BitmapImage::advanceAnimation):
2287         * platform/graphics/ImageSource.h:
2288         * platform/graphics/cg/ImageSourceCG.cpp:
2289         (WebCore::ImageSource::~ImageSource):
2290         (WebCore::ImageSource::clear):
2291
2292 2007-03-08  Alexey Proskuryakov  <ap@webkit.org>
2293
2294         Reviewed by Darin.
2295
2296         http://bugs.webkit.org/show_bug.cgi?id=13006
2297         XPath string-value is broken for some node types
2298
2299         Test: fast/xpath/string-value.html
2300
2301         * xml/XPathUtil.cpp:
2302         (WebCore::XPath::stringValue): Fix it :-)
2303
2304 2007-03-07  Anders Carlsson  <acarlsson@apple.com>
2305
2306         Reviewed by Adam.
2307
2308         <rdar://problem/4981000> 
2309         http://bugs.webkit.org/show_bug.cgi?id=12634
2310         REGRESSION: crash loading web archive (12634)
2311         
2312         The reason this bug wasn't always reproducible is that it involved sending an event to a plugin while 
2313         the page was loading. Before we send the event to the plugin we defer loads. The problem was that
2314         MainResourceLoader::setDefersLoad would not work with data loads.
2315         
2316         * loader/DocumentLoader.cpp:
2317         (WebCore::DocumentLoader::setRequest):
2318         Only set m_committed to false if we also have a valid unreachable URL.
2319         
2320         * loader/MainResourceLoader.cpp:
2321         (WebCore::MainResourceLoader::setDefersLoading):
2322         Make sure to stop and start data loads.
2323
2324 2007-03-07  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
2325
2326         Not reviewed.
2327
2328         Gdk build fixes.
2329
2330         * platform/gdk/EditorClientGdk.cpp:
2331         (WebCore::EditorClientGdk::handleKeypress): renamed
2332         (WebCore::EditorClientGdk::handleInputMethodKeypress): add a stub
2333         * platform/gdk/EditorClientGdk.h:
2334         * platform/graphics/cairo/ImageSourceCairo.cpp:
2335         (WebCore::ImageSource::destroyFrameAtIndex): add a stub
2336
2337 2007-03-07  Alexey Proskuryakov  <ap@webkit.org>
2338
2339         Reviewed by Darin.
2340
2341         http://bugs.webkit.org/show_bug.cgi?id=13004
2342         Repeatedly calling XPathExpression.evaluate() causes crashes or memory leaks
2343
2344         Removed XPath::Expression::optimize() and related methods, since they were buggy and almost useless.
2345         Merged doEvaluate() into evaluate(), since this was all evaluate() was doing after the above changes.
2346
2347         Test: fast/xpath/evaluate-twice.html
2348
2349         * xml/XPathExpression.cpp:
2350         (WebCore::XPathExpression::evaluate):
2351         * xml/XPathExpressionNode.cpp:
2352         (WebCore::XPath::Expression::Expression):
2353         (WebCore::XPath::Expression::~Expression):
2354         * xml/XPathExpressionNode.h:
2355         * xml/XPathFunctions.cpp:
2356         (WebCore::XPath::FunLast::evaluate):
2357         (WebCore::XPath::FunPosition::evaluate):
2358         (WebCore::XPath::FunId::evaluate):
2359         (WebCore::XPath::FunLocalName::evaluate):
2360         (WebCore::XPath::FunNamespaceURI::evaluate):
2361         (WebCore::XPath::FunName::evaluate):
2362         (WebCore::XPath::FunCount::evaluate):
2363         (WebCore::XPath::FunString::evaluate):
2364         (WebCore::XPath::FunConcat::evaluate):
2365         (WebCore::XPath::FunStartsWith::evaluate):
2366         (WebCore::XPath::FunContains::evaluate):
2367         (WebCore::XPath::FunSubstringBefore::evaluate):
2368         (WebCore::XPath::FunSubstringAfter::evaluate):
2369         (WebCore::XPath::FunSubstring::evaluate):
2370         (WebCore::XPath::FunStringLength::evaluate):
2371         (WebCore::XPath::FunNormalizeSpace::evaluate):
2372         (WebCore::XPath::FunTranslate::evaluate):
2373         (WebCore::XPath::FunBoolean::evaluate):
2374         (WebCore::XPath::FunNot::evaluate):
2375         (WebCore::XPath::FunTrue::evaluate):
2376         (WebCore::XPath::FunLang::evaluate):
2377         (WebCore::XPath::FunFalse::evaluate):
2378         (WebCore::XPath::FunNumber::evaluate):
2379         (WebCore::XPath::FunSum::evaluate):
2380         (WebCore::XPath::FunFloor::evaluate):
2381         (WebCore::XPath::FunCeiling::evaluate):
2382         (WebCore::XPath::FunRound::evaluate):
2383         * xml/XPathPath.cpp:
2384         (WebCore::XPath::Filter::evaluate):
2385         (WebCore::XPath::LocationPath::evaluate):
2386         (WebCore::XPath::Path::evaluate):
2387         * xml/XPathPath.h:
2388         * xml/XPathPredicate.cpp:
2389         (WebCore::XPath::Number::evaluate):
2390         (WebCore::XPath::StringExpression::evaluate):
2391         (WebCore::XPath::Negative::evaluate):
2392         (WebCore::XPath::NumericOp::evaluate):
2393         (WebCore::XPath::EqTestOp::evaluate):
2394         (WebCore::XPath::LogicalOp::evaluate):
2395         (WebCore::XPath::Union::evaluate):
2396         * xml/XPathPredicate.h:
2397         * xml/XPathStep.cpp:
2398         * xml/XPathStep.h:
2399         * xml/XPathVariableReference.cpp:
2400         (WebCore::XPath::VariableReference::evaluate):
2401         * xml/XPathVariableReference.h:
2402
2403 2007-03-07  Sam Weinig  <sam@webkit.org>
2404
2405         Reviewed by Tim H.
2406
2407         Remove unused #import from Objective-C bindings and cleanup the order of #imports.
2408
2409         * bindings/scripts/CodeGeneratorObjC.pm:
2410
2411 2007-03-07  Sam Weinig  <sam@webkit.org>
2412
2413         Reviewed by Tim H.
2414
2415         Make sure the baseURI attribute generates for private Objective-C bindings.
2416
2417         * dom/Node.idl:
2418
2419 2007-03-07  Anders Carlsson  <acarlsson@apple.com>
2420
2421         Reviewed by Maciej.
2422
2423         <rdar://problem/4874059>
2424         REGRESSION: Painter IX:register - Crash in WebCore:: ResourceLoader::willSendRequest()
2425
2426         If a load is done from inside of an error delegate method that is called because we cancel another load, 
2427         the first load should be ignored since this is what shipping WebKit does. 
2428         
2429         (Actually, it does load the page in the data source but doesn't do anything with it since the data source
2430         won't have a web frame).
2431         
2432         * loader/FrameLoader.cpp:
2433         (WebCore::FrameLoader::load):
2434         Just bail out if m_isStoppingLoad is true.
2435
2436 2007-03-07  David Hyatt  <hyatt@apple.com>
2437
2438         Use CGImageRelease instead of CFRelease.
2439
2440         Reviewed by aroben
2441
2442         * platform/graphics/cg/ImageCG.cpp:
2443         (WebCore::FrameData::clear):
2444         * platform/graphics/cg/ImageSourceCG.cpp:
2445         (WebCore::ImageSource::destroyFrameAtIndex):
2446
2447 2007-03-07  David Hyatt  <hyatt@apple.com>
2448
2449         Fix a regression where the cache size overflows because of a double
2450         subtraction per resource when they got removed from the cache.  Add an
2451         assert to adjustSize to detect this case in the future.
2452
2453         Fix ImageSourceCG so that when we flush decoded data from our cache that
2454         we also flush it from the ImageSource.
2455
2456         Reviewed by mjs
2457
2458         * loader/Cache.cpp:
2459         (WebCore::Cache::adjustSize):
2460         * platform/graphics/BitmapImage.cpp:
2461         (WebCore::BitmapImage::~BitmapImage):
2462         (WebCore::BitmapImage::destroyDecodedData):
2463         * platform/graphics/Image.h:
2464         * platform/graphics/ImageSource.h:
2465         * platform/graphics/cg/ImageSourceCG.cpp:
2466         (WebCore::ImageSource::setData):
2467         (WebCore::ImageSource::destroyFrameAtIndex):
2468
2469 2007-03-07  Mitz Pettel  <mitz@webkit.org>
2470
2471         Reviewed by Darin.
2472
2473         - fix http://bugs.webkit.org/show_bug.cgi?id=13002
2474           Incomplete repaint of inset outlines
2475
2476         Test: fast/repaint/outline-inset.html
2477
2478         * rendering/RenderObject.cpp:
2479         (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
2480
2481 2007-03-07  Oliver Hunt  <oliver@apple.com>
2482
2483         Reviewed by Antti.
2484
2485         Reset mouse down/drag state variables on mouse button release
2486         
2487         Fixes <rdar://problem/5044654>: Drag out of some QuickTime plug-ins converting into image drag
2488
2489         * page/EventHandler.cpp:
2490         (WebCore::EventHandler::handleMouseReleaseEvent):
2491
2492 2007-03-07  Adele Peterson  <adele@apple.com>
2493
2494         Reviewed by Darin.
2495
2496         WebCore part of fix for:
2497         http://bugs.webkit.org/show_bug.cgi?id=10871
2498         http://bugs.webkit.org/show_bug.cgi?id=12677
2499         <rdar://problem/4823129> REGRESSION: IME key events different in nightly
2500         <rdar://problem/4759563> REGRESSION: Return key is always sent when you confirm a clause in kotoeri
2501
2502         * page/EventHandler.cpp: (WebCore::EventHandler::defaultKeyboardEventHandler): Call handleInputMethodKeypress before actually dispatching the keypress event
2503           so that input methods have a chance to handle the event.  
2504           If the input method handles the event (by marking or unmarking text), then we don't need to send the keypress event.
2505           If an input method doesn't handle the event, then we'll save the data we need to perform the correct action (like what text to insert or what selector to use) 
2506           when we dispatch the keypress event.
2507
2508         * dom/KeyboardEvent.h: Added Mac-specific KeypressCommand struct, so we can store command info during handleInputMethodKeypress, and use it during handleKeypress.
2509         (WebCore::KeyboardEvent::keypressCommand):
2510         (WebCore::KeyboardEvent::setKeypressCommand):
2511
2512         * bridge/EditorClient.h:
2513         * editing/Editor.cpp:
2514         (WebCore::Editor::handleKeypress): Changed handleKeyPress to handleKeypress.
2515         (WebCore::Editor::handleInputMethodKeypress): Added.
2516         * editing/Editor.h:
2517
2518         * platform/graphics/svg/SVGImageEmptyClients.h:
2519         (WebCore::SVGEmptyEditorClient::handleKeypress): Changed handleKeyPress to handleKeypress.
2520         (WebCore::SVGEmptyEditorClient::handleInputMethodKeypress): Added.
2521
2522 2007-03-07  Rob Buis  <buis@kde.org>
2523
2524         Reviewed by Darin.
2525
2526         http://bugs.webkit.org/show_bug.cgi?id=12579
2527         WebKit fails SVG xml:base test
2528
2529         Implement DOM3 properties baseURI and documentURI to fix
2530         the testcase in bug 12579.
2531
2532         * bindings/js/kjs_dom.cpp:
2533         (KJS::DOMNode::getValueProperty):
2534         * bindings/js/kjs_domnode.h:
2535         (KJS::DOMNode::):
2536         * dom/Document.cpp:
2537         (WebCore::Document::documentURI):
2538         (WebCore::Document::setDocumentURI):
2539         (WebCore::Document::baseURI):
2540         * dom/Document.h:
2541         * dom/Document.idl:
2542         * dom/DocumentType.cpp:
2543         (WebCore::DocumentType::baseURI):
2544         * dom/DocumentType.h:
2545         * dom/Element.cpp:
2546         (WebCore::Element::baseURI):
2547         * dom/Element.h:
2548         * dom/Node.cpp:
2549         (WebCore::Node::baseURI):
2550         * dom/Node.h:
2551         * ksvg2/misc/SVGImageLoader.cpp:
2552         (WebCore::SVGImageLoader::updateFromElement):
2553         * ksvg2/svg/SVGImageElement.cpp:
2554         (WebCore::SVGImageElement::parseMappedAttribute):
2555         (WebCore::SVGImageElement::attach):
2556
2557 2007-03-07  Anders Carlsson  <acarlsson@apple.com>
2558
2559         Reviewed by Brady.
2560
2561         Remove some methods in FrameLoader that just calls down to the active document loader. Since each
2562         resource loader now has a pointer to its document loader, we can just call directly to the
2563         document loader.
2564
2565         * WebCore.exp:
2566         * loader/FrameLoader.cpp:
2567         * loader/FrameLoader.h:
2568         * loader/MainResourceLoader.cpp:
2569         (WebCore::MainResourceLoader::willSendRequest):
2570         (WebCore::MainResourceLoader::didReceiveResponse):
2571         * loader/SubresourceLoader.cpp:
2572         (WebCore::SubresourceLoader::SubresourceLoader):
2573         (WebCore::SubresourceLoader::didFinishLoading):
2574         (WebCore::SubresourceLoader::didFail):
2575         (WebCore::SubresourceLoader::didCancel):
2576         * loader/mac/NetscapePlugInStreamLoaderMac.mm:
2577         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
2578         (WebCore::NetscapePlugInStreamLoader::didFail):
2579         (WebCore::NetscapePlugInStreamLoader::didCancel):
2580
2581 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
2582
2583         Reviewed by Maciej Stachowiak.
2584         
2585         Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
2586         PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
2587         
2588         No test because this is very difficult to repro, and the new ASSERTs in 
2589         JavaScriptCore catch the underlying cause while running normal layout tests.
2590         
2591         This is a modified version of r14752 on the branch.
2592         
2593         The fix is to use a bit inside each node, instead of a hash table, to track 
2594         which node subtrees are in the process of being marked. This avoids a call 
2595         to malloc inside mark().
2596         
2597         * bindings/js/kjs_binding.cpp:
2598         (KJS::domObjects):
2599         (KJS::domNodesPerDocument):
2600         * bindings/js/kjs_dom.cpp:
2601         (KJS::DOMNode::mark):
2602         * dom/Node.cpp:
2603         (WebCore::Node::Node):
2604         * dom/Node.h:
2605
2606 2007-03-06  David Hyatt  <hyatt@apple.com>
2607
2608         This patch reworks the WebCore memory cache to significantly reduce the amount of memory consumed by
2609         images in the cache and to enhance the accuracy of the cache size as an absolute bound for the objects
2610         contained within it.  WebCore's memory use over time should significantly improve as a result of these
2611         changes.
2612
2613         Cached resources now have both an encoded size (the original data stream) and a decoded size (an estimate of
2614         the amount of memory consumed by an expanded version of that resource, e.g., the decoded frames of an image).
2615         Both sizes now count towards the total size of the object and towards the allowed memory cache total.
2616
2617         By including both totals the reported size of resources will now be larger, and the cache will therefore become
2618         much more aggressive about flushing.
2619
2620         Objects are stored in size-adjusted and popularity-aware LRU lists as before, but encoded size is now always
2621         used when determining the correct LRU list.
2622
2623         The flush algorithm for the memory cache has been rewritten to first destroy decoded data before evicting
2624         resources.  By being able to compact its resources without evicting them, the memory cache can now hold many more
2625         unique resources (encoded) in the same amount of space.  Depending on how much of a hit we want to take from
2626         re-decoding images, the memory cache could in theory have its size significantly reduced now while still holding
2627         more resources than it did at the larger size!
2628
2629         Reviewed by mjs
2630
2631         * WebCore.xcodeproj/project.pbxproj:
2632         * loader/Cache.cpp:
2633         (WebCore::Cache::requestResource):
2634         (WebCore::Cache::prune):
2635         (WebCore::Cache::remove):
2636         (WebCore::Cache::lruListFor):
2637         (WebCore::Cache::adjustSize):
2638         * loader/Cache.h:
2639         * loader/CachedCSSStyleSheet.cpp:
2640         (WebCore::CachedCSSStyleSheet::data):
2641         * loader/CachedImage.cpp:
2642         (WebCore::CachedImage::CachedImage):
2643         (WebCore::CachedImage::allReferencesRemoved):
2644         (WebCore::CachedImage::clear):
2645         (WebCore::CachedImage::data):
2646         (WebCore::CachedImage::destroyDecodedData):
2647         (WebCore::CachedImage::decodedSize):
2648         (WebCore::CachedImage::decodedSizeChanged):
2649         (WebCore::CachedImage::shouldPauseAnimation):
2650         * loader/CachedImage.h:
2651         * loader/CachedResource.cpp:
2652         (WebCore::CachedResource::CachedResource):
2653         (WebCore::CachedResource::deref):
2654         (WebCore::CachedResource::setEncodedSize):
2655         * loader/CachedResource.h:
2656         (WebCore::CachedResource::allReferencesRemoved):
2657         (WebCore::CachedResource::size):
2658         (WebCore::CachedResource::encodedSize):
2659         (WebCore::CachedResource::decodedSize):
2660         (WebCore::CachedResource::destroyDecodedData):
2661         * loader/CachedScript.cpp:
2662         (WebCore::CachedScript::data):
2663         * loader/CachedXSLStyleSheet.cpp:
2664         (WebCore::CachedXSLStyleSheet::data):
2665         * platform/graphics/BitmapImage.cpp:
2666         (WebCore::BitmapImage::BitmapImage):
2667         (WebCore::BitmapImage::~BitmapImage):
2668         (WebCore::BitmapImage::destroyDecodedData):
2669         (WebCore::BitmapImage::pruneDecodedDataIfNeeded):
2670         (WebCore::BitmapImage::cacheFrame):
2671         (WebCore::BitmapImage::setNativeData):
2672         (WebCore::BitmapImage::shouldAnimate):
2673         (WebCore::BitmapImage::advanceAnimation):
2674         * platform/graphics/BitmapImage.h:
2675         (WebCore::BitmapImage::decodedSize):
2676         * platform/graphics/Image.cpp:
2677         (WebCore::Image::Image):
2678         * platform/graphics/Image.h:
2679         (WebCore::Image::destroyDecodedData):
2680         (WebCore::Image::decodedSize):
2681         (WebCore::Image::imageObserver):
2682         * platform/graphics/ImageAnimationObserver.h: Removed.
2683         * platform/graphics/ImageObserver.h: Added.
2684         (WebCore::ImageObserver::~ImageObserver):
2685         * platform/graphics/svg/SVGImage.cpp:
2686         (WebCore::SVGImage::SVGImage):
2687         * platform/graphics/svg/SVGImage.h:
2688
2689 2007-03-06  Alexey Proskuryakov  <ap@webkit.org>
2690
2691         Reviewed by Sam Weinig.
2692
2693         http://bugs.webkit.org/show_bug.cgi?id=12987
2694         Fix and import 4XPath test_numeric_expr.html
2695
2696         * xml/XPathPredicate.cpp:
2697         (WebCore::XPath::Negative::doEvaluate): Convert the argument to number.
2698         (WebCore::XPath::NumericOp::doEvaluate): Convert the arguments to numbers. Use a correct operation for mod.
2699         * xml/XPathStep.cpp:
2700         (WebCore::XPath::Step::nodesInAxis): Do not append parent node if there is none.
2701         * xml/XPathValue.cpp:
2702         (WebCore::XPath::Value::toNumber): Do not convert to DeprecatedString just to trim whitespace and to convert to double.
2703         * platform/DeprecatedString.cpp:
2704         (WebCore::DeprecatedStringData::makeAscii): Added a FIXME about unreliable makeAscii() behavior.
2705
2706 2007-03-06  Maciej Stachowiak  <mjs@apple.com>
2707
2708         Reviewed by Adele.
2709
2710         <rdar://problem/4619663> REGRESSION (NativePopup): Popup menu doesn't draw at the correct vertical position (9816)
2711         
2712         * platform/mac/PopupMenuMac.mm:
2713         (WebCore::PopupMenu::show): Make a temporary dummy view with the
2714         passed in rect, since AppKit will use the view bounds to determine
2715         what area to exclude when popping up a menu moved to the top of
2716         the screen.
2717
2718 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
2719
2720         Reviewed by Maciej Stachowiak.
2721
2722         Fixed all known crashers exposed by run-webkit-tests --threaded [*]. See 
2723         JavaScriptCore ChangeLog for more details.
2724
2725         * bindings/js/kjs_binding.cpp:
2726         (KJS::domNodesPerDocument): Added thread safety ASSERT.
2727         (KJS::ScriptInterpreter::mark): Removed obsolete logic for marking unsafe
2728         objects when collecting on a secondary thread. The Collector takes care
2729         of this now.
2730
2731         * bindings/js/kjs_binding.h:
2732         (KJS::DOMObject::DOMObject): Used new API for specifying that WebCore
2733         objects should be garbage collected on the main thread only.
2734
2735         * bindings/js/kjs_window.cpp:
2736         (KJS::ScheduledAction::execute): Moved JSLock to cover implementedsCall() call,
2737         which, for some subclasses, ends up allocating garbage collected objects.
2738         (This fix was speculative. I didn't actually see a crash from this.)
2739         (KJS::Window::timerFired): Added JSLock around ScheduleAction destruction,
2740         since it destroys a KJS::List.
2741
2742         * bindings/objc/WebScriptObject.mm:
2743         (-[WebScriptObject setException:]): Added JSLock. (This fix was speculative. 
2744         I didn't actually see a crash from this.)
2745
2746         * bridge/mac/WebCoreScriptDebugger.mm:
2747         (-[WebCoreScriptCallFrame evaluateWebScript:]): Added JSLock. (This fix 
2748         was speculative. I didn't actually see a crash from this.)
2749
2750         * dom/Document.cpp:
2751         (WebCore::Document::~Document): Added JSLock around modification to 
2752         domNodesPerDocument(), which can be accessed concurrently during garbage 
2753         collection.
2754         * dom/Node.cpp:
2755         (WebCore::Node::setDocument): ditto.
2756         
2757         [*] fast/js/toString-stack-overflow.html is an exception. --threaded mode
2758         crashes this test because it causes the garbage collector to run frequently,
2759         and this test crashes if you happen to garbage collect while it's running.
2760         This is a known issue with stack overflow during the mark phase. It's
2761         not related to threading.
2762
2763 2007-03-06  Mark Rowe  <mrowe@apple.com>
2764
2765         Reviewed by Sam Weinig.
2766
2767         Fix http://bugs.webkit.org/show_bug.cgi?id=12942
2768         Bug 12942: ASSERTION FAILURE: qantas.com.au changing selected item in <select> via JS
2769
2770         Test: fast/dom/select-selectedIndex-bug-12942.html.
2771
2772         * html/HTMLSelectElement.cpp:
2773         (WebCore::HTMLSelectElement::recalcListItems): Reset m_lastOnChangeIndex when recalculating list items.
2774         * html/HTMLSelectElement.h:
2775
2776 2007-03-06  Brady Eidson  <beidson@apple.com>
2777
2778         Rubberstamped by Kevin Decker
2779
2780         20,000!
2781
2782         * ChangeLog: Point out revision 20,000
2783
2784 2007-03-06  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
2785
2786         Not reviewed.
2787
2788         Gdk build fix.
2789
2790         * loader/gdk/FrameLoaderClientGdk.cpp: update userAgent() signature.
2791         (WebCore::FrameLoaderClientGdk::userAgent):
2792         * loader/gdk/FrameLoaderClientGdk.h: ditto.
2793
2794 2007-03-06  Mitz Pettel  <mitz@webkit.org>
2795
2796         Reviewed by Adele.
2797
2798         - fix http://bugs.webkit.org/show_bug.cgi?id=12986
2799           REGRESSION(NativeListBox): Listboxes not updated when resized dynamically
2800
2801         Test: fast/forms/select-change-listbox-size.html
2802
2803         * html/HTMLSelectElement.cpp:
2804         (WebCore::HTMLSelectElement::parseMappedAttribute): Reattach on list box size change.
2805
2806 2007-03-06  Mitz Pettel  <mitz@webkit.org>
2807
2808         Reviewed by Dave Hyatt.
2809
2810         - fix http://bugs.webkit.org/show_bug.cgi?id=12885
2811           REGRESSION (r19696): Incomplete background repaint
2812
2813         Tests: fast/repaint/content-into-overflow.html
2814                fast/repaint/overflow-into-content.html
2815
2816         Changed repaintAfterLayoutIfNeeded() to take, in addition to the clipped overflow
2817         rect, the unclipped border box plus outline, and to repaint any areas that
2818         were added or removed from that box, in addition to any areas added or removed
2819         from the clipped overflow rect.
2820
2821         * platform/graphics/svg/SVGResourceMarker.cpp:
2822         (WebCore::SVGResourceMarker::draw):
2823         * rendering/RenderBlock.cpp:
2824         (WebCore::RenderBlock::layoutBlock):
2825         * rendering/RenderBox.cpp:
2826         (WebCore::RenderBox::absoluteClippedOverflowRect): Renamed getAbsoluteRepaintRect() to
2827         this.
2828         * rendering/RenderBox.h:
2829         * rendering/RenderFlexibleBox.cpp:
2830         (WebCore::RenderFlexibleBox::layoutBlock):
2831         * rendering/RenderFlow.cpp:
2832         (WebCore::RenderFlow::absoluteClippedOverflowRect):
2833         * rendering/RenderFlow.h:
2834         * rendering/RenderForeignObject.cpp:
2835         (WebCore::RenderForeignObject::layout):
2836         * rendering/RenderHTMLCanvas.cpp:
2837         (WebCore::RenderHTMLCanvas::layout):
2838         * rendering/RenderImage.cpp:
2839         (WebCore::RenderImage::layout):
2840         * rendering/RenderLayer.cpp:
2841         (WebCore::RenderLayer::RenderLayer):
2842         (WebCore::RenderLayer::checkForRepaintOnResize):
2843         (WebCore::RenderLayer::updateLayerPositions):
2844         * rendering/RenderLayer.h:
2845         * rendering/RenderObject.cpp:
2846         (WebCore::RenderObject::repaint):
2847         (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
2848         (WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
2849         (WebCore::RenderObject::absoluteClippedOverflowRect):
2850         (WebCore::RenderObject::absoluteOutlineBox):
2851         * rendering/RenderObject.h:
2852         * rendering/RenderPath.cpp:
2853         (WebCore::RenderPath::layout):
2854         (WebCore::RenderPath::absoluteClippedOverflowRect):
2855         (WebCore::RenderPath::absoluteRects):
2856         (WebCore::RenderPath::drawMarkersIfNeeded):
2857         * rendering/RenderPath.h:
2858         * rendering/RenderSVGContainer.cpp:
2859         (WebCore::RenderSVGContainer::layout):
2860         (WebCore::RenderSVGContainer::absoluteClippedOverflowRect):
2861         (WebCore::RenderSVGContainer::absoluteRects):
2862         * rendering/RenderSVGContainer.h:
2863         * rendering/RenderSVGHiddenContainer.cpp:
2864         (WebCore::RenderSVGHiddenContainer::absoluteClippedOverflowRect):
2865         * rendering/RenderSVGHiddenContainer.h:
2866         * rendering/RenderSVGImage.cpp:
2867         (WebCore::RenderSVGImage::imageChanged):
2868         (WebCore::RenderSVGImage::absoluteClippedOverflowRect):
2869         (WebCore::RenderSVGImage::absoluteRects):
2870         * rendering/RenderSVGImage.h:
2871         * rendering/RenderSVGText.cpp:
2872         (WebCore::RenderSVGText::absoluteClippedOverflowRect):
2873         (WebCore::RenderSVGText::layout):
2874         (WebCore::RenderSVGText::absoluteRects):
2875         * rendering/RenderSVGText.h:
2876         * rendering/RenderTable.cpp:
2877         (WebCore::RenderTable::layout):
2878         * rendering/RenderTableCell.cpp:
2879         (WebCore::RenderTableCell::absoluteClippedOverflowRect):
2880         * rendering/RenderTableCell.h:
2881         * rendering/RenderTableCol.cpp:
2882         (WebCore::RenderTableCol::absoluteClippedOverflowRect):
2883         * rendering/RenderTableCol.h:
2884         * rendering/RenderTableRow.cpp:
2885         (WebCore::RenderTableRow::absoluteClippedOverflowRect):
2886         * rendering/RenderTableRow.h:
2887         * rendering/RenderText.cpp:
2888         (WebCore::RenderText::absoluteClippedOverflowRect):
2889         * rendering/RenderText.h:
2890
2891 2007-03-06  Ian Eng <ian.eng.webkit@gmail.com>
2892
2893         Reviewed by Maciej.
2894
2895         - fixed http://bugs.webkit.org/show_bug.cgi?id=12720
2896         Bug 12720: Re-defining window.location.toString function keeps re-loading forever
2897
2898         * bindings/js/kjs_window.cpp:
2899         Disallow replacing functions in LocationTable, and return early without updating URL.
2900
2901 2007-03-06  Kevin McCullough  <kmccullough@apple.com>
2902
2903         Reviewed by Darin.
2904
2905         <http://bugs.webkit.org/show_bug.cgi?id=12686>
2906         REGRESSION: Bloglines.com Feeds tab cannot expand folders in TOT
2907         - Now all class constructors implement implementsHasInstance.
2908
2909         * bindings/scripts/CodeGeneratorJS.pm:
2910
2911 2007-03-07  Nikolas Zimmermann  <zimmermann@kde.org>
2912
2913         Reviewed by Rob & Oliver.
2914
2915         Preparations for the new SVG text engine.
2916
2917         Handle baseline-shift / kerning css values correctly.
2918         Recognize missing svg presentation attribute "font-size-adjust".
2919         Add all missing svg<->css property mappings in mapToEntry().
2920
2921         Doesn't affect any layout test (as these properties are not used w/o my text patch).
2922         While I'm at it, unify the macro names (RS_ -> SVG_RS_) & cleanup style a bit.
2923
2924         * ksvg2/css/CSSPropertyNames.in:
2925         * ksvg2/css/SVGCSSParser.cpp:
2926         (WebCore::CSSParser::parseSVGValue):
2927         * ksvg2/css/SVGCSSStyleSelector.cpp:
2928         (WebCore::CSSStyleSelector::applySVGProperty):
2929         * ksvg2/css/SVGRenderStyle.cpp:
2930         (WebCore::SVGRenderStyle::SVGRenderStyle):
2931         (WebCore::SVGRenderStyle::operator==):
2932         (WebCore::SVGRenderStyle::inheritedNotEqual):
2933         (WebCore::SVGRenderStyle::inheritFrom):
2934         * ksvg2/css/SVGRenderStyle.h:
2935         (WebCore::SVGRenderStyle::NonInheritedFlags::):
2936         (WebCore::SVGRenderStyle::setBitDefaults):
2937         * ksvg2/css/SVGRenderStyleDefs.cpp:
2938         (StyleTextData::StyleTextData):
2939         (StyleTextData::operator==):
2940         (StyleMiscData::StyleMiscData):
2941         (StyleMiscData::operator==):
2942         * ksvg2/css/SVGRenderStyleDefs.h:
2943         (WebCore::):
2944         (WebCore::StyleTextData::operator!=):
2945         * ksvg2/svg/SVGStyledElement.cpp:
2946         (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName):
2947
2948 2007-03-06  Justin Garcia  <justin.garcia@apple.com>
2949
2950         Reviewed by kevin
2951         
2952         <http://bugs.webkit.org/show_bug.cgi?id=12245>
2953         FCKeditor: Remove Format sometimes doesn't work
2954         <rdar://problem/4786404>
2955         Underline style is not removed from selection after performing Remove Format
2956
2957         * editing/Editor.cpp:
2958         (WebCore::Editor::removeFormattingAndStyle): Re-wrote this.
2959
2960 2007-03-07  Nikolas Zimmermann  <zimmermann@kde.org>
2961
2962         Reviewed by Oliver.
2963
2964         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12979
2965         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12981
2966
2967         Guard against registering pending resources with empty id.
2968         Be careful with calling recalcStyle() in SVGUseElement, when change is "Detach" we
2969         have to use special code, as calling attach() on the shadow tree root element will crash,
2970         because it has no (direct) parent node, only a shadow parent node element.
2971
2972         * ksvg2/misc/SVGDocumentExtensions.cpp:
2973         (WebCore::SVGDocumentExtensions::addPendingResource):
2974         * ksvg2/svg/SVGUseElement.cpp:
2975         (WebCore::SVGUseElement::recalcStyle):
2976
2977 2007-03-06  Kevin Decker  <kdecker@apple.com>
2978
2979         Reviewed by Adele.
2980
2981         Fixed: <rdar://problem/5041660> REGRESSION: <keygen> element broken, prevents users from signing up for Thawte email certs
2982         
2983         * bindings/objc/DOM.mm:
2984         (WebCore::createElementClassMap): Added <keygen> to the DOM bindings so it can be accessed from Objective-C.
2985         * css/html4.css: Apply the look of the <select> element to <keygen>.
2986         * html/HTMLElementFactory.cpp:
2987         (WebCore::keygenConstructor): Added. 
2988         (WebCore::createFunctionMap): Added keygen.
2989         * html/HTMLSelectElement.cpp: Made const typeAheadTimeout variable static const. 
2990         (WebCore::HTMLSelectElement::HTMLSelectElement):  Fix both HTMLSelectElement constructors to initialize the
2991          same number of member variables. The fact that some fields were not initialized could (and would) crash the
2992          keygen element when selecting different items. Also removed m_typedString(String()) from the constructor
2993          initialization because this is not needed.
2994
2995 2007-03-06  Kevin McCullough  <kmccullough@apple.com>
2996
2997         Reviewed by Darin.
2998
2999         - Rename a function to clarify its purpose.
3000
3001         * WebCore.exp:
3002         * loader/FrameLoader.cpp:
3003         (WebCore::FrameLoader::registerURLSchemeAsLocal):
3004         * loader/FrameLoader.h:
3005
3006 2007-03-06  Adam Roben  <aroben@apple.com>
3007
3008         Build fix.
3009
3010         * WebCore.exp: Updated symbols.
3011
3012 2007-03-06  Adam Roben  <aroben@apple.com>
3013
3014         Reviewed by Anders.
3015
3016         Added a parameter to all StringTruncator methods to specify whether
3017         rounding hacks should be on or off.
3018
3019         No layout test possible.
3020
3021         * platform/StringTruncator.cpp:
3022         (WebCore::stringWidth): Added disableRoundingHacks parameter.
3023         (WebCore::truncateString): Ditto.
3024         (WebCore::StringTruncator::centerTruncate): Ditto.
3025         (WebCore::StringTruncator::rightTruncate): Ditto.
3026         (WebCore::StringTruncator::width): Ditto.
3027         * platform/StringTruncator.h: Ditto.
3028         * platform/mac/FileChooserMac.mm:
3029         (WebCore::FileChooser::basenameForWidth): Pass in false to
3030         centerTruncate so that the truncation matches the way the text will be
3031         rendered.
3032
3033 2007-03-06  Anders Carlsson  <acarlsson@apple.com>
3034
3035         Reviewed by Maciej.
3036
3037         <rdar://problem/5035045>
3038         REGRESSION: WebKit browser doesn't display image at http://www.metoffice.gov.uk/weather/satellite/index.html
3039         
3040         It turns out WinIE does allow you to access images by their id as special document properties. However, this is only
3041         allowed when the element also has a name attribute. The value of the name attribute is ignored and can even be empty!
3042         
3043         * bindings/js/kjs_html.cpp:
3044         (KJS::JSHTMLDocument::namedItemGetter):
3045         Return jsUndefined() if the collection is empty.
3046         
3047         * html/HTMLImageElement.cpp:
3048         (WebCore::HTMLImageElement::parseMappedAttribute):
3049         (WebCore::HTMLImageElement::insertedIntoDocument):
3050         (WebCore::HTMLImageElement::removedFromDocument):
3051         * html/HTMLImageElement.h:
3052         Add the id attribute value to the extra named item map.
3053         
3054         * html/HTMLNameCollection.cpp:
3055         (WebCore::HTMLNameCollection::traverseNextItem):
3056         Check for images with name attributes that match, as well as elements with id attributes that match where
3057         the element also has a name attribute.
3058
3059 2007-03-06  Anders Carlsson  <acarlsson@apple.com>
3060
3061         Reviewed by Adam.
3062
3063         WebCore part of patch to make it possible to have different user agents for different URLs.
3064
3065         * bindings/js/kjs_navigator.cpp:
3066         (KJS::Navigator::getValueProperty):
3067         * bindings/js/kjs_proxy.cpp:
3068         (WebCore::KJSProxy::initScriptIfNeeded):
3069         * loader/DocumentLoader.cpp:
3070         (WebCore::DocumentLoader::setLoading):
3071         * loader/FrameLoader.cpp:
3072         (WebCore::FrameLoader::userAgent):
3073         (WebCore::FrameLoader::loadResourceSynchronously):
3074         (WebCore::FrameLoader::applyUserAgent):
3075         * loader/FrameLoader.h:
3076         * loader/FrameLoaderClient.h:
3077         * platform/graphics/svg/SVGImageEmptyClients.h:
3078         (WebCore::SVGEmptyFrameLoaderClient::userAgent):
3079
3080 2007-03-05  Kevin McCullough  <kmccullough@apple.com>
3081
3082         Reviewed by Mark and Dave H.
3083
3084         - rdar://problem/5038491
3085         An oversight of the security fix that prevented remote from loading local is that it
3086         prevents user style sheets when the site is remote.  This fixes that.
3087
3088         * loader/Cache.cpp: Propogate and check user style sheet flag.
3089         (WebCore::createResource):
3090         (WebCore::Cache::requestResource):
3091         * loader/Cache.h: Propogate user style sheet flag.
3092         * loader/CachedCSSStyleSheet.cpp: Propogate user style sheet flag.
3093         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
3094         * loader/CachedCSSStyleSheet.h: Propogate user style sheet flag.
3095         * loader/DocLoader.cpp: Propogate user style sheet flag.
3096         (WebCore::DocLoader::requestResource):
3097         * loader/SubresourceLoader.cpp: Propogate and check user style sheet flag.
3098         (WebCore::SubresourceLoader::create):
3099         * loader/SubresourceLoader.h: Add check for user style sheet flag.
3100         * loader/loader.cpp: Propogate user style sheet flag.
3101         (WebCore::Loader::load):
3102         (WebCore::Loader::servePendingRequests):
3103         * loader/loader.h: Propogate user style sheet flag.
3104
3105 2007-03-06  Nikolas Zimmermann  <zimmermann@kde.org>
3106
3107         Reviewed by Darin.
3108
3109         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12936 (Master bug used to track all current use problems.)
3110
3111         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12926 (transform attribute not respected in nested <use> elements)
3112         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12267 (getElementById broken for <use>)
3113         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12916 (use instance in symbol definition does not work)
3114         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12917 (mouseout event does not occur after scaling use instance)
3115         Fixes: http://bugs.webkit.org/show_bug.cgi?id=12838 (SVG <use> DOM broken for script)
3116
3117         Added test: svg/custom/use-nested-transform.svg
3118         Added test: svg/custom/struct-use-09-b.svg (not yet official W3C-SVG-1.1 testcase)
3119         Fixes test: svg/custom/use-elementInstance-event-target.svg (rectangle now turns green on first click)
3120
3121         Fix all (except one) known <use> bug. The remaining bug (12630) is not crucical at all.
3122         Enable <use> again as default SVG feature, as discussed on webkit-dev.
3123
3124         dom/Element.cpp needed following tweak: set hasParentStyle to true, if there is no parentNode
3125         available - which happens for <use> nodes, as it's a shadow node. This fixes recalcStyle behaviour.
3126         Override recalcStyle() in SVGUseElement, and properly forward the call to the shadow tree root element.
3127         The shadow tree now receives proper style updates (without having to recreate the whole tree!).
3128
3129         Override attributeChanged() in SVGUseElement and only call notifyAttributeChange if one of x/y/width/height/xlink:href
3130         attribute changed - otherwhise we'll end up recreating the tree for every transform/style/(non-existing-attribute) change.
3131
3132         Do not override transform in nested use situations, but correctly append (right-sided) the translation of the <use> element.
3133         Some cosmetic fixes: don't add transform="translate(0 0)" attributes if both x/y values are null in the shadow tree.
3134
3135         Factor out logic for replacing symbol/svg tags in the shadow tree, and also invoke it during expandUseElementsInShadowTree -
3136         otherwhise <symbol><use xlink:href="#someOtherSymbol"></symbol> the <use> gets expanded to a <symbol>. Though no one expands
3137         the <symbol> element - and we're end up in hitting an assertion. Avoid that.
3138
3139         * bindings/js/JSSVGElementWrapperFactory.cpp:
3140         * bindings/js/kjs_dom.cpp:
3141         (KJS::toJS):
3142         * bindings/objc/DOM.mm:
3143         (WebCore::createElementClassMap):
3144         * dom/Element.cpp:
3145         (WebCore::Element::recalcStyle):
3146         * ksvg2/svg/SVGElement.cpp:
3147         (WebCore::shadowTreeParentElementForShadowTreeElement):
3148         (WebCore::SVGElement::dispatchEvent):
3149         * ksvg2/svg/SVGElementInstance.cpp:
3150         * ksvg2/svg/SVGElementInstance.h:
3151         * ksvg2/svg/SVGElementInstance.idl:
3152         * ksvg2/svg/SVGElementInstanceList.cpp:
3153         * ksvg2/svg/SVGElementInstanceList.h:
3154         * ksvg2/svg/SVGElementInstanceList.idl:
3155         * ksvg2/svg/SVGStyledElement.cpp:
3156         (WebCore::SVGStyledElement::notifyAttributeChange):
3157         (WebCore::SVGStyledElement::updateElementInstance):
3158         * ksvg2/svg/SVGStyledElement.h:
3159         * ksvg2/svg/SVGUseElement.cpp:
3160         (WebCore::SVGUseElement::attributeChanged):
3161         (WebCore::SVGUseElement::notifyAttributeChange):
3162         (WebCore::SVGUseElement::recalcStyle):
3163         (WebCore::SVGUseElement::buildPendingResource):
3164         (WebCore::SVGUseElement::buildShadowTreeForSymbolTag):
3165         (WebCore::SVGUseElement::alterShadowTreeForSVGTag):
3166         (WebCore::SVGUseElement::buildShadowTree):
3167         (WebCore::SVGUseElement::expandUseElementsInShadowTree):
3168         (WebCore::SVGUseElement::attachShadowTree):
3169         * ksvg2/svg/SVGUseElement.h:
3170         * ksvg2/svg/SVGUseElement.idl:
3171         * ksvg2/svg/svgtags.in:
3172
3173 2007-03-05  Brady Eidson  <beidson@apple.com>
3174
3175         Reviewed by John
3176
3177         Fixes <rdar://problem/4974258>
3178         Adds some key null checking
3179
3180         * bindings/js/kjs_html.cpp:
3181         (KJS::JSHTMLElement::implementsCall): Null check doc/frame
3182         * bindings/objc/DOMInternal.mm:
3183         (-[WebScriptObject _initializeScriptDOMNodeImp]): Null check doc/frame
3184
3185 2007-03-06  Nikolas Zimmermann  <zimmermann@kde.org>
3186
3187         Reviewed by Darin.
3188
3189         Path::normalAngleAtLength() / Path::pointAtLength() don't work correctly.
3190         pointAtLength() was not implemented, basically and normalAngleAtLength()
3191         had a bug in the tangent slope calculation.
3192
3193         The normalAngleAtLength() stuff can only be tested with my local textPath support.
3194         New LayoutTest: svg/custom/path-textPath-simulation.svg
3195
3196         * platform/graphics/Path.cpp:
3197         (WebCore::pathLengthApplierFunction):
3198         * platform/graphics/PathTraversalState.cpp:
3199         (WebCore::PathTraversalState::quadraticBezierTo):
3200         (WebCore::PathTraversalState::cubicBezierTo):
3201         * platform/graphics/PathTraversalState.h:
3202         (WebCore::PathTraversalState::):
3203
3204 2007-03-05  Alexey Proskuryakov  <ap@webkit.org>
3205
3206         Reviewed by Darin.
3207
3208         http://bugs.webkit.org/show_bug.cgi?id=12970
3209         Fix and import 4XPath test_core_functions.html test
3210
3211         * xml/XPathExpression.cpp:
3212         (WebCore::XPathExpression::evaluate): Fully initialize the evaluation context.
3213
3214         * xml/XPathFunctions.cpp:
3215         (WebCore::XPath::FunSubstring::doEvaluate): Fixed handling of edge cases.
3216         (WebCore::XPath::FunRound::round): Reimplemented to match the spec; exposed FunRound::round() to be used in
3217         other functions.
3218
3219 2007-03-05  Alexey Proskuryakov  <ap@webkit.org>
3220
3221         Reviewed by Darin.
3222
3223         http://bugs.webkit.org/show_bug.cgi?id=12954
3224         XPath relative operations are implemented incorrectly
3225
3226         * xml/XPathPredicate.cpp:
3227         (WebCore::XPath::NumericOp::doEvaluate):
3228         (WebCore::XPath::EqTestOp::compare):
3229         (WebCore::XPath::EqTestOp::doEvaluate):
3230         Reimplemented relative equality operations to match the spec.
3231
3232         * xml/XPathPredicate.h:
3233         (WebCore::XPath::NumericOp::):
3234         (WebCore::XPath::EqTestOp::):
3235         Moved relative operations to EqTestOp.
3236
3237         * xml/XPathGrammar.y:
3238         * xml/XPathParser.cpp:
3239         (WebCore::XPath::Parser::nextTokenInternal):
3240         (WebCore::XPath::Parser::lex):
3241         Adapted for the above changes.
3242
3243 2007-03-05  Mark Rowe  <mrowe@apple.com>
3244
3245         Reviewed by Lars.
3246
3247         Fix http://bugs.webkit.org/show_bug.cgi?id=12947
3248         Bug 12947: REGRESSION: ASSERTION FAILED: maxWidth >= 0 in StringTruncator.cpp:109 in WebCore::truncateString()
3249
3250         Handle nil window correctly in toUserSpace and toDeviceSpace.  On Intel Macs a message to nil that returns a
3251         float will return 0.0.  We use this as the divisor in calculating a scale factor, which results in NaN being
3252         introduced into our rect.
3253
3254         * platform/mac/ScreenMac.mm:
3255         (WebCore::toUserSpace):
3256         (WebCore::toDeviceSpace):
3257
3258 2007-03-05  Rob Buis  <buis@kde.org>
3259
3260         Reviewed by Darin.
3261
3262         http://bugs.webkit.org/show_bug.cgi?id=12868
3263         parts of the CSS classes in this simple SVG example are not applied
3264
3265         Make sure the xml stylesheets are parsed in strict mode.
3266
3267         * dom/ProcessingInstruction.cpp:
3268         (WebCore::ProcessingInstruction::parseStyleSheet):
3269
3270 2007-03-04  Adele Peterson  <adele@apple.com>
3271
3272         Reviewed by Darin.
3273
3274         Change to dispatch the keypress event during the defaultEventHandler for keydown events.  This matches IE behavior.
3275         This is preparation for fixing event dispatch with input methods (http://bugs.webkit.org/show_bug.cgi?id=10871)
3276
3277         Test: fast/events/keydown-keypress-preventDefault.html
3278
3279         * dom/EventTargetNode.cpp: (WebCore::EventTargetNode::defaultEventHandler): Call the defaultKeyboardEventHandler for keydown events.
3280         * page/EventHandler.cpp:
3281         (WebCore::eventTargetNodeForDocument): Return 0 instead of false since the return type in EventTargetNode.
3282         (WebCore::EventHandler::keyEvent): Removed dispatch of keypress event, since this is now done in the default event handler.
3283         (WebCore::EventHandler::defaultKeyboardEventHandler): For keydown events, create and dispatch a keypress event.
3284
3285 2007-03-04  Alexey Proskuryakov  <ap@webkit.org>
3286
3287         Reviewed by Nikolas Zimmermann (yay!).
3288
3289         http://bugs.webkit.org/show_bug.cgi?id=12962
3290         4XPath tests crash on lang() function
3291
3292         Covered by 4XPath tests, to be landed later.
3293
3294         * platform/StringImpl.cpp:
3295         (WebCore::StringImpl::reverseFind): Do not crash with empty strings.
3296         * xml/XPathFunctions.cpp:
3297         (WebCore::XPath::FunLang::doEvaluate): Do not crash when an element has no
3298         attributes. Use a proper namespace for xml:lang (not sure where "xms" came from).
3299         Rewrote the algorithm for suffix removing to match the spec.
3300
3301 2007-03-02  Anders Carlsson  <acarlsson@apple.com>
3302
3303         Reviewed by Darin.
3304
3305         <rdar://problem/5028165> 
3306         http://bugs.webkit.org/show_bug.cgi?id=12915
3307         REGRESSION: XMLHttpRequest.abort() does not stop loading (12915)
3308         
3309         * loader/DocumentLoader.cpp:
3310         (WebCore::DocumentLoader::stopLoading):
3311         Save the value of m_loading since calling FrameLoader::stopLoading could set it to false.
3312         
3313         * loader/SubresourceLoader.cpp:
3314         (WebCore::SubresourceLoader::didCancel):
3315         * loader/SubresourceLoader.h:
3316         Get rid of didCancel now, it's not needed anymore.
3317         
3318         * xml/xmlhttprequest.cpp:
3319         (WebCore::XMLHttpRequest::abort):
3320         Call cancel() instead of stopLoading(). Also, set m_aborted to true so the XMLHttpRequest object
3321         won't be dereferenced in didFail when aborting.
3322
3323 2007-03-04  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3324
3325         Reviewed by Nikolas Zimmermann.
3326
3327         Move ScrollView stubs to ScrollViewGdk.cpp
3328
3329         * platform/gdk/FrameGdk.h: remove comment that no longer makes sense
3330         * platform/gdk/ScrollViewGdk.cpp:
3331         (WebCore::ScrollView::addChild):
3332         (WebCore::ScrollView::removeChild):
3333         (WebCore::ScrollView::scrollPointRecursively):
3334         (WebCore::ScrollView::inWindow):
3335         (WebCore::ScrollView::wheelEvent):
3336         (WebCore::ScrollView::updateScrollbars):
3337         (WebCore::ScrollView::updateScrollInfo):
3338         (WebCore::ScrollView::windowToContents):
3339         (WebCore::ScrollView::contentsToWindow):
3340         (WebCore::ScrollView::scrollbarUnderMouse):
3341         * platform/gdk/TemporaryLinkStubs.cpp:
3342
3343 2007-03-02  Kevin McCullough  <kmccullough@apple.com>
3344
3345         Reviewed by Geoff.
3346
3347         - rdar://problem/4922454
3348         - This fixes a security issue by making remote referrers not able to access local
3349         resources, unless they register their schemes to be treated as local. The result is
3350         that those schemes can access local resources and cannot be accessed by remote
3351         referrers.
3352         Because this behavior is new a link-on-or-after check is made to determine if the
3353         app should use the older, less safe, behavior.
3354
3355         * WebCore.exp: added exported functions
3356         * bindings/objc/DOM.mm: consolodated function to base class
3357         (-[DOMElement image]):
3358         (-[DOMElement _imageTIFFRepresentation]):
3359         * dom/Document.cpp: Cache the document's ability to load local resources.
3360         (WebCore::Document::Document):
3361         (WebCore::Document::setURL):
3362         (WebCore::Document::shouldBeAllowedToLoadLocalResources):
3363         (WebCore::Document::stylesheetLoaded):
3364         * dom/Document.h: Cache the docuent's ability to load local resources.
3365         (WebCore::Document::getPendingSheet):
3366         (WebCore::Document::isAllowedToLoadLocalResources):
3367         * html/HTMLImageLoader.cpp: Moved functionality into base class.
3368         (WebCore::HTMLImageLoader::updateFromElement):
3369         (WebCore::HTMLImageLoader::dispatchLoadEvent):
3370         * html/HTMLLinkElement.cpp: Handles null returns correctly now.
3371         * html/HTMLTokenizer.cpp: Moved functionality into base class.
3372         (WebCore::HTMLTokenizer::notifyFinished):
3373         * ksvg2/misc/SVGImageLoader.cpp: Moved functionality into base class.
3374         (WebCore::SVGImageLoader::dispatchLoadEvent):
3375         * loader/Cache.cpp: Checks if the cached resource can be loaded.
3376         (WebCore::Cache::requestResource):
3377         * loader/CachedCSSStyleSheet.cpp: Moved functionality into base class.
3378         (WebCore::CachedCSSStyleSheet::ref):
3379         (WebCore::CachedCSSStyleSheet::error):
3380         * loader/CachedImage.cpp: Moved functionality into base class.
3381         (WebCore::CachedImage::CachedImage):
3382         * loader/CachedImage.h: Moved functionality into base class.
3383         (WebCore::CachedImage::canRender):
3384         * loader/CachedResource.cpp: Cache if the CachedResource should be treated as local
3385         (WebCore::CachedResource::CachedResource):
3386         * loader/CachedResource.h: Moved functionality into base class.
3387         (WebCore::CachedResource::errorOccurred):
3388         (WebCore::CachedResource::shouldTreatAsLocal):
3389         * loader/CachedScript.cpp: Moved functionality into base class.
3390         (WebCore::CachedScript::CachedScript):
3391         * loader/CachedScript.h: Moved functionality into base class.
3392         (WebCore::CachedScript::schedule):
3393         * loader/CachedXBLDocument.cpp: Moved functionality into base class.
3394         (WebCore::CachedXBLDocument::error):
3395         * loader/CachedXSLStyleSheet.cpp: Moved functionality into base class.
3396         (WebCore::CachedXSLStyleSheet::error):
3397         * loader/FrameLoader.cpp: See comments for each function below.
3398         (WebCore::FrameLoader::loadSubframe): Use new canLoad.
3399         (WebCore::FrameLoader::restrictAccessToLocal): return value of linked-on-or-after check.
3400         (WebCore::FrameLoader::setRestrictAccessToLocal): set value for linked-on-or-after check.
3401         (WebCore::localSchemes): Return set of schemes that are to be treated as local.
3402         (WebCore::FrameLoader::loadPlugin): Use new canLoad.
3403         (WebCore::FrameLoader::canLoad): Now multiple functions that each do the same work but some can take advantage of the cached values, if they were computed previously.
3404         (WebCore::FrameLoader::shouldHideReferrer): Extracted out the logic to determine if the referrer should be hidden so it is only calculated when needed.
3405         (WebCore::FrameLoader::loadResourceSynchronously): No longer calls canLoad to get hideReferrer info.
3406         (WebCore::FrameLoader::registerSchemeAsLocal): Functionality to register a scheme to be treated as local.
3407         (WebCore::FrameLoader::treatURLAsLocal): Given a URL this function determines if it should be treated as local.
3408         * loader/FrameLoader.h: Declared functions for this security fix.  See above.
3409         * loader/MainResourceLoader.cpp: Optized order of bools to regain performance.
3410         (WebCore::MainResourceLoader::continueAfterContentPolicy):
3411         * loader/SubresourceLoader.cpp: Now restricts remote from loading local resources.
3412         (WebCore::SubresourceLoader::create):
3413         * page/EventHandler.cpp: Moved functionality into base class.
3414         (WebCore::selectCursor):
3415         * platform/KURL.cpp: KURLs need to check all the registered schemes now.
3416         (WebCore::KURL::isLocalFile):
3417         * rendering/HitTestResult.cpp: Moved functionality into base class.
3418         (WebCore::HitTestResult::image):
3419         * rendering/RenderImage.cpp: Moved functionality into base class.
3420         (WebCore::RenderImage::setCachedImage):
3421         (WebCore::RenderImage::imageChanged):
3422         (WebCore::RenderImage::paint):
3423         (WebCore::RenderImage::layout):
3424         (WebCore::RenderImage::calcAspectRatioWidth):
3425         (WebCore::RenderImage::calcAspectRatioHeight):
3426         * rendering/RenderImage.h: Moved functionality into base class.
3427         (WebCore::RenderImage::errorOccurred):
3428         * rendering/RenderListItem.cpp: Moved functionality into base class.
3429         (WebCore::RenderListItem::setStyle):
3430         * rendering/RenderListMarker.cpp: Moved functionality into base class.
3431         (WebCore::RenderListMarker::isImage):
3432         * xml/xmlhttprequest.cpp: Check doc's cached value instead of determining independently.
3433         (WebCore::XMLHttpRequest::urlMatchesDocumentDomain):
3434
3435 2007-03-02  Justin Garcia  <justin.garcia@apple.com>
3436
3437         Reviewed by kevin
3438         
3439         <rdar://problem/5028447>
3440         REGRESSION: Gmail Editor: Copied message text pastes at the wrong font size
3441
3442         * editing/markup.cpp:
3443         (WebCore::createMarkup): The style of the div that holds
3444         a fully selected body's styles didn't include styles inherited
3445         from the body's ancestors.
3446         
3447 2007-03-02  Justin Garcia  <justin.garcia@apple.com>
3448
3449         Reviewed by harrison
3450
3451         <rdar://problem/4545040>
3452         innerHTML does not HTML-escape text nodes inside PRE elements
3453         <rdar://problem/5027857>
3454         Pasting into Mail from Safari's view-source window renders the HTML
3455
3456         * editing/HTMLInterchange.cpp:
3457         (WebCore::convertHTMLTextToInterchangeFormat): Send this function
3458         the node that the text comes from as a parameter.  It shouldn't convert
3459         '\n's to spaces/nbsps if the text is coming from text where newlines are
3460         preserved.
3461         * editing/HTMLInterchange.h:
3462         * editing/markup.cpp:
3463         (WebCore::startMarkup): Escape text inside the children of PREs.
3464
3465 2007-03-02  Sam Weinig  <sam@webkit.org>
3466
3467         Reviewed by Anders.
3468
3469         Try to fix the Qt build.
3470
3471         * platform/qt/TemporaryLinkStubs.cpp: Add stubs.
3472         (WebCore::searchMenuNoRecentSearchesText):
3473         (WebCore::searchMenuRecentSearchesText):
3474         (WebCore::searchMenuClearRecentSearchesText):
3475         (WebCore::AXWebAreaText):
3476         (WebCore::AXLinkText):
3477         (WebCore::AXListMarkerText):
3478         (WebCore::AXImageMapText):
3479         (WebCore::AXHeadingText):
3480
3481 2007-03-02  David Harrison  <harrison@apple.com>
3482
3483         Suggested by Darin.
3484
3485         A more efficient solution to rdar://4961431.
3486
3487         * bridge/mac/WebCoreAXObject.mm:
3488         (-[WebCoreAXObject accessibilityIsIgnored]):
3489
3490 2007-03-01  Justin Garcia  <justin.garcia@apple.com>
3491
3492         Reviewed by john
3493         
3494         <rdar://problem/5032095>
3495         Gmail Editor: Copied text pastes on a new line instead of current line
3496         
3497         Start merge failed to occur because positionAtStartOfInsertedContent
3498         had a bug.
3499
3500         * editing/ReplaceSelectionCommand.cpp:
3501         (WebCore::ReplaceSelectionCommand::positionAtStartOfInsertedContent):
3502         Was failing when inserting <span><div>foo/div></span>. Return the 
3503         inserted content's first VisiblePosition.
3504
3505 2007-03-02  Dave Hyatt  <hyatt@apple.com>
3506
3507         Fix crasher in glyph map code (buffer overrun).
3508
3509         Reviewed by darin
3510
3511         * platform/win/GlyphPageTreeNodeWin.cpp:
3512         (WebCore::GlyphPage::fill):
3513
3514 2007-03-01  Antti Koivisto  <antti@apple.com>
3515
3516         Reviewed by Maciej.
3517
3518         Fix for http://bugs.webkit.org/show_bug.cgi?id=12895
3519         REGRESSION: imagemap: pointer cursor is shown everywhere
3520         <rdar://problem/5028163>
3521  
3522         Image with imagemap should&n