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