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