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