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