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