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