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