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