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