Reviewed by John.
[WebKit-https.git] / WebCore / ChangeLog-2005-08-23
1 2004-12-10  Maciej Stachowiak  <mjs@apple.com>
2
3         Reviewed by John.
4
5         <rdar://problem/3912979> REGRESSION (125-173): repro crash in HTMLCollectionImpl code (www.clubtravel.ie)
6
7         * khtml/html/html_miscimpl.cpp:
8         (HTMLCollectionImpl::traverseNextItem): Pass base when traversing
9         the initial one step, otherwise we might inadvertantly step
10         outside the collection base, thereby causing assertion failures or
11         other badness later.
12
13 2004-12-10  Ken Kocienda  <kocienda@apple.com>
14
15         Reviewed by Chris
16
17         * khtml/editing/htmlediting.cpp:
18         (khtml::InsertParagraphSeparatorCommand::doApply): There is a starting block which is supposed to 
19         act as the root node for this operation. However, a loop was incorrectly coded, and a parent node
20         search could escape this node. Also, one other piece to code to move nodes to the new <p> element
21         should do nothing if the starting point for the selection is itself the starting block.
22         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Similar changes, in spirit, to the above
23         function, though the names and concepts are slightly different.
24
25 2004-12-10  Maciej Stachowiak  <mjs@apple.com>
26
27         Reviewed by Ken.
28
29         <rdar://problem/3907705> REGRESSION (172-173): DHTML menus are broken at hrweb.apple.com
30         
31         * khtml/dom/html_document.cpp:
32         (HTMLDocument::nameableItems): New method, wrapper for HTMLCollection creation.
33         * khtml/dom/html_document.h:
34         * khtml/ecma/kjs_html.cpp:
35         (KJS::HTMLDocument::tryGet): use doc.nameableItems(), not doc.all()!
36         * khtml/html/html_miscimpl.cpp:
37         (HTMLCollectionImpl::traverseNextItem): Added new DOC_NAMEABLE_ITEMS type, this represents
38         the items that can be accessed directly as a document propery, in particular forms, images,
39         objects, applets and embeds.
40         (HTMLCollectionImpl::updateNameCache): Fix some nameCache/idCache confusion.
41         (HTMLFormCollectionImpl::updateNameCache): Ditto.
42         * khtml/html/html_miscimpl.h:
43         (DOM::HTMLCollectionImpl::): Added new type.
44
45 2004-12-10  Ken Kocienda  <kocienda@apple.com>
46
47         Reviewed by John
48
49         Fix for this bug:
50         
51         <rdar://problem/3914779> REGRESSION (Mail): Cannot arrow navigate to position before last character on text-wrapped line
52
53         * khtml/rendering/render_text.cpp:
54         (RenderText::caretRect): Code was not detecting space at the end of a line correctly. Now it does.
55
56 2004-12-10  Ken Kocienda  <kocienda@apple.com>
57
58         Reviewed by John
59
60         Fix for this bug:
61
62         <rdar://problem/3914755> REGRESSION (Mail): Insertion point disappears after pasting paragraph
63
64         * khtml/editing/htmlediting.cpp:
65         (khtml::ReplaceSelectionCommand::doApply): Selection could end up in a "placeholder" node
66         that was removed from the document when pasting. This caused the disappearance. Now this
67         is detected, and the selection is shifted to a node that is in the document.
68
69 2004-12-09  Richard Williamson   <rjw@apple.com>
70
71         Check to disable threaded decoding during
72         layout tests wasn't invoking function, just checking address of 
73         function, which would always return true.
74         
75         * kwq/WebCoreImageRendererFactory.m:
76         (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]):
77
78 2004-12-09  David Hyatt  <hyatt@apple.com>
79
80         Fix for 3892686, left/top overflow was not being propagated properly up to containing blocks because of a math
81         error.
82
83         Also fix a bug I noticed on the same page where relative position offsets were not being added in properly for
84         all inlines when repainting.
85         
86         Reviewed by rjw
87
88         * khtml/rendering/render_block.cpp:
89         (khtml::RenderBlock::layoutBlockChildren):
90         * khtml/rendering/render_flow.cpp:
91         (RenderFlow::getAbsoluteRepaintRect):
92
93 2004-12-09  David Hyatt  <hyatt@apple.com>
94
95         Fix for 3867545, finance.yahoo.com lays out incorrectly.  Add a quirk that will prevent tables from moving
96         down below floats when there is insufficient space.  Instead we will match Gecko and just spill out of the
97         containing block to the right.  This appears to be the more common desired behavior, despite being wrong.
98         WinIE sometimes wraps and sometimes doesn't, but it's really hard for us to match its inconsistency.
99         
100         Reviewed by john
101
102         * khtml/rendering/render_block.cpp:
103         (khtml::RenderBlock::getClearDelta):
104         * layout-tests/apple-only/base/www.cnn.com/index-expected.txt:
105         * layout-tests/apple-only/base/www.ebay.com/index-expected.txt:
106         * layout-tests/apple-only/base/www.excite.com/index-expected.txt:
107         * layout-tests/fast/block/margin-collapse/102-expected.txt:
108         * layout-tests/fast/block/margin-collapse/102.html:
109
110 2004-12-09  Richard Williamson   <rjw@apple.com>
111
112         Fixed <rdar://problem/3914078> worldclock crashing gc related
113
114         Use ProtectedValue for Context2D instance members.
115
116         Reviewed by Maciej.
117
118         * khtml/ecma/kjs_html.h:
119
120 2004-12-09  John Sullivan  <sullivan@apple.com>
121
122         Reviewed by Dave.
123         
124         - fixed <rdar://problem/3731099> Move AXTitle string for image elements to AXDescription
125
126         * kwq/KWQAccObject.mm:
127         (-[KWQAccObject title]): moved image alt tag code out of here
128         (-[KWQAccObject accessibilityDescription]): moved image alt tag code into this new method
129         (-[KWQAccObject accessibilityAttributeNames]): include AXDescription in the set of attributes
130         that ordinary elements return; this means that ordinary elements that aren't images will return
131         a nil description, which isn't ideal, but is in keeping with the way the rest of these attributes
132         work here.
133         (-[KWQAccObject accessibilityAttributeValue:]):
134         call accessibilityDescription when asked for AXDescription
135
136 2004-12-09  Ken Kocienda  <kocienda@apple.com>
137
138         Reviewed by Harrison
139
140         Fix for this bug:
141         
142         <rdar://problem/3910425> REGRESSION (Mail): Crash in ReplaceSelectionCommand; selection is empty, leading to null deref
143
144         * khtml/editing/htmlediting.cpp:
145         (khtml::MoveSelectionCommand::doApply): The node representing the destination for the move may have
146         been deleted. If this is the case, set the destination to the node the delete command provides in
147         its ending selection.
148
149 === Safari-175 ===
150
151 2004-12-09  Ken Kocienda  <kocienda@apple.com>
152
153         Reviewed by John
154         
155         Fix for this bug:
156         
157         <rdar://problem/3912841> REGRESSION (173-TOT): Some images report 0x0 dimensions on layout tests, causes spurious test failures
158
159         The new threaded image decoding capability can throw off layout tests. The issue is that the decoding
160         callback may not be delivered before the program asks for the dimensions of an image in order to
161         wrote the layout dimensions. More generally, I think we need to ensure that there are no races in
162         layout tests, so I have added a flag to the render tree debug code that we can set when debugging.
163
164         * kwq/KWQRenderTreeDebug.cpp:
165         (debuggingRenderTree): New function. Returns flag which tells whether the program is debugging the render tree.
166         (externalRepresentation): Sets debuggingRenderTree flag to true;
167         * kwq/KWQRenderTreeDebug.h:
168         * kwq/WebCoreImageRendererFactory.m:
169         (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]): Checks debuggingRenderTree flag and will not
170         do threaded decoding in any case if the flag is set.
171
172 2004-12-09  Chris Blumenberg  <cblu@apple.com>
173
174         Fix for busting XMLHTTPRequest.
175
176         Reviewed by kocienda.
177
178         * khtml/misc/loader.cpp:
179         (Loader::servePendingRequests): pass true for deliverAllData
180         * kwq/KWQKJob.h:
181         (KIO::get): take deliverAllData param
182         (KIO::http_post): ditto
183         * kwq/KWQKJobClasses.h:
184         * kwq/KWQKJobClasses.mm:
185         (KIO::TransferJob::TransferJob): if deliverAllData, create signal with data param
186         (KIO::TransferJob::emitResult): if deliverAllData, call signal with data param
187
188 2004-12-09  Ken Kocienda  <kocienda@apple.com>
189
190         Reviewed by John
191
192         <rdar://problem/3911011> REGRESSION (Mail): Spaces at end of line causing word wrap lost when copied/pasted
193
194         * khtml/xml/dom_nodeimpl.cpp:
195         (NodeImpl::renderedText): Fixed the code so that spaces at the end of lines are not skipped.
196
197 2004-12-07  Richard Williamson   <rjw@apple.com>
198
199         Support threaded image decoding on machines w/ > 2 CPUs.
200
201         Reviewed by Maciej and Chris.
202
203         * khtml/misc/loader.cpp:
204         (CachedImageCallback::notifyUpdate):
205         (CachedImageCallback::notifyFinished):
206         (CachedImageCallback::notifyDecodingError):
207         (CachedImageCallback::handleError):
208         (CachedImageCallback::clear):
209         (CachedImage::CachedImage):
210         (CachedImage::clear):
211         (CachedImage::data):
212         (CachedImage::checkNotify):
213         (Loader::servePendingRequests):
214         (Loader::slotFinished):
215         (Loader::numRequests):
216         (Loader::cancelRequests):
217         (Loader::removeBackgroundDecodingRequest):
218         * khtml/misc/loader.h:
219         (khtml::CachedImageCallback::CachedImageCallback):
220         (khtml::CachedImageCallback::ref):
221         (khtml::CachedImageCallback::deref):
222         (khtml::CachedImage::decoderCallback):
223         * khtml/rendering/render_object.cpp:
224         (RenderObject::setPixmap):
225         * kwq/KWQPixmap.h:
226         * kwq/KWQPixmap.mm:
227         (-[WebImageCallback initWithCallback:khtml::]):
228         (-[WebImageCallback _commonTermination]):
229         (-[WebImageCallback dealloc]):
230         (-[WebImageCallback finalize]):
231         (-[WebImageCallback notify]):
232         (-[WebImageCallback setImageSourceStatus:]):
233         (-[WebImageCallback status]):
234         (QPixmap::shouldUseThreadedDecoding):
235         (QPixmap::receivedData):
236         * kwq/WebCoreImageRenderer.h:
237         * kwq/WebCoreImageRendererFactory.h:
238         * kwq/WebCoreImageRendererFactory.m:
239         (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]):
240         (+[WebCoreImageRendererFactory setShouldUseThreadedDecoding:]):
241
242 2004-12-07  Ken Kocienda  <kocienda@apple.com>
243
244         Reviewed by John
245
246         * khtml/editing/htmlediting.cpp:
247         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Fix a problem with my
248         change in thei code yesterday. Call to insertBlockPlaceholderIfNeeded() must be done
249         after new block has been inserted, otherwise a crash can result. Shuffle down call 
250         to insertBlockPlaceholderIfNeeded() a couple of lines (where the node is inserted), 
251         and all is good.
252
253 2004-12-07  Ken Kocienda  <kocienda@apple.com>
254
255         Reviewed by John
256
257         Fix for this bug:
258         
259         <rdar://problem/3907422> REGRESSION (Mail): Pasting quoted content can place content after body element
260
261         * khtml/editing/htmlediting.cpp:
262         (khtml::ReplaceSelectionCommand::doApply): Detect when the body element is the "reference block" used
263         for determining the location for inserting content. Do not allow an insert before or after if the
264         reference block is the body. Perform insertNodeAt(0) and appendNode, respectively, in the block-is-body case.
265         * layout-tests/editing/inserting/insert-3907422-fix-expected.txt: Added.
266         * layout-tests/editing/inserting/insert-3907422-fix.html: Added.
267
268 2004-12-07  Darin Adler  <darin@apple.com>
269
270         Reviewed by Don.
271
272         - fixed <rdar://problem/3908701> REGRESSION: Cursor does not change to "hand" over active links
273
274         * kwq/KWQEvent.mm: (positionForEvent): Add NSMouseMoved to list of events that have mouse location.
275
276 2004-12-07  Ken Kocienda  <kocienda@apple.com>
277
278         Reviewed by John
279
280         Changed name of constant from KHTMLInterchangeNewline to AppleInterchangeNewline.
281         I discussed this with Hyatt and he agreed that going with "Apple" names was OK.
282
283         * khtml/editing/html_interchange.h: Name change, as described above.
284         * khtml/editing/htmlediting.cpp:
285         (khtml::ReplacementFragment::isInterchangeNewlineComment): Ditto.
286         * khtml/xml/dom2_rangeimpl.cpp:
287         (DOM::RangeImpl::toHTML): Ditto.
288
289 2004-12-07  Ken Kocienda  <kocienda@apple.com>
290
291         Reviewed by me
292         
293         Added a couple more layout tests.
294
295         * layout-tests/editing/deleting/delete-line-013-expected.txt: Added.
296         * layout-tests/editing/deleting/delete-line-013.html: Added.
297         * layout-tests/editing/deleting/delete-line-014-expected.txt: Added.
298         * layout-tests/editing/deleting/delete-line-014.html: Added.
299
300 2004-12-06  Maciej Stachowiak  <mjs@apple.com>
301
302         Reviewed by Hyatt.
303
304         - fixed <rdar://problem/3906974> assertion failure in QWidget::beforeMouseDown clicking on <select multiple>
305         
306         * kwq/KWQListBox.mm:
307         (QListBox::QListBox): Initialize KWQListBoxScrollView with this.
308         (-[KWQListBoxScrollView initWithListBox:]): Make this class a KWQWidgetHolder.
309         (-[KWQListBoxScrollView widget]): See above.
310         (-[KWQTableView mouseDown:]): Pass outerView rather than self to beforeMouseDown and
311         afterMouseDown, to avoid triggering an assertion failure.
312
313 2004-12-06  David Hyatt  <hyatt@apple.com>
314
315         Fix for 3615411, the linesAppended optimization was old and broken, and it's easier with the new code fixes
316         made by me, kocienda and harrison to just remove it.
317         
318         Reviewed by mjs
319
320         * khtml/rendering/bidi.cpp:
321         (khtml::RenderBlock::layoutInlineChildren):
322         * khtml/rendering/render_block.cpp:
323         (khtml:::RenderFlow):
324         * khtml/rendering/render_block.h:
325         * khtml/rendering/render_flow.cpp:
326         (RenderFlow::dirtyLinesFromChangedChild):
327
328 2004-12-06  David Hyatt  <hyatt@apple.com>
329
330         Fix for 3787133, some web pages print with many blank pages.  Make sure to use the real page print rect and
331         not a damage rect that can be changed when intersected with the clip regions of the web page.
332         
333         Reviewed by john
334
335         * khtml/rendering/render_canvas.h:
336         (khtml::RenderCanvas::printRect):
337         (khtml::RenderCanvas::setPrintRect):
338         * khtml/rendering/render_flow.cpp:
339         (RenderFlow::paintLines):
340         * khtml/rendering/render_list.cpp:
341         (RenderListMarker::paint):
342         * kwq/KWQKHTMLPart.mm:
343         (KWQKHTMLPart::adjustPageHeight):
344
345 2004-12-06  David Harrison  <harrison@apple.com>
346
347         Reviewed by Ken Kocienda and Dave Hyatt (OOPS!).
348
349                 <rdar://problem/3849947> Typing after pasting line does not appear until after window resize.
350                 
351                 
352         * khtml/rendering/render_flow.cpp:
353         (RenderFlow::dirtyLinesFromChangedChild):
354                 Dirty the line above because new child can inval the cached line break position of previous line.
355
356 2004-12-06  David Hyatt  <hyatt@apple.com>
357
358         Fix for 3254464, radio buttons do not work for quiz on netscape.com.  Left/top overflow needed to be implemented.
359         This also fixes 3106907, link hover color only partially set on rollover and the more general architecture bug
360         3126929, handle top/left overflow.
361
362         This patch also fixes 3902891, scroll bar of position:fixed content moves when a page is scrolled.
363
364         Finally, the Emerson regression 3869718 (error involving computing the rightmost/lowest position of overflow:auto
365         regions and web pages) has been fixed.
366         
367         Reviewed by mjs
368
369         * khtml/rendering/bidi.cpp:
370         (khtml::RenderBlock::computeHorizontalPositionsForLine):
371         (khtml::RenderBlock::checkLinesForOverflow):
372         * khtml/rendering/render_block.cpp:
373         (khtml:::RenderFlow):
374         (khtml::RenderBlock::overflowHeight):
375         (khtml::RenderBlock::overflowWidth):
376         (khtml::RenderBlock::overflowLeft):
377         (khtml::RenderBlock::overflowTop):
378         (khtml::RenderBlock::overflowRect):
379         (khtml::RenderBlock::layoutBlock):
380         (khtml::RenderBlock::layoutBlockChildren):
381         (khtml::RenderBlock::paint):
382         (khtml::RenderBlock::floatRect):
383         (khtml::RenderBlock::lowestPosition):
384         (khtml::RenderBlock::rightmostPosition):
385         (khtml::RenderBlock::leftmostPosition):
386         (khtml::RenderBlock::nodeAtPoint):
387         * khtml/rendering/render_block.h:
388         * khtml/rendering/render_box.h:
389         (khtml::RenderBox::borderBox):
390         (khtml::RenderBox::borderTopExtra):
391         (khtml::RenderBox::borderBottomExtra):
392         * khtml/rendering/render_layer.cpp:
393         (RenderLayer::paintScrollbars):
394         (mustExamineRenderer):
395         (RenderLayer::intersectsDamageRect):
396         (RenderLayer::containsPoint):
397         * khtml/rendering/render_line.cpp:
398         (khtml::InlineFlowBox::placeBoxesHorizontally):
399         (khtml::InlineFlowBox::verticallyAlignBoxes):
400         * khtml/rendering/render_line.h:
401         (khtml::InlineBox::leftOverflow):
402         (khtml::InlineBox::rightOverflow):
403         (khtml::InlineFlowBox::setVerticalOverflowPositions):
404         (khtml::RootInlineBox::RootInlineBox):
405         (khtml::RootInlineBox::leftOverflow):
406         (khtml::RootInlineBox::rightOverflow):
407         (khtml::RootInlineBox::setVerticalOverflowPositions):
408         (khtml::RootInlineBox::setHorizontalOverflowPositions):
409         * khtml/rendering/render_object.h:
410         (khtml::RenderObject::borderBox):
411         (khtml::RenderObject::overflowLeft):
412         (khtml::RenderObject::overflowTop):
413         (khtml::RenderObject::overflowRect):
414         (khtml::RenderObject::floatRect):
415         * khtml/rendering/render_table.cpp:
416         (RenderTable::layout):
417         (RenderTable::paint):
418         (RenderTable::paintBoxDecorations):
419         (RenderTable::calcMinMaxWidth):
420         * khtml/rendering/render_table.h:
421         (khtml::RenderTableCell::borderTopExtra):
422         (khtml::RenderTableCell::borderBottomExtra):
423         * kwq/KWQRect.h:
424         * kwq/KWQRect.mm:
425         (QRect::inflate):
426
427 2004-12-06  Maciej Stachowiak  <mjs@apple.com>
428
429         Reviewed by John.
430
431         - fixed <rdar://problem/3903797> scripts can cause other frames/windows to execute arbitrary script using javascript: URLs
432         
433         I changed all unprotected places that can navigate a different
434         window or frame from script to check for a javascript: URL, and if
435         found, to check for safety using cross-site-script rules. 
436
437         I considered a few other possible exploits and made no change:
438
439         - document.location is already protected because the document
440         object itself is protected
441
442         - frame.src, frame.location, iframe.src and targetted links are
443         all safe because setting the URL of a frame to a javascript: URL
444         executes the script in the context of the parent
445
446         * khtml/ecma/kjs_window.cpp:
447         (WindowFunc::tryCall):
448         (Location::put):
449         (LocationFunc::tryCall):
450
451 2004-12-06  Ken Kocienda  <kocienda@apple.com>
452
453         Reviewed by Maciej
454
455         Fix for this bug:
456         
457         <rdar://problem/3890955> 8A314: Forward delete sometimes fails to delete the selected quoted text
458
459         * khtml/editing/htmlediting.cpp:
460         (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Fixed bonehead coding mistake in the
461         check for one of the special cases being checked for in this function. The specific case 
462         intends to check for a selection that is only a <br> after a block ends (as in </div><br>). If it
463         sees such markup, it deletes only the <br> and bails. However, this code would run in *any*
464         case where a selection ended in a <br> after a block and would not delete any part of the
465         selection preceding the <br>. Bad. I have tightened the check to see that only a <br> is
466         selected.
467
468         Fixing the bug above was accomplished with an additional call to DOM::Position::downstream. This
469         new use of the function exposed this bug:
470         
471         <rdar://problem/3907666> Incorrectly coded loop in Position::downstream can lead to infinite loop
472
473         * khtml/xml/dom_position.cpp:
474         (DOM::Position::downstream): I am ashamed of my first cut at this. Rewrote the loop so it does 
475         not have this fatal flaw. It is a much better design as well.
476         
477         * layout-tests/editing/deleting/delete-3800834-fix-expected.txt: Changes made this test
478         have what I consider to be a better result. Going with it.
479
480 2004-12-06  Chris Blumenberg  <cblu@apple.com>
481
482         Fixed: <rdar://problem/3871718> REGRESSION (125-168): text marked bold with font that does not have bold variant copies as non-bold
483
484         Reviewed by hyatt.
485
486         * kwq/DOM.mm:
487         (-[DOMElement _font]): new SPI for AppKit
488         * kwq/DOMPrivate.h:
489
490 2004-12-06  Darin Adler  <darin@apple.com>
491
492         Reviewed by Maciej.
493
494         - fixed <rdar://problem/3906327> Select All of a large document is slow (>15 secs on my machine for attached specimen)
495
496         * kwq/KWQScrollView.mm: (QScrollView::updateContents): Intersect with visibleRect before calling through
497         to NSView to dirty; NSView could also be more efficient in this case (I filed 3906343).
498
499 2004-12-06  John Sullivan  <sullivan@apple.com>
500
501         Darin found what appears to be the real leak that we were falsely blaming
502         on the 'leaks' tool (3880245). I made the change, and ran layout tests and PLT to make
503         sure nothing barfed.
504
505         * khtml/css/cssparser.cpp:
506         (CSSParser::parseValue):
507         call clearProperties() instead of just setting numParsedProperties to 0
508         (CSSParser::parseDeclaration):
509         ditto
510         (CSSParser::createStyleDeclaration):
511         ditto
512
513 2004-12-06  Ken Kocienda  <kocienda@apple.com>
514
515         Reviewed by me
516         
517         New layout tests.
518
519         * layout-tests/editing/inserting/insert-div-001-expected.txt: Added.
520         * layout-tests/editing/inserting/insert-div-001.html: Added.
521         * layout-tests/editing/inserting/insert-div-002-expected.txt: Added.
522         * layout-tests/editing/inserting/insert-div-002.html: Added.
523         * layout-tests/editing/inserting/insert-div-003-expected.txt: Added.
524         * layout-tests/editing/inserting/insert-div-003.html: Added.
525         * layout-tests/editing/inserting/insert-div-004-expected.txt: Added.
526         * layout-tests/editing/inserting/insert-div-004.html: Added.
527         * layout-tests/editing/inserting/insert-div-005-expected.txt: Added.
528         * layout-tests/editing/inserting/insert-div-005.html: Added.
529         * layout-tests/editing/inserting/insert-div-006-expected.txt: Added.
530         * layout-tests/editing/inserting/insert-div-006.html: Added.
531         * layout-tests/editing/inserting/insert-div-007-expected.txt: Added.
532         * layout-tests/editing/inserting/insert-div-007.html: Added.
533         * layout-tests/editing/inserting/insert-div-008-expected.txt: Added.
534         * layout-tests/editing/inserting/insert-div-008.html: Added.
535         * layout-tests/editing/inserting/insert-div-009-expected.txt: Added.
536         * layout-tests/editing/inserting/insert-div-009.html: Added.
537
538 2004-12-06  Ken Kocienda  <kocienda@apple.com>
539
540         Reviewed by Harrison
541
542         Fix for this bug:
543         
544         <rdar://problem/3906948> REGRESSION (Mail): Insert paragraph code can make the insertion point "stick" in place.
545
546         * khtml/editing/htmlediting.cpp:
547         (khtml::InsertParagraphSeparatorCommand::doApply): Call insertBlockPlaceholderIfNeeded(), passing block
548         being added to this function. This ensures that the added block has a height.
549         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
550
551 2004-12-06  Ken Kocienda  <kocienda@apple.com>
552  
553         Reviewed by John
554         
555         * khtml/dom/dom_string.cpp:
556         (DOM::DOMString::substring): Expose method already on DOMStrimgImpl.
557         * khtml/dom/dom_string.h: Ditto.
558         * khtml/editing/htmlediting.cpp:
559         (khtml::CompositeEditCommand::rebalanceWhitespace): New helper to create and execute a
560         RebalanceWhitespaceCommand instance.
561         (khtml::DeleteSelectionCommand::doApply): Call rebalanceWhitespace() after running command.
562         (khtml::InsertLineBreakCommand::doApply): Ditto.
563         (khtml::InsertParagraphSeparatorCommand::doApply): Ditto.
564         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
565         (khtml::InsertTextCommand::input): Ditto.
566         (khtml::RebalanceWhitespaceCommand::RebalanceWhitespaceCommand): New command.
567         (khtml::RebalanceWhitespaceCommand::~RebalanceWhitespaceCommand): Ditto.
568         (khtml::RebalanceWhitespaceCommand::doApply): Ditto.
569         (khtml::RebalanceWhitespaceCommand::doUnapply): Ditto.
570         (khtml::RebalanceWhitespaceCommand::preservesTypingStyle): Ditto.
571         (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Ditto.
572         * khtml/editing/htmlediting.h: Ditto.
573         (khtml::RebalanceWhitespaceCommand::): Ditto.
574
575 2004-12-05  Darin Adler  <darin@apple.com>
576
577         - fixed small problem in my check-in from yesterday
578
579         * kwq/KWQEvent.mm:
580         (positionForEvent): Get location from event without raising exception if it's the wrong type.
581         (clickCountForEvent): Same, for clickCount.
582         (QMouseEvent::QMouseEvent): Use the new helper functions so this can be constructed even with
583         the wrong type of NSEvent. Required for cases where a keyboard event causes a "click" and we need
584         to synthesize a QMouseEvent for KHTML internal use, using the key down NSEvent.
585
586 2004-12-04  Darin Adler  <darin@apple.com>
587
588         Reviewed by John.
589
590         - fixed <rdar://problem/3878329> REGRESSION (169-170): colors are wrong for my.yahoo.com due to CSS background parsing changes
591
592         * khtml/css/cssparser.cpp: (CSSParser::parseBackgroundShorthand): Changed function so it doesn't rely on the position
593         attribute being at the end of the array and then moved position attribute before color attribute so it takes precedence.
594         Since "0" can be both the X coordinate of a position and a legal color (meaning black), we need to do position first.
595
596         - fixed <rdar://problem/3760869> click events for input type=button or type=checkbox don't have flags like shiftKey set
597
598         * khtml/rendering/render_form.h: Remove unused RenderFormElement fields.
599         * khtml/rendering/render_form.cpp:
600         (RenderFormElement::RenderFormElement): Take out code to set a bunch of unused fields.
601         (RenderFormElement::slotClicked): Change to create the QMouseEvent from the actual mouse event rather than
602         creating it with all the flags set to 0, using the new QMouseEvent constructor that does so.
603
604         * kwq/KWQEvent.h: Added constructor that takes no parameters which uses the current event from AppKit.
605         Made the click count getter const and added an isDoubleClick that matches the logic used elsewhere.
606         Added a fixState helper method so the constructors can save code.
607         * kwq/KWQEvent.mm:
608         (QMouseEvent::QMouseEvent): Factored out the state-fixing code that was in the two existing constructors
609         and added a third constructor that uses the "current event" from AppKit (used above).
610         (QMouseEvent::fixState): Compute state and click count based on event type.
611
612         - fixed first symptom of <rdar://problem/3830936> REGRESSION (125-165): crash due to null font family, hang at changeforamerica.com
613
614         * kwq/KWQFontFamily.mm: (KWQFontFamily::getNSFamily): Handle empty strings specially so we don't run into trouble when
615         the family name is a null string. This prevents the crash, but there are still other problems that may have the same
616         underlying cause in CSS.
617
618         - fixed <rdar://problem/3829808> Safari crashes when adding a DOM node that was removed from an XMLHTTP request result
619
620         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::insertedIntoDocument):
621         Added nil check before calling scheduleRelayout. This is new code so the nil-dereference is a recent regression.
622
623 2004-12-03  Chris Blumenberg  <cblu@apple.com>
624
625         New fixes for:
626         <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
627         <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
628         <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
629         <rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear
630
631         Reviewed by darin, rjw, kocienda.
632
633         * khtml/misc/loader.cpp:
634         (CachedObject::~CachedObject):
635         (CachedCSSStyleSheet::checkNotify):
636         (Loader::servePendingRequests):
637         (Loader::slotFinished):
638         (Loader::slotReceivedResponse):
639         (Cache::requestImage):
640         (Cache::requestScript):
641         * khtml/misc/loader.h:
642         (khtml::CachedObject::CachedObject):
643         (khtml::CachedObject::response):
644         (khtml::CachedObject::allData):
645         * kwq/KWQKJobClasses.h:
646         * kwq/KWQKJobClasses.mm:
647         (KIO::TransferJobPrivate::TransferJobPrivate):
648         (KIO::TransferJobPrivate::~TransferJobPrivate):
649         (KIO::TransferJob::TransferJob):
650         (KIO::TransferJob::assembleResponseHeaders):
651         (KIO::TransferJob::retrieveCharset):
652         (KIO::TransferJob::emitResult):
653         (KIO::TransferJob::emitReceivedResponse):
654         * kwq/KWQLoader.h:
655         * kwq/KWQLoader.mm:
656         (KWQHeaderStringFromDictionary):
657         (KWQCheckCacheObjectStatus):
658         (KWQIsResponseURLEqualToURL):
659         (KWQResponseURL):
660         (KWQResponseMIMEType):
661         (KWQCacheObjectExpiresTime):
662         (khtml::CachedObject::setResponse):
663         (khtml::CachedObject::setAllData):
664         * kwq/KWQPixmap.h:
665         * kwq/KWQPixmap.mm:
666         (QPixmap::QPixmap):
667         * kwq/KWQResourceLoader.mm:
668         (-[KWQResourceLoader finishJobAndHandle:]):
669         (-[KWQResourceLoader cancel]):
670         (-[KWQResourceLoader reportError]):
671         (-[KWQResourceLoader finishWithData:]):
672         * kwq/KWQSignal.h:
673         * kwq/KWQSignal.mm:
674         (KWQSignal::call):
675         * kwq/KWQSlot.h:
676         * kwq/KWQSlot.mm:
677         (KWQSlot::KWQSlot):
678         (KWQSlot::call):
679         * kwq/WebCoreBridge.h:
680         * kwq/WebCoreResourceLoader.h:
681
682 2004-12-04  Darin Adler  <darin@apple.com>
683
684         Reviewed by John.
685
686         - fixed <rdar://problem/3876093> REGRESSION (166-167): Setting slider control's value from JavaScript has no effect (breaks RSS)
687
688         * khtml/rendering/render_form.cpp:
689         (RenderSlider::updateFromElement): Call setValue to update the value of the DOM element rather than
690         modifying the m_value data member directly. We don't use m_value at all for sliders now, and in fact
691         the code relies on the fact that m_value is null. Setting m_value to a non-null value was causing the bug.
692         (RenderSlider::slotSliderValueChanged): Ditto.
693
694 2004-12-03  John Sullivan  <sullivan@apple.com>
695
696         Reviewed by Ken.
697         
698         - fixed <rdar://problem/3889411> REGRESSION (125-172): repro crash in 
699         khtml::BackgroundLayer::cullEmptyLayers
700
701         * khtml/rendering/render_style.cpp:
702         (BackgroundLayer::cullEmptyLayers):
703         added missing nil check
704
705 === Safari-173 ===
706
707 2004-12-03  Ken Kocienda  <kocienda@apple.com>
708
709         Reviewed by me
710
711         Roll out some recent changes by Chris that caused a performance regression.
712         Fix is in hand, but it is a little risky this close to a submission. So,
713         we have decided to roll back the change with the regression and roll in
714         the new code after we submit.
715
716         * khtml/css/cssproperties.c:
717         (hash_prop):
718         (findProp):
719         * khtml/css/cssvalues.c:
720         (hash_val):
721         (findValue):
722         * khtml/misc/htmlattrs.c:
723         (hash_attr):
724         (findAttr):
725         * khtml/misc/htmltags.c:
726         (hash_tag):
727         (findTag):
728         * khtml/misc/loader.cpp:
729         (CachedObject::~CachedObject):
730         (CachedObject::setResponse):
731         (CachedCSSStyleSheet::checkNotify):
732         (Loader::servePendingRequests):
733         (Loader::slotFinished):
734         (Loader::slotReceivedResponse):
735         (Cache::requestImage):
736         (Cache::requestScript):
737         * khtml/misc/loader.h:
738         (khtml::CachedObject::CachedObject):
739         (khtml::CachedObject::response):
740         * kwq/KWQKJobClasses.h:
741         * kwq/KWQKJobClasses.mm:
742         (KIO::TransferJobPrivate::TransferJobPrivate):
743         (KIO::TransferJobPrivate::~TransferJobPrivate):
744         (KIO::TransferJob::TransferJob):
745         (KIO::TransferJob::assembleResponseHeaders):
746         (KIO::TransferJob::retrieveCharset):
747         (KIO::TransferJob::emitResult):
748         (KIO::TransferJob::emitReceivedResponse):
749         * kwq/KWQLoader.h:
750         * kwq/KWQLoader.mm:
751         (KWQHeaderStringFromDictionary):
752         (KWQCheckCacheObjectStatus):
753         (KWQRetainResponse):
754         (KWQReleaseResponse):
755         (KWQIsResponseURLEqualToURL):
756         (KWQResponseURL):
757         (KWQResponseMIMEType):
758         (KWQResponseTextEncodingName):
759         (KWQResponseHeaderString):
760         (KWQCacheObjectExpiresTime):
761         (KWQLoader::KWQLoader):
762         * kwq/KWQPixmap.h:
763         * kwq/KWQPixmap.mm:
764         (QPixmap::QPixmap):
765         * kwq/KWQResourceLoader.mm:
766         (-[KWQResourceLoader finishJobAndHandle]):
767         (-[KWQResourceLoader cancel]):
768         (-[KWQResourceLoader reportError]):
769         (-[KWQResourceLoader finish]):
770         * kwq/KWQSignal.h:
771         * kwq/KWQSignal.mm:
772         (KWQSignal::call):
773         * kwq/KWQSlot.h:
774         * kwq/KWQSlot.mm:
775         (KWQSlot::KWQSlot):
776         (KWQSlot::call):
777         * kwq/WebCoreBridge.h:
778         * kwq/WebCoreResourceLoader.h:
779
780 2004-12-03  John Sullivan  <sullivan@apple.com>
781
782         Reviewed by Chris.
783         
784         - fixed <rdar://problem/3903990> can't tab to all items on www.google.com any more (other pages too?)
785
786         * kwq/KWQKHTMLPart.mm:
787         (KWQKHTMLPart::nextKeyViewInFrameHierarchy):
788         when checking whether we moved the focus to another view, make sure we didn't "move" it to
789         our documentView, because that's no move at all.
790
791 2004-12-03  Darin Adler  <darin@apple.com>
792
793         Reviewed by Vicki.
794
795         - fixed <rdar://problem/3901109> REGRESSION (171-172): repro crash in DOM::NodeImpl::setChanged at chick-fil-a.com
796
797         * khtml/css/css_valueimpl.cpp: (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl):
798         Added missing initialization for base class and node pointer.
799
800         - fixed a few places that could leave dangling node pointers
801
802         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::~HTMLBodyElementImpl):
803         Clear out the node pointer when the node is destroyed.
804         * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::~HTMLElementImpl): Ditto.
805
806 2004-12-03  Chris Blumenberg  <cblu@apple.com>
807
808         Fix for performance regression. My original patch added a signal for passing the data of a resource to its WebCore cache object. This patch passes the data with the preexisting "finished" symbol so we make less calls. 
809         Fixed: <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
810
811         Reviewed by rjw.
812
813         * khtml/misc/loader.cpp:
814         (Loader::servePendingRequests): pass data param to slotFinished, removed allData signal
815         (Loader::slotFinished): take data param
816         * khtml/misc/loader.h:
817         * kwq/KWQKJobClasses.h:
818         * kwq/KWQKJobClasses.mm:
819         (KIO::TransferJob::TransferJob): have m_result take a data param, removed m_allData
820         (KIO::TransferJob::emitResult): take data param and pass it
821         * kwq/KWQResourceLoader.mm:
822         (-[KWQResourceLoader finishJobAndHandle:]): take data param and pass it
823         (-[KWQResourceLoader cancel]): pass nil for data
824         (-[KWQResourceLoader reportError]): ditto
825         (-[KWQResourceLoader finishWithData:]): pass data
826         * kwq/KWQSlot.mm:
827         (KWQSlot::KWQSlot): pass data param to slotFinished
828         (KWQSlot::call): added support for slotFinished_Loader, removed slotAllData
829
830 2004-12-03  Ken Kocienda  <kocienda@apple.com>
831
832         Reviewed by John
833
834         Did some clean up in the Position class as a result of trying to write some new layout
835         tests and discovering a bug along the way.
836
837         I removed these three functions from the Position class:
838         
839         1. bool isFirstRenderedPositionOnLine() const;
840         2. bool isLastRenderedPositionOnLine() const;
841         3. static bool renderersOnDifferentLine(RenderObject *r1, long o1, RenderObject *r2, long o2);
842         4. bool inFirstEditableInRootEditableElement() const;
843
844         The first two have replacements in the VisiblePosition class, and some code has been
845         moved to use these new variants. The third function was a helper used only by these
846         first two function, and can be removed as well. The fourth function was not used by anyone.
847
848         * khtml/editing/htmlediting.cpp:
849         (khtml::InsertTextCommand::input): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
850         * khtml/editing/visible_position.cpp:
851         (khtml::visiblePositionsOnDifferentLines): Added an additional check for blocks to this function.
852         Incorrect results were being returned when asking about positions at the starts of blocks.
853         * khtml/xml/dom_position.cpp:
854         (DOM::Position::previousCharacterPosition): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
855         (DOM::Position::nextCharacterPosition): Change over to use VisiblePosition isLastVisiblePositionOnLine().
856         (DOM::Position::rendersInDifferentPosition): Removed use of #3 helper in a log message. We can live without it.
857         * khtml/xml/dom_position.h: Update header for deletions.
858
859 2004-12-03  Ken Kocienda  <kocienda@apple.com>
860
861         Reviewed by John
862
863         Terminology change in execCommand command identifiers. Specifically, the name of 
864         "InsertNewline" command has been changed to "InsertLineBreak". This matches the 
865         terminology used by AppKit. It is also more accurate, since the insertion of a
866         "br" element is what the command does. The inspiration for this change is so the 
867         -insertNewline AppKit method can be mapped to insert a new "div" element in 
868         a document and avoid ambiguity with what the javascript editing command does.
869         
870         * khtml/editing/jsediting.cpp
871         * layout-tests/editing/deleting/delete-tab-004.html
872         * layout-tests/editing/editing.js
873         * layout-tests/editing/inserting/insert-3654864-fix.html
874         * layout-tests/editing/inserting/insert-3659587-fix.html
875         * layout-tests/editing/inserting/insert-3775316-fix.html
876         * layout-tests/editing/inserting/insert-3800346-fix.html
877         * layout-tests/editing/inserting/insert-br-001.html
878         * layout-tests/editing/inserting/insert-br-002.html
879         * layout-tests/editing/inserting/insert-br-003.html
880         * layout-tests/editing/inserting/insert-br-004.html
881         * layout-tests/editing/inserting/insert-br-005.html
882         * layout-tests/editing/inserting/insert-br-006.html
883         * layout-tests/editing/inserting/insert-br-007.html
884         * layout-tests/editing/inserting/insert-br-008.html
885         * layout-tests/editing/inserting/insert-tab-004.html
886         * layout-tests/editing/inserting/insert-text-with-newlines.html
887         * layout-tests/editing/pasteboard/paste-text-010.html
888
889 2004-12-02  Ken Kocienda  <kocienda@apple.com>
890
891         Reviewed by John
892
893         Fix for this bug:
894         
895         <rdar://problem/3786362> REGRESSION (Mail): pasted text loses one newline
896
897         * khtml/editing/htmlediting.cpp:
898         (khtml::InsertLineBreakCommand::doApply): Added check for strict mode before adding an extra br element
899         at the end of a block. This is only necessary in quirks mode. Also, lower-case "br" used to make element.
900         (khtml::ReplaceSelectionCommand::doApply): If the replacement adds a br element as the last element
901         in a block and the document is in quirks mode, add an additional br to make the one in the 
902         replacement content show up. This turns out to be much the same logic as is done in InsertLineBreakCommand.
903         * layout-tests/editing/inserting/insert-3786362-fix-expected.txt: Added.
904         * layout-tests/editing/inserting/insert-3786362-fix.html: Added.
905
906 2004-12-02  Richard Williamson   <rjw@apple.com>
907
908         Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images
909
910         Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
911         the b/f cache won't incorrectly trash the previous state when restoring.
912
913         Reviewed by John.
914
915         * kwq/WebCoreBridge.h:
916         * kwq/WebCoreBridge.mm:
917         (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
918         (-[WebCoreBridge canCachePage]):
919         (-[WebCoreBridge clear]):
920
921 2004-12-02  Ken Kocienda  <kocienda@apple.com>
922
923         Reviewed by Richard
924
925         Fix for this bug:
926         
927         <rdar://problem/3857775> 8A293: Mail.app crashes converting copy-pasted text into plain text
928
929         * khtml/xml/dom2_rangeimpl.cpp:
930         (DOM::RangeImpl::commonAncestorContainer): Return the document element if no common ancestor container
931         was found. This can happen in cases where the DOM was built from malformed markup (as in the case
932         of this bug where there is content after the body tag). Did a little code clean up as well.
933         (DOM::RangeImpl::compareBoundaryPoints): Made code more robust by adding some null checks.
934
935 2004-12-02  Ken Kocienda  <kocienda@apple.com>
936
937         Reviewed by Chris
938
939         Fix for this bug:
940         
941         <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection was created right-to-left
942
943         * khtml/khtml_part.cpp:
944         (KHTMLPart::handleMousePressEventSingleClick): Use RangeImpl::compareBoundaryPoints
945         to figure out which end of the selection to extend.
946
947 2004-12-02  David Harrison  <harrison@apple.com>
948
949         Reviewed by Ken Kocienda.
950
951                 <rdar://problem/3834917> REGRESSION (Mail): double-clicking blank line selects end of previous line
952                 Fixed originally reported bug plus the case of double-clicking whitespace at the beginning of a line, which has a similar result.
953
954         * khtml/editing/visible_text.cpp:
955         (khtml::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
956         (khtml::SimplifiedBackwardsTextIterator::handleTextNode):
957         (khtml::SimplifiedBackwardsTextIterator::handleReplacedElement):
958         (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode):
959         (khtml::SimplifiedBackwardsTextIterator::emitCharacter):
960         Distinguish BR from whitespace.
961         * khtml/editing/visible_text.h:
962         Distinguish BR from whitespace.
963         * khtml/editing/visible_units.cpp:
964         (khtml::previousWordBoundary):
965         Use UPSTREAM visible position now that SimplifiedBackwardsTextIterator distinguishes BR from whitespace.  Otherwise, double-clicking at end of line would result in caret selection at start of next line. 
966
967 2004-12-02  Ken Kocienda  <kocienda@apple.com>
968
969         Reviewed by John
970
971         Fix for this bug:
972         
973         <rdar://problem/3900996> Crash dragging past end of contentEditable DIV, at DOM::RangeImpl::pastEndNode() const + 24
974
975         * khtml/xml/dom_position.cpp:
976         (DOM::Position::equivalentRangeCompliantPosition): Fixed this function so that it constrains the offset
977         of the position to be >= 0 and <= number of kids of its node. Not doing this constraining led to a DOM
978         exception trying to use a Position returned from this function to set the boundary point of a Range (which
979         eventually led to the crash). Since this crash happened, it seems like this function was failing in its
980         contract to return a range-compliant position, hence the need for this fix.
981
982 2004-12-01  Ken Kocienda  <kocienda@apple.com>
983
984         Reviewed by me
985
986         Moving code only.
987
988         * khtml/editing/htmlediting.cpp: Move ReplaceSelectionCommand into alphabetical order with
989         regard to other editing commands. The class had a name change ages ago, and it was never
990         moved.
991         * khtml/editing/htmlediting.h: Ditto.
992
993 2004-12-01  Ken Kocienda  <kocienda@apple.com>
994
995         Reviewed by Hyatt
996         
997         Some improvements for paste, including some new code to annotate
998         whitespace when writing to the pasteboard to ensure that the meaning
999         of the markup on the pasteboard is unambiguous.
1000         
1001         There is also new code for reading this annotated markup from the pasteboard,
1002         removing the nodes that were added only to prevent ambiguity.
1003
1004         * WebCore.pbproj/project.pbxproj: Added html_interchange.h and html_interchange.cpp files.
1005         The header should have been added earlier, but I did not do so.
1006         * khtml/editing/html_interchange.cpp: Added.
1007         (convertHTMLTextToInterchangeFormat):
1008         * khtml/editing/html_interchange.h: Added some new constants for use with whitespace annotations.
1009         * khtml/editing/htmlediting.cpp:
1010         (khtml::ReplacementFragment::ReplacementFragment): Now looks for and removes annotations added for whitespace.
1011         Also fixed a bug in the code that counts blocks in a fragment.
1012         (khtml::ReplacementFragment::isInterchangeConvertedSpaceSpan): New helper. Recognizes annotation spans.
1013         (khtml::ReplacementFragment::insertNodeBefore): New helper.
1014         (khtml::ReplaceSelectionCommand::doApply): Fixed a bug in the code that sets the start position
1015         for the replacement after deleting. This was causing a bug when pasting at the end of a block.
1016         * khtml/editing/htmlediting.h: Add some new declarations.
1017         * khtml/xml/dom2_rangeimpl.cpp:
1018         (DOM::RangeImpl::toHTML): Calls to startMarkup now pass true for the new annotate flag.
1019         * khtml/xml/dom_nodeimpl.cpp:
1020         (NodeImpl::stringValueForRange): New helper.
1021         (NodeImpl::renderedText): New helper to return only the rendered text in a node.
1022         (NodeImpl::startMarkup): Now takes an additional flag to control whether interchange annotations
1023         should be added. Called by the paste code.
1024         * khtml/xml/dom_nodeimpl.h: Added and modified function declarations.
1025
1026         New test to check the khtml::ReplaceSelectionCommand::doApply fix.
1027         * layout-tests/editing/pasteboard/paste-text-010-expected.txt: Added.
1028         * layout-tests/editing/pasteboard/paste-text-010.html: Added.
1029
1030 2004-11-30  Chris Blumenberg  <cblu@apple.com>
1031
1032         * ChangeLog: removed conflict marker
1033
1034 2004-11-30  Chris Blumenberg  <cblu@apple.com>
1035
1036         Fixed:
1037         <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
1038         <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
1039
1040         Reviewed by darin.
1041
1042         * khtml/misc/loader.cpp:
1043         (CachedObject::~CachedObject): release m_allData
1044         (CachedObject::setAllData): new
1045         (Loader::servePendingRequests): connect slotAllData
1046         (Loader::slotAllData): new
1047         (Cache::requestImage): tweak
1048         * khtml/misc/loader.h:
1049         (khtml::CachedObject::CachedObject): set allData to 0
1050         (khtml::CachedObject::allData): new
1051         * kwq/KWQKJobClasses.h:
1052         * kwq/KWQKJobClasses.mm:
1053         (KIO::TransferJob::TransferJob): set m_allData
1054         (KIO::TransferJob::emitAllData): new
1055         * kwq/KWQLoader.mm:
1056         (KWQCheckCacheObjectStatus): pass WebKit the data instead of the length of the resource
1057         * kwq/KWQResourceLoader.mm:
1058         (-[KWQResourceLoader finishWithData:]): renamed to pass all data for the resource
1059         * kwq/KWQSlot.mm:
1060         (KWQSlot::KWQSlot): support for slotAllData
1061         (KWQSlot::call):
1062         * kwq/WebCoreBridge.h:
1063         * kwq/WebCoreResourceLoader.h:
1064
1065 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
1066
1067         Reviewed by John.
1068
1069 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
1070
1071         Reviewed by John.
1072
1073         <rdar://problem/3805311> REGRESSION (159-163): onload in dynamically written document not called (causes blank search page at Japanese EPP site, many others)
1074
1075         * khtml/khtml_part.cpp:
1076         (KHTMLPart::begin): call setParsing on document here after opening
1077         - from now on we'll only set parsing to true for a document open
1078         caused by page loading, not a programmatic one.
1079         * khtml/xml/dom_docimpl.cpp:
1080         (DocumentImpl::open): don't setParsing to true here any more.
1081
1082 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
1083
1084         Reviewed by John.
1085
1086         - fix recent regression from collection perf fixes.
1087         
1088         * khtml/html/html_miscimpl.cpp:
1089         (HTMLFormCollectionImpl::updateNameCache): Look up the name
1090         attribute in the name cache, not the id cache (d'oh!)
1091
1092 2004-11-30  Darin Adler  <darin@apple.com>
1093
1094         Reviewed by Ken.
1095
1096         - rolled in a KDE fix for a problem that may underlie a number of crashes
1097
1098         * khtml/xml/dom2_rangeimpl.cpp: (RangeImpl::compareBoundaryPoints): Rolled in a change from
1099         the KDE guys to fix a subtle problem. Code said "n = n =".
1100
1101         - rolled in a KDE fix for a containingBlock crash
1102
1103         * khtml/rendering/render_object.cpp: Roll in a change from KDE that adds frameset to the list of
1104         elements that can not be a containingBlock. They said this fixes a crash, although I did not look
1105         into that further.
1106
1107         - fixed <rdar://problem/3884660> 8A305: Repro crash in QScrollBar::setValue (affects Safari RSS)
1108
1109         * kwq/KWQButton.mm:
1110         (-[KWQButton initWithQButton:]): Set up target and action here instead of in caller.
1111         (-[KWQButton detachQButton]): Added.
1112         (-[KWQButton sendConsumedMouseUpIfNeeded]): Check button for nil instead of checking target.
1113         (-[KWQButton mouseDown:]): Add calls to QWidget::beforeMouseDown/afterMouseDown.
1114         (-[KWQButton widget]): Added.
1115         (-[KWQButton becomeFirstResponder]): Added check to handle when button is 0.
1116         (-[KWQButton resignFirstResponder]): Ditto.
1117         (-[KWQButton canBecomeKeyView]): Ditto.
1118         (QButton::QButton): Remove target and action setup; handled in KWQButton now.
1119         (QButton::~QButton): Call detachQButton instead of setTarget:nil.
1120
1121         * kwq/KWQComboBox.mm:
1122         (QComboBox::~QComboBox): Call detachQComboBox.
1123         (-[KWQPopUpButtonCell detachQComboBox]): Added.
1124         (-[KWQPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:]): Handle case where box is 0.
1125         (-[KWQPopUpButtonCell setHighlighted:]): Ditto.
1126         (-[KWQPopUpButton action:]): Ditto.
1127         (-[KWQPopUpButton widget]): Tweaked.
1128         (-[KWQPopUpButton mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.
1129         (-[KWQPopUpButton becomeFirstResponder]): Handle case where widget is 0.
1130         (-[KWQPopUpButton resignFirstResponder]): Ditto.
1131         (-[KWQPopUpButton canBecomeKeyView]): Ditto.
1132
1133         * kwq/KWQLineEdit.mm: (QLineEdit::~QLineEdit): Updated to use new detachQLineEdit name.
1134
1135         * kwq/KWQListBox.mm:
1136         (-[KWQTableView mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.
1137
1138         * kwq/KWQScrollBar.h: Removed m_scroller field.
1139         * kwq/KWQScrollBar.mm:
1140         (-[KWQScrollBar initWithQScrollBar:]): Rearranged a little bit.
1141         (-[KWQScrollBar detachQScrollBar]): Added.
1142         (-[KWQScrollBar widget]): Added.
1143         (-[KWQScrollBar mouseDown:]): Added.  Calls QWidget::beforeMouseDown and afterMouseDown.
1144         (QScrollBar::QScrollBar): Changed to no longer set m_scroller.
1145         (QScrollBar::~QScrollBar): Changed to call detachQScrollBar. No longer calls removeFromSuperview.
1146         (QScrollBar::setValue): Chagned to use getView instad of m_scrollBar.
1147         (QScrollBar::setKnobProportion): Ditto.
1148         (QScrollBar::scrollbarHit): Ditto.
1149
1150         * kwq/KWQScrollView.mm:
1151         (QScrollView::addChild): Changed to call QWidget to add to superview to accomodate the
1152         hack where we don't remove right away when doing mouse tracking.
1153         (QScrollView::removeChild): Changed to call QWidget to remove from superview to accomodate
1154         the hack where we don't add right away when doing mouse tracking.
1155
1156         * kwq/KWQSlider.h: Added destructor.
1157         * kwq/KWQSlider.mm:
1158         (-[KWQSlider initWithQSlider:]): Tweaked a little.
1159         (-[KWQSlider detachQSlider]): Added.
1160         (-[KWQSlider mouseDown:]): Added call to QWidget::beforeMouseDown/afterMouseDown.
1161         (-[KWQSlider widget]): Added.
1162         (QSlider::~QSlider): Added. Calls detachQSlider.
1163
1164         * kwq/KWQTextArea.h: Added detachQTextEdit method.
1165         * kwq/KWQTextArea.mm:
1166         (-[KWQTextArea detachQTextEdit]): Added.
1167         (-[KWQTextArea textDidChange:]): Added check for widget of 0.
1168         (-[KWQTextArea becomeFirstResponder]): Ditto.
1169         (-[KWQTextArea nextKeyView]): Ditto.
1170         (-[KWQTextArea previousKeyView]): Ditto.
1171         (-[KWQTextArea drawRect:]): Ditto.
1172         (-[KWQTextAreaTextView insertTab:]): Ditto.
1173         (-[KWQTextAreaTextView insertBacktab:]): Ditto.
1174         (-[KWQTextAreaTextView shouldDrawInsertionPoint]): Ditto.
1175         (-[KWQTextAreaTextView selectedTextAttributes]): Ditto.
1176         (-[KWQTextAreaTextView mouseDown:]): Ditto.
1177         (-[KWQTextAreaTextView keyDown:]): Ditto.
1178         (-[KWQTextAreaTextView keyUp:]): Ditto.
1179
1180         * kwq/KWQTextEdit.h: Added ~QTextEdit.
1181         * kwq/KWQTextEdit.mm: (QTextEdit::~QTextEdit): Added. Calls detachQTextEdit.
1182
1183         * kwq/KWQTextField.h: Changed invalidate to detachQLineEdit.
1184         * kwq/KWQTextField.mm: (-[KWQTextFieldController detachQLineEdit]): Changed.
1185
1186         * kwq/KWQWidget.h: Added addToSuperview/removeFromSuperview for use from QScrollView.
1187         Added beforeMouseDown and afterMouseDown for use in widget implementations.
1188         Removed unused hasMouseTracking function.
1189         * kwq/KWQWidget.mm:
1190         (QWidget::QWidget): Initialize two new fields.
1191         (QWidget::~QWidget): Added code to remove view when widget is destroyed.
1192         (QWidget::getOuterView): Remove unneeded exception blocking since we're just caling superview.
1193         (QWidget::addToSuperview): Added.
1194         (QWidget::removeFromSuperview): Added.
1195         (QWidget::beforeMouseDown): Added.
1196         (QWidget::afterMouseDown): Added.
1197
1198         * khtml/rendering/render_layer.cpp:
1199         (RenderLayer::setHasHorizontalScrollbar): Remove parent parameter; let addChild call addSubview:.
1200         (RenderLayer::setHasVerticalScrollbar): Ditto.
1201
1202 2004-11-30  Ken Kocienda  <kocienda@apple.com>
1203
1204         Reviewed by John
1205
1206         Fix for this bug:
1207         
1208         <rdar://problem/3863031> REGRESSION (Mail): caret continues flashing while mouse is down
1209
1210         * khtml/khtml_part.cpp:
1211         (KHTMLPart::timerEvent): Add a check for whether the mouse is down. Keep the caret drawn
1212         with no blink if it is.
1213
1214 2004-11-30  Ken Kocienda  <kocienda@apple.com>
1215
1216         Reviewed by John
1217
1218         Fix for this bug:
1219         
1220         <rdar://problem/3861602> cursor gets lost trying to backspace to delete a form control
1221
1222         * khtml/khtml_part.cpp:
1223         (KHTMLPart::setFocusNodeIfNeeded): This function would clear the selection if a <button>
1224         or <input type=image> was checked for focus since these elements are keyboard-focusable,
1225         but not mouse focusable. Also, this function did not work hard enough to set the focused
1226         node, and was content to clear it if the first element checked failed the test, rather
1227         than looking more at parents. This would have the effect of clearing, then resetting the
1228         focus on a DIV containing a button or image with content on either side of it in the
1229         process of arrowing over such content.
1230
1231 2004-11-30  Ken Kocienda  <kocienda@apple.com>
1232
1233         Reviewed by John
1234
1235         * khtml/editing/htmlediting.cpp:
1236         (khtml::ReplaceSelectionCommand::doApply): Fix smart replace, which I (knowingly) broke with yesterday's checkin.
1237         Also, call updateLayout() in one more place to prevent stale information being returned from caretMaxOffset().
1238         * khtml/khtml_part.cpp:
1239         (KHTMLPart::isCharacterSmartReplaceExempt): Make this virtual and always return true. This gets rid of an
1240         ugly APPLE_CHANGES block and use of KWQ(part) in ReplaceSelectionCommand.
1241         * khtml/khtml_part.h: To help out with the isCharacterSmartReplaceExempt cleanup, add declaration.
1242         * kwq/KWQKHTMLPart.h: To help out with the isCharacterSmartReplaceExempt cleanup, make 
1243         isCharacterSmartReplaceExempt virtual.
1244
1245 2004-11-30  Ken Kocienda  <kocienda@apple.com>
1246
1247         Reviewed by me
1248
1249         * khtml/editing/htmlediting.cpp:
1250         (khtml::ReplacementFragment::mergeEndNode): Fixed one-line coding mistake that created an endless loop.
1251         Seemed simple enough to land without review.
1252
1253 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1254
1255         Reviewed by Chris
1256     
1257         Rewrite of paste code (specifically the ReplaceSelectionCommand class). Many more cases
1258         are handled correctly now, including selections that span multiple blocks, and cases
1259         where content on the pasteboard ends in newlines (or what appear to be newlines to a
1260         user, really block ends or BRs). I also made one small, but important change in the 
1261         copy code to annotate the markup written to the pasteboard to support these selections 
1262         ending in newlines.
1263
1264         New header that defines a couple of constants used in copying and pasting.
1265
1266         * ForwardingHeaders/editing/html_interchange.h: Added.
1267         * khtml/editing/html_interchange.h: Added.
1268         
1269         Rewrite of the ReplaceSelectionCommand. There are several new helper functions, as well
1270         as a new helper class, ReplacementFragment, which encapsulates information and functions
1271         pertaining to a document fragment that is being inserted into a document.
1272         
1273         * khtml/editing/htmlediting.cpp:
1274         (khtml::ReplacementFragment::ReplacementFragment):
1275         (khtml::ReplacementFragment::~ReplacementFragment):
1276         (khtml::ReplacementFragment::firstChild): Simple accessor.
1277         (khtml::ReplacementFragment::lastChild): Ditto.
1278         (khtml::ReplacementFragment::mergeStartNode): Looks at the nodes in a fragment and determines
1279         the starting node to use for merging into the block containing the start of the selection.
1280         (khtml::ReplacementFragment::mergeEndNode): Same as above, but for the end of the selection.
1281         (khtml::ReplacementFragment::pruneEmptyNodes): Simple helper.
1282         (khtml::ReplacementFragment::isInterchangeNewlineComment): Determines if a node is the
1283         special annotation comment added in by the copy code.
1284         (khtml::ReplacementFragment::removeNode): Simple helper.
1285         (khtml::isComment): Simple helper.
1286         (khtml::isProbablyBlock): Determines if a node is of a type that is usually rendered as a block.
1287         I would like to do better than this some day, but this check will hold us until I can do better.
1288         (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand):
1289         (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand):
1290         (khtml::ReplaceSelectionCommand::doApply):
1291         (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Figures out the right ending selection.
1292         * khtml/editing/htmlediting.h: Declarations for the new ReplacementFragment class.
1293         (khtml::ReplacementFragment::root):
1294         (khtml::ReplacementFragment::type):
1295         (khtml::ReplacementFragment::isEmpty):
1296         (khtml::ReplacementFragment::isSingleTextNode):
1297         (khtml::ReplacementFragment::isTreeFragment):
1298         (khtml::ReplacementFragment::hasMoreThanOneBlock):
1299         (khtml::ReplacementFragment::hasLogicalNewlineAtEnd):
1300         
1301         This smaller set of changes markup generation to add the newline annotation described in the
1302         comment at the start of this entry.
1303         
1304         * khtml/xml/dom2_rangeimpl.cpp:
1305         (DOM::RangeImpl::addCommentToHTMLMarkup): Simple helper.
1306         (DOM::RangeImpl::toHTML): Added new EAnnotateForInterchange default argument to control whether
1307         comment annotations are added to the markup generated.
1308         * khtml/xml/dom2_rangeimpl.h: Add some new declarations.
1309         * kwq/WebCoreBridge.mm:
1310         (-[WebCoreBridge markupStringFromRange:nodes:]): Request that markup resulting from call to 
1311         DOM::RangeImpl::toHTML uses annotations when generating.
1312         
1313         New tests.        
1314
1315         * layout-tests/editing/pasteboard/paste-text-001-expected.txt: Added.
1316         * layout-tests/editing/pasteboard/paste-text-001.html: Added.
1317         * layout-tests/editing/pasteboard/paste-text-002-expected.txt: Added.
1318         * layout-tests/editing/pasteboard/paste-text-002.html: Added.
1319         * layout-tests/editing/pasteboard/paste-text-003-expected.txt: Added.
1320         * layout-tests/editing/pasteboard/paste-text-003.html: Added.
1321         * layout-tests/editing/pasteboard/paste-text-004-expected.txt: Added.
1322         * layout-tests/editing/pasteboard/paste-text-004.html: Added.
1323         * layout-tests/editing/pasteboard/paste-text-005-expected.txt: Added.
1324         * layout-tests/editing/pasteboard/paste-text-005.html: Added.
1325         * layout-tests/editing/pasteboard/paste-text-006-expected.txt: Added.
1326         * layout-tests/editing/pasteboard/paste-text-006.html: Added.
1327         * layout-tests/editing/pasteboard/paste-text-007-expected.txt: Added.
1328         * layout-tests/editing/pasteboard/paste-text-007.html: Added.
1329         * layout-tests/editing/pasteboard/paste-text-008-expected.txt: Added.
1330         * layout-tests/editing/pasteboard/paste-text-008.html: Added.
1331         * layout-tests/editing/pasteboard/paste-text-009-expected.txt: Added.
1332         * layout-tests/editing/pasteboard/paste-text-009.html: Added.
1333
1334 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1335
1336         Reviewed by Harrison
1337
1338         Made two small changes that make it possible for comments to have DOM nodes made for them
1339         when pasting. This relies on some earlier work I did some days ago.
1340
1341         * khtml/xml/dom_nodeimpl.cpp:
1342         (NodeImpl::startMarkup): Get the string from the comment.
1343         * kwq/WebCoreBridge.mm:
1344         (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): Did some very minor
1345         rearranging. Now passes a flag when creating a contextual fragment, requesting that comments
1346         be included in the DOM.
1347
1348 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1349
1350         Reviewed by Harrison
1351
1352         Added some new helpers to the VisiblePosition class. I will begin to use these when I check in
1353         my improved paste code.
1354
1355         * khtml/editing/visible_position.cpp:
1356         (khtml::blockRelationship)
1357         (khtml::visiblePositionsInDifferentBlocks)
1358         (khtml::isFirstVisiblePositionInBlock)
1359         (khtml::isFirstVisiblePositionInNode)
1360         (khtml::isLastVisiblePositionInBlock)
1361         * khtml/editing/visible_position.h
1362
1363 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1364
1365         Reviewed by Harrison
1366
1367         * khtml/xml/dom_position.cpp:
1368         (DOM::Position::downstream): Fix a bug in downstream that prevented a call with DoNotStayInBlock
1369         specified from obeying that directive. The old code would stop at an outer block boundary in
1370         the case where that block had a block as its first child. The correct behavior is to drill into
1371         that inner block (and continue on drilling down, if possible), to find the correct position.
1372
1373 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1374
1375         Reviewed by Harrison
1376
1377         Small improvements to the node-display debugging helpers.
1378
1379         * khtml/xml/dom_nodeimpl.cpp:
1380         (NodeImpl::displayTree): Make the rootNode be this if there is no rootEditableElement.
1381         * khtml/xml/dom_nodeimpl.h: Make displayNode take a default argument of "" for its string.
1382
1383 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1384
1385         Reviewed by Harrison
1386
1387         * khtml/editing/htmlediting.cpp:
1388         (khtml::DeleteSelectionCommand::handleGeneralDelete): The downstream position in this function 
1389         may need to be adjusted when deleting text off the front part of a text node. This fixes a problem 
1390         I discovered while improving the paste command, where the insertion poitn wound up in the wrong
1391         place after the delete. 
1392
1393 2004-11-29  Ken Kocienda  <kocienda@apple.com>
1394
1395         Reviewed by Harrison
1396
1397         Add a new helper function to insert a paragraph separator. Will be used in my
1398         upcoming paste improvments.
1399
1400         * khtml/editing/htmlediting.cpp: Added function
1401         (khtml::CompositeEditCommand::insertParagraphSeparator)
1402         * khtml/editing/htmlediting.h: Ditto.
1403
1404 2004-11-23  David Harrison  <harrison@apple.com>
1405
1406         Added various comments.
1407
1408         * khtml/editing/htmlediting.cpp:
1409         (khtml::StyleChange::init):
1410         (khtml::ApplyStyleCommand::doApply):
1411         (khtml::ApplyStyleCommand::applyBlockStyle):
1412         (khtml::ApplyStyleCommand::applyInlineStyle):
1413
1414 2004-11-23  David Hyatt  <hyatt@apple.com>
1415
1416         Hit testing in table cells with top/bottom space from vertical alignment didn't work.  I forgot about the
1417         super-secret yPos() lie that table cells do.  Use m_y instead of yPos().
1418
1419         * khtml/rendering/render_block.cpp:
1420         (khtml::RenderBlock::nodeAtPoint):
1421
1422 2004-11-22  David Hyatt  <hyatt@apple.com>
1423
1424         Make sure you can use document.createElement to make a <canvas> element.
1425
1426         * khtml/xml/dom_docimpl.cpp:
1427         (DocumentImpl::createHTMLElement):
1428
1429 2004-11-22  Maciej Stachowiak  <mjs@apple.com>
1430
1431         Reviewed by Dave.
1432
1433         <rdar://problem/3492044> performing JavaScript operations on form elements is slower than WinIE (HTMLFormCollection)
1434         <rdar://problem/3489679> selecting an item on the Apache bugzilla query page is very slow (HTMLFormCollection)
1435         <rdar://problem/3477810> checking 80 check boxes with JavaScript is 10x slower than in IE (HTMLFormCollection)
1436         <rdar://problem/3760962> JavaScript that toggles checkboxes is slow (HTMLCollection,HTMLFormCollection)
1437         
1438         * khtml/ecma/kjs_html.cpp:
1439         (KJS::HTMLDocument::tryGet):
1440         * khtml/html/html_formimpl.cpp:
1441         (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
1442         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
1443         * khtml/html/html_formimpl.h:
1444         * khtml/html/html_miscimpl.cpp:
1445         (HTMLCollectionImpl::HTMLCollectionImpl):
1446         (HTMLCollectionImpl::~HTMLCollectionImpl):
1447         (HTMLCollectionImpl::CollectionInfo::CollectionInfo):
1448         (HTMLCollectionImpl::CollectionInfo::reset):
1449         (HTMLCollectionImpl::resetCollectionInfo):
1450         (HTMLCollectionImpl::checkForNameMatch):
1451         (appendToVector):
1452         (HTMLCollectionImpl::updateNameCache):
1453         (HTMLCollectionImpl::namedItems):
1454         (HTMLFormCollectionImpl::HTMLFormCollectionImpl):
1455         (HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
1456         (HTMLFormCollectionImpl::item):
1457         (HTMLFormCollectionImpl::updateNameCache):
1458         * khtml/html/html_miscimpl.h:
1459
1460 2004-11-22  David Hyatt  <hyatt@apple.com>
1461
1462         Improve the WebCore cache so that the maximum cacheable object size is scaled based off the total cache
1463         size.
1464         
1465         Reviewed by mjs
1466
1467         * khtml/misc/loader.cpp:
1468         (CachedObject::finish):
1469         (Cache::flush):
1470         (Cache::setSize):
1471         * khtml/misc/loader.h:
1472         (khtml::Cache::maxCacheableObjectSize):
1473
1474 2004-11-22  David Hyatt  <hyatt@apple.com>
1475
1476         Fix for 3673381, huge directory listing so slow it seems like a hang.  Rework painting and hit testing so that
1477         it crawls the line box tree instead of the render tree.  This allows more precise intersection/containment testing
1478         that lets us short circuit earlier when painting and hit testing.
1479         
1480         Reviewed by mjs
1481
1482         * khtml/khtml_part.cpp:
1483         (KHTMLPart::isPointInsideSelection):
1484         * khtml/rendering/render_block.cpp:
1485         (khtml::RenderBlock::paint):
1486         (khtml::RenderBlock::paintChildren):
1487         (khtml::RenderBlock::paintObject):
1488         (khtml::RenderBlock::paintFloats):
1489         (khtml::RenderBlock::nodeAtPoint):
1490         * khtml/rendering/render_block.h:
1491         * khtml/rendering/render_box.cpp:
1492         (RenderBox::nodeAtPoint):
1493         * khtml/rendering/render_box.h:
1494         * khtml/rendering/render_br.h:
1495         * khtml/rendering/render_canvas.cpp:
1496         (RenderCanvas::paint):
1497         * khtml/rendering/render_flow.cpp:
1498         (RenderFlow::paintLines):
1499         (RenderFlow::hitTestLines):
1500         (RenderFlow::caretRect):
1501         (RenderFlow::addFocusRingRects):
1502         (RenderFlow::paintFocusRing):
1503         (RenderFlow::paintOutlines):
1504         (RenderFlow::paintOutlineForLine):
1505         * khtml/rendering/render_flow.h:
1506         * khtml/rendering/render_frames.cpp:
1507         (RenderFrameSet::nodeAtPoint):
1508         * khtml/rendering/render_frames.h:
1509         * khtml/rendering/render_image.cpp:
1510         (RenderImage::nodeAtPoint):
1511         * khtml/rendering/render_image.h:
1512         * khtml/rendering/render_inline.cpp:
1513         (RenderInline::paint):
1514         (RenderInline::nodeAtPoint):
1515         * khtml/rendering/render_inline.h:
1516         * khtml/rendering/render_layer.cpp:
1517         (RenderLayer::paintLayer):
1518         (RenderLayer::hitTest):
1519         (RenderLayer::hitTestLayer):
1520         * khtml/rendering/render_layer.h:
1521         * khtml/rendering/render_line.cpp:
1522         (khtml::InlineBox::paint):
1523         (khtml::InlineBox::nodeAtPoint):
1524         (khtml::InlineFlowBox::flowObject):
1525         (khtml::InlineFlowBox::nodeAtPoint):
1526         (khtml::InlineFlowBox::paint):
1527         (khtml::InlineFlowBox::paintBackgrounds):
1528         (khtml::InlineFlowBox::paintBackground):
1529         (khtml::InlineFlowBox::paintBackgroundAndBorder):
1530         (khtml::InlineFlowBox::paintDecorations):
1531         (khtml::EllipsisBox::paint):
1532         (khtml::EllipsisBox::nodeAtPoint):
1533         (khtml::RootInlineBox::paintEllipsisBox):
1534         (khtml::RootInlineBox::paint):
1535         (khtml::RootInlineBox::nodeAtPoint):
1536         * khtml/rendering/render_line.h:
1537         (khtml::InlineRunBox::paintBackgroundAndBorder):
1538         * khtml/rendering/render_object.cpp:
1539         (RenderObject::hitTest):
1540         (RenderObject::setInnerNode):
1541         (RenderObject::nodeAtPoint):
1542         * khtml/rendering/render_object.h:
1543         (khtml::RenderObject::PaintInfo::PaintInfo):
1544         (khtml::RenderObject::PaintInfo::~PaintInfo):
1545         (khtml::RenderObject::paintingRootForChildren):
1546         (khtml::RenderObject::shouldPaintWithinRoot):
1547         * khtml/rendering/render_table.cpp:
1548         (RenderTable::layout):
1549         (RenderTable::paint):
1550         * khtml/rendering/render_text.cpp:
1551         (simpleDifferenceBetweenColors):
1552         (correctedTextColor):
1553         (InlineTextBox::nodeAtPoint):
1554         (InlineTextBox::paint):
1555         (InlineTextBox::selectionStartEnd):
1556         (InlineTextBox::paintSelection):
1557         (InlineTextBox::paintMarkedTextBackground):
1558         (InlineTextBox::paintDecoration):
1559         (RenderText::posOfChar):
1560         * khtml/rendering/render_text.h:
1561         (khtml::RenderText::paint):
1562         (khtml::RenderText::layout):
1563         (khtml::RenderText::nodeAtPoint):
1564         * khtml/xml/dom2_eventsimpl.cpp:
1565         (MouseEventImpl::computeLayerPos):
1566         * khtml/xml/dom_docimpl.cpp:
1567         (DocumentImpl::prepareMouseEvent):
1568         * kwq/KWQAccObject.mm:
1569         (-[KWQAccObject accessibilityHitTest:]):
1570         * kwq/KWQKHTMLPart.mm:
1571         (KWQKHTMLPart::scrollOverflowWithScrollWheelEvent):
1572         (KWQKHTMLPart::eventMayStartDrag):
1573         (KWQKHTMLPart::khtmlMouseMoveEvent):
1574         * kwq/WebCoreBridge.mm:
1575         (-[WebCoreBridge elementAtPoint:]):
1576         (-[WebCoreBridge _positionForPoint:]):
1577
1578 2004-11-22  Maciej Stachowiak  <mjs@apple.com>
1579
1580         Reviewed by Dave.
1581
1582         <rdar://problem/3890961> selecting an item on the Apache bugzilla query page can be sped up 10% (HTMLFormCollection)
1583         <rdar://problem/3890958> JavaScript that toggles checkboxes can be improved 73% (HTMLCollection,HTMLFormCollection)
1584
1585         This avoids the O(N^2) penalty for named item traversal for form collections.
1586
1587         It also combines the item traversal logic for all non-form
1588         collection operations into a single traverseNextItem
1589         function. This avoids having 5 copies of the big switch statement
1590         for this.
1591
1592         Also fixed a bug that prevented the last form element from being removed properly.
1593         
1594         * khtml/html/html_formimpl.cpp:
1595         (DOM::removeFromVector):
1596         * khtml/dom/html_misc.cpp:
1597         (HTMLCollection::namedItems):
1598         * khtml/dom/html_misc.h:
1599         * khtml/ecma/kjs_html.cpp:
1600         (KJS::HTMLCollection::getNamedItems):
1601         * khtml/html/html_miscimpl.cpp:
1602         (HTMLCollectionImpl::traverseNextItem):
1603         (HTMLCollectionImpl::calcLength):
1604         (HTMLCollectionImpl::length):
1605         (HTMLCollectionImpl::item):
1606         (HTMLCollectionImpl::nextItem):
1607         (HTMLCollectionImpl::checkForNameMatch):
1608         (HTMLCollectionImpl::namedItem):
1609         (HTMLCollectionImpl::namedItems):
1610         (HTMLCollectionImpl::nextNamedItem):
1611         (HTMLFormCollectionImpl::calcLength):
1612         (HTMLFormCollectionImpl::namedItem):
1613         (HTMLFormCollectionImpl::nextNamedItem):
1614         (HTMLFormCollectionImpl::namedItems):
1615         * khtml/html/html_miscimpl.h:
1616
1617 2004-11-22  Ken Kocienda  <kocienda@apple.com>
1618
1619         Reviewed by Harrison
1620
1621         Change around the way we block the Javascript "Paste" command identifier from
1622         being available. Formerly, this was done with an ifdef we never compiled in.
1623         Now, this is done with a couple of cheap runtime checks. The advantage is that
1624         we can now compile this command into development builds, and still yet switch
1625         on the command in deployment builds through the use of WebCore SPI so we can
1626         write and run layout tests with all of our builds.
1627
1628         * khtml/editing/jsediting.cpp:
1629         (DOM::JSEditor::queryCommandSupported): Checks state of paste command in case
1630         command being queried is the paste command. 
1631         (DOM::JSEditor::setSupportsPasteCommand): New SPI to turn on paste command.
1632         * khtml/editing/jsediting.h: Ditto.
1633         * khtml/khtml_part.cpp:
1634         (KHTMLPart::pasteFromPasteboard): Added.
1635         (KHTMLPart::canPaste): Added.
1636         * kwq/KWQKHTMLPart.mm:
1637         (KHTMLPart::canPaste): Added.
1638         * kwq/KWQRenderTreeDebug.cpp:
1639         (externalRepresentation): Turn on paste command.
1640         * kwq/WebCoreBridge.h: Add canPaste call so WebKit can fill in the answer.
1641
1642 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
1643
1644         Reviewed by Richard.
1645
1646         <rdar://problem/3889655> HTMLCollectionImpl should use traverseNextNode to improve speed and save recursion
1647         
1648         * khtml/html/html_miscimpl.cpp:
1649         (HTMLCollectionImpl::calcLength):
1650         (HTMLCollectionImpl::getItem):
1651         (HTMLCollectionImpl::item):
1652         (HTMLCollectionImpl::nextItem):
1653         (HTMLCollectionImpl::getNamedItem):
1654         (HTMLCollectionImpl::namedItem):
1655         (HTMLCollectionImpl::nextNamedItemInternal):
1656         (HTMLFormCollectionImpl::nextNamedItemInternal):
1657
1658 2004-11-19  Maciej Stachowiak  <mjs@apple.com>
1659
1660         Reviewed by Darin.
1661
1662         <rdar://problem/3482935> JavaScript so slow it seems like a hang (hrweb.apple.com) (HTMLCollection?)
1663         <rdar://problem/3759149> PeopleSoft page in Safari twice as slow as Mozilla engine (HTMLFormCollection)
1664         <rdar://problem/3888368> selecting an item on the Apache bugzilla query page can be improved 95% (HTMLFormCollection)
1665
1666         Many optimizations to HTMLFormCollection. Iterating it should not
1667         be N^2 any more, though finding items by name could still be.
1668         
1669         * khtml/html/html_formimpl.cpp:
1670         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
1671         (DOM::HTMLFormElementImpl::length):
1672         (DOM::HTMLFormElementImpl::submitClick):
1673         (DOM::HTMLFormElementImpl::formData):
1674         (DOM::HTMLFormElementImpl::submit):
1675         (DOM::HTMLFormElementImpl::reset):
1676         (DOM::HTMLFormElementImpl::radioClicked):
1677         (DOM::appendToVector):
1678         (DOM::removeFromVector):
1679         (DOM::HTMLFormElementImpl::registerFormElement):
1680         (DOM::HTMLFormElementImpl::removeFormElement):
1681         (DOM::HTMLFormElementImpl::makeFormElementDormant):
1682         (DOM::HTMLFormElementImpl::registerImgElement):
1683         (DOM::HTMLFormElementImpl::removeImgElement):
1684         * khtml/html/html_formimpl.h:
1685         * khtml/html/html_miscimpl.cpp:
1686         (HTMLFormCollectionImpl::FormCollectionInfo::FormCollectionInfo):
1687         (void::HTMLFormCollectionImpl::FormCollectionInfo::reset):
1688         (HTMLFormCollectionImpl::resetCollectionInfo):
1689         (HTMLFormCollectionImpl::calcLength):
1690         (HTMLFormCollectionImpl::item):
1691         (HTMLFormCollectionImpl::getNamedItem):
1692         (HTMLFormCollectionImpl::getNamedFormItem):
1693         (HTMLFormCollectionImpl::firstItem):
1694         (HTMLFormCollectionImpl::nextItem):
1695         * khtml/html/html_miscimpl.h:
1696         (DOM::HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
1697         * khtml/xml/dom_elementimpl.cpp:
1698         (ElementImpl::setAttribute):
1699         (ElementImpl::setAttributeMap):
1700         * kwq/KWQPtrVector.h:
1701         (QPtrVector::findRef):
1702         * kwq/KWQVectorImpl.h:
1703         * kwq/KWQVectorImpl.mm:
1704         (KWQVectorImpl::findRef):
1705         * kwq/WebCoreBridge.mm:
1706         (-[WebCoreBridge elementWithName:inForm:]):
1707         (-[WebCoreBridge controlsInForm:]):
1708
1709 2004-11-19  David Harrison  <harrison@apple.com>
1710
1711         Reviewed by Ken and Darin.
1712
1713         <rdar://problem/3856215> Cannot remove bold from the beginning of a message
1714
1715         Problem is that KHTMLPart::computeAndSetTypingStyle always looked upstream
1716         for the existing style, but in this case (hitting cmd-B with caret at top of
1717         file) there is nothing upstream.  Changed this to use the VisiblePosition
1718         deepEquivalent instead.
1719         
1720         * khtml/khtml_part.cpp:
1721         (KHTMLPart::computeAndSetTypingStyle):
1722
1723 === Safari-172 ===
1724
1725 2004-11-19  Maciej Stachowiak  <mjs@apple.com>
1726
1727         Reviewed by Darin.
1728
1729         <rdar://problem/3864151> REGRESSION (125-167): Chrysler.com never stops loading
1730         
1731         * khtml/xml/dom_docimpl.cpp:
1732         (DocumentImpl::close): Don't fire the onload handler if there is a
1733         redirect pending. This is a very long-standing bug that was masked
1734         by our previously incorrect redirect logic. It used to be that an
1735         older redirect would always win. Recently we changed things so
1736         that a newer redirect would win, but a script that causes a
1737         redirect would stop parsing once complete (so if there are two
1738         redirects in the same script, the latter wins). However, we should
1739         have also prevented onload in this case. Testing with other
1740         browsers shows that onload handlers do not run at all when there
1741         is a pending redirect.
1742
1743 2004-11-19  Ken Kocienda  <kocienda@apple.com>
1744
1745         Reviewed by Harrison
1746
1747         Fix some object lifetime issues in these two commands. This fixes some crashes
1748         I am seeing in some new code I am working on, but have not yet reproduced otherwise.
1749
1750         * khtml/editing/htmlediting.cpp:
1751         (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): No longer deref nodes
1752         in the ancestor list. They are not ref'ed when put on list. D'uh.
1753         (khtml::InsertParagraphSeparatorCommand::doApply): Ref all cloned nodes that are created by the command
1754         before putting them on the cloned nodes list. This are still deref'ed in the destructor.
1755         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto
1756         destructor comment.
1757         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto doApply comment.
1758
1759 2004-11-19  Ken Kocienda  <kocienda@apple.com>
1760
1761         Reviewed by Harrison
1762
1763         Fix for this bug:
1764         
1765         <rdar://problem/3655241> setTypingStyle: does not set the real typing style, and typingStyle does not return it
1766
1767         * khtml/khtml_part.cpp:
1768         (KHTMLPart::computeAndSetTypingStyle): New helper that does the work of reducing a passed-in style
1769         declaration given the current selection, and then sets the minimum necessary style as the typing
1770         style on the part.
1771         (KHTMLPart::applyStyle): Call new computeAndSetTypingStyle. The guts of computeAndSetTypingStyle used
1772         to be here in the selection-as-caret case. But now [WebCoreBridge setTypingStyle:] needs this code
1773         as well.
1774         * khtml/khtml_part.h: Declare new computeAndSetTypingStyle() function.
1775         * kwq/WebCoreBridge.h: Declare new typingStyle and setTypingStyle: methods.
1776         * kwq/WebCoreBridge.mm: 
1777         (-[WebCoreBridge typingStyle]): Calls through to the part to retrieve the typing style.
1778         (-[WebCoreBridge setTypingStyle:]): Calls through to the part to set the typing style.
1779
1780 2004-11-18  David Harrison  <harrison@apple.com>
1781
1782         Reviewed by Darin.
1783         
1784         Back out part of Darin's fix for <rdar://problem/3885729>, because the new exception gets triggered
1785         by Mail.app. Filed <rdar://problem/3886832> against Mail.app.
1786
1787         * kwq/DOM-CSS.mm:
1788         (-[DOMCSSStyleDeclaration setProperty:::]):
1789
1790 2004-11-18  Chris Blumenberg  <cblu@apple.com>
1791
1792         Fixed: <rdar://problem/3587481> Bug Reporter Login Page: Password AutoFill does not work reliably
1793
1794         Reviewed by john.
1795
1796         * kwq/KWQKHTMLPart.mm:
1797         (KWQKHTMLPart::currentForm): just return the current form, don't scan the entire document looking for a form if there is no current form
1798
1799 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1800
1801         Reviewed by Chris.
1802
1803         - fix recursive item traversal, use traverseNextNode() instead of
1804         the buggy hand-rolled traversal.
1805
1806         * khtml/xml/dom_nodeimpl.cpp:
1807         (NodeListImpl::recursiveItem):
1808
1809 2004-11-17  Darin Adler  <darin@apple.com>
1810
1811         Reviewed by Ken.
1812
1813         - fixed <rdar://problem/3885744> crash with XMLHttpRequest test page (reported by KDE folks)
1814
1815         * khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::slotFinished):
1816         Rolled in fix from KDE; make sure to set job to 0 before calling changeState.
1817
1818         - fixed <rdar://problem/3885729> attempting to modify a computed style does nothing, but should raise a DOM exception
1819         - fixed <rdar://problem/3885731> style declarations use too many malloc blocks; switch to QValueList
1820         - fixed <rdar://problem/3885739> DOM::NodeImpl accessor in DOM::Node class is hot; should be inlined
1821         - changed NodeImpl calls like replaceChild to always ref/deref the parameter; this is a better way to fix
1822           an entire category of leaks we have been fixing one by one recently
1823         - changed computed styles so they hold a reference to the DOM node; the old code could end up with a
1824           stale RenderObject pointer, although I never saw it do that in practice
1825         - implemented the length and item methods for computed styles
1826         - implemented querying additional properties in computed styles (29 more)
1827
1828         * khtml/khtml_part.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
1829         now a separate class rather than a typedef. Changed the parameter type of setTypingStyle to
1830         take a mutable style.
1831         * khtml/khtml_part.cpp:
1832         (KHTMLPart::setTypingStyle): Change parameter to take a mutable style.
1833         (KHTMLPart::applyStyle): Add code to make a mutable style in case we are passed
1834         a computed style; also change some types to mutable style.
1835         (updateState): Update iteration of CSSProperty objects in a style declaration to use
1836         the new valuesIterator interface.
1837         (KHTMLPart::selectionHasStyle): Add a call to makeMutable.
1838         (KHTMLPart::selectionStartHasStyle): Add call to makeMutable and update iteration.
1839         (editingStyle): Change type to mutable style, and simplify the style-creation calls,
1840         including accomodating the exception code that setCssText has now.
1841         (KHTMLPart::applyEditingStyleToElement): Change types to mutable style.
1842         (KHTMLPart::removeEditingStyleFromElement): Change code to call setChanged only if removing
1843         the style attributes really was a change, although it's not an important optimization it's
1844         good to do it right.
1845
1846         * khtml/css/css_base.h: Remove unneeded setParsedValue method.
1847         * khtml/css/css_base.cpp: Remove unneeded setParsedValue method. All the places that were
1848         calling it were already removing the old property explicitly, so the code in here to remove
1849         the property again was redundant.
1850
1851         * khtml/css/css_computedstyle.h: Updated virtual functions for changes to parameters in base class.
1852         Moved all the "set"-type functions so they are private. Store a node pointer instead of a renderer.
1853         * khtml/css/css_computedstyle.cpp:
1854         (DOM::CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl): Hold a reference to
1855         the node we compute style for, so we don't end up with a pointer to a deallocated RenderObject.
1856         Before we had no guarantee the object would outlast us.
1857         (DOM::CSSComputedStyleDeclarationImpl::setCssText): Add exception parameter, and set the
1858         exception to NO_MODIFICATION_ALLOWED_ERR.
1859         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Update to use node pointer rather
1860         than renderer pointer. Added implementation for box-align, box-direction, box-flex, box-flex-group,
1861         box-lines, box-ordinal-group, box-orient, box-pack, caption-side, clear, cursor, direction,
1862         list-style-image, list-style-position, list-style-type, marquee-direction, marquee-repetition,
1863         marquee-style, user-modify, opacity, orphans, outline-style, page-break-after, page-break-before,
1864         page-break-inside, position, unicode-bidi, widows, z-index.
1865         (DOM::CSSComputedStyleDeclarationImpl::removeProperty): Add exception parameter, and set the
1866         exception to NO_MODIFICATION_ALLOWED_ERR.
1867         (DOM::CSSComputedStyleDeclarationImpl::setProperty): Ditto.
1868         (DOM::CSSComputedStyleDeclarationImpl::length): Implemented.
1869         (DOM::CSSComputedStyleDeclarationImpl::item): Implemented, calls getPropertyValue.
1870         (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Changed return type to
1871         CSSMutableStyleDeclarationImpl.
1872         (DOM::CSSComputedStyleDeclarationImpl::copy): Added.
1873         (DOM::CSSComputedStyleDeclarationImpl::makeMutable): Added.
1874
1875         * khtml/css/css_ruleimpl.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
1876         now a separate class rather than a typedef.
1877         * khtml/css/cssparser.h: Ditto.
1878
1879         * khtml/css/css_valueimpl.h: Refactor CSSStyleDeclarationImpl into two classes. New derived class
1880         CSSMutableStyleDeclarationImpl has the guts, and the base class has only some virtual functions.
1881         Removed a bunch of redundant stuff from other classes in this file too.
1882         (DOM::DashboardRegionImpl::setNext): Ref new before deref'ing old to handle the set-to-same case.
1883         (DOM::CSSProperty::CSSProperty): Added new overload so you can create a CSSProperty with initial values.
1884         (DOM::CSSProperty::operator=): Added.
1885         (DOM::CSSProperty::setValue): Use ref-before-deref pattern to simplify slightly.
1886
1887         * khtml/css/css_valueimpl.cpp:
1888         (DOM::CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Remove uneeded things.
1889         (DOM::CSSStyleDeclarationImpl::isStyleDeclaration): Put here now that it's no longer inline.
1890         (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl): Added.
1891         (DOM::CSSMutableStyleDeclarationImpl::operator=): Added.
1892         (DOM::CSSMutableStyleDeclarationImpl::~CSSMutableStyleDeclarationImpl): Updated.
1893         (DOM::CSSMutableStyleDeclarationImpl::getPropertyValue): Removed now-uneeded check.
1894         (DOM::CSSMutableStyleDeclarationImpl::get4Values): Moved here from base class.
1895         (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue): Ditto.
1896         (DOM::CSSMutableStyleDeclarationImpl::getPropertyCSSValue): Update to use QValueList instead of QPtrList.
1897         (DOM::CSSMutableStyleDeclarationImpl::removeProperty): Added exception parameter, updated for QValueList.
1898         (DOM::CSSMutableStyleDeclarationImpl::setChanged): Moved here from base class.
1899         (DOM::CSSMutableStyleDeclarationImpl::getPropertyPriority): Update to use QValueList.
1900         (DOM::CSSMutableStyleDeclarationImpl::setProperty): Added more overloads to match new parameters.
1901         (DOM::CSSMutableStyleDeclarationImpl::setStringProperty): Update to use QValueList.
1902         (DOM::CSSMutableStyleDeclarationImpl::setImageProperty): Ditto.
1903         (DOM::CSSMutableStyleDeclarationImpl::parseProperty): Remove unneeded initialization code due to QValueList.
1904         (DOM::CSSMutableStyleDeclarationImpl::addParsedProperties): Added.
1905         (DOM::CSSMutableStyleDeclarationImpl::setLengthProperty): Moved here from base class.
1906         (DOM::CSSMutableStyleDeclarationImpl::length): Update to use QValueList.
1907         (DOM::CSSMutableStyleDeclarationImpl::item): Moved here from base class.
1908         (DOM::CSSMutableStyleDeclarationImpl::cssText): Return empty string rather than null string when there are
1909         no styles in the list. Update to use QValueList.
1910         (DOM::CSSMutableStyleDeclarationImpl::setCssText): Update to use QValueList and to take an exceptionCode
1911         parameter and set it.
1912         (DOM::CSSMutableStyleDeclarationImpl::merge): Update to use QValueList.
1913         (DOM::CSSStyleDeclarationImpl::diff): Update to use QValueList.
1914         (DOM::CSSMutableStyleDeclarationImpl::copyBlockProperties): Moved here from base class. Change return type.
1915         (DOM::CSSStyleDeclarationImpl::copyPropertiesInSet): Update to use QValueList and use stack, not new/delete.
1916         (DOM::CSSMutableStyleDeclarationImpl::makeMutable): Added.
1917         (DOM::CSSMutableStyleDeclarationImpl::copy): Added.
1918
1919         * khtml/css/cssparser.cpp:
1920         (CSSParser::parseValue): Changed to use addParsedProperties.
1921         (CSSParser::parseDeclaration): Ditto.
1922         (CSSParser::createStyleDeclaration): Use new constructor to create declaration in a more efficient manner.
1923
1924         * khtml/css/cssproperties.in: Removed unused font-size-adjust and -khtml-flow-mode.
1925         * khtml/css/cssproperties.c: Regenerated.
1926         * khtml/css/cssproperties.h: Regenerated.
1927
1928         * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyDeclarations):
1929         Updated to use QValueList interface to CSSMutableStyleDeclarationImpl.
1930
1931         * khtml/dom/css_value.cpp:
1932         (DOM::CSSStyleDeclaration::cssText): Removed unneeded cast.
1933         (DOM::CSSStyleDeclaration::setCssText): Added exception code handling.
1934         (DOM::CSSStyleDeclaration::getPropertyValue): Changed to call getPropertyValue directly instead of
1935         first doing getPropertyCSSValue and then doing cssText.
1936         (DOM::CSSStyleDeclaration::getPropertyCSSValue): Removed unneeded cast.
1937         (DOM::CSSStyleDeclaration::removeProperty): Added exception code handling. 
1938         (DOM::CSSStyleDeclaration::setProperty): Added exception code handling.
1939         (DOM::CSSStyleDeclaration::length): Removed unneeded cast.
1940         (DOM::CSSStyleDeclaration::item): Removed unneeded cast.
1941         (DOM::CSSStyleDeclaration::parentRule): Removed unneeded cast.
1942         (DOM::CSSValue::setCssText): Removed strange non-implementation (still not implemented).
1943
1944         * khtml/dom/dom_node.h: Made isNull and handle functions inline.
1945         * khtml/dom/dom_node.cpp: Ditto.
1946
1947         * khtml/editing/htmlediting.h: Change some types to mutable style.
1948         * khtml/editing/htmlediting.cpp:
1949         (khtml::EditCommandPtr::typingStyle): Change return type to mutable style.
1950         (khtml::EditCommandPtr::setTypingStyle): Change parameter to mutable style.
1951         (khtml::StyleChange::init): Convert parameter to mutable style. Update to use QValueList.
1952         (khtml::EditCommand::assignTypingStyle): Change parameter to mutable type.
1953         (khtml::EditCommand::setTypingStyle): Ditto.
1954         (khtml::ApplyStyleCommand::ApplyStyleCommand): Convert parameter to mutable style.
1955         (khtml::ApplyStyleCommand::doApply): Change local variables to mutable style.
1956         (khtml::ApplyStyleCommand::applyBlockStyle): Change parameter to mutable style.
1957         (khtml::ApplyStyleCommand::applyInlineStyle): Ditto.
1958         (khtml::ApplyStyleCommand::isHTMLStyleNode): Ditto.
1959         (khtml::ApplyStyleCommand::removeCSSStyle): Ditto. Also update to use QValueList.
1960         (khtml::ApplyStyleCommand::removeBlockStyle): Change parameter to mutable style.
1961         (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
1962         (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): Ditto.
1963         (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): Ditto.
1964         (khtml::InsertLineBreakCommand::doApply): Convert locals to mutable style.
1965         (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
1966         (khtml::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand): Convert parameter to mutable style.
1967
1968         * khtml/editing/jsediting.cpp: Convert types to mutable styles where we create styles.
1969         * khtml/html/html_baseimpl.h: Change type to mutable style.
1970         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::createLinkDecl): Ditto.
1971
1972         * khtml/html/html_elementimpl.h: Make CSSMappedAttributeDeclarationImpl use the mutable style
1973         class as a base class, and change types to mutable style as needed.
1974         * khtml/html/html_elementimpl.cpp:
1975         (HTMLElementImpl::createInlineStyleDecl): Change type to mutable style.
1976         (HTMLElementImpl::parseHTMLAttribute): Call parseProperty method.
1977         (HTMLElementImpl::getInlineStyleDecl): Change type to mutable style.
1978         (HTMLElementImpl::additionalAttributeStyleDecl): Ditto.
1979         (HTMLElementImpl::createContextualFragment): Add ref/deref to fix potential node leak.
1980         (HTMLElementImpl::setInnerHTML): Remove ref/deref pair because this leak is now fixed by changes
1981         to appendChild.
1982         (HTMLElementImpl::setOuterHTML): Remove ref/deref pair because this leak is now fixed by changes
1983         to replaceChild.
1984
1985         * khtml/html/html_tableimpl.h: Change types to mutable style.
1986         * khtml/html/html_tableimpl.cpp:
1987         (HTMLTableElementImpl::additionalAttributeStyleDecl): Change type to mutable style.
1988         (HTMLTableElementImpl::getSharedCellDecl): Change type to mutable style.
1989         (HTMLTableCellElementImpl::additionalAttributeStyleDecl): Change type to mutable style.
1990
1991         * khtml/html/htmlparser.cpp:
1992         (KHTMLParser::parseToken): Use a local variable to protect the node by ref'ing it. This is better
1993         than using an explicit delete to make the node go away, and is required for compatibility with the
1994         changes to the NodeImpl functions.
1995         (KHTMLParser::insertNode): Ditto.
1996         (KHTMLParser::createHead): Get rid of explicit delete, no longer needed because of changes to
1997         the NodeImpl functions.
1998
1999         * khtml/xml/dom_docimpl.cpp: (DocumentImpl::createCSSStyleDeclaration): Call simpler constructor
2000         now that there's no need to make the property list explictly.
2001
2002         * kwq/DOM-CSS.mm:
2003         (-[DOMCSSStyleDeclaration setCssText:]): Raise exception when appropriate.
2004         (-[DOMCSSStyleDeclaration removeProperty:]): Ditto.
2005         (-[DOMCSSStyleDeclaration setProperty:::]): Dito.
2006
2007         * khtml/xml/dom_nodeimpl.cpp:
2008         (NodeImpl::insertBefore): Always do a ref/deref, so callers don't have to worry about whether the
2009         function succeeded or not for ownership purposes.
2010         (NodeImpl::replaceChild): Ditto.
2011         (NodeImpl::appendChild): Ditto.
2012         (NodeBaseImpl::insertBefore): Ditto.
2013         (NodeBaseImpl::replaceChild): Ditto.
2014         (NodeBaseImpl::appendChild): Ditto.
2015         (NodeBaseImpl::addChild): Ditto.
2016
2017         * WebCore-tests.exp: Removed CSSStyleDeclaration::length; not sure why it was in here.
2018         * WebCore-combined.exp: Regenerated.
2019
2020 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
2021
2022         still even more build fixing
2023
2024         * khtml/html/html_miscimpl.cpp:
2025         (HTMLCollectionImpl::resetCollectionInfo):
2026
2027 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
2028
2029         more build fixing
2030
2031         * khtml/html/html_miscimpl.cpp:
2032         (HTMLCollectionImpl::resetCollectionInfo):
2033
2034 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
2035
2036         Fixed build problem.
2037
2038         * khtml/html/html_miscimpl.h:
2039         (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo): it's haslength, not hasLenght.
2040
2041 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
2042
2043         Reviewed by Ken.
2044
2045         - merged and cleaned up HTMLCollection and HTMLFormCollection speedups from konqueror
2046
2047         <rdar://problem/3822992> VIP: Program listings pages at directv.com take a really long time to load [HTMLCollection]
2048         <rdar://problem/3701991> Safari unresponsive loading (www.maxim-ic.com) (HTMLCollection)
2049
2050         This is also a start on fixing 5 other bugs, but those need additional work to make
2051         HTMLFormCollection fast.
2052
2053         * khtml/html/html_documentimpl.h:
2054         (DOM::HTMLDocumentImpl::collectionInfo):
2055         * khtml/html/html_formimpl.cpp:
2056         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
2057         (DOM::HTMLFormElementImpl::isURLAttribute):
2058         (DOM::HTMLFormElementImpl::registerImgElement):
2059         (DOM::HTMLFormElementImpl::removeImgElement):
2060         * khtml/html/html_formimpl.h:
2061         * khtml/html/html_imageimpl.cpp:
2062         (HTMLImageElementImpl::HTMLImageElementImpl):
2063         (HTMLImageElementImpl::~HTMLImageElementImpl):
2064         * khtml/html/html_imageimpl.h:
2065         * khtml/html/html_miscimpl.cpp:
2066         (HTMLCollectionImpl::HTMLCollectionImpl):
2067         (HTMLCollectionImpl::~HTMLCollectionImpl):
2068         (HTMLCollectionImpl::updateCollectionInfo):
2069         (HTMLCollectionImpl::length):
2070         (HTMLCollectionImpl::item):
2071         (HTMLCollectionImpl::firstItem):
2072         (HTMLCollectionImpl::nextItem):
2073         (HTMLCollectionImpl::namedItem):
2074         (HTMLCollectionImpl::nextNamedItemInternal):
2075         (HTMLFormCollectionImpl::getNamedFormItem):
2076         * khtml/html/html_miscimpl.h:
2077         (DOM::HTMLCollectionImpl::):
2078         (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo):
2079         * khtml/html/htmlparser.cpp:
2080         (KHTMLParser::getElement):
2081         * khtml/xml/dom_docimpl.cpp:
2082         (DocumentImpl::DocumentImpl):
2083         * khtml/xml/dom_docimpl.h:
2084         (DOM::DocumentImpl::incDOMTreeVersion):
2085         (DOM::DocumentImpl::domTreeVersion):
2086         * khtml/xml/dom_nodeimpl.cpp:
2087         (NodeImpl::attach):
2088         (NodeImpl::detach):
2089
2090 2004-11-18  Kevin Decker  <kdecker@apple.com>
2091
2092         Reviewed by Chris.
2093
2094         fixed: <rdar://problem/3841842> getPropertyID expensive
2095
2096         * kwq/DOM-CSS.mm:
2097         (getPropertyID): avoid unnecessary memory allocations by using a fixed-sized stack based buffer.
2098
2099 2004-11-17  David Hyatt  <hyatt@apple.com>
2100
2101         Improve responsiveness by being willing to break out of the tokenizer.  (This patch was landed already
2102         and subsequently backed out).
2103         
2104         Reviewed by kocienda
2105
2106         * khtml/html/html_baseimpl.cpp:
2107         (HTMLBodyElementImpl::insertedIntoDocument):
2108         * khtml/html/htmltokenizer.cpp:
2109         (khtml::HTMLTokenizer::reset):
2110         (khtml::HTMLTokenizer::scriptHandler):
2111         (khtml::HTMLTokenizer::scriptExecution):
2112         (khtml::HTMLTokenizer::write):
2113         (khtml::HTMLTokenizer::continueProcessing):
2114         (khtml::HTMLTokenizer::timerEvent):
2115         (khtml::HTMLTokenizer::notifyFinished):
2116         * khtml/html/htmltokenizer.h:
2117         * khtml/khtmlview.cpp:
2118         (KHTMLViewPrivate::KHTMLViewPrivate):
2119         (KHTMLViewPrivate::reset):
2120         (KHTMLView::clear):
2121         (KHTMLView::layout):
2122         (KHTMLView::timerEvent):
2123         (KHTMLView::scheduleRelayout):
2124         (KHTMLView::layoutPending):
2125         (KHTMLView::haveDelayedLayoutScheduled):
2126         (KHTMLView::unscheduleRelayout):
2127         * khtml/khtmlview.h:
2128         * khtml/xml/dom_docimpl.cpp:
2129         (DocumentImpl::DocumentImpl):
2130         (DocumentImpl::close):
2131         (DocumentImpl::setParsing):
2132         (DocumentImpl::shouldScheduleLayout):
2133         (DocumentImpl::minimumLayoutDelay):
2134         (DocumentImpl::write):
2135         (DocumentImpl::finishParsing):
2136         (DocumentImpl::stylesheetLoaded):
2137         (DocumentImpl::updateStyleSelector):
2138         * khtml/xml/dom_docimpl.h:
2139         (DOM::DocumentImpl::parsing):
2140         * kwq/KWQDateTime.mm:
2141         (KWQUIEventTime::uiEventPending):
2142
2143 2004-11-17  David Harrison  <harrison@apple.com>
2144
2145         Reviewed by Ken Kocienda.
2146         
2147         Make sure previousLineStart is non-null before calling compareBoundaryPoints.
2148         Treat null case as meaning no post-move merge is needed.
2149
2150         * khtml/editing/htmlediting.cpp:
2151         (khtml::DeleteSelectionCommand::initializePositionData):
2152
2153 2004-11-17  David Harrison  <harrison@apple.com>
2154         
2155         Added displayNode and displayTree methods for debugging.  Fixed comment typo in dispatchChildRemovalEvents.
2156         * khtml/xml/dom_nodeimpl.cpp:
2157         (NodeImpl::displayNode):
2158         (NodeImpl::displayTree):
2159         (NodeBaseImpl::dispatchChildRemovalEvents):
2160         * khtml/xml/dom_nodeimpl.h:
2161
2162 2004-11-16  John Sullivan  <sullivan@apple.com>
2163
2164         Reviewed by Richard.
2165         
2166         - fixed <rdar://problem/3881929> 32 byte leak in editingStyle() in KHTMLPart (one-time only)
2167
2168         * khtml/khtml_part.cpp:
2169         (editingStyle):
2170         delete the list we created when we're done with it
2171
2172 2004-11-16  Ken Kocienda  <kocienda@apple.com>
2173
2174         Reviewed by John
2175         
2176         It is unwise to use the QPtrList autodelete feature on shared objects like DOM nodes.
2177         Instead, I replaced this with a helper function that derefs DOM nodes stored in a 
2178         QPtrList when the list goes out of scope.
2179
2180         * khtml/editing/htmlediting.cpp:
2181         (khtml::derefNodesInList): New helper to deref DOM nodes stored in a QPtrList.
2182         (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): No longer set lists to autodelete.
2183         (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): Call new derefNodesInList helper.
2184         (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):  
2185         No longer set lists to autodelete.
2186         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand):
2187          Call new derefNodesInList helper.
2188         * khtml/editing/htmlediting.h: Add virtual destructor for InsertParagraphSeparatorCommand. It had no need
2189         of one before, but now it does.
2190
2191 2004-11-15  David Harrison  <harrison@apple.com>
2192
2193         Reviewed by Chris and Darin.
2194         
2195         <rdar://problem/3880304> Non-linear performance hit for style changes
2196
2197         * khtml/xml/dom_nodeimpl.cpp:
2198         (NodeImpl::traverseNextNode):
2199         (NodeImpl::traverseNextSibling):
2200         (NodeImpl::traversePreviousNodePostOrder):
2201         Return 0 rather than traversing beyond stayWithin when this == stayWithin.
2202         Add asserts that stayWithin is an ancestor of the returned node.
2203
2204 2004-11-15  Darin Adler  <darin@apple.com>
2205
2206         Reviewed by Ken.
2207
2208         - fixed <rdar://problem/3880036> Many leaks from CSSComputedStyleDeclarationImpl::getPropertyCSSValue, seen in Mail and Blot
2209
2210         * khtml/css/css_computedstyle.cpp:
2211         (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Ref and deref the value returned from getPropertyCSSValue,
2212         since there's no guarantee it's already ref'd.
2213         * khtml/css/css_valueimpl.cpp:
2214         (CSSStyleDeclarationImpl::getPropertyValue): Wrap result in a CSSValue to ref/deref.
2215         (CSSStyleDeclarationImpl::get4Values): Ref/deref explicitly.
2216         (CSSStyleDeclarationImpl::getShortHandValue): Ditto.
2217         (CSSStyleDeclarationImpl::merge): Ditto.
2218         (CSSStyleDeclarationImpl::diff): Ditto.
2219         * khtml/editing/htmlediting.cpp:
2220         (khtml::StyleChange::currentlyHasStyle): Ditto.
2221         (khtml::ApplyStyleCommand::removeCSSStyle): Ditto.
2222         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::parseHTMLAttribute): Ditto.
2223         * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::parseHTMLAttribute): Ditto.
2224
2225 2004-11-15  Darin Adler  <darin@apple.com>
2226
2227         Reviewed by Ken.
2228
2229         Use separate mutable style and computed style types as appropriate.
2230         For now this should have no effect, but it prepares us for refactoring later.
2231         Also remove some unnecessary "DOM::" prefixes and in one case factor out
2232         some shared code.
2233
2234         * khtml/khtml_part.cpp:
2235         (KHTMLPart::typingStyle):
2236         (KHTMLPart::setTypingStyle):
2237         (updateState):
2238         (KHTMLPart::selectionHasStyle):
2239         (KHTMLPart::selectionStartHasStyle):
2240         (KHTMLPart::selectionComputedStyle):
2241         * khtml/khtml_part.h:
2242         * khtml/khtmlpart_p.h:
2243
2244         * khtml/css/css_base.h:
2245         * khtml/css/css_ruleimpl.cpp:
2246         (CSSStyleRuleImpl::setDeclaration):
2247         * khtml/css/css_ruleimpl.h:
2248         (DOM::CSSFontFaceRuleImpl::style):
2249         (DOM::CSSPageRuleImpl::style):
2250         (DOM::CSSStyleRuleImpl::style):
2251         (DOM::CSSStyleRuleImpl::declaration):
2252         * khtml/css/css_valueimpl.h:
2253         (DOM::CSSPrimitiveValueImpl::):
2254         * khtml/css/cssparser.cpp:
2255         (CSSParser::parseValue):
2256         (CSSParser::parseColor):
2257         (CSSParser::parseDeclaration):
2258         (CSSParser::createStyleDeclaration):
2259         * khtml/css/cssparser.h:
2260         * khtml/css/cssstyleselector.cpp:
2261         (khtml::CSSStyleSelector::addMatchedDeclaration):
2262         (khtml::CSSStyleSelector::matchRulesForList):
2263         (khtml::CSSStyleSelector::styleForElement):
2264         (khtml::CSSStyleSelector::applyDeclarations):
2265         * khtml/css/cssstyleselector.h:
2266         * khtml/css/parser.cpp:
2267         * khtml/css/parser.y:
2268         * khtml/dom/css_rule.h:
2269         * khtml/dom/css_stylesheet.h:
2270         * khtml/dom/css_value.h:
2271         * khtml/dom/dom2_views.cpp:
2272         * khtml/xml/dom2_viewsimpl.cpp:
2273         (DOM::AbstractViewImpl::getComputedStyle):
2274         * khtml/xml/dom_docimpl.cpp:
2275         (DocumentImpl::importNode):
2276         (DocumentImpl::setStyleSheet):
2277         * khtml/xml/dom_docimpl.h:
2278         * khtml/xml/dom_xmlimpl.cpp:
2279         (DOM::ProcessingInstructionImpl::setStyleSheet):
2280         * khtml/xml/dom_xmlimpl.h:
2281
2282         * khtml/dom/css_value.cpp:
2283         (DOM::throwException): Added.
2284         (DOM::CSSStyleDeclaration::setCssText): Call throwException, but always on 0 for now.
2285         The real thing is coming with the next change to refactor.
2286         (DOM::CSSPrimitiveValue::setFloatValue): Call throwException.
2287         (DOM::CSSPrimitiveValue::setStringValue): Ditto.
2288
2289 2004-11-15  Darin Adler  <darin@apple.com>
2290
2291         Reviewed by Ken.
2292
2293         - fixed <rdar://problem/3878489> REGRESSION: modifying attribute of <textarea> blows away edited text (breaks simplemachines.org forum)
2294
2295         * khtml/xml/dom_nodeimpl.h: Added boolean "children changed" parameter to
2296         dispatchSubtreeModifiedEvent, so it can be called in cases where only the
2297         node's attributes changed without sending a misleading childrenChanged call,
2298         but the childrenChanged call can happen at the exact right moment.
2299         * khtml/xml/dom_nodeimpl.cpp: Removed some uneeded "DOM::".
2300         (NodeImpl::dispatchSubtreeModifiedEvent): Only call "children changed" if
2301         the boolean true is passed in.
2302
2303         * khtml/xml/dom_elementimpl.cpp:
2304         (NamedAttrMapImpl::addAttribute): Pass false for "children changed".
2305         (NamedAttrMapImpl::removeAttribute): Ditto.
2306
2307 2004-11-15  John Sullivan  <sullivan@apple.com>
2308
2309         Reviewed by Ken.
2310         
2311         - fixed <rdar://problem/3880075> leak in CSSStyleDeclarationImpl::copyPropertiesInSet, 
2312         seen often in Mail and Blot
2313
2314         * khtml/css/css_valueimpl.cpp:
2315         (CSSStyleDeclarationImpl::copyPropertiesInSet):
2316         delete temporary list after we're done using it
2317
2318 2004-11-15  Richard Williamson   <rjw@apple.com>
2319
2320         Fixed leak (3879883) that John found.  Early return leaked
2321         allocated instance.
2322
2323         Reviewed by John.
2324
2325         * khtml/css/css_computedstyle.cpp:
2326         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
2327
2328 2004-11-15  Ken Kocienda  <kocienda@apple.com>
2329
2330         Reviewed by John
2331
2332         Fix for this bug:
2333         
2334         <rdar://problem/3879569> Many leaks in EditCommand mechanism, seen in Mail
2335
2336         Fixed a couple of object lifetime issues. The EditCommand class used to hold an
2337         EditCommandPtr to its parent, but this caused a a reference cycle in composite 
2338         commands as the children held a ref to their parent. Now, the parent variable
2339         is a non-retained reference to an EditCommand *. It would be nice to have a 
2340         weak reference to the parent or even override deref in composite commands (but I
2341         can't since deref() is not virtual). However, this should be OK since any
2342         dangling parent pointer is a sign of a bigger object lifetime problem that
2343         would need to be addressed anyway.
2344
2345         * khtml/css/css_valueimpl.cpp:
2346         (CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Fix bug in constructor that takes a 
2347         QPtrList<CSSProperty> *. List values must be copied into newly-allocated list, rather than
2348         just assigning the list variable passed in to the local list variable, or the list will be 
2349         double-deleted.
2350         * khtml/editing/htmlediting.cpp:
2351         (khtml::EditCommand::setStartingSelection): No longer call get(). m_parent is no longer a smart pointer.
2352         (khtml::EditCommand::setEndingSelection): Ditto.
2353         (khtml::EditCommand::assignTypingStyle): Short-circuit if passed in style is identical to current style.
2354         Unrelated to the change, but saves some ref's and deref's.
2355         (khtml::EditCommand::setTypingStyle): No longer call get(). m_parent is no longer a smart pointer.
2356         * khtml/editing/htmlediting.h: Change m_parent to a EditCommand *. Was an EditCommandPtr. Using an
2357         EditCommandPtr caused a reference cycle in composite commands as the children held a ref to their parent.
2358         (khtml::EditCommand::parent): No longer call get(). m_parent is no longer a smart pointer.
2359
2360 2004-11-15  Maciej Stachowiak  <mjs@apple.com>
2361
2362         Reviewed by Kevin.
2363
2364         <rdar://problem/3807080> Safari so slow it seems like a hang accessing a page on an IBM website
2365         
2366         * khtml/xml/dom_nodeimpl.cpp:
2367         (NodeListImpl::NodeListImpl): Initialize isItemCacheValid, renamed isCacheValid to
2368         isLengthCacheValid.
2369         (NodeListImpl::recursiveLength): Adjusted for rename.
2370         (NodeListImpl::recursiveItem): Cache the last item accessed and its offset.
2371         If the same offset is looked up again, just return it, otherwise, if looking up
2372         a later offset, start at the last item and proceed from there.
2373         (NodeListImpl::itemById): Apply the special document optimization to all
2374         nodes that are either a document or in a document - just walk up to make
2375         sure the node found by ID has the root node as an ancestor.
2376         (NodeListImpl::rootNodeSubtreeModified): Adjust both cache bits.
2377         * khtml/xml/dom_nodeimpl.h: Prototype new stuff.
2378
2379 2004-11-15  John Sullivan  <sullivan@apple.com>
2380
2381         Reviewed by Ken.
2382         
2383         - fixed <rdar://problem/3879539> leak of NSString after pasting into editable HTML (e.g. Mail)
2384
2385         * kwq/KWQKHTMLPart.mm:
2386         (KWQKHTMLPart::documentFragmentWithText):
2387         release mutable copy of string after we're done using it
2388
2389 2004-11-14  Kevin Decker  <kdecker@apple.com>
2390
2391         Reviewed by mjs.
2392
2393         fixed: <rdar://problem/3823038> LEAK: huge leak in DOM::HTMLElementImpl::createContextualFragment(DOM::DOMString const&, bool)
2394
2395         * khtml/html/html_elementimpl.cpp:
2396         (HTMLElementImpl::setInnerHTML): uses the ref counting system to deallocate fragments instead of explicitly invoking a destructor.
2397         (HTMLElementImpl::setOuterHTML): function is responsible for derefing the fragment prior to returning. Now it does.
2398
2399 2004-11-13  Maciej Stachowiak  <mjs@apple.com>
2400
2401         Reviewed by Kevin.
2402
2403         <rdar://problem/3878766> VIP: Program listings pages at directv.com takes 75% of time traversing NodeLists
2404
2405         * khtml/dom/dom_node.cpp:
2406         (NodeList::itemById): New method, just forward to impl.
2407         * khtml/dom/dom_node.h: Prototype it.
2408         * khtml/ecma/kjs_dom.cpp:
2409         (DOMNodeList::tryGet): Instead of looping over the whole list to do by-id access,
2410         let the NodeList do it. The NodeList might be able to do it more efficiently.
2411         * khtml/xml/dom_nodeimpl.cpp:
2412         (NodeListImpl::itemById): Optimize for the case where the NodeList
2413         covers the whole document. In this case, just use getElementById,
2414         then check that the element satisfies the list criteria.
2415         (ChildNodeListImpl::nodeMatches): Return true only if the node is our child.
2416         (TagNodeListImpl::TagNodeListImpl): Irrelevant change to reformat initializers.
2417         * khtml/xml/dom_nodeimpl.h:
2418
2419 2004-11-12  Maciej Stachowiak  <mjs@apple.com>
2420
2421         Reviewed by Gramps.
2422
2423         - fixed another bug in the last checkin, isCacheValid was unitialized, resulting in
2424         sometimes using a huge bogus length value.
2425         
2426         * khtml/xml/dom_nodeimpl.cpp:
2427         (NodeListImpl::NodeListImpl): Initialize isCacheValid.
2428
2429 2004-11-12  Darin Adler  <darin@apple.com>
2430
2431         Reviewed by Maciej.
2432
2433         - fixed an infinite loop in that last check-in
2434
2435         * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::notifyLocalNodeListsSubtreeModified):
2436         Added a ++i to the loop so it won't get stuck on the first element in the list.
2437
2438 2004-11-12  Maciej Stachowiak  <mjs@apple.com>
2439
2440         Reviewed by Kevin.
2441
2442         - fixed <rdar://problem/3878183> Safari is 77% slower than it should be on a page on an IBM website due to NodeListImpl length
2443         
2444         I fixed this by changing NodeLists to cache their length, but
2445         invalidate it whenever there is a change in the DOM subtree at
2446         which they are rooted. This makes NodeListImpl::recursiveLength()
2447         drop completely off the profile, since we were repeatedly getting
2448         a length for the same NodeList over and over.
2449         
2450         * khtml/xml/dom_nodeimpl.cpp:
2451         (NodeImpl::NodeImpl):
2452         (NodeImpl::~NodeImpl):
2453         (NodeImpl::registerNodeList):
2454         (NodeImpl::unregisterNodeList):
2455         (NodeImpl::notifyLocalNodeListsSubtreeModified):
2456         (NodeImpl::notifyNodeListsSubtreeModified):
2457         (NodeImpl::dispatchSubtreeModifiedEvent):
2458         (NodeListImpl::NodeListImpl):
2459         (NodeListImpl::~NodeListImpl):
2460         (NodeListImpl::recursiveLength):
2461         (NodeListImpl::recursiveItem):
2462         (NodeListImpl::rootNodeSubtreeModified):
2463         (ChildNodeListImpl::ChildNodeListImpl):
2464         (ChildNodeListImpl::length):
2465         (ChildNodeListImpl::item):
2466         (TagNodeListImpl::TagNodeListImpl):
2467         (TagNodeListImpl::length):
2468         (TagNodeListImpl::item):
2469         (NameNodeListImpl::NameNodeListImpl):
2470         (NameNodeListImpl::length):
2471         (NameNodeListImpl::item):
2472         * khtml/xml/dom_nodeimpl.h:
2473
2474 2004-11-12  Darin Adler  <darin@apple.com>
2475
2476         Reviewed by Maciej.
2477
2478         - various small cleanups
2479
2480         * khtml/xml/dom_docimpl.h: Added policyBaseURL and setPolicyBaseURL.
2481         * khtml/html/html_documentimpl.h: Removed policyBaseURL and setPolicyBaseURL.
2482
2483         * khtml/xml/xml_tokenizer.h: Marked isWaitingForScripts const.
2484         * khtml/xml/xml_tokenizer.cpp: (khtml::XMLTokenizer::isWaitingForScripts): Marked const.
2485         * khtml/html/htmltokenizer.h: Marked isWaitingForScripts const.
2486         * khtml/html/htmltokenizer.cpp:
2487         (khtml::HTMLTokenizer::isWaitingForScripts): Marked const.
2488         (khtml::HTMLTokenizer::setOnHold): Took out extraneous line of code.
2489
2490         * khtml/khtml_part.h: Removed docImpl function.
2491         * khtml/khtml_part.cpp: Ditto.
2492
2493         * khtml/xml/dom_docimpl.cpp: (DocumentImpl::close): Simplified code that implements
2494         the "redirect during onload" optimization. Now uses isScheduledLocationChangePending.
2495
2496         * kwq/KWQKHTMLPart.h: Removed now-unused _firstResponderAtMouseDownTime.
2497         * kwq/KWQKHTMLPart.mm: Removed _firstResponderAtMouseDownTime (forgot to land this
2498         part of the change last time, which is why the build broke).
2499         (KWQKHTMLPart::updatePolicyBaseURL): Use xmlDocImpl instead of docImpl.
2500         (KWQKHTMLPart::setPolicyBaseURL): Ditto.
2501         (KWQKHTMLPart::keyEvent): Ditto.
2502         (KWQKHTMLPart::dispatchCPPEvent): Ditto.
2503         (KWQKHTMLPart::bodyBackgroundColor): Ditto.
2504
2505 2004-11-12  Chris Blumenberg  <cblu@apple.com>
2506
2507         <rdar://problem/3843312> REGRESSION: Tabbing into content area puts insertion point at start, should go to where it last was
2508
2509         Reviewed by rjw.
2510
2511         * kwq/KWQKHTMLPart.mm:
2512         (KWQKHTMLPart::nextKeyViewInFrameHierarchy): only blow away selection when another view is focused
2513
2514 === Safari-171 ===
2515
2516 2004-11-12  Darin Adler  <darin@apple.com>
2517
2518         Reviewed by Kevin.
2519
2520         - fixed a couple places that would not work for XML documents
2521
2522         * khtml/ecma/kjs_window.cpp:
2523         (Window::isSafeScript): Use xmlDocImpl instead of docImpl, since the function we're using
2524         is present on the base class.
2525         (WindowFunc::tryCall): More of the same.
2526
2527 2004-11-12  Darin Adler  <darin@apple.com>
2528
2529         - land versions of these files generated by the newer gperf
2530
2531         People building on Panther will continue to see these files modified.
2532         A workaround would be to install the newer gperf on our Tiger build machines.
2533
2534         * khtml/css/cssproperties.c: Regenerated.
2535         * khtml/css/cssvalues.c: Regenerated.
2536         * khtml/html/doctypes.cpp: Regenerated.
2537         * khtml/html/kentities.c: Regenerated.
2538         * khtml/misc/htmlattrs.c: Regenerated.
2539         * khtml/misc/htmltags.c: Regenerated.
2540         * kwq/KWQColorData.c: Regenerated.
2541
2542 2004-11-11  Richard Williamson   <rjw@apple.com>
2543         
2544         Fix build horkage from previous checkin.
2545                 
2546         * kwq/KWQKHTMLPart.h:
2547
2548 2004-11-11  Darin Adler  <darin@apple.com>
2549
2550         Reviewed by John.
2551
2552         - fixed <rdar://problem/3846152> REGRESSION (125-166): can't drag text out of <input type=text> fields
2553
2554         * kwq/WebCoreBridge.h: Added wasFirstResponderAtMouseDownTime: method.
2555
2556         * kwq/KWQKHTMLPart.h: Removed _firstResponderAtMouseDownTime.
2557         * kwq/KWQKHTMLPart.mm:
2558         (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Use the new wasFirstResponderAtMouseDownTime:
2559         method on the bridge instead of _firstResponderAtMouseDownTime. This will return YES for the case where
2560         we started with the NSTextField as first responder, and then took focus away and gave it back, which
2561         makes dragging text work again.
2562         (KWQKHTMLPart::mouseDown): Removed code to set _firstResponderAtMouseDownTime.
2563
2564 2004-11-11  David Hyatt  <hyatt@apple.com>
2565
2566         Disable the tokenizer deferral, since it hurts the PLT by 3% or so.
2567         
2568         Reviewed by vicki
2569
2570         * khtml/html/htmltokenizer.cpp:
2571         (khtml::HTMLTokenizer::continueProcessing):
2572
2573 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2574
2575         Reviewed by Maciej
2576
2577         * khtml/editing/htmlediting.cpp:
2578         (khtml::InsertLineBreakCommand::doApply): Use new isLastVisiblePositionInBlock() helper instead
2579         of old isLastInBlock() member function on VisiblePosition. This is a cosmetic change in keeping
2580         with the prevailing style for the VisiblePosition class.
2581         * khtml/editing/htmlediting.h: Move isLastVisiblePositionInNode() function to visible_position.[cpp|h] files. 
2582         * khtml/editing/visible_position.cpp: Removed isLastInBlock() helper. Renamed to isLastVisiblePositionInBlock().
2583         (khtml::visiblePositionsInDifferentBlocks): New helper method.
2584         (khtml::isLastVisiblePositionInBlock): Ditto.
2585         (khtml::isLastVisiblePositionInNode): Ditto.
2586         * khtml/editing/visible_position.h: Add declarations for new functions.
2587
2588 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2589
2590         Reviewed by Hyatt
2591
2592         * khtml/editing/htmlediting.cpp:
2593         (khtml::CompositeEditCommand::deleteInsignificantText): Call new compareBoundaryPoints convenience.
2594         (khtml::ApplyStyleCommand::removeBlockStyle): Ditto.
2595         (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
2596         (khtml::ApplyStyleCommand::nodeFullySelected): Ditto.
2597         (khtml::DeleteSelectionCommand::initializePositionData): Ditto.
2598         * khtml/xml/dom2_rangeimpl.cpp:
2599         (DOM::RangeImpl::compareBoundaryPoints): New convenience variant of this function which takes two Position objects.
2600         * khtml/xml/dom2_rangeimpl.h: Ditto.
2601
2602 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2603
2604         Reviewed by Harrison
2605
2606         Some improvements to deleting when complete lines are selected.
2607
2608         * khtml/editing/htmlediting.cpp:
2609         (khtml::DeleteSelectionCommand::initializePositionData): Detect when the line containing
2610         the end of a selection is fully selected. Turn off block merging in this case.
2611         (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Fix a bug in the check for
2612         whether a BR immediately followed a block. The old code could erroneously skip nodes.
2613         (khtml::DeleteSelectionCommand::handleGeneralDelete): Add a case for when the entire
2614         start block is selected. This new code will now delete this block in one call, rather
2615         than iterating over each child.
2616         * khtml/editing/visible_position.cpp:
2617         (khtml::visiblePositionsOnDifferentLines): New helper called in initializePositionData()
2618         to do the work mentioned above in the comment for that function.
2619         (khtml::isFirstVisiblePositionOnLine): Ditto.
2620         (khtml::isLastVisiblePositionOnLine): Ditto.
2621         * khtml/editing/visible_position.h: Add new functions.
2622         * layout-tests/editing/deleting/delete-line-001-expected.txt: Added.
2623         * layout-tests/editing/deleting/delete-line-001.html: Added.
2624         * layout-tests/editing/deleting/delete-line-002-expected.txt: Added.
2625         * layout-tests/editing/deleting/delete-line-002.html: Added.
2626         * layout-tests/editing/deleting/delete-line-003-expected.txt: Added.
2627         * layout-tests/editing/deleting/delete-line-003.html: Added.
2628         * layout-tests/editing/deleting/delete-line-004-expected.txt: Added.
2629         * layout-tests/editing/deleting/delete-line-004.html: Added.
2630         * layout-tests/editing/deleting/delete-line-005-expected.txt: Added.
2631         * layout-tests/editing/deleting/delete-line-005.html: Added.
2632         * layout-tests/editing/deleting/delete-line-006-expected.txt: Added.
2633         * layout-tests/editing/deleting/delete-line-006.html: Added.
2634         * layout-tests/editing/deleting/delete-line-007-expected.txt: Added.
2635         * layout-tests/editing/deleting/delete-line-007.html: Added.
2636         * layout-tests/editing/deleting/delete-line-008-expected.txt: Added.
2637         * layout-tests/editing/deleting/delete-line-008.html: Added.
2638         * layout-tests/editing/deleting/delete-line-009-expected.txt: Added.
2639         * layout-tests/editing/deleting/delete-line-009.html: Added.
2640         * layout-tests/editing/deleting/delete-line-010-expected.txt: Added.
2641         * layout-tests/editing/deleting/delete-line-010.html: Added.
2642         * layout-tests/editing/deleting/delete-line-011-expected.txt: Added.
2643         * layout-tests/editing/deleting/delete-line-011.html: Added.
2644         * layout-tests/editing/deleting/delete-line-012-expected.txt: Added.
2645         * layout-tests/editing/deleting/delete-line-012.html: Added.
2646
2647 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2648
2649         Reviewed by Adele
2650
2651         * khtml/editing/htmlediting.cpp:
2652         (khtml::DeleteSelectionCommand::initializePositionData): Add some comments and a new piece of debugging output.
2653
2654 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2655
2656         Reviewed by John
2657
2658         Fix for these bugs:
2659
2660         <rdar://problem/3875618> REGRESSION (Mail): Hitting down arrow with full line selected skips line (br case)
2661         <rdar://problem/3875641> REGRESSION (Mail): Hitting down arrow with full line selected skips line (div case)
2662
2663         * khtml/editing/selection.cpp:
2664         (khtml::Selection::modifyMovingRightForward): Fixed by juggling the position as the starting point for
2665         the next line position when necessary.
2666         * layout-tests/editing/selection/move-3875618-fix-expected.txt: Added.
2667         * layout-tests/editing/selection/move-3875618-fix.html: Added.
2668         * layout-tests/editing/selection/move-3875641-fix-expected.txt: Added.
2669         * layout-tests/editing/selection/move-3875641-fix.html: Added.
2670
2671 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2672
2673         Reviewed by John
2674
2675         Improved some function names, at John's urging. No changes to the
2676         functions themselves.
2677         
2678         canPerformSpecialCaseAllContentDelete() --> handleSpecialCaseAllContentDelete()
2679         canPerformSpecialCaseBRDelete() --> handleSpecialCaseBRDelete()
2680         performGeneralDelete() --> handleGeneralDelete()
2681
2682         * khtml/editing/htmlediting.cpp:
2683         (khtml::DeleteSelectionCommand::handleSpecialCaseAllContentDelete)
2684         (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete)
2685         (khtml::DeleteSelectionCommand::handleGeneralDelete)
2686         (khtml::DeleteSelectionCommand::doApply)
2687         * khtml/editing/htmlediting.h
2688
2689 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2690
2691         Reviewed by John
2692         
2693         Updated some layout test results that changed as a result of my last checking.
2694         Added a new test that has been in my tree for a few days.
2695
2696         * layout-tests/editing/deleting/delete-3775172-fix-expected.txt:
2697         * layout-tests/editing/deleting/delete-3800834-fix-expected.txt:
2698         * layout-tests/editing/inserting/insert-3851164-fix-expected.txt: Added.
2699         * layout-tests/editing/inserting/insert-3851164-fix.html: Added.
2700
2701 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2702
2703         Reviewed by John
2704
2705         * khtml/editing/htmlediting.cpp:
2706         (khtml::debugNode): New debugging helper.
2707         (khtml::DeleteSelectionCommand::initializePositionData): No longer call obsoleted
2708         startPositionForDelete() and endPositionForDelete() functions. Just use the 
2709         m_selectionToDelete object to determine start and end positions for the delete.
2710         (khtml::DeleteSelectionCommand::canPerformSpecialCaseAllContentDelete): New
2711         function that creates a special case for deleting all the content in a root
2712         editable element.
2713         (khtml::DeleteSelectionCommand::doApply): Call canPerformSpecialCaseAllContentDelete()
2714         function before BR special case and the general case delete functions.
2715         * khtml/editing/htmlediting.h: Updated for changed functions.
2716
2717 2004-11-10  Kevin Decker  <kdecker@apple.com>
2718
2719         Reviewed by mjs.
2720         
2721         Fixed <rdar://problem/3875011> DOMNodeList::tryGet() performs unnecessary (and expensive) dom tree traversals. Improved a loop from 2-n-squared to just n-squared.  
2722
2723         * khtml/ecma/kjs_dom.cpp:
2724         (DOMNodeList::tryGet): Got rid of an unnecessary node traversal. 
2725
2726 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2727
2728         Reviewed by Chris
2729
2730         * khtml/editing/htmlediting.cpp:
2731         (khtml::DeleteSelectionCommand::initializePositionData): Move position adjustments for
2732         smart delete from the two functions below to here. There was an unnecessary double 
2733         calculation of the leading and trailing whitespace positions. Also refined the trailing
2734         case so it only acts when the leading position is null (which seems to match TextEdit in
2735         my tests). Also removed some unnecessary copying of Position objects.
2736         (khtml::DeleteSelectionCommand::startPositionForDelete): Move out smart delete adjustment
2737         from here.
2738         (khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.
2739
2740 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2741
2742         Reviewed by Harrison
2743
2744         (khtml::DeleteSelectionCommand::performGeneralDelete): Add some more comments to
2745         make things more clear.
2746         * khtml/editing/selection.cpp:
2747         (khtml::Selection::toRange): Fixed the upstream and downstream calls so that the 
2748         resulting positions do not cross block boundaries. This was a bug and caused some
2749         delete problems when whole blocks were selected. I will be addressing that issue
2750         more fully in upcoming changes.
2751
2752 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2753
2754         Reviewed by Harrison
2755
2756         Some cleanups and fixes in upstream and downstream functions. 
2757         
2758         Removed redundant checks for isBlockFlow() when calling enclosingBlockFlowElement(). 
2759         Blocks do not need to skip the call to enclosingBlockFlowElement() for fear that the 
2760         block's enclosing block will be returned. 
2761         
2762         Remove code from upstream that confined the serach to block boundaries outside of
2763         the code which runs in the StayInBlock case. This code was redundant, and caused
2764         incorrect results to be returned in the DoNotStayInBlock case.
2765         
2766         In downstream, the check for crossing into a new block should use the equivalentDeepPosition()
2767         node, not the the this pointer's node.
2768
2769         * khtml/xml/dom_position.cpp:
2770         (DOM::Position::upstream)
2771         (DOM::Position::downstream)
2772
2773 2004-11-09  David Hyatt  <hyatt@apple.com>
2774
2775         Fix for 3873234, Safari UI is unresponsive when parsing multiple HTML docs and 3873233, Safari hangs when
2776         loading large local files.
2777         
2778         Reviewed by mjs
2779
2780         * khtml/html/htmltokenizer.cpp:
2781         (khtml::HTMLTokenizer::HTMLTokenizer):
2782         (khtml::HTMLTokenizer::reset):
2783         (khtml::HTMLTokenizer::write):
2784         (khtml::HTMLTokenizer::stopped):
2785         (khtml::HTMLTokenizer::processingData):
2786         (khtml::HTMLTokenizer::continueProcessing):
2787         (khtml::HTMLTokenizer::timerEvent):
2788         (khtml::HTMLTokenizer::allDataProcessed):
2789         (khtml::HTMLTokenizer::end):
2790         (khtml::HTMLTokenizer::finish):
2791         (khtml::HTMLTokenizer::notifyFinished):
2792         * khtml/html/htmltokenizer.h:
2793         * khtml/khtml_part.cpp:
2794         (KHTMLPart::slotFinished):
2795         (KHTMLPart::end):
2796         (KHTMLPart::stop):
2797         * khtml/khtml_part.h:
2798         (KHTMLPart::tokenizerProcessedData):
2799         * khtml/khtmlview.cpp:
2800         * khtml/xml/dom_docimpl.cpp:
2801         * khtml/xml/xml_tokenizer.h:
2802         (khtml::Tokenizer::stopped):
2803         (khtml::Tokenizer::processingData):
2804         * kwq/KWQDateTime.h:
2805         * kwq/KWQDateTime.mm:
2806         (QDateTime::secsTo):
2807         (KWQUIEventTime::uiEventPending):
2808         * kwq/KWQKHTMLPart.h:
2809         * kwq/KWQKHTMLPart.mm:
2810         (KWQKHTMLPart::tokenizerProcessedData):
2811         * kwq/WebCoreBridge.h:
2812         * kwq/WebCoreBridge.mm:
2813         (-[WebCoreBridge stop]):
2814         (-[WebCoreBridge numPendingOrLoadingRequests]):
2815         (-[WebCoreBridge doneProcessingData]):
2816
2817 2004-11-09  David Harrison  <harrison@apple.com>
2818
2819         Reviewed by Ken Kocienda.
2820
2821                 <rdar://problem/3865837> Wrong text style after delete to start of document
2822                 
2823         * khtml/editing/htmlediting.cpp:
2824         (khtml::DeleteSelectionCommand::saveTypingStyleState):
2825         Sample computedStyle of m_selectionToDelete.start instead of m_downstreamStart.
2826
2827 2004-11-09  Richard Williamson   <rjw@apple.com>
2828
2829         Fixed <rdar://problem/3872440> NSTimer prematurely released.
2830
2831         Reviewed by Darin.
2832
2833         * kwq/KWQTimer.mm:
2834         (QTimer::fire):
2835         * kwq/KWQWidget.mm:
2836         (QWidget::paint):
2837
2838 2004-11-09  Chris Blumenberg  <cblu@apple.com>
2839
2840         Reviewed by vicki.
2841
2842         * WebCore.pbproj/project.pbxproj: explicitly link against libxml2.2.6.14.dylib since the version number has been bumped
2843
2844 2004-11-08  David Harrison  <harrison@apple.com>
2845
2846         Reviewed by Ken Kocienda.
2847
2848                 <rdar://problem/3865854> Deleting first line deletes all lines
2849                 
2850         * khtml/editing/htmlediting.cpp:
2851         (khtml::DeleteSelectionCommand::performGeneralDelete):
2852         Problem was that the code that deletes fully selected m_downstreamEnd.node() by deleting one
2853         of its ancestors, failed to end the loop that deletes all fully selected nodes.  Also,
2854         fixed this code to clear m_trailingWhitespaceValid.  Also removed dead m_endingPosition
2855         update because it is handled in calculateEndingPosition now.
2856         * layout-tests/editing/deleting/delete-3865854-fix-expected.txt: Added.
2857         * layout-tests/editing/deleting/delete-3865854-fix.html: Added.
2858
2859 2004-11-08  Ken Kocienda  <kocienda@apple.com>
2860
2861         Reviewed by Hyatt
2862
2863         * khtml/html/html_elementimpl.cpp:
2864         (HTMLElementImpl::createContextualFragment): Now takes flag to control whether comments
2865         are added to the DOM.
2866         * khtml/html/html_elementimpl.h: Ditto.
2867         * khtml/html/htmlparser.cpp:
2868         (KHTMLParser::KHTMLParser): Ditto.
2869         (KHTMLParser::getElement): Remove ifdef for comment processing. Replace with flag check.
2870         * khtml/html/htmlparser.h: Add flag to constructor so callers can request comment nodes.
2871         * khtml/html/htmltokenizer.cpp:
2872         (khtml::HTMLTokenizer::HTMLTokenizer): Add flag to constructor so callers can request comment nodes.
2873         (khtml::HTMLTokenizer::parseComment): Fix code to handle parsing out comment text correctly.
2874         There were a couple of indexing errors that resulted in the comment text containing part of the 
2875         comment markers.
2876         (khtml::HTMLTokenizer::processToken): Don't let token id be reset to ID_TEXT if token is a comment.
2877         * khtml/html/htmltokenizer.h:  Add flag to constructor so callers can request comment nodes.
2878
2879 2004-11-08  Chris Blumenberg  <cblu@apple.com>
2880
2881         Fixed: <rdar://problem/3870907> WebCore unnecessary links against JavaVM and Security
2882
2883         Reviewed by darin.
2884
2885         * WebCore.pbproj/project.pbxproj: stop unnecessary linking
2886         * khtml/html/html_objectimpl.h: don't unnecessarily include JavaVM header
2887         * kwq/KWQKHTMLPart.h: ditto
2888
2889 2004-11-08  Darin Adler  <darin@apple.com>
2890
2891         Reviewed by John.
2892
2893         - fixed <rdar://problem/3825966> 8A274 Safari crashes closing window: QTimer::fire() with MallocStackLogging and MallocScribble enabled
2894
2895         * kwq/KWQTimer.mm: (QTimer::fire): Rearrange so we don't access the QTimer object after calling code
2896         that possibly deletes the QTimer.
2897
2898 2004-11-08  Chris Blumenberg  <cblu@apple.com>
2899
2900         Fixed: <rdar://problem/3783904> Return key behavior is confusingly different between popup menus and autofill menus
2901
2902         Reviewed by john.
2903
2904         * kwq/KWQTextField.mm:
2905         (-[KWQTextFieldController textView:shouldHandleEvent:]): let the bridge have a crack at the event so that it can swallow the newline if it wants to
2906         * kwq/WebCoreBridge.h:
2907
2908 2004-11-08  David Harrison  <harrison@apple.com>
2909
2910         Reviewed by Darin.
2911         
2912         Renamed NodeImpl::enclosingNonBlockFlowElement to NodeImpl::enclosingInlineElement, per Hyatt.
2913
2914         * khtml/editing/htmlediting.cpp:
2915         (khtml::DeleteSelectionCommand::moveNodesAfterNode):
2916         * khtml/xml/dom_nodeimpl.cpp:
2917         (NodeImpl::enclosingInlineElement):
2918         * khtml/xml/dom_nodeimpl.h:
2919
2920 2004-11-05  Chris Blumenberg  <cblu@apple.com>
2921
2922         Fixed: <rdar://problem/3838413> REGRESSION (Mail): "Smart" word paste adds spaces before/after special characters
2923
2924         Reviewed by rjw.
2925
2926         * khtml/editing/htmlediting.cpp:
2927         (khtml::ReplaceSelectionCommand::doApply): call isCharacterSmartReplaceExempt on the part to see if a space should be inserted
2928         * khtml/editing/visible_position.cpp:
2929         (khtml::VisiblePosition::character): new, returns the character for the position
2930         * khtml/editing/visible_position.h:
2931         * kwq/KWQKHTMLPart.h:
2932         * kwq/KWQKHTMLPart.mm:
2933         (KWQKHTMLPart::isCharacterSmartReplaceExempt): new, calls the bridge
2934         * kwq/WebCoreBridge.h:
2935
2936 === Safari-170 ===
2937
2938 2004-11-05  Adele Amchan  <adele@apple.com>
2939
2940         Reviewed by Darin
2941
2942         Fix for <rdar://problem/3854383> REGRESSION(166-168) input fields show black background when background color is set to transparent
2943         and a workaround for displaying transparent backgrounds for textareas.
2944
2945         * kwq/KWQLineEdit.mm: (QLineEdit::setPalette): If the background color is transparent (we check the alpha value) then we set the background to white
2946         * kwq/KWQTextEdit.mm: (QTextEdit::setPalette): If the background color is transparent, then we don't draw the background
2947         * kwq/KWQTextArea.mm: (-[KWQTextArea setDrawsBackground:]): added setDrawsBackground function which calls setDrawsBackground on the super class, 
2948           on the contentView, and on the textView.
2949
2950 2004-11-04  David Hyatt  <hyatt@apple.com>
2951
2952         Fix for relpositioned inlines.  This was reviewed a long time ago, but I can't recall who reviewed it (either
2953         darin or ken).
2954         
2955         Reviewed by darin or ken
2956
2957         * khtml/rendering/bidi.cpp:
2958         (khtml::appendRunsForObject):
2959         (khtml::RenderBlock::skipWhitespace):
2960         (khtml::RenderBlock::findNextLineBreak):
2961         * khtml/rendering/render_block.cpp:
2962         (khtml::RenderBlock::lowestPosition):
2963         (khtml::RenderBlock::rightmostPosition):
2964         (khtml::RenderBlock::leftmostPosition):
2965         * khtml/rendering/render_box.cpp:
2966         (RenderBox::position):
2967         * khtml/rendering/render_box.h:
2968         (khtml::RenderBox::staticX):
2969         (khtml::RenderBox::staticY):
2970         * khtml/rendering/render_layer.cpp:
2971         (RenderLayer::updateLayerPosition):
2972         (RenderLayer::convertToLayerCoords):
2973         * khtml/rendering/render_line.cpp:
2974         (khtml::InlineFlowBox::placeBoxesHorizontally):
2975         * khtml/rendering/render_object.h:
2976         (khtml::RenderObject::staticX):
2977         (khtml::RenderObject::staticY):
2978
2979         Finish turning on XSLT.  Make sure child stylesheets can load.
2980         
2981         * khtml/xsl/xslt_processorimpl.cpp:
2982         (DOM::stylesheetLoadFunc):
2983         (DOM::XSLTProcessorImpl::transformDocument):
2984
2985 2004-11-04  David Hyatt  <hyatt@apple.com>
2986
2987         Implement CSS3 support for multiple backgrounds.  Also fix a bug with background propagation so that it only
2988         happens (from the <body> to the root) for HTML documents.  Fixed background-position to handle a mixture of
2989         keyword and length values.
2990
2991         Reviewed by darin
2992
2993         * khtml/css/cssparser.cpp:
2994         (CSSParser::parseValue):
2995         (CSSParser::addBackgroundValue):
2996         (CSSParser::parseBackgroundShorthand):
2997         (CSSParser::parseBackgroundColor):
2998         (CSSParser::parseBackgroundImage):
2999         (CSSParser::parseBackgroundPositionXY):
3000         (CSSParser::parseBackgroundPosition):
3001         (CSSParser::parseBackgroundProperty):
3002         (CSSParser::parseColorFromValue):
3003         * khtml/css/cssparser.h:
3004         * khtml/css/cssstyleselector.cpp:
3005         (khtml::CSSStyleSelector::adjustRenderStyle):
3006         (khtml::CSSStyleSelector::applyProperty):
3007         (khtml::CSSStyleSelector::mapBackgroundAttachment):
3008         (khtml::CSSStyleSelector::mapBackgroundImage):
3009         (khtml::CSSStyleSelector::mapBackgroundRepeat):
3010         (khtml::CSSStyleSelector::mapBackgroundXPosition):
3011         (khtml::CSSStyleSelector::mapBackgroundYPosition):
3012         * khtml/css/cssstyleselector.h:
3013         * khtml/rendering/render_box.cpp:
3014         (RenderBox::paintRootBoxDecorations):
3015         (RenderBox::paintBoxDecorations):
3016         (RenderBox::paintBackgrounds):
3017         (RenderBox::paintBackground):
3018         (RenderBox::paintBackgroundExtended):
3019         * khtml/rendering/render_box.h:
3020         * khtml/rendering/render_form.cpp:
3021         (RenderFieldset::paintBoxDecorations):
3022         * khtml/rendering/render_line.cpp:
3023         (khtml::InlineFlowBox::paintBackgrounds):
3024         (khtml::InlineFlowBox::paintBackground):
3025         (khtml::InlineFlowBox::paintBackgroundAndBorder):
3026         * khtml/rendering/render_line.h:
3027         * khtml/rendering/render_object.cpp:
3028         (RenderObject::setStyle):
3029         (RenderObject::updateBackgroundImages):
3030         (RenderObject::getVerticalPosition):
3031         * khtml/rendering/render_object.h:
3032         (khtml::RenderObject::paintBackgroundExtended):
3033         * khtml/rendering/render_style.cpp:
3034         (m_next):
3035         (BackgroundLayer::BackgroundLayer):
3036         (BackgroundLayer::~BackgroundLayer):
3037         (BackgroundLayer::operator=):
3038         (BackgroundLayer::operator==):
3039         (BackgroundLayer::fillUnsetProperties):
3040         (BackgroundLayer::cullEmptyLayers):
3041         (StyleBackgroundData::StyleBackgroundData):
3042         (StyleBackgroundData::operator==):
3043         (RenderStyle::diff):
3044         (RenderStyle::adjustBackgroundLayers):
3045         * khtml/rendering/render_style.h:
3046         (khtml::OutlineValue::operator==):
3047         (khtml::OutlineValue::operator!=):
3048         (khtml::BackgroundLayer::backgroundImage):
3049         (khtml::BackgroundLayer::backgroundXPosition):
3050         (khtml::BackgroundLayer::backgroundYPosition):
3051         (khtml::BackgroundLayer::backgroundAttachment):
3052         (khtml::BackgroundLayer::backgroundRepeat):
3053         (khtml::BackgroundLayer::next):
3054         (khtml::BackgroundLayer::isBackgroundImageSet):
3055         (khtml::BackgroundLayer::isBackgroundXPositionSet):
3056         (khtml::BackgroundLayer::isBackgroundYPositionSet):
3057         (khtml::BackgroundLayer::isBackgroundAttachmentSet):
3058         (khtml::BackgroundLayer::isBackgroundRepeatSet):
3059         (khtml::BackgroundLayer::setBackgroundImage):
3060         (khtml::BackgroundLayer::setBackgroundXPosition):
3061         (khtml::BackgroundLayer::setBackgroundYPosition):
3062         (khtml::BackgroundLayer::setBackgroundAttachment):
3063         (khtml::BackgroundLayer::setBackgroundRepeat):
3064         (khtml::BackgroundLayer::clearBackgroundImage):
3065         (khtml::BackgroundLayer::clearBackgroundXPosition):
3066         (khtml::BackgroundLayer::clearBackgroundYPosition):
3067         (khtml::BackgroundLayer::clearBackgroundAttachment):
3068         (khtml::BackgroundLayer::clearBackgroundRepeat):
3069         (khtml::BackgroundLayer::setNext):
3070         (khtml::BackgroundLayer::operator!=):
3071         (khtml::BackgroundLayer::containsImage):
3072         (khtml::BackgroundLayer::hasImage):
3073         (khtml::BackgroundLayer::hasFixedImage):
3074         (khtml::RenderStyle::setBitDefaults):
3075         (khtml::RenderStyle::hasBackground):
3076         (khtml::RenderStyle::hasFixedBackgroundImage):
3077         (khtml::RenderStyle::outlineWidth):
3078         (khtml::RenderStyle::outlineStyle):
3079         (khtml::RenderStyle::outlineStyleIsAuto):
3080         (khtml::RenderStyle::outlineColor):
3081         (khtml::RenderStyle::backgroundColor):
3082         (khtml::RenderStyle::backgroundImage):
3083         (khtml::RenderStyle::backgroundRepeat):
3084         (khtml::RenderStyle::backgroundAttachment):
3085         (khtml::RenderStyle::backgroundXPosition):
3086         (khtml::RenderStyle::backgroundYPosition):
3087         (khtml::RenderStyle::accessBackgroundLayers):
3088         (khtml::RenderStyle::backgroundLayers):
3089         (khtml::RenderStyle::outlineOffset):
3090         (khtml::RenderStyle::resetOutline):
3091         (khtml::RenderStyle::setBackgroundColor):
3092         (khtml::RenderStyle::setOutlineWidth):
3093         (khtml::RenderStyle::setOutlineStyle):
3094         (khtml::RenderStyle::setOutlineColor):
3095         (khtml::RenderStyle::clearBackgroundLayers):
3096         (khtml::RenderStyle::inheritBackgroundLayers):
3097         (khtml::RenderStyle::setOutlineOffset):
3098         * khtml/rendering/render_table.cpp:
3099         (RenderTable::paintBoxDecorations):
3100         (RenderTableCell::paintBoxDecorations):
3101
3102 2004-11-04  David Hyatt  <hyatt@apple.com>
3103
3104         Make sure the text decoder returns empty strings rather than null strings when the utf8 char ptr is non-null.
3105         Ensures that <a href=""> works with libxml (which returns data in utf-8 buffers).
3106
3107         Reviewed by darin
3108
3109         * kwq/KWQTextCodec.mm:
3110         (KWQTextDecoder::convertLatin1):
3111         (KWQTextDecoder::convertUTF16):
3112         (KWQTextDecoder::convertUsingTEC):
3113         (KWQTextDecoder::toUnicode):
3114
3115 2004-11-04  David Hyatt  <hyatt@apple.com>
3116
3117         Make sure line-height returns the correct value for normal.
3118         
3119         Reviewed by darin
3120
3121         * khtml/css/css_computedstyle.cpp:
3122         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
3123
3124 2004-11-04  David Harrison  <harrison@apple.com>
3125
3126         Reviewed by Ken Kocienda.
3127
3128                 <rdar://problem/3857753> REGRESSION (Mail): Delete incorrectly causes text to take on new style
3129                 
3130         * khtml/editing/htmlediting.cpp:
3131         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Fixed to move entire source subtree (up
3132         to, but not including, the enclosingBlockFlowElement) rather than just the source element.
3133         Fixed to insert after the destination subtree, rather than the destination element.  Handles
3134         edge case of deleting back to the top of the tree, where there is nothing left to insert after.
3135         * khtml/xml/dom_nodeimpl.cpp:
3136         (NodeImpl::enclosingNonBlockFlowElement): New method to support moveNodesAfterNode changes.
3137         * khtml/xml/dom_nodeimpl.h: Declare NodeImpl::enclosingNonBlockFlowElement
3138         * layout-tests/editing/deleting/delete-3857753-fix-expected.txt: Added.
3139         * layout-tests/editing/deleting/delete-3857753-fix.html: Added.
3140
3141 2004-11-03  Ken Kocienda  <kocienda@apple.com>
3142
3143         Reviewed by me
3144         
3145         More layout tests.
3146
3147         * layout-tests/editing/deleting/delete-br-008-expected.txt: Added.
3148         * layout-tests/editing/deleting/delete-br-008.html: Added.
3149         * layout-tests/editing/deleting/delete-br-009-expected.txt: Added.
3150         * layout-tests/editing/deleting/delete-br-009.html: Added.
3151         * layout-tests/editing/deleting/delete-br-010-expected.txt: Added.
3152         * layout-tests/editing/deleting/delete-br-010.html: Added.
3153
3154 2004-11-03  Maciej Stachowiak  <mjs@apple.com>
3155
3156         Fix by Yasuo Kida, reviewed by me.
3157
3158         <rdar://problem/3819004> REGRESSION (Mail): Can't move cursor / delete character after deleting the active input area
3159         
3160         * kwq/KWQKHTMLPart.mm:
3161         (KWQKHTMLPart::setMarkedTextRange): Treat a collapsed range the
3162         same as a nil range - setting an empty marked range should clear
3163         the marked range entirely.
3164
3165 2004-11-02  Maciej Stachowiak  <mjs@apple.com>
3166
3167         Reviewed by Dave Hyatt (when I originally coded it).
3168
3169         WebCore part of fix for:
3170
3171         <rdar://problem/3759187> REGRESSION (Mail): implement firstRectForCharacterRange:
3172         
3173         * kwq/WebCoreBridge.h:
3174         * kwq/WebCoreBridge.mm:
3175         (-[WebCoreBridge firstRectForDOMRange:]): New method to compute the rect for a
3176         DOMRange, or if the range is split into multiple lines, the rect for the part on
3177         the first line only.
3178         
3179         * khtml/rendering/render_object.cpp:
3180         (RenderObject::caretRect): Added extraWidthToEndOfLine parameter and ditto
3181         for the overrides below.
3182         * khtml/rendering/render_object.h:
3183         * khtml/rendering/render_box.cpp:
3184         (RenderBox::caretRect):
3185         * khtml/rendering/render_box.h:
3186         * khtml/rendering/render_br.cpp:
3187         (RenderBR::caretRect):
3188         * khtml/rendering/render_br.h:
3189         * khtml/rendering/render_flow.cpp:
3190         (RenderFlow::caretRect):
3191         * khtml/rendering/render_flow.h:
3192         * khtml/rendering/render_text.cpp:
3193         (RenderText::caretRect):
3194
3195 2004-11-02  Ken Kocienda  <kocienda@apple.com>
3196
3197         Reviewed by Hyatt
3198
3199         Implemented command to insert a block in response to typing a return key (even though
3200         I am not turning that on by default with this patch....that will come later). 
3201         
3202         This new command is called InsertParagraphSeparatorCommand.
3203         
3204         Reworked the command and function names associated with inserting content into a 
3205         document. Before this patch, there were inputXXX and insertXXX variants, with the
3206         former used for more high-level actions and the latter used for lower-level stuff.
3207         However, this was confusing as the AppKit uses insertXXX for everything. This resulted
3208         in an insertXXX command going through an inputXXX WebCore step and then finally to an
3209         insertXXX WebCore step. To make this less confusing, I have changes all the names to
3210         be insertXXX, and modified the lower-level operations so that it is clear what they do.
3211         
3212         * khtml/editing/htmlediting.cpp:
3213         (khtml::EditCommandPtr::isInsertTextCommand): Name change.
3214         (khtml::EditCommand::isInsertTextCommand): Ditto.
3215         (khtml::CompositeEditCommand::inputText): Ditto.
3216         (khtml::CompositeEditCommand::insertTextIntoNode): Ditto.
3217         (khtml::CompositeEditCommand::deleteTextFromNode): Ditto.
3218         (khtml::CompositeEditCommand::replaceTextInNode): Ditto.
3219         (khtml::CompositeEditCommand::deleteInsignificantText): Name changes in implementation.
3220         (khtml::CompositeEditCommand::isLastVisiblePositionInNode): Ditto.
3221         (khtml::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand): Class name change, was DeleteTextCommand.
3222         (khtml::DeleteFromTextNodeCommand::~DeleteFromTextNodeCommand): Ditto.
3223         (khtml::DeleteFromTextNodeCommand::doApply): Ditto.
3224         (khtml::DeleteFromTextNodeCommand::doUnapply): Ditto.
3225         (khtml::DeleteSelectionCommand::performGeneralDelete): Ditto.
3226         (khtml::DeleteSelectionCommand::fixupWhitespace): Ditto.
3227         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Ditto.
3228         (khtml::InsertIntoTextNode::InsertIntoTextNode): Class name change.
3229         (khtml::InsertIntoTextNode::~InsertIntoTextNode): Ditto.
3230         (khtml::InsertIntoTextNode::doApply): Ditto.
3231         (khtml::InsertIntoTextNode::doUnapply): Ditto.
3232         (khtml::InsertLineBreakCommand::InsertLineBreakCommand): Class name change, was InsertNewlineCommand.
3233         (khtml::InsertLineBreakCommand::insertNodeAfterPosition):
3234         (khtml::InsertLineBreakCommand::insertNodeBeforePosition):
3235         (khtml::InsertLineBreakCommand::doApply):
3236         (khtml::InsertNodeBeforeCommand::InsertNodeBeforeCommand): Code moved. No changes.
3237         (khtml::InsertNodeBeforeCommand::~InsertNodeBeforeCommand): Ditto.
3238         (khtml::InsertNodeBeforeCommand::doApply): Ditto.
3239         (khtml::InsertNodeBeforeCommand::doUnapply): Ditto.
3240         (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): New command.
3241         (khtml::InsertParagraphSeparatorCommand::doApply):
3242         (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):
3243         Class name change, was InsertNewlineCommandInQuotedContentCommand.
3244         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto.
3245         (khtml::InsertParagraphSeparatorInQuotedContentCommand::isMailBlockquote): Ditto.
3246         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
3247         (khtml::InsertTextCommand::InsertTextCommand): Class name change, was InputTextCommand.
3248         (khtml::InsertTextCommand::doApply): Ditto.
3249         (khtml::InsertTextCommand::deleteCharacter): Ditto.
3250         (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
3251         (khtml::InsertTextCommand::input): Ditto.
3252         (khtml::InsertTextCommand::insertSpace): Ditto.
3253         (khtml::InsertTextCommand::isInsertTextCommand): Ditto.
3254         (khtml::TypingCommand::insertLineBreak): Name change, was insertNewline.
3255         (khtml::TypingCommand::insertParagraphSeparatorInQuotedContent): Name change, was insertNewlineInQuotedContent.
3256         (khtml::TypingCommand::insertParagraphSeparator): New function.
3257         (khtml::TypingCommand::doApply): Name changes, as above.
3258         (khtml::TypingCommand::insertText): Ditto.
3259         (khtml::TypingCommand::deleteKeyPressed): Ditto.
3260         (khtml::TypingCommand::preservesTypingStyle): Ditto.
3261         * khtml/editing/htmlediting.h:
3262         (khtml::DeleteFromTextNodeCommand::node): Name change.
3263         (khtml::DeleteFromTextNodeCommand::offset): Ditto.
3264         (khtml::DeleteFromTextNodeCommand::count): Ditto.
3265         (khtml::InsertIntoTextNode::text): Ditto.
3266         (khtml::InsertNodeBeforeCommand::insertChild): Ditto.
3267         (khtml::InsertNodeBeforeCommand::refChild): Ditto.
3268         (khtml::TypingCommand::): Ditto.
3269         * khtml/editing/jsediting.cpp: Name changes, as above.
3270         * kwq/WebCoreBridge.h:
3271         * kwq/WebCoreBridge.mm:
3272         (-[WebCoreBridge insertLineBreak]): Name change, was insertNewline.
3273         (-[WebCoreBridge insertParagraphSeparator]): New function.
3274         (-[WebCoreBridge insertParagraphSeparatorInQuotedContent]): Name change, was insertNewlineInQuotedContent.
3275
3276 2004-11-01  Kevin Decker  <kdecker@apple.com>
3277
3278         Reviewed by rjw.
3279
3280         fixed <rdar://problem/3681094> Crash in KJS::WindowFunc::tryCall with application/xhtml+xml Content-Type
3281         once and for all. 
3282
3283         * khtml/ecma/kjs_window.cpp:
3284         (WindowFunc::tryCall): Added a nil check in the case of an empty document lacking a baseURL().
3285
3286 2004-11-01  Darin Adler  <darin@apple.com>
3287
3288         Reviewed by Hyatt.
3289
3290         - fixed <rdar://problem/3859381> REGRESSION (167-168): text in form fields should not use body's text color
3291
3292         * khtml/css/html4.css: Use color: initial for textarea and related ones.
3293
3294 2004-11-01  Ken Kocienda  <kocienda@apple.com>
3295
3296         Reviewed by John
3297
3298         Fix for this bug:
3299         
3300         <rdar://problem/3775920> REGRESSION (Mail): Centering doesn't work in HTML mail
3301
3302         * khtml/css/css_computedstyle.cpp:
3303         (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Factor out the 
3304         implementation here into new copyPropertiesInSet helper. This now calls the
3305         generalized copyPropertiesInSet function with the arguments needed to make copying
3306         inheritable work.
3307         * khtml/css/css_computedstyle.h:
3308         * khtml/css/css_valueimpl.cpp:
3309         (CSSStyleDeclarationImpl::diff): Move this function here from css_computedstyle.cpp.
3310         In order to do apply block properties, "regular" style declarations need to do style
3311         diffs as well.
3312         (CSSStyleDeclarationImpl::copyBlockProperties): New helper. Just like copyInheritableProperties
3313         except that it uses a different set of properties that apply only to blocks.
3314         (CSSStyleDeclarationImpl::copyPropertiesInSet): New helper that looks at a style declaration
3315         and copies out those properties listed in a pre-defined set.
3316         * khtml/css/css_valueimpl.h:
3317         * khtml/editing/htmlediting.cpp:
3318         (khtml::StyleChange::StyleChange): Modified to work with style changes that apply to a whole
3319         block, factoring out some of the special case code that should now only run in the inline case.
3320         (khtml::StyleChange::init): Factored out the code that now is in checkForLegacyHTMLStyleChange.
3321         (khtml::StyleChange::checkForLegacyHTMLStyleChange): New helper for case where we want
3322         special handling for "legacy" HTML styles like <B> and <I>.
3323         (khtml::ApplyStyleCommand::doApply): Much refactoring in this class to divide up the work of
3324         style changes into different kinds. CSS specifies certain properties only apply to&nb