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