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