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