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