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