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