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