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