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