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