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