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