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