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