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