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