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