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