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