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