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