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