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