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