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