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