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