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