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