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