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