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