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