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