391626d40d60a64ca9a62d1a4ed27d1fab2407f5
[WebKit-https.git] / WebCore / ChangeLog-2005-08-23
1 2004-12-05  Darin Adler  <darin@apple.com>
2
3         - fixed small problem in my check-in from yesterday
4
5         * kwq/KWQEvent.mm:
6         (positionForEvent): Get location from event without raising exception if it's the wrong type.
7         (clickCountForEvent): Same, for clickCount.
8         (QMouseEvent::QMouseEvent): Use the new helper functions so this can be constructed even with
9         the wrong type of NSEvent. Required for cases where a keyboard event causes a "click" and we need
10         to synthesize a QMouseEvent for KHTML internal use, using the key down NSEvent.
11
12 2004-12-04  Darin Adler  <darin@apple.com>
13
14         Reviewed by John.
15
16         - fixed <rdar://problem/3878329> REGRESSION (169-170): colors are wrong for my.yahoo.com due to CSS background parsing changes
17
18         * khtml/css/cssparser.cpp: (CSSParser::parseBackgroundShorthand): Changed function so it doesn't rely on the position
19         attribute being at the end of the array and then moved position attribute before color attribute so it takes precedence.
20         Since "0" can be both the X coordinate of a position and a legal color (meaning black), we need to do position first.
21
22         - fixed <rdar://problem/3760869> click events for input type=button or type=checkbox don't have flags like shiftKey set
23
24         * khtml/rendering/render_form.h: Remove unused RenderFormElement fields.
25         * khtml/rendering/render_form.cpp:
26         (RenderFormElement::RenderFormElement): Take out code to set a bunch of unused fields.
27         (RenderFormElement::slotClicked): Change to create the QMouseEvent from the actual mouse event rather than
28         creating it with all the flags set to 0, using the new QMouseEvent constructor that does so.
29
30         * kwq/KWQEvent.h: Added constructor that takes no parameters which uses the current event from AppKit.
31         Made the click count getter const and added an isDoubleClick that matches the logic used elsewhere.
32         Added a fixState helper method so the constructors can save code.
33         * kwq/KWQEvent.mm:
34         (QMouseEvent::QMouseEvent): Factored out the state-fixing code that was in the two existing constructors
35         and added a third constructor that uses the "current event" from AppKit (used above).
36         (QMouseEvent::fixState): Compute state and click count based on event type.
37
38         - fixed first symptom of <rdar://problem/3830936> REGRESSION (125-165): crash due to null font family, hang at changeforamerica.com
39
40         * kwq/KWQFontFamily.mm: (KWQFontFamily::getNSFamily): Handle empty strings specially so we don't run into trouble when
41         the family name is a null string. This prevents the crash, but there are still other problems that may have the same
42         underlying cause in CSS.
43
44         - fixed <rdar://problem/3829808> Safari crashes when adding a DOM node that was removed from an XMLHTTP request result
45
46         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::insertedIntoDocument):
47         Added nil check before calling scheduleRelayout. This is new code so the nil-dereference is a recent regression.
48
49 2004-12-03  Chris Blumenberg  <cblu@apple.com>
50
51         New fixes for:
52         <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
53         <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
54         <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
55         <rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear
56
57         Reviewed by darin, rjw, kocienda.
58
59         * khtml/misc/loader.cpp:
60         (CachedObject::~CachedObject):
61         (CachedCSSStyleSheet::checkNotify):
62         (Loader::servePendingRequests):
63         (Loader::slotFinished):
64         (Loader::slotReceivedResponse):
65         (Cache::requestImage):
66         (Cache::requestScript):
67         * khtml/misc/loader.h:
68         (khtml::CachedObject::CachedObject):
69         (khtml::CachedObject::response):
70         (khtml::CachedObject::allData):
71         * kwq/KWQKJobClasses.h:
72         * kwq/KWQKJobClasses.mm:
73         (KIO::TransferJobPrivate::TransferJobPrivate):
74         (KIO::TransferJobPrivate::~TransferJobPrivate):
75         (KIO::TransferJob::TransferJob):
76         (KIO::TransferJob::assembleResponseHeaders):
77         (KIO::TransferJob::retrieveCharset):
78         (KIO::TransferJob::emitResult):
79         (KIO::TransferJob::emitReceivedResponse):
80         * kwq/KWQLoader.h:
81         * kwq/KWQLoader.mm:
82         (KWQHeaderStringFromDictionary):
83         (KWQCheckCacheObjectStatus):
84         (KWQIsResponseURLEqualToURL):
85         (KWQResponseURL):
86         (KWQResponseMIMEType):
87         (KWQCacheObjectExpiresTime):
88         (khtml::CachedObject::setResponse):
89         (khtml::CachedObject::setAllData):
90         * kwq/KWQPixmap.h:
91         * kwq/KWQPixmap.mm:
92         (QPixmap::QPixmap):
93         * kwq/KWQResourceLoader.mm:
94         (-[KWQResourceLoader finishJobAndHandle:]):
95         (-[KWQResourceLoader cancel]):
96         (-[KWQResourceLoader reportError]):
97         (-[KWQResourceLoader finishWithData:]):
98         * kwq/KWQSignal.h:
99         * kwq/KWQSignal.mm:
100         (KWQSignal::call):
101         * kwq/KWQSlot.h:
102         * kwq/KWQSlot.mm:
103         (KWQSlot::KWQSlot):
104         (KWQSlot::call):
105         * kwq/WebCoreBridge.h:
106         * kwq/WebCoreResourceLoader.h:
107
108 2004-12-04  Darin Adler  <darin@apple.com>
109
110         Reviewed by John.
111
112         - fixed <rdar://problem/3876093> REGRESSION (166-167): Setting slider control's value from JavaScript has no effect (breaks RSS)
113
114         * khtml/rendering/render_form.cpp:
115         (RenderSlider::updateFromElement): Call setValue to update the value of the DOM element rather than
116         modifying the m_value data member directly. We don't use m_value at all for sliders now, and in fact
117         the code relies on the fact that m_value is null. Setting m_value to a non-null value was causing the bug.
118         (RenderSlider::slotSliderValueChanged): Ditto.
119
120 2004-12-03  John Sullivan  <sullivan@apple.com>
121
122         Reviewed by Ken.
123         
124         - fixed <rdar://problem/3889411> REGRESSION (125-172): repro crash in 
125         khtml::BackgroundLayer::cullEmptyLayers
126
127         * khtml/rendering/render_style.cpp:
128         (BackgroundLayer::cullEmptyLayers):
129         added missing nil check
130
131 === Safari-173 ===
132
133 2004-12-03  Ken Kocienda  <kocienda@apple.com>
134
135         Reviewed by me
136
137         Roll out some recent changes by Chris that caused a performance regression.
138         Fix is in hand, but it is a little risky this close to a submission. So,
139         we have decided to roll back the change with the regression and roll in
140         the new code after we submit.
141
142         * khtml/css/cssproperties.c:
143         (hash_prop):
144         (findProp):
145         * khtml/css/cssvalues.c:
146         (hash_val):
147         (findValue):
148         * khtml/misc/htmlattrs.c:
149         (hash_attr):
150         (findAttr):
151         * khtml/misc/htmltags.c:
152         (hash_tag):
153         (findTag):
154         * khtml/misc/loader.cpp:
155         (CachedObject::~CachedObject):
156         (CachedObject::setResponse):
157         (CachedCSSStyleSheet::checkNotify):
158         (Loader::servePendingRequests):
159         (Loader::slotFinished):
160         (Loader::slotReceivedResponse):
161         (Cache::requestImage):
162         (Cache::requestScript):
163         * khtml/misc/loader.h:
164         (khtml::CachedObject::CachedObject):
165         (khtml::CachedObject::response):
166         * kwq/KWQKJobClasses.h:
167         * kwq/KWQKJobClasses.mm:
168         (KIO::TransferJobPrivate::TransferJobPrivate):
169         (KIO::TransferJobPrivate::~TransferJobPrivate):
170         (KIO::TransferJob::TransferJob):
171         (KIO::TransferJob::assembleResponseHeaders):
172         (KIO::TransferJob::retrieveCharset):
173         (KIO::TransferJob::emitResult):
174         (KIO::TransferJob::emitReceivedResponse):
175         * kwq/KWQLoader.h:
176         * kwq/KWQLoader.mm:
177         (KWQHeaderStringFromDictionary):
178         (KWQCheckCacheObjectStatus):
179         (KWQRetainResponse):
180         (KWQReleaseResponse):
181         (KWQIsResponseURLEqualToURL):
182         (KWQResponseURL):
183         (KWQResponseMIMEType):
184         (KWQResponseTextEncodingName):
185         (KWQResponseHeaderString):
186         (KWQCacheObjectExpiresTime):
187         (KWQLoader::KWQLoader):
188         * kwq/KWQPixmap.h:
189         * kwq/KWQPixmap.mm:
190         (QPixmap::QPixmap):
191         * kwq/KWQResourceLoader.mm:
192         (-[KWQResourceLoader finishJobAndHandle]):
193         (-[KWQResourceLoader cancel]):
194         (-[KWQResourceLoader reportError]):
195         (-[KWQResourceLoader finish]):
196         * kwq/KWQSignal.h:
197         * kwq/KWQSignal.mm:
198         (KWQSignal::call):
199         * kwq/KWQSlot.h:
200         * kwq/KWQSlot.mm:
201         (KWQSlot::KWQSlot):
202         (KWQSlot::call):
203         * kwq/WebCoreBridge.h:
204         * kwq/WebCoreResourceLoader.h:
205
206 2004-12-03  John Sullivan  <sullivan@apple.com>
207
208         Reviewed by Chris.
209         
210         - fixed <rdar://problem/3903990> can't tab to all items on www.google.com any more (other pages too?)
211
212         * kwq/KWQKHTMLPart.mm:
213         (KWQKHTMLPart::nextKeyViewInFrameHierarchy):
214         when checking whether we moved the focus to another view, make sure we didn't "move" it to
215         our documentView, because that's no move at all.
216
217 2004-12-03  Darin Adler  <darin@apple.com>
218
219         Reviewed by Vicki.
220
221         - fixed <rdar://problem/3901109> REGRESSION (171-172): repro crash in DOM::NodeImpl::setChanged at chick-fil-a.com
222
223         * khtml/css/css_valueimpl.cpp: (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl):
224         Added missing initialization for base class and node pointer.
225
226         - fixed a few places that could leave dangling node pointers
227
228         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::~HTMLBodyElementImpl):
229         Clear out the node pointer when the node is destroyed.
230         * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::~HTMLElementImpl): Ditto.
231
232 2004-12-03  Chris Blumenberg  <cblu@apple.com>
233
234         Fix for performance regression. My original patch added a signal for passing the data of a resource to its WebCore cache object. This patch passes the data with the preexisting "finished" symbol so we make less calls. 
235         Fixed: <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
236
237         Reviewed by rjw.
238
239         * khtml/misc/loader.cpp:
240         (Loader::servePendingRequests): pass data param to slotFinished, removed allData signal
241         (Loader::slotFinished): take data param
242         * khtml/misc/loader.h:
243         * kwq/KWQKJobClasses.h:
244         * kwq/KWQKJobClasses.mm:
245         (KIO::TransferJob::TransferJob): have m_result take a data param, removed m_allData
246         (KIO::TransferJob::emitResult): take data param and pass it
247         * kwq/KWQResourceLoader.mm:
248         (-[KWQResourceLoader finishJobAndHandle:]): take data param and pass it
249         (-[KWQResourceLoader cancel]): pass nil for data
250         (-[KWQResourceLoader reportError]): ditto
251         (-[KWQResourceLoader finishWithData:]): pass data
252         * kwq/KWQSlot.mm:
253         (KWQSlot::KWQSlot): pass data param to slotFinished
254         (KWQSlot::call): added support for slotFinished_Loader, removed slotAllData
255
256 2004-12-03  Ken Kocienda  <kocienda@apple.com>
257
258         Reviewed by John
259
260         Did some clean up in the Position class as a result of trying to write some new layout
261         tests and discovering a bug along the way.
262
263         I removed these three functions from the Position class:
264         
265         1. bool isFirstRenderedPositionOnLine() const;
266         2. bool isLastRenderedPositionOnLine() const;
267         3. static bool renderersOnDifferentLine(RenderObject *r1, long o1, RenderObject *r2, long o2);
268         4. bool inFirstEditableInRootEditableElement() const;
269
270         The first two have replacements in the VisiblePosition class, and some code has been
271         moved to use these new variants. The third function was a helper used only by these
272         first two function, and can be removed as well. The fourth function was not used by anyone.
273
274         * khtml/editing/htmlediting.cpp:
275         (khtml::InsertTextCommand::input): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
276         * khtml/editing/visible_position.cpp:
277         (khtml::visiblePositionsOnDifferentLines): Added an additional check for blocks to this function.
278         Incorrect results were being returned when asking about positions at the starts of blocks.
279         * khtml/xml/dom_position.cpp:
280         (DOM::Position::previousCharacterPosition): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
281         (DOM::Position::nextCharacterPosition): Change over to use VisiblePosition isLastVisiblePositionOnLine().
282         (DOM::Position::rendersInDifferentPosition): Removed use of #3 helper in a log message. We can live without it.
283         * khtml/xml/dom_position.h: Update header for deletions.
284
285 2004-12-03  Ken Kocienda  <kocienda@apple.com>
286
287         Reviewed by John
288
289         Terminology change in execCommand command identifiers. Specifically, the name of 
290         "InsertNewline" command has been changed to "InsertLineBreak". This matches the 
291         terminology used by AppKit. It is also more accurate, since the insertion of a
292         "br" element is what the command does. The inspiration for this change is so the 
293         -insertNewline AppKit method can be mapped to insert a new "div" element in 
294         a document and avoid ambiguity with what the javascript editing command does.
295         
296         * khtml/editing/jsediting.cpp
297         * layout-tests/editing/deleting/delete-tab-004.html
298         * layout-tests/editing/editing.js
299         * layout-tests/editing/inserting/insert-3654864-fix.html
300         * layout-tests/editing/inserting/insert-3659587-fix.html
301         * layout-tests/editing/inserting/insert-3775316-fix.html
302         * layout-tests/editing/inserting/insert-3800346-fix.html
303         * layout-tests/editing/inserting/insert-br-001.html
304         * layout-tests/editing/inserting/insert-br-002.html
305         * layout-tests/editing/inserting/insert-br-003.html
306         * layout-tests/editing/inserting/insert-br-004.html
307         * layout-tests/editing/inserting/insert-br-005.html
308         * layout-tests/editing/inserting/insert-br-006.html
309         * layout-tests/editing/inserting/insert-br-007.html
310         * layout-tests/editing/inserting/insert-br-008.html
311         * layout-tests/editing/inserting/insert-tab-004.html
312         * layout-tests/editing/inserting/insert-text-with-newlines.html
313         * layout-tests/editing/pasteboard/paste-text-010.html
314
315 2004-12-02  Ken Kocienda  <kocienda@apple.com>
316
317         Reviewed by John
318
319         Fix for this bug:
320         
321         <rdar://problem/3786362> REGRESSION (Mail): pasted text loses one newline
322
323         * khtml/editing/htmlediting.cpp:
324         (khtml::InsertLineBreakCommand::doApply): Added check for strict mode before adding an extra br element
325         at the end of a block. This is only necessary in quirks mode. Also, lower-case "br" used to make element.
326         (khtml::ReplaceSelectionCommand::doApply): If the replacement adds a br element as the last element
327         in a block and the document is in quirks mode, add an additional br to make the one in the 
328         replacement content show up. This turns out to be much the same logic as is done in InsertLineBreakCommand.
329         * layout-tests/editing/inserting/insert-3786362-fix-expected.txt: Added.
330         * layout-tests/editing/inserting/insert-3786362-fix.html: Added.
331
332 2004-12-02  Richard Williamson   <rjw@apple.com>
333
334         Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images
335
336         Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
337         the b/f cache won't incorrectly trash the previous state when restoring.
338
339         Reviewed by John.
340
341         * kwq/WebCoreBridge.h:
342         * kwq/WebCoreBridge.mm:
343         (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
344         (-[WebCoreBridge canCachePage]):
345         (-[WebCoreBridge clear]):
346
347 2004-12-02  Ken Kocienda  <kocienda@apple.com>
348
349         Reviewed by Richard
350
351         Fix for this bug:
352         
353         <rdar://problem/3857775> 8A293: Mail.app crashes converting copy-pasted text into plain text
354
355         * khtml/xml/dom2_rangeimpl.cpp:
356         (DOM::RangeImpl::commonAncestorContainer): Return the document element if no common ancestor container
357         was found. This can happen in cases where the DOM was built from malformed markup (as in the case
358         of this bug where there is content after the body tag). Did a little code clean up as well.
359         (DOM::RangeImpl::compareBoundaryPoints): Made code more robust by adding some null checks.
360
361 2004-12-02  Ken Kocienda  <kocienda@apple.com>
362
363         Reviewed by Chris
364
365         Fix for this bug:
366         
367         <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection was created right-to-left
368
369         * khtml/khtml_part.cpp:
370         (KHTMLPart::handleMousePressEventSingleClick): Use RangeImpl::compareBoundaryPoints
371         to figure out which end of the selection to extend.
372
373 2004-12-02  David Harrison  <harrison@apple.com>
374
375         Reviewed by Ken Kocienda.
376
377                 <rdar://problem/3834917> REGRESSION (Mail): double-clicking blank line selects end of previous line
378                 Fixed originally reported bug plus the case of double-clicking whitespace at the beginning of a line, which has a similar result.
379
380         * khtml/editing/visible_text.cpp:
381         (khtml::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
382         (khtml::SimplifiedBackwardsTextIterator::handleTextNode):
383         (khtml::SimplifiedBackwardsTextIterator::handleReplacedElement):
384         (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode):
385         (khtml::SimplifiedBackwardsTextIterator::emitCharacter):
386         Distinguish BR from whitespace.
387         * khtml/editing/visible_text.h:
388         Distinguish BR from whitespace.
389         * khtml/editing/visible_units.cpp:
390         (khtml::previousWordBoundary):
391         Use UPSTREAM visible position now that SimplifiedBackwardsTextIterator distinguishes BR from whitespace.  Otherwise, double-clicking at end of line would result in caret selection at start of next line. 
392
393 2004-12-02  Ken Kocienda  <kocienda@apple.com>
394
395         Reviewed by John
396
397         Fix for this bug:
398         
399         <rdar://problem/3900996> Crash dragging past end of contentEditable DIV, at DOM::RangeImpl::pastEndNode() const + 24
400
401         * khtml/xml/dom_position.cpp:
402         (DOM::Position::equivalentRangeCompliantPosition): Fixed this function so that it constrains the offset
403         of the position to be >= 0 and <= number of kids of its node. Not doing this constraining led to a DOM
404         exception trying to use a Position returned from this function to set the boundary point of a Range (which
405         eventually led to the crash). Since this crash happened, it seems like this function was failing in its
406         contract to return a range-compliant position, hence the need for this fix.
407
408 2004-12-01  Ken Kocienda  <kocienda@apple.com>
409
410         Reviewed by me
411
412         Moving code only.
413
414         * khtml/editing/htmlediting.cpp: Move ReplaceSelectionCommand into alphabetical order with
415         regard to other editing commands. The class had a name change ages ago, and it was never
416         moved.
417         * khtml/editing/htmlediting.h: Ditto.
418
419 2004-12-01  Ken Kocienda  <kocienda@apple.com>
420
421         Reviewed by Hyatt
422         
423         Some improvements for paste, including some new code to annotate
424         whitespace when writing to the pasteboard to ensure that the meaning
425         of the markup on the pasteboard is unambiguous.
426         
427         There is also new code for reading this annotated markup from the pasteboard,
428         removing the nodes that were added only to prevent ambiguity.
429
430         * WebCore.pbproj/project.pbxproj: Added html_interchange.h and html_interchange.cpp files.
431         The header should have been added earlier, but I did not do so.
432         * khtml/editing/html_interchange.cpp: Added.
433         (convertHTMLTextToInterchangeFormat):
434         * khtml/editing/html_interchange.h: Added some new constants for use with whitespace annotations.
435         * khtml/editing/htmlediting.cpp:
436         (khtml::ReplacementFragment::ReplacementFragment): Now looks for and removes annotations added for whitespace.
437         Also fixed a bug in the code that counts blocks in a fragment.
438         (khtml::ReplacementFragment::isInterchangeConvertedSpaceSpan): New helper. Recognizes annotation spans.
439         (khtml::ReplacementFragment::insertNodeBefore): New helper.
440         (khtml::ReplaceSelectionCommand::doApply): Fixed a bug in the code that sets the start position
441         for the replacement after deleting. This was causing a bug when pasting at the end of a block.
442         * khtml/editing/htmlediting.h: Add some new declarations.
443         * khtml/xml/dom2_rangeimpl.cpp:
444         (DOM::RangeImpl::toHTML): Calls to startMarkup now pass true for the new annotate flag.
445         * khtml/xml/dom_nodeimpl.cpp:
446         (NodeImpl::stringValueForRange): New helper.
447         (NodeImpl::renderedText): New helper to return only the rendered text in a node.
448         (NodeImpl::startMarkup): Now takes an additional flag to control whether interchange annotations
449         should be added. Called by the paste code.
450         * khtml/xml/dom_nodeimpl.h: Added and modified function declarations.
451
452         New test to check the khtml::ReplaceSelectionCommand::doApply fix.
453         * layout-tests/editing/pasteboard/paste-text-010-expected.txt: Added.
454         * layout-tests/editing/pasteboard/paste-text-010.html: Added.
455
456 2004-11-30  Chris Blumenberg  <cblu@apple.com>
457
458         * ChangeLog: removed conflict marker
459
460 2004-11-30  Chris Blumenberg  <cblu@apple.com>
461
462         Fixed:
463         <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
464         <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
465
466         Reviewed by darin.
467
468         * khtml/misc/loader.cpp:
469         (CachedObject::~CachedObject): release m_allData
470         (CachedObject::setAllData): new
471         (Loader::servePendingRequests): connect slotAllData
472         (Loader::slotAllData): new
473         (Cache::requestImage): tweak
474         * khtml/misc/loader.h:
475         (khtml::CachedObject::CachedObject): set allData to 0
476         (khtml::CachedObject::allData): new
477         * kwq/KWQKJobClasses.h:
478         * kwq/KWQKJobClasses.mm:
479         (KIO::TransferJob::TransferJob): set m_allData
480         (KIO::TransferJob::emitAllData): new
481         * kwq/KWQLoader.mm:
482         (KWQCheckCacheObjectStatus): pass WebKit the data instead of the length of the resource
483         * kwq/KWQResourceLoader.mm:
484         (-[KWQResourceLoader finishWithData:]): renamed to pass all data for the resource
485         * kwq/KWQSlot.mm:
486         (KWQSlot::KWQSlot): support for slotAllData
487         (KWQSlot::call):
488         * kwq/WebCoreBridge.h:
489         * kwq/WebCoreResourceLoader.h:
490
491 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
492
493         Reviewed by John.
494
495 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
496
497         Reviewed by John.
498
499         <rdar://problem/3805311> REGRESSION (159-163): onload in dynamically written document not called (causes blank search page at Japanese EPP site, many others)
500
501         * khtml/khtml_part.cpp:
502         (KHTMLPart::begin): call setParsing on document here after opening
503         - from now on we'll only set parsing to true for a document open
504         caused by page loading, not a programmatic one.
505         * khtml/xml/dom_docimpl.cpp:
506         (DocumentImpl::open): don't setParsing to true here any more.
507
508 2004-11-30  Maciej Stachowiak  <mjs@apple.com>
509
510         Reviewed by John.
511
512         - fix recent regression from collection perf fixes.
513         
514         * khtml/html/html_miscimpl.cpp:
515         (HTMLFormCollectionImpl::updateNameCache): Look up the name
516         attribute in the name cache, not the id cache (d'oh!)
517
518 2004-11-30  Darin Adler  <darin@apple.com>
519
520         Reviewed by Ken.
521
522         - rolled in a KDE fix for a problem that may underlie a number of crashes
523
524         * khtml/xml/dom2_rangeimpl.cpp: (RangeImpl::compareBoundaryPoints): Rolled in a change from
525         the KDE guys to fix a subtle problem. Code said "n = n =".
526
527         - rolled in a KDE fix for a containingBlock crash
528
529         * khtml/rendering/render_object.cpp: Roll in a change from KDE that adds frameset to the list of
530         elements that can not be a containingBlock. They said this fixes a crash, although I did not look
531         into that further.
532
533         - fixed <rdar://problem/3884660> 8A305: Repro crash in QScrollBar::setValue (affects Safari RSS)
534
535         * kwq/KWQButton.mm:
536         (-[KWQButton initWithQButton:]): Set up target and action here instead of in caller.
537         (-[KWQButton detachQButton]): Added.
538         (-[KWQButton sendConsumedMouseUpIfNeeded]): Check button for nil instead of checking target.
539         (-[KWQButton mouseDown:]): Add calls to QWidget::beforeMouseDown/afterMouseDown.
540         (-[KWQButton widget]): Added.
541         (-[KWQButton becomeFirstResponder]): Added check to handle when button is 0.
542         (-[KWQButton resignFirstResponder]): Ditto.
543         (-[KWQButton canBecomeKeyView]): Ditto.
544         (QButton::QButton): Remove target and action setup; handled in KWQButton now.
545         (QButton::~QButton): Call detachQButton instead of setTarget:nil.
546
547         * kwq/KWQComboBox.mm:
548         (QComboBox::~QComboBox): Call detachQComboBox.
549         (-[KWQPopUpButtonCell detachQComboBox]): Added.
550         (-[KWQPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:]): Handle case where box is 0.
551         (-[KWQPopUpButtonCell setHighlighted:]): Ditto.
552         (-[KWQPopUpButton action:]): Ditto.
553         (-[KWQPopUpButton widget]): Tweaked.
554         (-[KWQPopUpButton mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.
555         (-[KWQPopUpButton becomeFirstResponder]): Handle case where widget is 0.
556         (-[KWQPopUpButton resignFirstResponder]): Ditto.
557         (-[KWQPopUpButton canBecomeKeyView]): Ditto.
558
559         * kwq/KWQLineEdit.mm: (QLineEdit::~QLineEdit): Updated to use new detachQLineEdit name.
560
561         * kwq/KWQListBox.mm:
562         (-[KWQTableView mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.
563
564         * kwq/KWQScrollBar.h: Removed m_scroller field.
565         * kwq/KWQScrollBar.mm:
566         (-[KWQScrollBar initWithQScrollBar:]): Rearranged a little bit.
567         (-[KWQScrollBar detachQScrollBar]): Added.
568         (-[KWQScrollBar widget]): Added.
569         (-[KWQScrollBar mouseDown:]): Added.  Calls QWidget::beforeMouseDown and afterMouseDown.
570         (QScrollBar::QScrollBar): Changed to no longer set m_scroller.
571         (QScrollBar::~QScrollBar): Changed to call detachQScrollBar. No longer calls removeFromSuperview.
572         (QScrollBar::setValue): Chagned to use getView instad of m_scrollBar.
573         (QScrollBar::setKnobProportion): Ditto.
574         (QScrollBar::scrollbarHit): Ditto.
575
576         * kwq/KWQScrollView.mm:
577         (QScrollView::addChild): Changed to call QWidget to add to superview to accomodate the
578         hack where we don't remove right away when doing mouse tracking.
579         (QScrollView::removeChild): Changed to call QWidget to remove from superview to accomodate
580         the hack where we don't add right away when doing mouse tracking.
581
582         * kwq/KWQSlider.h: Added destructor.
583         * kwq/KWQSlider.mm:
584         (-[KWQSlider initWithQSlider:]): Tweaked a little.
585         (-[KWQSlider detachQSlider]): Added.
586         (-[KWQSlider mouseDown:]): Added call to QWidget::beforeMouseDown/afterMouseDown.
587         (-[KWQSlider widget]): Added.
588         (QSlider::~QSlider): Added. Calls detachQSlider.
589
590         * kwq/KWQTextArea.h: Added detachQTextEdit method.
591         * kwq/KWQTextArea.mm:
592         (-[KWQTextArea detachQTextEdit]): Added.
593         (-[KWQTextArea textDidChange:]): Added check for widget of 0.
594         (-[KWQTextArea becomeFirstResponder]): Ditto.
595         (-[KWQTextArea nextKeyView]): Ditto.
596         (-[KWQTextArea previousKeyView]): Ditto.
597         (-[KWQTextArea drawRect:]): Ditto.
598         (-[KWQTextAreaTextView insertTab:]): Ditto.
599         (-[KWQTextAreaTextView insertBacktab:]): Ditto.
600         (-[KWQTextAreaTextView shouldDrawInsertionPoint]): Ditto.
601         (-[KWQTextAreaTextView selectedTextAttributes]): Ditto.
602         (-[KWQTextAreaTextView mouseDown:]): Ditto.
603         (-[KWQTextAreaTextView keyDown:]): Ditto.
604         (-[KWQTextAreaTextView keyUp:]): Ditto.
605
606         * kwq/KWQTextEdit.h: Added ~QTextEdit.
607         * kwq/KWQTextEdit.mm: (QTextEdit::~QTextEdit): Added. Calls detachQTextEdit.
608
609         * kwq/KWQTextField.h: Changed invalidate to detachQLineEdit.
610         * kwq/KWQTextField.mm: (-[KWQTextFieldController detachQLineEdit]): Changed.
611
612         * kwq/KWQWidget.h: Added addToSuperview/removeFromSuperview for use from QScrollView.
613         Added beforeMouseDown and afterMouseDown for use in widget implementations.
614         Removed unused hasMouseTracking function.
615         * kwq/KWQWidget.mm:
616         (QWidget::QWidget): Initialize two new fields.
617         (QWidget::~QWidget): Added code to remove view when widget is destroyed.
618         (QWidget::getOuterView): Remove unneeded exception blocking since we're just caling superview.
619         (QWidget::addToSuperview): Added.
620         (QWidget::removeFromSuperview): Added.
621         (QWidget::beforeMouseDown): Added.
622         (QWidget::afterMouseDown): Added.
623
624         * khtml/rendering/render_layer.cpp:
625         (RenderLayer::setHasHorizontalScrollbar): Remove parent parameter; let addChild call addSubview:.
626         (RenderLayer::setHasVerticalScrollbar): Ditto.
627
628 2004-11-30  Ken Kocienda  <kocienda@apple.com>
629
630         Reviewed by John
631
632         Fix for this bug:
633         
634         <rdar://problem/3863031> REGRESSION (Mail): caret continues flashing while mouse is down
635
636         * khtml/khtml_part.cpp:
637         (KHTMLPart::timerEvent): Add a check for whether the mouse is down. Keep the caret drawn
638         with no blink if it is.
639
640 2004-11-30  Ken Kocienda  <kocienda@apple.com>
641
642         Reviewed by John
643
644         Fix for this bug:
645         
646         <rdar://problem/3861602> cursor gets lost trying to backspace to delete a form control
647
648         * khtml/khtml_part.cpp:
649         (KHTMLPart::setFocusNodeIfNeeded): This function would clear the selection if a <button>
650         or <input type=image> was checked for focus since these elements are keyboard-focusable,
651         but not mouse focusable. Also, this function did not work hard enough to set the focused
652         node, and was content to clear it if the first element checked failed the test, rather
653         than looking more at parents. This would have the effect of clearing, then resetting the
654         focus on a DIV containing a button or image with content on either side of it in the
655         process of arrowing over such content.
656
657 2004-11-30  Ken Kocienda  <kocienda@apple.com>
658
659         Reviewed by John
660
661         * khtml/editing/htmlediting.cpp:
662         (khtml::ReplaceSelectionCommand::doApply): Fix smart replace, which I (knowingly) broke with yesterday's checkin.
663         Also, call updateLayout() in one more place to prevent stale information being returned from caretMaxOffset().
664         * khtml/khtml_part.cpp:
665         (KHTMLPart::isCharacterSmartReplaceExempt): Make this virtual and always return true. This gets rid of an
666         ugly APPLE_CHANGES block and use of KWQ(part) in ReplaceSelectionCommand.
667         * khtml/khtml_part.h: To help out with the isCharacterSmartReplaceExempt cleanup, add declaration.
668         * kwq/KWQKHTMLPart.h: To help out with the isCharacterSmartReplaceExempt cleanup, make 
669         isCharacterSmartReplaceExempt virtual.
670
671 2004-11-30  Ken Kocienda  <kocienda@apple.com>
672
673         Reviewed by me
674
675         * khtml/editing/htmlediting.cpp:
676         (khtml::ReplacementFragment::mergeEndNode): Fixed one-line coding mistake that created an endless loop.
677         Seemed simple enough to land without review.
678
679 2004-11-29  Ken Kocienda  <kocienda@apple.com>
680
681         Reviewed by Chris
682     
683         Rewrite of paste code (specifically the ReplaceSelectionCommand class). Many more cases
684         are handled correctly now, including selections that span multiple blocks, and cases
685         where content on the pasteboard ends in newlines (or what appear to be newlines to a
686         user, really block ends or BRs). I also made one small, but important change in the 
687         copy code to annotate the markup written to the pasteboard to support these selections 
688         ending in newlines.
689
690         New header that defines a couple of constants used in copying and pasting.
691
692         * ForwardingHeaders/editing/html_interchange.h: Added.
693         * khtml/editing/html_interchange.h: Added.
694         
695         Rewrite of the ReplaceSelectionCommand. There are several new helper functions, as well
696         as a new helper class, ReplacementFragment, which encapsulates information and functions
697         pertaining to a document fragment that is being inserted into a document.
698         
699         * khtml/editing/htmlediting.cpp:
700         (khtml::ReplacementFragment::ReplacementFragment):
701         (khtml::ReplacementFragment::~ReplacementFragment):
702         (khtml::ReplacementFragment::firstChild): Simple accessor.
703         (khtml::ReplacementFragment::lastChild): Ditto.
704         (khtml::ReplacementFragment::mergeStartNode): Looks at the nodes in a fragment and determines
705         the starting node to use for merging into the block containing the start of the selection.
706         (khtml::ReplacementFragment::mergeEndNode): Same as above, but for the end of the selection.
707         (khtml::ReplacementFragment::pruneEmptyNodes): Simple helper.
708         (khtml::ReplacementFragment::isInterchangeNewlineComment): Determines if a node is the
709         special annotation comment added in by the copy code.
710         (khtml::ReplacementFragment::removeNode): Simple helper.
711         (khtml::isComment): Simple helper.
712         (khtml::isProbablyBlock): Determines if a node is of a type that is usually rendered as a block.
713         I would like to do better than this some day, but this check will hold us until I can do better.
714         (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand):
715         (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand):
716         (khtml::ReplaceSelectionCommand::doApply):
717         (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Figures out the right ending selection.
718         * khtml/editing/htmlediting.h: Declarations for the new ReplacementFragment class.
719         (khtml::ReplacementFragment::root):
720         (khtml::ReplacementFragment::type):
721         (khtml::ReplacementFragment::isEmpty):
722         (khtml::ReplacementFragment::isSingleTextNode):
723         (khtml::ReplacementFragment::isTreeFragment):
724         (khtml::ReplacementFragment::hasMoreThanOneBlock):
725         (khtml::ReplacementFragment::hasLogicalNewlineAtEnd):
726         
727         This smaller set of changes markup generation to add the newline annotation described in the
728         comment at the start of this entry.
729         
730         * khtml/xml/dom2_rangeimpl.cpp:
731         (DOM::RangeImpl::addCommentToHTMLMarkup): Simple helper.
732         (DOM::RangeImpl::toHTML): Added new EAnnotateForInterchange default argument to control whether
733         comment annotations are added to the markup generated.
734         * khtml/xml/dom2_rangeimpl.h: Add some new declarations.
735         * kwq/WebCoreBridge.mm:
736         (-[WebCoreBridge markupStringFromRange:nodes:]): Request that markup resulting from call to 
737         DOM::RangeImpl::toHTML uses annotations when generating.
738         
739         New tests.        
740
741         * layout-tests/editing/pasteboard/paste-text-001-expected.txt: Added.
742         * layout-tests/editing/pasteboard/paste-text-001.html: Added.
743         * layout-tests/editing/pasteboard/paste-text-002-expected.txt: Added.
744         * layout-tests/editing/pasteboard/paste-text-002.html: Added.
745         * layout-tests/editing/pasteboard/paste-text-003-expected.txt: Added.
746         * layout-tests/editing/pasteboard/paste-text-003.html: Added.
747         * layout-tests/editing/pasteboard/paste-text-004-expected.txt: Added.
748         * layout-tests/editing/pasteboard/paste-text-004.html: Added.
749         * layout-tests/editing/pasteboard/paste-text-005-expected.txt: Added.
750         * layout-tests/editing/pasteboard/paste-text-005.html: Added.
751         * layout-tests/editing/pasteboard/paste-text-006-expected.txt: Added.
752         * layout-tests/editing/pasteboard/paste-text-006.html: Added.
753         * layout-tests/editing/pasteboard/paste-text-007-expected.txt: Added.
754         * layout-tests/editing/pasteboard/paste-text-007.html: Added.
755         * layout-tests/editing/pasteboard/paste-text-008-expected.txt: Added.
756         * layout-tests/editing/pasteboard/paste-text-008.html: Added.
757         * layout-tests/editing/pasteboard/paste-text-009-expected.txt: Added.
758         * layout-tests/editing/pasteboard/paste-text-009.html: Added.
759
760 2004-11-29  Ken Kocienda  <kocienda@apple.com>
761
762         Reviewed by Harrison
763
764         Made two small changes that make it possible for comments to have DOM nodes made for them
765         when pasting. This relies on some earlier work I did some days ago.
766
767         * khtml/xml/dom_nodeimpl.cpp:
768         (NodeImpl::startMarkup): Get the string from the comment.
769         * kwq/WebCoreBridge.mm:
770         (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): Did some very minor
771         rearranging. Now passes a flag when creating a contextual fragment, requesting that comments
772         be included in the DOM.
773
774 2004-11-29  Ken Kocienda  <kocienda@apple.com>
775
776         Reviewed by Harrison
777
778         Added some new helpers to the VisiblePosition class. I will begin to use these when I check in
779         my improved paste code.
780
781         * khtml/editing/visible_position.cpp:
782         (khtml::blockRelationship)
783         (khtml::visiblePositionsInDifferentBlocks)
784         (khtml::isFirstVisiblePositionInBlock)
785         (khtml::isFirstVisiblePositionInNode)
786         (khtml::isLastVisiblePositionInBlock)
787         * khtml/editing/visible_position.h
788
789 2004-11-29  Ken Kocienda  <kocienda@apple.com>
790
791         Reviewed by Harrison
792
793         * khtml/xml/dom_position.cpp:
794         (DOM::Position::downstream): Fix a bug in downstream that prevented a call with DoNotStayInBlock
795         specified from obeying that directive. The old code would stop at an outer block boundary in
796         the case where that block had a block as its first child. The correct behavior is to drill into
797         that inner block (and continue on drilling down, if possible), to find the correct position.
798
799 2004-11-29  Ken Kocienda  <kocienda@apple.com>
800
801         Reviewed by Harrison
802
803         Small improvements to the node-display debugging helpers.
804
805         * khtml/xml/dom_nodeimpl.cpp:
806         (NodeImpl::displayTree): Make the rootNode be this if there is no rootEditableElement.
807         * khtml/xml/dom_nodeimpl.h: Make displayNode take a default argument of "" for its string.
808
809 2004-11-29  Ken Kocienda  <kocienda@apple.com>
810
811         Reviewed by Harrison
812
813         * khtml/editing/htmlediting.cpp:
814         (khtml::DeleteSelectionCommand::handleGeneralDelete): The downstream position in this function 
815         may need to be adjusted when deleting text off the front part of a text node. This fixes a problem 
816         I discovered while improving the paste command, where the insertion poitn wound up in the wrong
817         place after the delete. 
818
819 2004-11-29  Ken Kocienda  <kocienda@apple.com>
820
821         Reviewed by Harrison
822
823         Add a new helper function to insert a paragraph separator. Will be used in my
824         upcoming paste improvments.
825
826         * khtml/editing/htmlediting.cpp: Added function
827         (khtml::CompositeEditCommand::insertParagraphSeparator)
828         * khtml/editing/htmlediting.h: Ditto.
829
830 2004-11-23  David Harrison  <harrison@apple.com>
831
832         Added various comments.
833
834         * khtml/editing/htmlediting.cpp:
835         (khtml::StyleChange::init):
836         (khtml::ApplyStyleCommand::doApply):
837         (khtml::ApplyStyleCommand::applyBlockStyle):
838         (khtml::ApplyStyleCommand::applyInlineStyle):
839
840 2004-11-23  David Hyatt  <hyatt@apple.com>
841
842         Hit testing in table cells with top/bottom space from vertical alignment didn't work.  I forgot about the
843         super-secret yPos() lie that table cells do.  Use m_y instead of yPos().
844
845         * khtml/rendering/render_block.cpp:
846         (khtml::RenderBlock::nodeAtPoint):
847
848 2004-11-22  David Hyatt  <hyatt@apple.com>
849
850         Make sure you can use document.createElement to make a <canvas> element.
851
852         * khtml/xml/dom_docimpl.cpp:
853         (DocumentImpl::createHTMLElement):
854
855 2004-11-22  Maciej Stachowiak  <mjs@apple.com>
856
857         Reviewed by Dave.
858
859         <rdar://problem/3492044> performing JavaScript operations on form elements is slower than WinIE (HTMLFormCollection)
860         <rdar://problem/3489679> selecting an item on the Apache bugzilla query page is very slow (HTMLFormCollection)
861         <rdar://problem/3477810> checking 80 check boxes with JavaScript is 10x slower than in IE (HTMLFormCollection)
862         <rdar://problem/3760962> JavaScript that toggles checkboxes is slow (HTMLCollection,HTMLFormCollection)
863         
864         * khtml/ecma/kjs_html.cpp:
865         (KJS::HTMLDocument::tryGet):
866         * khtml/html/html_formimpl.cpp:
867         (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
868         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
869         * khtml/html/html_formimpl.h:
870         * khtml/html/html_miscimpl.cpp:
871         (HTMLCollectionImpl::HTMLCollectionImpl):
872         (HTMLCollectionImpl::~HTMLCollectionImpl):
873         (HTMLCollectionImpl::CollectionInfo::CollectionInfo):
874         (HTMLCollectionImpl::CollectionInfo::reset):
875         (HTMLCollectionImpl::resetCollectionInfo):
876         (HTMLCollectionImpl::checkForNameMatch):
877         (appendToVector):
878         (HTMLCollectionImpl::updateNameCache):
879         (HTMLCollectionImpl::namedItems):
880         (HTMLFormCollectionImpl::HTMLFormCollectionImpl):
881         (HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
882         (HTMLFormCollectionImpl::item):
883         (HTMLFormCollectionImpl::updateNameCache):
884         * khtml/html/html_miscimpl.h:
885
886 2004-11-22  David Hyatt  <hyatt@apple.com>
887
888         Improve the WebCore cache so that the maximum cacheable object size is scaled based off the total cache
889         size.
890         
891         Reviewed by mjs
892
893         * khtml/misc/loader.cpp:
894         (CachedObject::finish):
895         (Cache::flush):
896         (Cache::setSize):
897         * khtml/misc/loader.h:
898         (khtml::Cache::maxCacheableObjectSize):
899
900 2004-11-22  David Hyatt  <hyatt@apple.com>
901
902         Fix for 3673381, huge directory listing so slow it seems like a hang.  Rework painting and hit testing so that
903         it crawls the line box tree instead of the render tree.  This allows more precise intersection/containment testing
904         that lets us short circuit earlier when painting and hit testing.
905         
906         Reviewed by mjs
907
908         * khtml/khtml_part.cpp:
909         (KHTMLPart::isPointInsideSelection):
910         * khtml/rendering/render_block.cpp:
911         (khtml::RenderBlock::paint):
912         (khtml::RenderBlock::paintChildren):
913         (khtml::RenderBlock::paintObject):
914         (khtml::RenderBlock::paintFloats):
915         (khtml::RenderBlock::nodeAtPoint):
916         * khtml/rendering/render_block.h:
917         * khtml/rendering/render_box.cpp:
918         (RenderBox::nodeAtPoint):
919         * khtml/rendering/render_box.h:
920         * khtml/rendering/render_br.h:
921         * khtml/rendering/render_canvas.cpp:
922         (RenderCanvas::paint):
923         * khtml/rendering/render_flow.cpp:
924         (RenderFlow::paintLines):
925         (RenderFlow::hitTestLines):
926         (RenderFlow::caretRect):
927         (RenderFlow::addFocusRingRects):
928         (RenderFlow::paintFocusRing):
929         (RenderFlow::paintOutlines):
930         (RenderFlow::paintOutlineForLine):
931         * khtml/rendering/render_flow.h:
932         * khtml/rendering/render_frames.cpp:
933         (RenderFrameSet::nodeAtPoint):
934         * khtml/rendering/render_frames.h:
935         * khtml/rendering/render_image.cpp:
936         (RenderImage::nodeAtPoint):
937         * khtml/rendering/render_image.h:
938         * khtml/rendering/render_inline.cpp:
939         (RenderInline::paint):
940         (RenderInline::nodeAtPoint):
941         * khtml/rendering/render_inline.h:
942         * khtml/rendering/render_layer.cpp:
943         (RenderLayer::paintLayer):
944         (RenderLayer::hitTest):
945         (RenderLayer::hitTestLayer):
946         * khtml/rendering/render_layer.h:
947         * khtml/rendering/render_line.cpp:
948         (khtml::InlineBox::paint):
949         (khtml::InlineBox::nodeAtPoint):
950         (khtml::InlineFlowBox::flowObject):
951         (khtml::InlineFlowBox::nodeAtPoint):
952         (khtml::InlineFlowBox::paint):
953         (khtml::InlineFlowBox::paintBackgrounds):
954         (khtml::InlineFlowBox::paintBackground):
955         (khtml::InlineFlowBox::paintBackgroundAndBorder):
956         (khtml::InlineFlowBox::paintDecorations):
957         (khtml::EllipsisBox::paint):
958         (khtml::EllipsisBox::nodeAtPoint):
959         (khtml::RootInlineBox::paintEllipsisBox):
960         (khtml::RootInlineBox::paint):
961         (khtml::RootInlineBox::nodeAtPoint):
962         * khtml/rendering/render_line.h:
963         (khtml::InlineRunBox::paintBackgroundAndBorder):
964         * khtml/rendering/render_object.cpp:
965         (RenderObject::hitTest):
966         (RenderObject::setInnerNode):
967         (RenderObject::nodeAtPoint):
968         * khtml/rendering/render_object.h:
969         (khtml::RenderObject::PaintInfo::PaintInfo):
970         (khtml::RenderObject::PaintInfo::~PaintInfo):
971         (khtml::RenderObject::paintingRootForChildren):
972         (khtml::RenderObject::shouldPaintWithinRoot):
973         * khtml/rendering/render_table.cpp:
974         (RenderTable::layout):
975         (RenderTable::paint):
976         * khtml/rendering/render_text.cpp:
977         (simpleDifferenceBetweenColors):
978         (correctedTextColor):
979         (InlineTextBox::nodeAtPoint):
980         (InlineTextBox::paint):
981         (InlineTextBox::selectionStartEnd):
982         (InlineTextBox::paintSelection):
983         (InlineTextBox::paintMarkedTextBackground):
984         (InlineTextBox::paintDecoration):
985         (RenderText::posOfChar):
986         * khtml/rendering/render_text.h:
987         (khtml::RenderText::paint):
988         (khtml::RenderText::layout):
989         (khtml::RenderText::nodeAtPoint):
990         * khtml/xml/dom2_eventsimpl.cpp:
991         (MouseEventImpl::computeLayerPos):
992         * khtml/xml/dom_docimpl.cpp:
993         (DocumentImpl::prepareMouseEvent):
994         * kwq/KWQAccObject.mm:
995         (-[KWQAccObject accessibilityHitTest:]):
996         * kwq/KWQKHTMLPart.mm:
997         (KWQKHTMLPart::scrollOverflowWithScrollWheelEvent):
998         (KWQKHTMLPart::eventMayStartDrag):
999         (KWQKHTMLPart::khtmlMouseMoveEvent):
1000         * kwq/WebCoreBridge.mm:
1001         (-[WebCoreBridge elementAtPoint:]):
1002         (-[WebCoreBridge _positionForPoint:]):
1003
1004 2004-11-22  Maciej Stachowiak  <mjs@apple.com>
1005
1006         Reviewed by Dave.
1007
1008         <rdar://problem/3890961> selecting an item on the Apache bugzilla query page can be sped up 10% (HTMLFormCollection)
1009         <rdar://problem/3890958> JavaScript that toggles checkboxes can be improved 73% (HTMLCollection,HTMLFormCollection)
1010
1011         This avoids the O(N^2) penalty for named item traversal for form collections.
1012
1013         It also combines the item traversal logic for all non-form
1014         collection operations into a single traverseNextItem
1015         function. This avoids having 5 copies of the big switch statement
1016         for this.
1017
1018         Also fixed a bug that prevented the last form element from being removed properly.
1019         
1020         * khtml/html/html_formimpl.cpp:
1021         (DOM::removeFromVector):
1022         * khtml/dom/html_misc.cpp:
1023         (HTMLCollection::namedItems):
1024         * khtml/dom/html_misc.h:
1025         * khtml/ecma/kjs_html.cpp:
1026         (KJS::HTMLCollection::getNamedItems):
1027         * khtml/html/html_miscimpl.cpp:
1028         (HTMLCollectionImpl::traverseNextItem):
1029         (HTMLCollectionImpl::calcLength):
1030         (HTMLCollectionImpl::length):
1031         (HTMLCollectionImpl::item):
1032         (HTMLCollectionImpl::nextItem):
1033         (HTMLCollectionImpl::checkForNameMatch):
1034         (HTMLCollectionImpl::namedItem):
1035         (HTMLCollectionImpl::namedItems):
1036         (HTMLCollectionImpl::nextNamedItem):
1037         (HTMLFormCollectionImpl::calcLength):
1038         (HTMLFormCollectionImpl::namedItem):
1039         (HTMLFormCollectionImpl::nextNamedItem):
1040         (HTMLFormCollectionImpl::namedItems):
1041         * khtml/html/html_miscimpl.h:
1042
1043 2004-11-22  Ken Kocienda  <kocienda@apple.com>
1044
1045         Reviewed by Harrison
1046
1047         Change around the way we block the Javascript "Paste" command identifier from
1048         being available. Formerly, this was done with an ifdef we never compiled in.
1049         Now, this is done with a couple of cheap runtime checks. The advantage is that
1050         we can now compile this command into development builds, and still yet switch
1051         on the command in deployment builds through the use of WebCore SPI so we can
1052         write and run layout tests with all of our builds.
1053
1054         * khtml/editing/jsediting.cpp:
1055         (DOM::JSEditor::queryCommandSupported): Checks state of paste command in case
1056         command being queried is the paste command. 
1057         (DOM::JSEditor::setSupportsPasteCommand): New SPI to turn on paste command.
1058         * khtml/editing/jsediting.h: Ditto.
1059         * khtml/khtml_part.cpp:
1060         (KHTMLPart::pasteFromPasteboard): Added.
1061         (KHTMLPart::canPaste): Added.
1062         * kwq/KWQKHTMLPart.mm:
1063         (KHTMLPart::canPaste): Added.
1064         * kwq/KWQRenderTreeDebug.cpp:
1065         (externalRepresentation): Turn on paste command.
1066         * kwq/WebCoreBridge.h: Add canPaste call so WebKit can fill in the answer.
1067
1068 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
1069
1070         Reviewed by Richard.
1071
1072         <rdar://problem/3889655> HTMLCollectionImpl should use traverseNextNode to improve speed and save recursion
1073         
1074         * khtml/html/html_miscimpl.cpp:
1075         (HTMLCollectionImpl::calcLength):
1076         (HTMLCollectionImpl::getItem):
1077         (HTMLCollectionImpl::item):
1078         (HTMLCollectionImpl::nextItem):
1079         (HTMLCollectionImpl::getNamedItem):
1080         (HTMLCollectionImpl::namedItem):
1081         (HTMLCollectionImpl::nextNamedItemInternal):
1082         (HTMLFormCollectionImpl::nextNamedItemInternal):
1083
1084 2004-11-19  Maciej Stachowiak  <mjs@apple.com>
1085
1086         Reviewed by Darin.
1087
1088         <rdar://problem/3482935> JavaScript so slow it seems like a hang (hrweb.apple.com) (HTMLCollection?)
1089         <rdar://problem/3759149> PeopleSoft page in Safari twice as slow as Mozilla engine (HTMLFormCollection)
1090         <rdar://problem/3888368> selecting an item on the Apache bugzilla query page can be improved 95% (HTMLFormCollection)
1091
1092         Many optimizations to HTMLFormCollection. Iterating it should not
1093         be N^2 any more, though finding items by name could still be.
1094         
1095         * khtml/html/html_formimpl.cpp:
1096         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
1097         (DOM::HTMLFormElementImpl::length):
1098         (DOM::HTMLFormElementImpl::submitClick):
1099         (DOM::HTMLFormElementImpl::formData):
1100         (DOM::HTMLFormElementImpl::submit):
1101         (DOM::HTMLFormElementImpl::reset):
1102         (DOM::HTMLFormElementImpl::radioClicked):
1103         (DOM::appendToVector):
1104         (DOM::removeFromVector):
1105         (DOM::HTMLFormElementImpl::registerFormElement):
1106         (DOM::HTMLFormElementImpl::removeFormElement):
1107         (DOM::HTMLFormElementImpl::makeFormElementDormant):
1108         (DOM::HTMLFormElementImpl::registerImgElement):
1109         (DOM::HTMLFormElementImpl::removeImgElement):
1110         * khtml/html/html_formimpl.h:
1111         * khtml/html/html_miscimpl.cpp:
1112         (HTMLFormCollectionImpl::FormCollectionInfo::FormCollectionInfo):
1113         (void::HTMLFormCollectionImpl::FormCollectionInfo::reset):
1114         (HTMLFormCollectionImpl::resetCollectionInfo):
1115         (HTMLFormCollectionImpl::calcLength):
1116         (HTMLFormCollectionImpl::item):
1117         (HTMLFormCollectionImpl::getNamedItem):
1118         (HTMLFormCollectionImpl::getNamedFormItem):
1119         (HTMLFormCollectionImpl::firstItem):
1120         (HTMLFormCollectionImpl::nextItem):
1121         * khtml/html/html_miscimpl.h:
1122         (DOM::HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
1123         * khtml/xml/dom_elementimpl.cpp:
1124         (ElementImpl::setAttribute):
1125         (ElementImpl::setAttributeMap):
1126         * kwq/KWQPtrVector.h:
1127         (QPtrVector::findRef):
1128         * kwq/KWQVectorImpl.h:
1129         * kwq/KWQVectorImpl.mm:
1130         (KWQVectorImpl::findRef):
1131         * kwq/WebCoreBridge.mm:
1132         (-[WebCoreBridge elementWithName:inForm:]):
1133         (-[WebCoreBridge controlsInForm:]):
1134
1135 2004-11-19  David Harrison  <harrison@apple.com>
1136
1137         Reviewed by Ken and Darin.
1138
1139         <rdar://problem/3856215> Cannot remove bold from the beginning of a message
1140
1141         Problem is that KHTMLPart::computeAndSetTypingStyle always looked upstream
1142         for the existing style, but in this case (hitting cmd-B with caret at top of
1143         file) there is nothing upstream.  Changed this to use the VisiblePosition
1144         deepEquivalent instead.
1145         
1146         * khtml/khtml_part.cpp:
1147         (KHTMLPart::computeAndSetTypingStyle):
1148
1149 === Safari-172 ===
1150
1151 2004-11-19  Maciej Stachowiak  <mjs@apple.com>
1152
1153         Reviewed by Darin.
1154
1155         <rdar://problem/3864151> REGRESSION (125-167): Chrysler.com never stops loading
1156         
1157         * khtml/xml/dom_docimpl.cpp:
1158         (DocumentImpl::close): Don't fire the onload handler if there is a
1159         redirect pending. This is a very long-standing bug that was masked
1160         by our previously incorrect redirect logic. It used to be that an
1161         older redirect would always win. Recently we changed things so
1162         that a newer redirect would win, but a script that causes a
1163         redirect would stop parsing once complete (so if there are two
1164         redirects in the same script, the latter wins). However, we should
1165         have also prevented onload in this case. Testing with other
1166         browsers shows that onload handlers do not run at all when there
1167         is a pending redirect.
1168
1169 2004-11-19  Ken Kocienda  <kocienda@apple.com>
1170
1171         Reviewed by Harrison
1172
1173         Fix some object lifetime issues in these two commands. This fixes some crashes
1174         I am seeing in some new code I am working on, but have not yet reproduced otherwise.
1175
1176         * khtml/editing/htmlediting.cpp:
1177         (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): No longer deref nodes
1178         in the ancestor list. They are not ref'ed when put on list. D'uh.
1179         (khtml::InsertParagraphSeparatorCommand::doApply): Ref all cloned nodes that are created by the command
1180         before putting them on the cloned nodes list. This are still deref'ed in the destructor.
1181         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto
1182         destructor comment.
1183         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto doApply comment.
1184
1185 2004-11-19  Ken Kocienda  <kocienda@apple.com>
1186
1187         Reviewed by Harrison
1188
1189         Fix for this bug:
1190         
1191         <rdar://problem/3655241> setTypingStyle: does not set the real typing style, and typingStyle does not return it
1192
1193         * khtml/khtml_part.cpp:
1194         (KHTMLPart::computeAndSetTypingStyle): New helper that does the work of reducing a passed-in style
1195         declaration given the current selection, and then sets the minimum necessary style as the typing
1196         style on the part.
1197         (KHTMLPart::applyStyle): Call new computeAndSetTypingStyle. The guts of computeAndSetTypingStyle used
1198         to be here in the selection-as-caret case. But now [WebCoreBridge setTypingStyle:] needs this code
1199         as well.
1200         * khtml/khtml_part.h: Declare new computeAndSetTypingStyle() function.
1201         * kwq/WebCoreBridge.h: Declare new typingStyle and setTypingStyle: methods.
1202         * kwq/WebCoreBridge.mm: 
1203         (-[WebCoreBridge typingStyle]): Calls through to the part to retrieve the typing style.
1204         (-[WebCoreBridge setTypingStyle:]): Calls through to the part to set the typing style.
1205
1206 2004-11-18  David Harrison  <harrison@apple.com>
1207
1208         Reviewed by Darin.
1209         
1210         Back out part of Darin's fix for <rdar://problem/3885729>, because the new exception gets triggered
1211         by Mail.app. Filed <rdar://problem/3886832> against Mail.app.
1212
1213         * kwq/DOM-CSS.mm:
1214         (-[DOMCSSStyleDeclaration setProperty:::]):
1215
1216 2004-11-18  Chris Blumenberg  <cblu@apple.com>
1217
1218         Fixed: <rdar://problem/3587481> Bug Reporter Login Page: Password AutoFill does not work reliably
1219
1220         Reviewed by john.
1221
1222         * kwq/KWQKHTMLPart.mm:
1223         (KWQKHTMLPart::currentForm): just return the current form, don't scan the entire document looking for a form if there is no current form
1224
1225 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1226
1227         Reviewed by Chris.
1228
1229         - fix recursive item traversal, use traverseNextNode() instead of
1230         the buggy hand-rolled traversal.
1231
1232         * khtml/xml/dom_nodeimpl.cpp:
1233         (NodeListImpl::recursiveItem):
1234
1235 2004-11-17  Darin Adler  <darin@apple.com>
1236
1237         Reviewed by Ken.
1238
1239         - fixed <rdar://problem/3885744> crash with XMLHttpRequest test page (reported by KDE folks)
1240
1241         * khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::slotFinished):
1242         Rolled in fix from KDE; make sure to set job to 0 before calling changeState.
1243
1244         - fixed <rdar://problem/3885729> attempting to modify a computed style does nothing, but should raise a DOM exception
1245         - fixed <rdar://problem/3885731> style declarations use too many malloc blocks; switch to QValueList
1246         - fixed <rdar://problem/3885739> DOM::NodeImpl accessor in DOM::Node class is hot; should be inlined
1247         - changed NodeImpl calls like replaceChild to always ref/deref the parameter; this is a better way to fix
1248           an entire category of leaks we have been fixing one by one recently
1249         - changed computed styles so they hold a reference to the DOM node; the old code could end up with a
1250           stale RenderObject pointer, although I never saw it do that in practice
1251         - implemented the length and item methods for computed styles
1252         - implemented querying additional properties in computed styles (29 more)
1253
1254         * khtml/khtml_part.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
1255         now a separate class rather than a typedef. Changed the parameter type of setTypingStyle to
1256         take a mutable style.
1257         * khtml/khtml_part.cpp:
1258         (KHTMLPart::setTypingStyle): Change parameter to take a mutable style.
1259         (KHTMLPart::applyStyle): Add code to make a mutable style in case we are passed
1260         a computed style; also change some types to mutable style.
1261         (updateState): Update iteration of CSSProperty objects in a style declaration to use
1262         the new valuesIterator interface.
1263         (KHTMLPart::selectionHasStyle): Add a call to makeMutable.
1264         (KHTMLPart::selectionStartHasStyle): Add call to makeMutable and update iteration.
1265         (editingStyle): Change type to mutable style, and simplify the style-creation calls,
1266         including accomodating the exception code that setCssText has now.
1267         (KHTMLPart::applyEditingStyleToElement): Change types to mutable style.
1268         (KHTMLPart::removeEditingStyleFromElement): Change code to call setChanged only if removing
1269         the style attributes really was a change, although it's not an important optimization it's
1270         good to do it right.
1271
1272         * khtml/css/css_base.h: Remove unneeded setParsedValue method.
1273         * khtml/css/css_base.cpp: Remove unneeded setParsedValue method. All the places that were
1274         calling it were already removing the old property explicitly, so the code in here to remove
1275         the property again was redundant.
1276
1277         * khtml/css/css_computedstyle.h: Updated virtual functions for changes to parameters in base class.
1278         Moved all the "set"-type functions so they are private. Store a node pointer instead of a renderer.
1279         * khtml/css/css_computedstyle.cpp:
1280         (DOM::CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl): Hold a reference to
1281         the node we compute style for, so we don't end up with a pointer to a deallocated RenderObject.
1282         Before we had no guarantee the object would outlast us.
1283         (DOM::CSSComputedStyleDeclarationImpl::setCssText): Add exception parameter, and set the
1284         exception to NO_MODIFICATION_ALLOWED_ERR.
1285         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Update to use node pointer rather
1286         than renderer pointer. Added implementation for box-align, box-direction, box-flex, box-flex-group,
1287         box-lines, box-ordinal-group, box-orient, box-pack, caption-side, clear, cursor, direction,
1288         list-style-image, list-style-position, list-style-type, marquee-direction, marquee-repetition,
1289         marquee-style, user-modify, opacity, orphans, outline-style, page-break-after, page-break-before,
1290         page-break-inside, position, unicode-bidi, widows, z-index.
1291         (DOM::CSSComputedStyleDeclarationImpl::removeProperty): Add exception parameter, and set the
1292         exception to NO_MODIFICATION_ALLOWED_ERR.
1293         (DOM::CSSComputedStyleDeclarationImpl::setProperty): Ditto.
1294         (DOM::CSSComputedStyleDeclarationImpl::length): Implemented.
1295         (DOM::CSSComputedStyleDeclarationImpl::item): Implemented, calls getPropertyValue.
1296         (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Changed return type to
1297         CSSMutableStyleDeclarationImpl.
1298         (DOM::CSSComputedStyleDeclarationImpl::copy): Added.
1299         (DOM::CSSComputedStyleDeclarationImpl::makeMutable): Added.
1300
1301         * khtml/css/css_ruleimpl.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
1302         now a separate class rather than a typedef.
1303         * khtml/css/cssparser.h: Ditto.
1304
1305         * khtml/css/css_valueimpl.h: Refactor CSSStyleDeclarationImpl into two classes. New derived class
1306         CSSMutableStyleDeclarationImpl has the guts, and the base class has only some virtual functions.
1307         Removed a bunch of redundant stuff from other classes in this file too.
1308         (DOM::DashboardRegionImpl::setNext): Ref new before deref'ing old to handle the set-to-same case.
1309         (DOM::CSSProperty::CSSProperty): Added new overload so you can create a CSSProperty with initial values.
1310         (DOM::CSSProperty::operator=): Added.
1311         (DOM::CSSProperty::setValue): Use ref-before-deref pattern to simplify slightly.
1312
1313         * khtml/css/css_valueimpl.cpp:
1314         (DOM::CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Remove uneeded things.
1315         (DOM::CSSStyleDeclarationImpl::isStyleDeclaration): Put here now that it's no longer inline.
1316         (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl): Added.
1317         (DOM::CSSMutableStyleDeclarationImpl::operator=): Added.
1318         (DOM::CSSMutableStyleDeclarationImpl::~CSSMutableStyleDeclarationImpl): Updated.
1319         (DOM::CSSMutableStyleDeclarationImpl::getPropertyValue): Removed now-uneeded check.
1320         (DOM::CSSMutableStyleDeclarationImpl::get4Values): Moved here from base class.
1321         (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue): Ditto.
1322         (DOM::CSSMutableStyleDeclarationImpl::getPropertyCSSValue): Update to use QValueList instead of QPtrList.
1323         (DOM::CSSMutableStyleDeclarationImpl::removeProperty): Added exception parameter, updated for QValueList.
1324         (DOM::CSSMutableStyleDeclarationImpl::setChanged): Moved here from base class.
1325         (DOM::CSSMutableStyleDeclarationImpl::getPropertyPriority): Update to use QValueList.
1326         (DOM::CSSMutableStyleDeclarationImpl::setProperty): Added more overloads to match new parameters.
1327         (DOM::CSSMutableStyleDeclarationImpl::setStringProperty): Update to use QValueList.
1328         (DOM::CSSMutableStyleDeclarationImpl::setImageProperty): Ditto.
1329         (DOM::CSSMutableStyleDeclarationImpl::parseProperty): Remove unneeded initialization code due to QValueList.
1330         (DOM::CSSMutableStyleDeclarationImpl::addParsedProperties): Added.
1331         (DOM::CSSMutableStyleDeclarationImpl::setLengthProperty): Moved here from base class.
1332         (DOM::CSSMutableStyleDeclarationImpl::length): Update to use QValueList.
1333         (DOM::CSSMutableStyleDeclarationImpl::item): Moved here from base class.
1334         (DOM::CSSMutableStyleDeclarationImpl::cssText): Return empty string rather than null string when there are
1335         no styles in the list. Update to use QValueList.
1336         (DOM::CSSMutableStyleDeclarationImpl::setCssText): Update to use QValueList and to take an exceptionCode
1337         parameter and set it.
1338         (DOM::CSSMutableStyleDeclarationImpl::merge): Update to use QValueList.
1339         (DOM::CSSStyleDeclarationImpl::diff): Update to use QValueList.
1340         (DOM::CSSMutableStyleDeclarationImpl::copyBlockProperties): Moved here from base class. Change return type.
1341         (DOM::CSSStyleDeclarationImpl::copyPropertiesInSet): Update to use QValueList and use stack, not new/delete.
1342         (DOM::CSSMutableStyleDeclarationImpl::makeMutable): Added.
1343         (DOM::CSSMutableStyleDeclarationImpl::copy): Added.
1344
1345         * khtml/css/cssparser.cpp:
1346         (CSSParser::parseValue): Changed to use addParsedProperties.
1347         (CSSParser::parseDeclaration): Ditto.
1348         (CSSParser::createStyleDeclaration): Use new constructor to create declaration in a more efficient manner.
1349
1350         * khtml/css/cssproperties.in: Removed unused font-size-adjust and -khtml-flow-mode.
1351         * khtml/css/cssproperties.c: Regenerated.
1352         * khtml/css/cssproperties.h: Regenerated.
1353
1354         * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyDeclarations):
1355         Updated to use QValueList interface to CSSMutableStyleDeclarationImpl.
1356
1357         * khtml/dom/css_value.cpp:
1358         (DOM::CSSStyleDeclaration::cssText): Removed unneeded cast.
1359         (DOM::CSSStyleDeclaration::setCssText): Added exception code handling.
1360         (DOM::CSSStyleDeclaration::getPropertyValue): Changed to call getPropertyValue directly instead of
1361         first doing getPropertyCSSValue and then doing cssText.
1362         (DOM::CSSStyleDeclaration::getPropertyCSSValue): Removed unneeded cast.
1363         (DOM::CSSStyleDeclaration::removeProperty): Added exception code handling. 
1364         (DOM::CSSStyleDeclaration::setProperty): Added exception code handling.
1365         (DOM::CSSStyleDeclaration::length): Removed unneeded cast.
1366         (DOM::CSSStyleDeclaration::item): Removed unneeded cast.
1367         (DOM::CSSStyleDeclaration::parentRule): Removed unneeded cast.
1368         (DOM::CSSValue::setCssText): Removed strange non-implementation (still not implemented).
1369
1370         * khtml/dom/dom_node.h: Made isNull and handle functions inline.
1371         * khtml/dom/dom_node.cpp: Ditto.
1372
1373         * khtml/editing/htmlediting.h: Change some types to mutable style.
1374         * khtml/editing/htmlediting.cpp:
1375         (khtml::EditCommandPtr::typingStyle): Change return type to mutable style.
1376         (khtml::EditCommandPtr::setTypingStyle): Change parameter to mutable style.
1377         (khtml::StyleChange::init): Convert parameter to mutable style. Update to use QValueList.
1378         (khtml::EditCommand::assignTypingStyle): Change parameter to mutable type.
1379         (khtml::EditCommand::setTypingStyle): Ditto.
1380         (khtml::ApplyStyleCommand::ApplyStyleCommand): Convert parameter to mutable style.
1381         (khtml::ApplyStyleCommand::doApply): Change local variables to mutable style.
1382         (khtml::ApplyStyleCommand::applyBlockStyle): Change parameter to mutable style.
1383         (khtml::ApplyStyleCommand::applyInlineStyle): Ditto.
1384         (khtml::ApplyStyleCommand::isHTMLStyleNode): Ditto.
1385         (khtml::ApplyStyleCommand::removeCSSStyle): Ditto. Also update to use QValueList.
1386         (khtml::ApplyStyleCommand::removeBlockStyle): Change parameter to mutable style.
1387         (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
1388         (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): Ditto.
1389         (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): Ditto.
1390         (khtml::InsertLineBreakCommand::doApply): Convert locals to mutable style.
1391         (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
1392         (khtml::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand): Convert parameter to mutable style.
1393
1394         * khtml/editing/jsediting.cpp: Convert types to mutable styles where we create styles.
1395         * khtml/html/html_baseimpl.h: Change type to mutable style.
1396         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::createLinkDecl): Ditto.
1397
1398         * khtml/html/html_elementimpl.h: Make CSSMappedAttributeDeclarationImpl use the mutable style
1399         class as a base class, and change types to mutable style as needed.
1400         * khtml/html/html_elementimpl.cpp:
1401         (HTMLElementImpl::createInlineStyleDecl): Change type to mutable style.
1402         (HTMLElementImpl::parseHTMLAttribute): Call parseProperty method.
1403         (HTMLElementImpl::getInlineStyleDecl): Change type to mutable style.
1404         (HTMLElementImpl::additionalAttributeStyleDecl): Ditto.
1405         (HTMLElementImpl::createContextualFragment): Add ref/deref to fix potential node leak.
1406         (HTMLElementImpl::setInnerHTML): Remove ref/deref pair because this leak is now fixed by changes
1407         to appendChild.
1408         (HTMLElementImpl::setOuterHTML): Remove ref/deref pair because this leak is now fixed by changes
1409         to replaceChild.
1410
1411         * khtml/html/html_tableimpl.h: Change types to mutable style.
1412         * khtml/html/html_tableimpl.cpp:
1413         (HTMLTableElementImpl::additionalAttributeStyleDecl): Change type to mutable style.
1414         (HTMLTableElementImpl::getSharedCellDecl): Change type to mutable style.
1415         (HTMLTableCellElementImpl::additionalAttributeStyleDecl): Change type to mutable style.
1416
1417         * khtml/html/htmlparser.cpp:
1418         (KHTMLParser::parseToken): Use a local variable to protect the node by ref'ing it. This is better
1419         than using an explicit delete to make the node go away, and is required for compatibility with the
1420         changes to the NodeImpl functions.
1421         (KHTMLParser::insertNode): Ditto.
1422         (KHTMLParser::createHead): Get rid of explicit delete, no longer needed because of changes to
1423         the NodeImpl functions.
1424
1425         * khtml/xml/dom_docimpl.cpp: (DocumentImpl::createCSSStyleDeclaration): Call simpler constructor
1426         now that there's no need to make the property list explictly.
1427
1428         * kwq/DOM-CSS.mm:
1429         (-[DOMCSSStyleDeclaration setCssText:]): Raise exception when appropriate.
1430         (-[DOMCSSStyleDeclaration removeProperty:]): Ditto.
1431         (-[DOMCSSStyleDeclaration setProperty:::]): Dito.
1432
1433         * khtml/xml/dom_nodeimpl.cpp:
1434         (NodeImpl::insertBefore): Always do a ref/deref, so callers don't have to worry about whether the
1435         function succeeded or not for ownership purposes.
1436         (NodeImpl::replaceChild): Ditto.
1437         (NodeImpl::appendChild): Ditto.
1438         (NodeBaseImpl::insertBefore): Ditto.
1439         (NodeBaseImpl::replaceChild): Ditto.
1440         (NodeBaseImpl::appendChild): Ditto.
1441         (NodeBaseImpl::addChild): Ditto.
1442
1443         * WebCore-tests.exp: Removed CSSStyleDeclaration::length; not sure why it was in here.
1444         * WebCore-combined.exp: Regenerated.
1445
1446 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1447
1448         still even more build fixing
1449
1450         * khtml/html/html_miscimpl.cpp:
1451         (HTMLCollectionImpl::resetCollectionInfo):
1452
1453 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1454
1455         more build fixing
1456
1457         * khtml/html/html_miscimpl.cpp:
1458         (HTMLCollectionImpl::resetCollectionInfo):
1459
1460 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1461
1462         Fixed build problem.
1463
1464         * khtml/html/html_miscimpl.h:
1465         (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo): it's haslength, not hasLenght.
1466
1467 2004-11-18  Maciej Stachowiak  <mjs@apple.com>
1468
1469         Reviewed by Ken.
1470
1471         - merged and cleaned up HTMLCollection and HTMLFormCollection speedups from konqueror
1472
1473         <rdar://problem/3822992> VIP: Program listings pages at directv.com take a really long time to load [HTMLCollection]
1474         <rdar://problem/3701991> Safari unresponsive loading (www.maxim-ic.com) (HTMLCollection)
1475
1476         This is also a start on fixing 5 other bugs, but those need additional work to make
1477         HTMLFormCollection fast.
1478
1479         * khtml/html/html_documentimpl.h:
1480         (DOM::HTMLDocumentImpl::collectionInfo):
1481         * khtml/html/html_formimpl.cpp:
1482         (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
1483         (DOM::HTMLFormElementImpl::isURLAttribute):
1484         (DOM::HTMLFormElementImpl::registerImgElement):
1485         (DOM::HTMLFormElementImpl::removeImgElement):
1486         * khtml/html/html_formimpl.h:
1487         * khtml/html/html_imageimpl.cpp:
1488         (HTMLImageElementImpl::HTMLImageElementImpl):
1489         (HTMLImageElementImpl::~HTMLImageElementImpl):
1490         * khtml/html/html_imageimpl.h:
1491         * khtml/html/html_miscimpl.cpp:
1492         (HTMLCollectionImpl::HTMLCollectionImpl):
1493         (HTMLCollectionImpl::~HTMLCollectionImpl):
1494         (HTMLCollectionImpl::updateCollectionInfo):
1495         (HTMLCollectionImpl::length):
1496         (HTMLCollectionImpl::item):
1497         (HTMLCollectionImpl::firstItem):
1498         (HTMLCollectionImpl::nextItem):
1499         (HTMLCollectionImpl::namedItem):
1500         (HTMLCollectionImpl::nextNamedItemInternal):
1501         (HTMLFormCollectionImpl::getNamedFormItem):
1502         * khtml/html/html_miscimpl.h:
1503         (DOM::HTMLCollectionImpl::):
1504         (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo):
1505         * khtml/html/htmlparser.cpp:
1506         (KHTMLParser::getElement):
1507         * khtml/xml/dom_docimpl.cpp:
1508         (DocumentImpl::DocumentImpl):
1509         * khtml/xml/dom_docimpl.h:
1510         (DOM::DocumentImpl::incDOMTreeVersion):
1511         (DOM::DocumentImpl::domTreeVersion):
1512         * khtml/xml/dom_nodeimpl.cpp:
1513         (NodeImpl::attach):
1514         (NodeImpl::detach):
1515
1516 2004-11-18  Kevin Decker  <kdecker@apple.com>
1517
1518         Reviewed by Chris.
1519
1520         fixed: <rdar://problem/3841842> getPropertyID expensive
1521
1522         * kwq/DOM-CSS.mm:
1523         (getPropertyID): avoid unnecessary memory allocations by using a fixed-sized stack based buffer.
1524
1525 2004-11-17  David Hyatt  <hyatt@apple.com>
1526
1527         Improve responsiveness by being willing to break out of the tokenizer.  (This patch was landed already
1528         and subsequently backed out).
1529         
1530         Reviewed by kocienda
1531
1532         * khtml/html/html_baseimpl.cpp:
1533         (HTMLBodyElementImpl::insertedIntoDocument):
1534         * khtml/html/htmltokenizer.cpp:
1535         (khtml::HTMLTokenizer::reset):
1536         (khtml::HTMLTokenizer::scriptHandler):
1537         (khtml::HTMLTokenizer::scriptExecution):
1538         (khtml::HTMLTokenizer::write):
1539         (khtml::HTMLTokenizer::continueProcessing):
1540         (khtml::HTMLTokenizer::timerEvent):
1541         (khtml::HTMLTokenizer::notifyFinished):
1542         * khtml/html/htmltokenizer.h:
1543         * khtml/khtmlview.cpp:
1544         (KHTMLViewPrivate::KHTMLViewPrivate):
1545         (KHTMLViewPrivate::reset):
1546         (KHTMLView::clear):
1547         (KHTMLView::layout):
1548         (KHTMLView::timerEvent):
1549         (KHTMLView::scheduleRelayout):
1550         (KHTMLView::layoutPending):
1551         (KHTMLView::haveDelayedLayoutScheduled):
1552         (KHTMLView::unscheduleRelayout):
1553         * khtml/khtmlview.h:
1554         * khtml/xml/dom_docimpl.cpp:
1555         (DocumentImpl::DocumentImpl):
1556         (DocumentImpl::close):
1557         (DocumentImpl::setParsing):
1558         (DocumentImpl::shouldScheduleLayout):
1559         (DocumentImpl::minimumLayoutDelay):
1560         (DocumentImpl::write):
1561         (DocumentImpl::finishParsing):
1562         (DocumentImpl::stylesheetLoaded):
1563         (DocumentImpl::updateStyleSelector):
1564         * khtml/xml/dom_docimpl.h:
1565         (DOM::DocumentImpl::parsing):
1566         * kwq/KWQDateTime.mm:
1567         (KWQUIEventTime::uiEventPending):
1568
1569 2004-11-17  David Harrison  <harrison@apple.com>
1570
1571         Reviewed by Ken Kocienda.
1572         
1573         Make sure previousLineStart is non-null before calling compareBoundaryPoints.
1574         Treat null case as meaning no post-move merge is needed.
1575
1576         * khtml/editing/htmlediting.cpp:
1577         (khtml::DeleteSelectionCommand::initializePositionData):
1578
1579 2004-11-17  David Harrison  <harrison@apple.com>
1580         
1581         Added displayNode and displayTree methods for debugging.  Fixed comment typo in dispatchChildRemovalEvents.
1582         * khtml/xml/dom_nodeimpl.cpp:
1583         (NodeImpl::displayNode):
1584         (NodeImpl::displayTree):
1585         (NodeBaseImpl::dispatchChildRemovalEvents):
1586         * khtml/xml/dom_nodeimpl.h:
1587
1588 2004-11-16  John Sullivan  <sullivan@apple.com>
1589
1590         Reviewed by Richard.
1591         
1592         - fixed <rdar://problem/3881929> 32 byte leak in editingStyle() in KHTMLPart (one-time only)
1593
1594         * khtml/khtml_part.cpp:
1595         (editingStyle):
1596         delete the list we created when we're done with it
1597
1598 2004-11-16  Ken Kocienda  <kocienda@apple.com>
1599
1600         Reviewed by John
1601         
1602         It is unwise to use the QPtrList autodelete feature on shared objects like DOM nodes.
1603         Instead, I replaced this with a helper function that derefs DOM nodes stored in a 
1604         QPtrList when the list goes out of scope.
1605
1606         * khtml/editing/htmlediting.cpp:
1607         (khtml::derefNodesInList): New helper to deref DOM nodes stored in a QPtrList.
1608         (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): No longer set lists to autodelete.
1609         (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): Call new derefNodesInList helper.
1610         (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):  
1611         No longer set lists to autodelete.
1612         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand):
1613          Call new derefNodesInList helper.
1614         * khtml/editing/htmlediting.h: Add virtual destructor for InsertParagraphSeparatorCommand. It had no need
1615         of one before, but now it does.
1616
1617 2004-11-15  David Harrison  <harrison@apple.com>
1618
1619         Reviewed by Chris and Darin.
1620         
1621         <rdar://problem/3880304> Non-linear performance hit for style changes
1622
1623         * khtml/xml/dom_nodeimpl.cpp:
1624         (NodeImpl::traverseNextNode):
1625         (NodeImpl::traverseNextSibling):
1626         (NodeImpl::traversePreviousNodePostOrder):
1627         Return 0 rather than traversing beyond stayWithin when this == stayWithin.
1628         Add asserts that stayWithin is an ancestor of the returned node.
1629
1630 2004-11-15  Darin Adler  <darin@apple.com>
1631
1632         Reviewed by Ken.
1633
1634         - fixed <rdar://problem/3880036> Many leaks from CSSComputedStyleDeclarationImpl::getPropertyCSSValue, seen in Mail and Blot
1635
1636         * khtml/css/css_computedstyle.cpp:
1637         (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Ref and deref the value returned from getPropertyCSSValue,
1638         since there's no guarantee it's already ref'd.
1639         * khtml/css/css_valueimpl.cpp:
1640         (CSSStyleDeclarationImpl::getPropertyValue): Wrap result in a CSSValue to ref/deref.
1641         (CSSStyleDeclarationImpl::get4Values): Ref/deref explicitly.
1642         (CSSStyleDeclarationImpl::getShortHandValue): Ditto.
1643         (CSSStyleDeclarationImpl::merge): Ditto.
1644         (CSSStyleDeclarationImpl::diff): Ditto.
1645         * khtml/editing/htmlediting.cpp:
1646         (khtml::StyleChange::currentlyHasStyle): Ditto.
1647         (khtml::ApplyStyleCommand::removeCSSStyle): Ditto.
1648         * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::parseHTMLAttribute): Ditto.
1649         * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::parseHTMLAttribute): Ditto.
1650
1651 2004-11-15  Darin Adler  <darin@apple.com>
1652
1653         Reviewed by Ken.
1654
1655         Use separate mutable style and computed style types as appropriate.
1656         For now this should have no effect, but it prepares us for refactoring later.
1657         Also remove some unnecessary "DOM::" prefixes and in one case factor out
1658         some shared code.
1659
1660         * khtml/khtml_part.cpp:
1661         (KHTMLPart::typingStyle):
1662         (KHTMLPart::setTypingStyle):
1663         (updateState):
1664         (KHTMLPart::selectionHasStyle):
1665         (KHTMLPart::selectionStartHasStyle):
1666         (KHTMLPart::selectionComputedStyle):
1667         * khtml/khtml_part.h:
1668         * khtml/khtmlpart_p.h:
1669
1670         * khtml/css/css_base.h:
1671         * khtml/css/css_ruleimpl.cpp:
1672         (CSSStyleRuleImpl::setDeclaration):
1673         * khtml/css/css_ruleimpl.h:
1674         (DOM::CSSFontFaceRuleImpl::style):
1675         (DOM::CSSPageRuleImpl::style):
1676         (DOM::CSSStyleRuleImpl::style):
1677         (DOM::CSSStyleRuleImpl::declaration):
1678         * khtml/css/css_valueimpl.h:
1679         (DOM::CSSPrimitiveValueImpl::):
1680         * khtml/css/cssparser.cpp:
1681         (CSSParser::parseValue):
1682         (CSSParser::parseColor):
1683         (CSSParser::parseDeclaration):
1684         (CSSParser::createStyleDeclaration):
1685         * khtml/css/cssparser.h:
1686         * khtml/css/cssstyleselector.cpp:
1687         (khtml::CSSStyleSelector::addMatchedDeclaration):
1688         (khtml::CSSStyleSelector::matchRulesForList):
1689         (khtml::CSSStyleSelector::styleForElement):
1690         (khtml::CSSStyleSelector::applyDeclarations):
1691         * khtml/css/cssstyleselector.h:
1692         * khtml/css/parser.cpp:
1693         * khtml/css/parser.y:
1694         * khtml/dom/css_rule.h:
1695         * khtml/dom/css_stylesheet.h:
1696         * khtml/dom/css_value.h:
1697         * khtml/dom/dom2_views.cpp:
1698         * khtml/xml/dom2_viewsimpl.cpp:
1699         (DOM::AbstractViewImpl::getComputedStyle):
1700         * khtml/xml/dom_docimpl.cpp:
1701         (DocumentImpl::importNode):
1702         (DocumentImpl::setStyleSheet):
1703         * khtml/xml/dom_docimpl.h:
1704         * khtml/xml/dom_xmlimpl.cpp:
1705         (DOM::ProcessingInstructionImpl::setStyleSheet):
1706         * khtml/xml/dom_xmlimpl.h:
1707
1708         * khtml/dom/css_value.cpp:
1709         (DOM::throwException): Added.
1710         (DOM::CSSStyleDeclaration::setCssText): Call throwException, but always on 0 for now.
1711         The real thing is coming with the next change to refactor.
1712         (DOM::CSSPrimitiveValue::setFloatValue): Call throwException.
1713         (DOM::CSSPrimitiveValue::setStringValue): Ditto.
1714
1715 2004-11-15  Darin Adler  <darin@apple.com>
1716
1717         Reviewed by Ken.
1718
1719         - fixed <rdar://problem/3878489> REGRESSION: modifying attribute of <textarea> blows away edited text (breaks simplemachines.org forum)
1720
1721         * khtml/xml/dom_nodeimpl.h: Added boolean "children changed" parameter to
1722         dispatchSubtreeModifiedEvent, so it can be called in cases where only the
1723         node's attributes changed without sending a misleading childrenChanged call,
1724         but the childrenChanged call can happen at the exact right moment.
1725         * khtml/xml/dom_nodeimpl.cpp: Removed some uneeded "DOM::".
1726         (NodeImpl::dispatchSubtreeModifiedEvent): Only call "children changed" if
1727         the boolean true is passed in.
1728
1729         * khtml/xml/dom_elementimpl.cpp:
1730         (NamedAttrMapImpl::addAttribute): Pass false for "children changed".
1731         (NamedAttrMapImpl::removeAttribute): Ditto.
1732
1733 2004-11-15  John Sullivan  <sullivan@apple.com>
1734
1735         Reviewed by Ken.
1736         
1737         - fixed <rdar://problem/3880075> leak in CSSStyleDeclarationImpl::copyPropertiesInSet, 
1738         seen often in Mail and Blot
1739
1740         * khtml/css/css_valueimpl.cpp:
1741         (CSSStyleDeclarationImpl::copyPropertiesInSet):
1742         delete temporary list after we're done using it
1743
1744 2004-11-15  Richard Williamson   <rjw@apple.com>
1745
1746         Fixed leak (3879883) that John found.  Early return leaked
1747         allocated instance.
1748
1749         Reviewed by John.
1750
1751         * khtml/css/css_computedstyle.cpp:
1752         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
1753
1754 2004-11-15  Ken Kocienda  <kocienda@apple.com>
1755
1756         Reviewed by John
1757
1758         Fix for this bug:
1759         
1760         <rdar://problem/3879569> Many leaks in EditCommand mechanism, seen in Mail
1761
1762         Fixed a couple of object lifetime issues. The EditCommand class used to hold an
1763         EditCommandPtr to its parent, but this caused a a reference cycle in composite 
1764         commands as the children held a ref to their parent. Now, the parent variable
1765         is a non-retained reference to an EditCommand *. It would be nice to have a 
1766         weak reference to the parent or even override deref in composite commands (but I
1767         can't since deref() is not virtual). However, this should be OK since any
1768         dangling parent pointer is a sign of a bigger object lifetime problem that
1769         would need to be addressed anyway.
1770
1771         * khtml/css/css_valueimpl.cpp:
1772         (CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Fix bug in constructor that takes a 
1773         QPtrList<CSSProperty> *. List values must be copied into newly-allocated list, rather than
1774         just assigning the list variable passed in to the local list variable, or the list will be 
1775         double-deleted.
1776         * khtml/editing/htmlediting.cpp:
1777         (khtml::EditCommand::setStartingSelection): No longer call get(). m_parent is no longer a smart pointer.
1778         (khtml::EditCommand::setEndingSelection): Ditto.
1779         (khtml::EditCommand::assignTypingStyle): Short-circuit if passed in style is identical to current style.
1780         Unrelated to the change, but saves some ref's and deref's.
1781         (khtml::EditCommand::setTypingStyle): No longer call get(). m_parent is no longer a smart pointer.
1782         * khtml/editing/htmlediting.h: Change m_parent to a EditCommand *. Was an EditCommandPtr. Using an
1783         EditCommandPtr caused a reference cycle in composite commands as the children held a ref to their parent.
1784         (khtml::EditCommand::parent): No longer call get(). m_parent is no longer a smart pointer.
1785
1786 2004-11-15  Maciej Stachowiak  <mjs@apple.com>
1787
1788         Reviewed by Kevin.
1789
1790         <rdar://problem/3807080> Safari so slow it seems like a hang accessing a page on an IBM website
1791         
1792         * khtml/xml/dom_nodeimpl.cpp:
1793         (NodeListImpl::NodeListImpl): Initialize isItemCacheValid, renamed isCacheValid to
1794         isLengthCacheValid.
1795         (NodeListImpl::recursiveLength): Adjusted for rename.
1796         (NodeListImpl::recursiveItem): Cache the last item accessed and its offset.
1797         If the same offset is looked up again, just return it, otherwise, if looking up
1798         a later offset, start at the last item and proceed from there.
1799         (NodeListImpl::itemById): Apply the special document optimization to all
1800         nodes that are either a document or in a document - just walk up to make
1801         sure the node found by ID has the root node as an ancestor.
1802         (NodeListImpl::rootNodeSubtreeModified): Adjust both cache bits.
1803         * khtml/xml/dom_nodeimpl.h: Prototype new stuff.
1804
1805 2004-11-15  John Sullivan  <sullivan@apple.com>
1806
1807         Reviewed by Ken.
1808         
1809         - fixed <rdar://problem/3879539> leak of NSString after pasting into editable HTML (e.g. Mail)
1810
1811         * kwq/KWQKHTMLPart.mm:
1812         (KWQKHTMLPart::documentFragmentWithText):
1813         release mutable copy of string after we're done using it
1814
1815 2004-11-14  Kevin Decker  <kdecker@apple.com>
1816
1817         Reviewed by mjs.
1818
1819         fixed: <rdar://problem/3823038> LEAK: huge leak in DOM::HTMLElementImpl::createContextualFragment(DOM::DOMString const&, bool)
1820
1821         * khtml/html/html_elementimpl.cpp:
1822         (HTMLElementImpl::setInnerHTML): uses the ref counting system to deallocate fragments instead of explicitly invoking a destructor.
1823         (HTMLElementImpl::setOuterHTML): function is responsible for derefing the fragment prior to returning. Now it does.
1824
1825 2004-11-13  Maciej Stachowiak  <mjs@apple.com>
1826
1827         Reviewed by Kevin.
1828
1829         <rdar://problem/3878766> VIP: Program listings pages at directv.com takes 75% of time traversing NodeLists
1830
1831         * khtml/dom/dom_node.cpp:
1832         (NodeList::itemById): New method, just forward to impl.
1833         * khtml/dom/dom_node.h: Prototype it.
1834         * khtml/ecma/kjs_dom.cpp:
1835         (DOMNodeList::tryGet): Instead of looping over the whole list to do by-id access,
1836         let the NodeList do it. The NodeList might be able to do it more efficiently.
1837         * khtml/xml/dom_nodeimpl.cpp:
1838         (NodeListImpl::itemById): Optimize for the case where the NodeList
1839         covers the whole document. In this case, just use getElementById,
1840         then check that the element satisfies the list criteria.
1841         (ChildNodeListImpl::nodeMatches): Return true only if the node is our child.
1842         (TagNodeListImpl::TagNodeListImpl): Irrelevant change to reformat initializers.
1843         * khtml/xml/dom_nodeimpl.h:
1844
1845 2004-11-12  Maciej Stachowiak  <mjs@apple.com>
1846
1847         Reviewed by Gramps.
1848
1849         - fixed another bug in the last checkin, isCacheValid was unitialized, resulting in
1850         sometimes using a huge bogus length value.
1851         
1852         * khtml/xml/dom_nodeimpl.cpp:
1853         (NodeListImpl::NodeListImpl): Initialize isCacheValid.
1854
1855 2004-11-12  Darin Adler  <darin@apple.com>
1856
1857         Reviewed by Maciej.
1858
1859         - fixed an infinite loop in that last check-in
1860
1861         * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::notifyLocalNodeListsSubtreeModified):
1862         Added a ++i to the loop so it won't get stuck on the first element in the list.
1863
1864 2004-11-12  Maciej Stachowiak  <mjs@apple.com>
1865
1866         Reviewed by Kevin.
1867
1868         - fixed <rdar://problem/3878183> Safari is 77% slower than it should be on a page on an IBM website due to NodeListImpl length
1869         
1870         I fixed this by changing NodeLists to cache their length, but
1871         invalidate it whenever there is a change in the DOM subtree at
1872         which they are rooted. This makes NodeListImpl::recursiveLength()
1873         drop completely off the profile, since we were repeatedly getting
1874         a length for the same NodeList over and over.
1875         
1876         * khtml/xml/dom_nodeimpl.cpp:
1877         (NodeImpl::NodeImpl):
1878         (NodeImpl::~NodeImpl):
1879         (NodeImpl::registerNodeList):
1880         (NodeImpl::unregisterNodeList):
1881         (NodeImpl::notifyLocalNodeListsSubtreeModified):
1882         (NodeImpl::notifyNodeListsSubtreeModified):
1883         (NodeImpl::dispatchSubtreeModifiedEvent):
1884         (NodeListImpl::NodeListImpl):
1885         (NodeListImpl::~NodeListImpl):
1886         (NodeListImpl::recursiveLength):
1887         (NodeListImpl::recursiveItem):
1888         (NodeListImpl::rootNodeSubtreeModified):
1889         (ChildNodeListImpl::ChildNodeListImpl):
1890         (ChildNodeListImpl::length):
1891         (ChildNodeListImpl::item):
1892         (TagNodeListImpl::TagNodeListImpl):
1893         (TagNodeListImpl::length):
1894         (TagNodeListImpl::item):
1895         (NameNodeListImpl::NameNodeListImpl):
1896         (NameNodeListImpl::length):
1897         (NameNodeListImpl::item):
1898         * khtml/xml/dom_nodeimpl.h:
1899
1900 2004-11-12  Darin Adler  <darin@apple.com>
1901
1902         Reviewed by Maciej.
1903
1904         - various small cleanups
1905
1906         * khtml/xml/dom_docimpl.h: Added policyBaseURL and setPolicyBaseURL.
1907         * khtml/html/html_documentimpl.h: Removed policyBaseURL and setPolicyBaseURL.
1908
1909         * khtml/xml/xml_tokenizer.h: Marked isWaitingForScripts const.
1910         * khtml/xml/xml_tokenizer.cpp: (khtml::XMLTokenizer::isWaitingForScripts): Marked const.
1911         * khtml/html/htmltokenizer.h: Marked isWaitingForScripts const.
1912         * khtml/html/htmltokenizer.cpp:
1913         (khtml::HTMLTokenizer::isWaitingForScripts): Marked const.
1914         (khtml::HTMLTokenizer::setOnHold): Took out extraneous line of code.
1915
1916         * khtml/khtml_part.h: Removed docImpl function.
1917         * khtml/khtml_part.cpp: Ditto.
1918
1919         * khtml/xml/dom_docimpl.cpp: (DocumentImpl::close): Simplified code that implements
1920         the "redirect during onload" optimization. Now uses isScheduledLocationChangePending.
1921
1922         * kwq/KWQKHTMLPart.h: Removed now-unused _firstResponderAtMouseDownTime.
1923         * kwq/KWQKHTMLPart.mm: Removed _firstResponderAtMouseDownTime (forgot to land this
1924         part of the change last time, which is why the build broke).
1925         (KWQKHTMLPart::updatePolicyBaseURL): Use xmlDocImpl instead of docImpl.
1926         (KWQKHTMLPart::setPolicyBaseURL): Ditto.
1927         (KWQKHTMLPart::keyEvent): Ditto.
1928         (KWQKHTMLPart::dispatchCPPEvent): Ditto.
1929         (KWQKHTMLPart::bodyBackgroundColor): Ditto.
1930
1931 2004-11-12  Chris Blumenberg  <cblu@apple.com>
1932
1933         <rdar://problem/3843312> REGRESSION: Tabbing into content area puts insertion point at start, should go to where it last was
1934
1935         Reviewed by rjw.
1936
1937         * kwq/KWQKHTMLPart.mm:
1938         (KWQKHTMLPart::nextKeyViewInFrameHierarchy): only blow away selection when another view is focused
1939
1940 === Safari-171 ===
1941
1942 2004-11-12  Darin Adler  <darin@apple.com>
1943
1944         Reviewed by Kevin.
1945
1946         - fixed a couple places that would not work for XML documents
1947
1948         * khtml/ecma/kjs_window.cpp:
1949         (Window::isSafeScript): Use xmlDocImpl instead of docImpl, since the function we're using
1950         is present on the base class.
1951         (WindowFunc::tryCall): More of the same.
1952
1953 2004-11-12  Darin Adler  <darin@apple.com>
1954
1955         - land versions of these files generated by the newer gperf
1956
1957         People building on Panther will continue to see these files modified.
1958         A workaround would be to install the newer gperf on our Tiger build machines.
1959
1960         * khtml/css/cssproperties.c: Regenerated.
1961         * khtml/css/cssvalues.c: Regenerated.
1962         * khtml/html/doctypes.cpp: Regenerated.
1963         * khtml/html/kentities.c: Regenerated.
1964         * khtml/misc/htmlattrs.c: Regenerated.
1965         * khtml/misc/htmltags.c: Regenerated.
1966         * kwq/KWQColorData.c: Regenerated.
1967
1968 2004-11-11  Richard Williamson   <rjw@apple.com>
1969         
1970         Fix build horkage from previous checkin.
1971                 
1972         * kwq/KWQKHTMLPart.h:
1973
1974 2004-11-11  Darin Adler  <darin@apple.com>
1975
1976         Reviewed by John.
1977
1978         - fixed <rdar://problem/3846152> REGRESSION (125-166): can't drag text out of <input type=text> fields
1979
1980         * kwq/WebCoreBridge.h: Added wasFirstResponderAtMouseDownTime: method.
1981
1982         * kwq/KWQKHTMLPart.h: Removed _firstResponderAtMouseDownTime.
1983         * kwq/KWQKHTMLPart.mm:
1984         (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Use the new wasFirstResponderAtMouseDownTime:
1985         method on the bridge instead of _firstResponderAtMouseDownTime. This will return YES for the case where
1986         we started with the NSTextField as first responder, and then took focus away and gave it back, which
1987         makes dragging text work again.
1988         (KWQKHTMLPart::mouseDown): Removed code to set _firstResponderAtMouseDownTime.
1989
1990 2004-11-11  David Hyatt  <hyatt@apple.com>
1991
1992         Disable the tokenizer deferral, since it hurts the PLT by 3% or so.
1993         
1994         Reviewed by vicki
1995
1996         * khtml/html/htmltokenizer.cpp:
1997         (khtml::HTMLTokenizer::continueProcessing):
1998
1999 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2000
2001         Reviewed by Maciej
2002
2003         * khtml/editing/htmlediting.cpp:
2004         (khtml::InsertLineBreakCommand::doApply): Use new isLastVisiblePositionInBlock() helper instead
2005         of old isLastInBlock() member function on VisiblePosition. This is a cosmetic change in keeping
2006         with the prevailing style for the VisiblePosition class.
2007         * khtml/editing/htmlediting.h: Move isLastVisiblePositionInNode() function to visible_position.[cpp|h] files. 
2008         * khtml/editing/visible_position.cpp: Removed isLastInBlock() helper. Renamed to isLastVisiblePositionInBlock().
2009         (khtml::visiblePositionsInDifferentBlocks): New helper method.
2010         (khtml::isLastVisiblePositionInBlock): Ditto.
2011         (khtml::isLastVisiblePositionInNode): Ditto.
2012         * khtml/editing/visible_position.h: Add declarations for new functions.
2013
2014 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2015
2016         Reviewed by Hyatt
2017
2018         * khtml/editing/htmlediting.cpp:
2019         (khtml::CompositeEditCommand::deleteInsignificantText): Call new compareBoundaryPoints convenience.
2020         (khtml::ApplyStyleCommand::removeBlockStyle): Ditto.
2021         (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
2022         (khtml::ApplyStyleCommand::nodeFullySelected): Ditto.
2023         (khtml::DeleteSelectionCommand::initializePositionData): Ditto.
2024         * khtml/xml/dom2_rangeimpl.cpp:
2025         (DOM::RangeImpl::compareBoundaryPoints): New convenience variant of this function which takes two Position objects.
2026         * khtml/xml/dom2_rangeimpl.h: Ditto.
2027
2028 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2029
2030         Reviewed by Harrison
2031
2032         Some improvements to deleting when complete lines are selected.
2033
2034         * khtml/editing/htmlediting.cpp:
2035         (khtml::DeleteSelectionCommand::initializePositionData): Detect when the line containing
2036         the end of a selection is fully selected. Turn off block merging in this case.
2037         (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Fix a bug in the check for
2038         whether a BR immediately followed a block. The old code could erroneously skip nodes.
2039         (khtml::DeleteSelectionCommand::handleGeneralDelete): Add a case for when the entire
2040         start block is selected. This new code will now delete this block in one call, rather
2041         than iterating over each child.
2042         * khtml/editing/visible_position.cpp:
2043         (khtml::visiblePositionsOnDifferentLines): New helper called in initializePositionData()
2044         to do the work mentioned above in the comment for that function.
2045         (khtml::isFirstVisiblePositionOnLine): Ditto.
2046         (khtml::isLastVisiblePositionOnLine): Ditto.
2047         * khtml/editing/visible_position.h: Add new functions.
2048         * layout-tests/editing/deleting/delete-line-001-expected.txt: Added.
2049         * layout-tests/editing/deleting/delete-line-001.html: Added.
2050         * layout-tests/editing/deleting/delete-line-002-expected.txt: Added.
2051         * layout-tests/editing/deleting/delete-line-002.html: Added.
2052         * layout-tests/editing/deleting/delete-line-003-expected.txt: Added.
2053         * layout-tests/editing/deleting/delete-line-003.html: Added.
2054         * layout-tests/editing/deleting/delete-line-004-expected.txt: Added.
2055         * layout-tests/editing/deleting/delete-line-004.html: Added.
2056         * layout-tests/editing/deleting/delete-line-005-expected.txt: Added.
2057         * layout-tests/editing/deleting/delete-line-005.html: Added.
2058         * layout-tests/editing/deleting/delete-line-006-expected.txt: Added.
2059         * layout-tests/editing/deleting/delete-line-006.html: Added.
2060         * layout-tests/editing/deleting/delete-line-007-expected.txt: Added.
2061         * layout-tests/editing/deleting/delete-line-007.html: Added.
2062         * layout-tests/editing/deleting/delete-line-008-expected.txt: Added.
2063         * layout-tests/editing/deleting/delete-line-008.html: Added.
2064         * layout-tests/editing/deleting/delete-line-009-expected.txt: Added.
2065         * layout-tests/editing/deleting/delete-line-009.html: Added.
2066         * layout-tests/editing/deleting/delete-line-010-expected.txt: Added.
2067         * layout-tests/editing/deleting/delete-line-010.html: Added.
2068         * layout-tests/editing/deleting/delete-line-011-expected.txt: Added.
2069         * layout-tests/editing/deleting/delete-line-011.html: Added.
2070         * layout-tests/editing/deleting/delete-line-012-expected.txt: Added.
2071         * layout-tests/editing/deleting/delete-line-012.html: Added.
2072
2073 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2074
2075         Reviewed by Adele
2076
2077         * khtml/editing/htmlediting.cpp:
2078         (khtml::DeleteSelectionCommand::initializePositionData): Add some comments and a new piece of debugging output.
2079
2080 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2081
2082         Reviewed by John
2083
2084         Fix for these bugs:
2085
2086         <rdar://problem/3875618> REGRESSION (Mail): Hitting down arrow with full line selected skips line (br case)
2087         <rdar://problem/3875641> REGRESSION (Mail): Hitting down arrow with full line selected skips line (div case)
2088
2089         * khtml/editing/selection.cpp:
2090         (khtml::Selection::modifyMovingRightForward): Fixed by juggling the position as the starting point for
2091         the next line position when necessary.
2092         * layout-tests/editing/selection/move-3875618-fix-expected.txt: Added.
2093         * layout-tests/editing/selection/move-3875618-fix.html: Added.
2094         * layout-tests/editing/selection/move-3875641-fix-expected.txt: Added.
2095         * layout-tests/editing/selection/move-3875641-fix.html: Added.
2096
2097 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2098
2099         Reviewed by John
2100
2101         Improved some function names, at John's urging. No changes to the
2102         functions themselves.
2103         
2104         canPerformSpecialCaseAllContentDelete() --> handleSpecialCaseAllContentDelete()
2105         canPerformSpecialCaseBRDelete() --> handleSpecialCaseBRDelete()
2106         performGeneralDelete() --> handleGeneralDelete()
2107
2108         * khtml/editing/htmlediting.cpp:
2109         (khtml::DeleteSelectionCommand::handleSpecialCaseAllContentDelete)
2110         (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete)
2111         (khtml::DeleteSelectionCommand::handleGeneralDelete)
2112         (khtml::DeleteSelectionCommand::doApply)
2113         * khtml/editing/htmlediting.h
2114
2115 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2116
2117         Reviewed by John
2118         
2119         Updated some layout test results that changed as a result of my last checking.
2120         Added a new test that has been in my tree for a few days.
2121
2122         * layout-tests/editing/deleting/delete-3775172-fix-expected.txt:
2123         * layout-tests/editing/deleting/delete-3800834-fix-expected.txt:
2124         * layout-tests/editing/inserting/insert-3851164-fix-expected.txt: Added.
2125         * layout-tests/editing/inserting/insert-3851164-fix.html: Added.
2126
2127 2004-11-11  Ken Kocienda  <kocienda@apple.com>
2128
2129         Reviewed by John
2130
2131         * khtml/editing/htmlediting.cpp:
2132         (khtml::debugNode): New debugging helper.
2133         (khtml::DeleteSelectionCommand::initializePositionData): No longer call obsoleted
2134         startPositionForDelete() and endPositionForDelete() functions. Just use the 
2135         m_selectionToDelete object to determine start and end positions for the delete.
2136         (khtml::DeleteSelectionCommand::canPerformSpecialCaseAllContentDelete): New
2137         function that creates a special case for deleting all the content in a root
2138         editable element.
2139         (khtml::DeleteSelectionCommand::doApply): Call canPerformSpecialCaseAllContentDelete()
2140         function before BR special case and the general case delete functions.
2141         * khtml/editing/htmlediting.h: Updated for changed functions.
2142
2143 2004-11-10  Kevin Decker  <kdecker@apple.com>
2144
2145         Reviewed by mjs.
2146         
2147         Fixed <rdar://problem/3875011> DOMNodeList::tryGet() performs unnecessary (and expensive) dom tree traversals. Improved a loop from 2-n-squared to just n-squared.  
2148
2149         * khtml/ecma/kjs_dom.cpp:
2150         (DOMNodeList::tryGet): Got rid of an unnecessary node traversal. 
2151
2152 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2153
2154         Reviewed by Chris
2155
2156         * khtml/editing/htmlediting.cpp:
2157         (khtml::DeleteSelectionCommand::initializePositionData): Move position adjustments for
2158         smart delete from the two functions below to here. There was an unnecessary double 
2159         calculation of the leading and trailing whitespace positions. Also refined the trailing
2160         case so it only acts when the leading position is null (which seems to match TextEdit in
2161         my tests). Also removed some unnecessary copying of Position objects.
2162         (khtml::DeleteSelectionCommand::startPositionForDelete): Move out smart delete adjustment
2163         from here.
2164         (khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.
2165
2166 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2167
2168         Reviewed by Harrison
2169
2170         (khtml::DeleteSelectionCommand::performGeneralDelete): Add some more comments to
2171         make things more clear.
2172         * khtml/editing/selection.cpp:
2173         (khtml::Selection::toRange): Fixed the upstream and downstream calls so that the 
2174         resulting positions do not cross block boundaries. This was a bug and caused some
2175         delete problems when whole blocks were selected. I will be addressing that issue
2176         more fully in upcoming changes.
2177
2178 2004-11-10  Ken Kocienda  <kocienda@apple.com>
2179
2180         Reviewed by Harrison
2181
2182         Some cleanups and fixes in upstream and downstream functions. 
2183         
2184         Removed redundant checks for isBlockFlow() when calling enclosingBlockFlowElement(). 
2185         Blocks do not need to skip the call to enclosingBlockFlowElement() for fear that the 
2186         block's enclosing block will be returned. 
2187         
2188         Remove code from upstream that confined the serach to block boundaries outside of
2189         the code which runs in the StayInBlock case. This code was redundant, and caused
2190         incorrect results to be returned in the DoNotStayInBlock case.
2191         
2192         In downstream, the check for crossing into a new block should use the equivalentDeepPosition()
2193         node, not the the this pointer's node.
2194
2195         * khtml/xml/dom_position.cpp:
2196         (DOM::Position::upstream)
2197         (DOM::Position::downstream)
2198
2199 2004-11-09  David Hyatt  <hyatt@apple.com>
2200
2201         Fix for 3873234, Safari UI is unresponsive when parsing multiple HTML docs and 3873233, Safari hangs when
2202         loading large local files.
2203         
2204         Reviewed by mjs
2205
2206         * khtml/html/htmltokenizer.cpp:
2207         (khtml::HTMLTokenizer::HTMLTokenizer):
2208         (khtml::HTMLTokenizer::reset):
2209         (khtml::HTMLTokenizer::write):
2210         (khtml::HTMLTokenizer::stopped):
2211         (khtml::HTMLTokenizer::processingData):
2212         (khtml::HTMLTokenizer::continueProcessing):
2213         (khtml::HTMLTokenizer::timerEvent):
2214         (khtml::HTMLTokenizer::allDataProcessed):
2215         (khtml::HTMLTokenizer::end):
2216         (khtml::HTMLTokenizer::finish):
2217         (khtml::HTMLTokenizer::notifyFinished):
2218         * khtml/html/htmltokenizer.h:
2219         * khtml/khtml_part.cpp:
2220         (KHTMLPart::slotFinished):
2221         (KHTMLPart::end):
2222         (KHTMLPart::stop):
2223         * khtml/khtml_part.h:
2224         (KHTMLPart::tokenizerProcessedData):
2225         * khtml/khtmlview.cpp:
2226         * khtml/xml/dom_docimpl.cpp:
2227         * khtml/xml/xml_tokenizer.h:
2228         (khtml::Tokenizer::stopped):
2229         (khtml::Tokenizer::processingData):
2230         * kwq/KWQDateTime.h:
2231         * kwq/KWQDateTime.mm:
2232         (QDateTime::secsTo):
2233         (KWQUIEventTime::uiEventPending):
2234         * kwq/KWQKHTMLPart.h:
2235         * kwq/KWQKHTMLPart.mm:
2236         (KWQKHTMLPart::tokenizerProcessedData):
2237         * kwq/WebCoreBridge.h:
2238         * kwq/WebCoreBridge.mm:
2239         (-[WebCoreBridge stop]):
2240         (-[WebCoreBridge numPendingOrLoadingRequests]):
2241         (-[WebCoreBridge doneProcessingData]):
2242
2243 2004-11-09  David Harrison  <harrison@apple.com>
2244
2245         Reviewed by Ken Kocienda.
2246
2247                 <rdar://problem/3865837> Wrong text style after delete to start of document
2248                 
2249         * khtml/editing/htmlediting.cpp:
2250         (khtml::DeleteSelectionCommand::saveTypingStyleState):
2251         Sample computedStyle of m_selectionToDelete.start instead of m_downstreamStart.
2252
2253 2004-11-09  Richard Williamson   <rjw@apple.com>
2254
2255         Fixed <rdar://problem/3872440> NSTimer prematurely released.
2256
2257         Reviewed by Darin.
2258
2259         * kwq/KWQTimer.mm:
2260         (QTimer::fire):
2261         * kwq/KWQWidget.mm:
2262         (QWidget::paint):
2263
2264 2004-11-09  Chris Blumenberg  <cblu@apple.com>
2265
2266         Reviewed by vicki.
2267
2268         * WebCore.pbproj/project.pbxproj: explicitly link against libxml2.2.6.14.dylib since the version number has been bumped
2269
2270 2004-11-08  David Harrison  <harrison@apple.com>
2271
2272         Reviewed by Ken Kocienda.
2273
2274                 <rdar://problem/3865854> Deleting first line deletes all lines
2275                 
2276         * khtml/editing/htmlediting.cpp:
2277         (khtml::DeleteSelectionCommand::performGeneralDelete):
2278         Problem was that the code that deletes fully selected m_downstreamEnd.node() by deleting one
2279         of its ancestors, failed to end the loop that deletes all fully selected nodes.  Also,
2280         fixed this code to clear m_trailingWhitespaceValid.  Also removed dead m_endingPosition
2281         update because it is handled in calculateEndingPosition now.
2282         * layout-tests/editing/deleting/delete-3865854-fix-expected.txt: Added.
2283         * layout-tests/editing/deleting/delete-3865854-fix.html: Added.
2284
2285 2004-11-08  Ken Kocienda  <kocienda@apple.com>
2286
2287         Reviewed by Hyatt
2288
2289         * khtml/html/html_elementimpl.cpp:
2290         (HTMLElementImpl::createContextualFragment): Now takes flag to control whether comments
2291         are added to the DOM.
2292         * khtml/html/html_elementimpl.h: Ditto.
2293         * khtml/html/htmlparser.cpp:
2294         (KHTMLParser::KHTMLParser): Ditto.
2295         (KHTMLParser::getElement): Remove ifdef for comment processing. Replace with flag check.
2296         * khtml/html/htmlparser.h: Add flag to constructor so callers can request comment nodes.
2297         * khtml/html/htmltokenizer.cpp:
2298         (khtml::HTMLTokenizer::HTMLTokenizer): Add flag to constructor so callers can request comment nodes.
2299         (khtml::HTMLTokenizer::parseComment): Fix code to handle parsing out comment text correctly.
2300         There were a couple of indexing errors that resulted in the comment text containing part of the 
2301         comment markers.
2302         (khtml::HTMLTokenizer::processToken): Don't let token id be reset to ID_TEXT if token is a comment.
2303         * khtml/html/htmltokenizer.h:  Add flag to constructor so callers can request comment nodes.
2304
2305 2004-11-08  Chris Blumenberg  <cblu@apple.com>
2306
2307         Fixed: <rdar://problem/3870907> WebCore unnecessary links against JavaVM and Security
2308
2309         Reviewed by darin.
2310
2311         * WebCore.pbproj/project.pbxproj: stop unnecessary linking
2312         * khtml/html/html_objectimpl.h: don't unnecessarily include JavaVM header
2313         * kwq/KWQKHTMLPart.h: ditto
2314
2315 2004-11-08  Darin Adler  <darin@apple.com>
2316
2317         Reviewed by John.
2318
2319         - fixed <rdar://problem/3825966> 8A274 Safari crashes closing window: QTimer::fire() with MallocStackLogging and MallocScribble enabled
2320
2321         * kwq/KWQTimer.mm: (QTimer::fire): Rearrange so we don't access the QTimer object after calling code
2322         that possibly deletes the QTimer.
2323
2324 2004-11-08  Chris Blumenberg  <cblu@apple.com>
2325
2326         Fixed: <rdar://problem/3783904> Return key behavior is confusingly different between popup menus and autofill menus
2327
2328         Reviewed by john.
2329
2330         * kwq/KWQTextField.mm:
2331         (-[KWQTextFieldController textView:shouldHandleEvent:]): let the bridge have a crack at the event so that it can swallow the newline if it wants to
2332         * kwq/WebCoreBridge.h:
2333
2334 2004-11-08  David Harrison  <harrison@apple.com>
2335
2336         Reviewed by Darin.
2337         
2338         Renamed NodeImpl::enclosingNonBlockFlowElement to NodeImpl::enclosingInlineElement, per Hyatt.
2339
2340         * khtml/editing/htmlediting.cpp:
2341         (khtml::DeleteSelectionCommand::moveNodesAfterNode):
2342         * khtml/xml/dom_nodeimpl.cpp:
2343         (NodeImpl::enclosingInlineElement):
2344         * khtml/xml/dom_nodeimpl.h:
2345
2346 2004-11-05  Chris Blumenberg  <cblu@apple.com>
2347
2348         Fixed: <rdar://problem/3838413> REGRESSION (Mail): "Smart" word paste adds spaces before/after special characters
2349
2350         Reviewed by rjw.
2351
2352         * khtml/editing/htmlediting.cpp:
2353         (khtml::ReplaceSelectionCommand::doApply): call isCharacterSmartReplaceExempt on the part to see if a space should be inserted
2354         * khtml/editing/visible_position.cpp:
2355         (khtml::VisiblePosition::character): new, returns the character for the position
2356         * khtml/editing/visible_position.h:
2357         * kwq/KWQKHTMLPart.h:
2358         * kwq/KWQKHTMLPart.mm:
2359         (KWQKHTMLPart::isCharacterSmartReplaceExempt): new, calls the bridge
2360         * kwq/WebCoreBridge.h:
2361
2362 === Safari-170 ===
2363
2364 2004-11-05  Adele Amchan  <adele@apple.com>
2365
2366         Reviewed by Darin
2367
2368         Fix for <rdar://problem/3854383> REGRESSION(166-168) input fields show black background when background color is set to transparent
2369         and a workaround for displaying transparent backgrounds for textareas.
2370
2371         * kwq/KWQLineEdit.mm: (QLineEdit::setPalette): If the background color is transparent (we check the alpha value) then we set the background to white
2372         * kwq/KWQTextEdit.mm: (QTextEdit::setPalette): If the background color is transparent, then we don't draw the background
2373         * kwq/KWQTextArea.mm: (-[KWQTextArea setDrawsBackground:]): added setDrawsBackground function which calls setDrawsBackground on the super class, 
2374           on the contentView, and on the textView.
2375
2376 2004-11-04  David Hyatt  <hyatt@apple.com>
2377
2378         Fix for relpositioned inlines.  This was reviewed a long time ago, but I can't recall who reviewed it (either
2379         darin or ken).
2380         
2381         Reviewed by darin or ken
2382
2383         * khtml/rendering/bidi.cpp:
2384         (khtml::appendRunsForObject):
2385         (khtml::RenderBlock::skipWhitespace):
2386         (khtml::RenderBlock::findNextLineBreak):
2387         * khtml/rendering/render_block.cpp:
2388         (khtml::RenderBlock::lowestPosition):
2389         (khtml::RenderBlock::rightmostPosition):
2390         (khtml::RenderBlock::leftmostPosition):
2391         * khtml/rendering/render_box.cpp:
2392         (RenderBox::position):
2393         * khtml/rendering/render_box.h:
2394         (khtml::RenderBox::staticX):
2395         (khtml::RenderBox::staticY):
2396         * khtml/rendering/render_layer.cpp:
2397         (RenderLayer::updateLayerPosition):
2398         (RenderLayer::convertToLayerCoords):
2399         * khtml/rendering/render_line.cpp:
2400         (khtml::InlineFlowBox::placeBoxesHorizontally):
2401         * khtml/rendering/render_object.h:
2402         (khtml::RenderObject::staticX):
2403         (khtml::RenderObject::staticY):
2404
2405         Finish turning on XSLT.  Make sure child stylesheets can load.
2406         
2407         * khtml/xsl/xslt_processorimpl.cpp:
2408         (DOM::stylesheetLoadFunc):
2409         (DOM::XSLTProcessorImpl::transformDocument):
2410
2411 2004-11-04  David Hyatt  <hyatt@apple.com>
2412
2413         Implement CSS3 support for multiple backgrounds.  Also fix a bug with background propagation so that it only
2414         happens (from the <body> to the root) for HTML documents.  Fixed background-position to handle a mixture of
2415         keyword and length values.
2416
2417         Reviewed by darin
2418
2419         * khtml/css/cssparser.cpp:
2420         (CSSParser::parseValue):
2421         (CSSParser::addBackgroundValue):
2422         (CSSParser::parseBackgroundShorthand):
2423         (CSSParser::parseBackgroundColor):
2424         (CSSParser::parseBackgroundImage):
2425         (CSSParser::parseBackgroundPositionXY):
2426         (CSSParser::parseBackgroundPosition):
2427         (CSSParser::parseBackgroundProperty):
2428         (CSSParser::parseColorFromValue):
2429         * khtml/css/cssparser.h:
2430         * khtml/css/cssstyleselector.cpp:
2431         (khtml::CSSStyleSelector::adjustRenderStyle):
2432         (khtml::CSSStyleSelector::applyProperty):
2433         (khtml::CSSStyleSelector::mapBackgroundAttachment):
2434         (khtml::CSSStyleSelector::mapBackgroundImage):
2435         (khtml::CSSStyleSelector::mapBackgroundRepeat):
2436         (khtml::CSSStyleSelector::mapBackgroundXPosition):
2437         (khtml::CSSStyleSelector::mapBackgroundYPosition):
2438         * khtml/css/cssstyleselector.h:
2439         * khtml/rendering/render_box.cpp:
2440         (RenderBox::paintRootBoxDecorations):
2441         (RenderBox::paintBoxDecorations):
2442         (RenderBox::paintBackgrounds):
2443         (RenderBox::paintBackground):
2444         (RenderBox::paintBackgroundExtended):
2445         * khtml/rendering/render_box.h:
2446         * khtml/rendering/render_form.cpp:
2447         (RenderFieldset::paintBoxDecorations):
2448         * khtml/rendering/render_line.cpp:
2449         (khtml::InlineFlowBox::paintBackgrounds):
2450         (khtml::InlineFlowBox::paintBackground):
2451         (khtml::InlineFlowBox::paintBackgroundAndBorder):
2452         * khtml/rendering/render_line.h:
2453         * khtml/rendering/render_object.cpp:
2454         (RenderObject::setStyle):
2455         (RenderObject::updateBackgroundImages):
2456         (RenderObject::getVerticalPosition):
2457         * khtml/rendering/render_object.h:
2458         (khtml::RenderObject::paintBackgroundExtended):
2459         * khtml/rendering/render_style.cpp:
2460         (m_next):
2461         (BackgroundLayer::BackgroundLayer):
2462         (BackgroundLayer::~BackgroundLayer):
2463         (BackgroundLayer::operator=):
2464         (BackgroundLayer::operator==):
2465         (BackgroundLayer::fillUnsetProperties):
2466         (BackgroundLayer::cullEmptyLayers):
2467         (StyleBackgroundData::StyleBackgroundData):
2468         (StyleBackgroundData::operator==):
2469         (RenderStyle::diff):
2470         (RenderStyle::adjustBackgroundLayers):
2471         * khtml/rendering/render_style.h:
2472         (khtml::OutlineValue::operator==):
2473         (khtml::OutlineValue::operator!=):
2474         (khtml::BackgroundLayer::backgroundImage):
2475         (khtml::BackgroundLayer::backgroundXPosition):
2476         (khtml::BackgroundLayer::backgroundYPosition):
2477         (khtml::BackgroundLayer::backgroundAttachment):
2478         (khtml::BackgroundLayer::backgroundRepeat):
2479         (khtml::BackgroundLayer::next):
2480         (khtml::BackgroundLayer::isBackgroundImageSet):
2481         (khtml::BackgroundLayer::isBackgroundXPositionSet):
2482         (khtml::BackgroundLayer::isBackgroundYPositionSet):
2483         (khtml::BackgroundLayer::isBackgroundAttachmentSet):
2484         (khtml::BackgroundLayer::isBackgroundRepeatSet):
2485         (khtml::BackgroundLayer::setBackgroundImage):
2486         (khtml::BackgroundLayer::setBackgroundXPosition):
2487         (khtml::BackgroundLayer::setBackgroundYPosition):
2488         (khtml::BackgroundLayer::setBackgroundAttachment):
2489         (khtml::BackgroundLayer::setBackgroundRepeat):
2490         (khtml::BackgroundLayer::clearBackgroundImage):
2491         (khtml::BackgroundLayer::clearBackgroundXPosition):
2492         (khtml::BackgroundLayer::clearBackgroundYPosition):
2493         (khtml::BackgroundLayer::clearBackgroundAttachment):
2494         (khtml::BackgroundLayer::clearBackgroundRepeat):
2495         (khtml::BackgroundLayer::setNext):
2496         (khtml::BackgroundLayer::operator!=):
2497         (khtml::BackgroundLayer::containsImage):
2498         (khtml::BackgroundLayer::hasImage):
2499         (khtml::BackgroundLayer::hasFixedImage):
2500         (khtml::RenderStyle::setBitDefaults):
2501         (khtml::RenderStyle::hasBackground):
2502         (khtml::RenderStyle::hasFixedBackgroundImage):
2503         (khtml::RenderStyle::outlineWidth):
2504         (khtml::RenderStyle::outlineStyle):
2505         (khtml::RenderStyle::outlineStyleIsAuto):
2506         (khtml::RenderStyle::outlineColor):
2507         (khtml::RenderStyle::backgroundColor):
2508         (khtml::RenderStyle::backgroundImage):
2509         (khtml::RenderStyle::backgroundRepeat):
2510         (khtml::RenderStyle::backgroundAttachment):
2511         (khtml::RenderStyle::backgroundXPosition):
2512         (khtml::RenderStyle::backgroundYPosition):
2513         (khtml::RenderStyle::accessBackgroundLayers):
2514         (khtml::RenderStyle::backgroundLayers):
2515         (khtml::RenderStyle::outlineOffset):
2516         (khtml::RenderStyle::resetOutline):
2517         (khtml::RenderStyle::setBackgroundColor):
2518         (khtml::RenderStyle::setOutlineWidth):
2519         (khtml::RenderStyle::setOutlineStyle):
2520         (khtml::RenderStyle::setOutlineColor):
2521         (khtml::RenderStyle::clearBackgroundLayers):
2522         (khtml::RenderStyle::inheritBackgroundLayers):
2523         (khtml::RenderStyle::setOutlineOffset):
2524         * khtml/rendering/render_table.cpp:
2525         (RenderTable::paintBoxDecorations):
2526         (RenderTableCell::paintBoxDecorations):
2527
2528 2004-11-04  David Hyatt  <hyatt@apple.com>
2529
2530         Make sure the text decoder returns empty strings rather than null strings when the utf8 char ptr is non-null.
2531         Ensures that <a href=""> works with libxml (which returns data in utf-8 buffers).
2532
2533         Reviewed by darin
2534
2535         * kwq/KWQTextCodec.mm:
2536         (KWQTextDecoder::convertLatin1):
2537         (KWQTextDecoder::convertUTF16):
2538         (KWQTextDecoder::convertUsingTEC):
2539         (KWQTextDecoder::toUnicode):
2540
2541 2004-11-04  David Hyatt  <hyatt@apple.com>
2542
2543         Make sure line-height returns the correct value for normal.
2544         
2545         Reviewed by darin
2546
2547         * khtml/css/css_computedstyle.cpp:
2548         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
2549
2550 2004-11-04  David Harrison  <harrison@apple.com>
2551
2552         Reviewed by Ken Kocienda.
2553
2554                 <rdar://problem/3857753> REGRESSION (Mail): Delete incorrectly causes text to take on new style
2555                 
2556         * khtml/editing/htmlediting.cpp:
2557         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Fixed to move entire source subtree (up
2558         to, but not including, the enclosingBlockFlowElement) rather than just the source element.
2559         Fixed to insert after the destination subtree, rather than the destination element.  Handles
2560         edge case of deleting back to the top of the tree, where there is nothing left to insert after.
2561         * khtml/xml/dom_nodeimpl.cpp:
2562         (NodeImpl::enclosingNonBlockFlowElement): New method to support moveNodesAfterNode changes.
2563         * khtml/xml/dom_nodeimpl.h: Declare NodeImpl::enclosingNonBlockFlowElement
2564         * layout-tests/editing/deleting/delete-3857753-fix-expected.txt: Added.
2565         * layout-tests/editing/deleting/delete-3857753-fix.html: Added.
2566
2567 2004-11-03  Ken Kocienda  <kocienda@apple.com>
2568
2569         Reviewed by me
2570         
2571         More layout tests.
2572
2573         * layout-tests/editing/deleting/delete-br-008-expected.txt: Added.
2574         * layout-tests/editing/deleting/delete-br-008.html: Added.
2575         * layout-tests/editing/deleting/delete-br-009-expected.txt: Added.
2576         * layout-tests/editing/deleting/delete-br-009.html: Added.
2577         * layout-tests/editing/deleting/delete-br-010-expected.txt: Added.
2578         * layout-tests/editing/deleting/delete-br-010.html: Added.
2579
2580 2004-11-03  Maciej Stachowiak  <mjs@apple.com>
2581
2582         Fix by Yasuo Kida, reviewed by me.
2583
2584         <rdar://problem/3819004> REGRESSION (Mail): Can't move cursor / delete character after deleting the active input area
2585         
2586         * kwq/KWQKHTMLPart.mm:
2587         (KWQKHTMLPart::setMarkedTextRange): Treat a collapsed range the
2588         same as a nil range - setting an empty marked range should clear
2589         the marked range entirely.
2590
2591 2004-11-02  Maciej Stachowiak  <mjs@apple.com>
2592
2593         Reviewed by Dave Hyatt (when I originally coded it).
2594
2595         WebCore part of fix for:
2596
2597         <rdar://problem/3759187> REGRESSION (Mail): implement firstRectForCharacterRange:
2598         
2599         * kwq/WebCoreBridge.h:
2600         * kwq/WebCoreBridge.mm:
2601         (-[WebCoreBridge firstRectForDOMRange:]): New method to compute the rect for a
2602         DOMRange, or if the range is split into multiple lines, the rect for the part on
2603         the first line only.
2604         
2605         * khtml/rendering/render_object.cpp:
2606         (RenderObject::caretRect): Added extraWidthToEndOfLine parameter and ditto
2607         for the overrides below.
2608         * khtml/rendering/render_object.h:
2609         * khtml/rendering/render_box.cpp:
2610         (RenderBox::caretRect):
2611         * khtml/rendering/render_box.h:
2612         * khtml/rendering/render_br.cpp:
2613         (RenderBR::caretRect):
2614         * khtml/rendering/render_br.h:
2615         * khtml/rendering/render_flow.cpp:
2616         (RenderFlow::caretRect):
2617         * khtml/rendering/render_flow.h:
2618         * khtml/rendering/render_text.cpp:
2619         (RenderText::caretRect):
2620
2621 2004-11-02  Ken Kocienda  <kocienda@apple.com>
2622
2623         Reviewed by Hyatt
2624
2625         Implemented command to insert a block in response to typing a return key (even though
2626         I am not turning that on by default with this patch....that will come later). 
2627         
2628         This new command is called InsertParagraphSeparatorCommand.
2629         
2630         Reworked the command and function names associated with inserting content into a 
2631         document. Before this patch, there were inputXXX and insertXXX variants, with the
2632         former used for more high-level actions and the latter used for lower-level stuff.
2633         However, this was confusing as the AppKit uses insertXXX for everything. This resulted
2634         in an insertXXX command going through an inputXXX WebCore step and then finally to an
2635         insertXXX WebCore step. To make this less confusing, I have changes all the names to
2636         be insertXXX, and modified the lower-level operations so that it is clear what they do.
2637         
2638         * khtml/editing/htmlediting.cpp:
2639         (khtml::EditCommandPtr::isInsertTextCommand): Name change.
2640         (khtml::EditCommand::isInsertTextCommand): Ditto.
2641         (khtml::CompositeEditCommand::inputText): Ditto.
2642         (khtml::CompositeEditCommand::insertTextIntoNode): Ditto.
2643         (khtml::CompositeEditCommand::deleteTextFromNode): Ditto.
2644         (khtml::CompositeEditCommand::replaceTextInNode): Ditto.
2645         (khtml::CompositeEditCommand::deleteInsignificantText): Name changes in implementation.
2646         (khtml::CompositeEditCommand::isLastVisiblePositionInNode): Ditto.
2647         (khtml::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand): Class name change, was DeleteTextCommand.
2648         (khtml::DeleteFromTextNodeCommand::~DeleteFromTextNodeCommand): Ditto.
2649         (khtml::DeleteFromTextNodeCommand::doApply): Ditto.
2650         (khtml::DeleteFromTextNodeCommand::doUnapply): Ditto.
2651         (khtml::DeleteSelectionCommand::performGeneralDelete): Ditto.
2652         (khtml::DeleteSelectionCommand::fixupWhitespace): Ditto.
2653         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Ditto.
2654         (khtml::InsertIntoTextNode::InsertIntoTextNode): Class name change.
2655         (khtml::InsertIntoTextNode::~InsertIntoTextNode): Ditto.
2656         (khtml::InsertIntoTextNode::doApply): Ditto.
2657         (khtml::InsertIntoTextNode::doUnapply): Ditto.
2658         (khtml::InsertLineBreakCommand::InsertLineBreakCommand): Class name change, was InsertNewlineCommand.
2659         (khtml::InsertLineBreakCommand::insertNodeAfterPosition):
2660         (khtml::InsertLineBreakCommand::insertNodeBeforePosition):
2661         (khtml::InsertLineBreakCommand::doApply):
2662         (khtml::InsertNodeBeforeCommand::InsertNodeBeforeCommand): Code moved. No changes.
2663         (khtml::InsertNodeBeforeCommand::~InsertNodeBeforeCommand): Ditto.
2664         (khtml::InsertNodeBeforeCommand::doApply): Ditto.
2665         (khtml::InsertNodeBeforeCommand::doUnapply): Ditto.
2666         (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): New command.
2667         (khtml::InsertParagraphSeparatorCommand::doApply):
2668         (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):
2669         Class name change, was InsertNewlineCommandInQuotedContentCommand.
2670         (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto.
2671         (khtml::InsertParagraphSeparatorInQuotedContentCommand::isMailBlockquote): Ditto.
2672         (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
2673         (khtml::InsertTextCommand::InsertTextCommand): Class name change, was InputTextCommand.
2674         (khtml::InsertTextCommand::doApply): Ditto.
2675         (khtml::InsertTextCommand::deleteCharacter): Ditto.
2676         (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
2677         (khtml::InsertTextCommand::input): Ditto.
2678         (khtml::InsertTextCommand::insertSpace): Ditto.
2679         (khtml::InsertTextCommand::isInsertTextCommand): Ditto.
2680         (khtml::TypingCommand::insertLineBreak): Name change, was insertNewline.
2681         (khtml::TypingCommand::insertParagraphSeparatorInQuotedContent): Name change, was insertNewlineInQuotedContent.
2682         (khtml::TypingCommand::insertParagraphSeparator): New function.
2683         (khtml::TypingCommand::doApply): Name changes, as above.
2684         (khtml::TypingCommand::insertText): Ditto.
2685         (khtml::TypingCommand::deleteKeyPressed): Ditto.
2686         (khtml::TypingCommand::preservesTypingStyle): Ditto.
2687         * khtml/editing/htmlediting.h:
2688         (khtml::DeleteFromTextNodeCommand::node): Name change.
2689         (khtml::DeleteFromTextNodeCommand::offset): Ditto.
2690         (khtml::DeleteFromTextNodeCommand::count): Ditto.
2691         (khtml::InsertIntoTextNode::text): Ditto.
2692         (khtml::InsertNodeBeforeCommand::insertChild): Ditto.
2693         (khtml::InsertNodeBeforeCommand::refChild): Ditto.
2694         (khtml::TypingCommand::): Ditto.
2695         * khtml/editing/jsediting.cpp: Name changes, as above.
2696         * kwq/WebCoreBridge.h:
2697         * kwq/WebCoreBridge.mm:
2698         (-[WebCoreBridge insertLineBreak]): Name change, was insertNewline.
2699         (-[WebCoreBridge insertParagraphSeparator]): New function.
2700         (-[WebCoreBridge insertParagraphSeparatorInQuotedContent]): Name change, was insertNewlineInQuotedContent.
2701
2702 2004-11-01  Kevin Decker  <kdecker@apple.com>
2703
2704         Reviewed by rjw.
2705
2706         fixed <rdar://problem/3681094> Crash in KJS::WindowFunc::tryCall with application/xhtml+xml Content-Type
2707         once and for all. 
2708
2709         * khtml/ecma/kjs_window.cpp:
2710         (WindowFunc::tryCall): Added a nil check in the case of an empty document lacking a baseURL().
2711
2712 2004-11-01  Darin Adler  <darin@apple.com>
2713
2714         Reviewed by Hyatt.
2715
2716         - fixed <rdar://problem/3859381> REGRESSION (167-168): text in form fields should not use body's text color
2717
2718         * khtml/css/html4.css: Use color: initial for textarea and related ones.
2719
2720 2004-11-01  Ken Kocienda  <kocienda@apple.com>
2721
2722         Reviewed by John
2723
2724         Fix for this bug:
2725         
2726         <rdar://problem/3775920> REGRESSION (Mail): Centering doesn't work in HTML mail
2727
2728         * khtml/css/css_computedstyle.cpp:
2729         (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Factor out the 
2730         implementation here into new copyPropertiesInSet helper. This now calls the
2731         generalized copyPropertiesInSet function with the arguments needed to make copying
2732         inheritable work.
2733         * khtml/css/css_computedstyle.h:
2734         * khtml/css/css_valueimpl.cpp:
2735         (CSSStyleDeclarationImpl::diff): Move this function here from css_computedstyle.cpp.
2736         In order to do apply block properties, "regular" style declarations need to do style
2737         diffs as well.
2738         (CSSStyleDeclarationImpl::copyBlockProperties): New helper. Just like copyInheritableProperties
2739         except that it uses a different set of properties that apply only to blocks.
2740         (CSSStyleDeclarationImpl::copyPropertiesInSet): New helper that looks at a style declaration
2741         and copies out those properties listed in a pre-defined set.
2742         * khtml/css/css_valueimpl.h:
2743         * khtml/editing/htmlediting.cpp:
2744         (khtml::StyleChange::StyleChange): Modified to work with style changes that apply to a whole
2745         block, factoring out some of the special case code that should now only run in the inline case.
2746         (khtml::StyleChange::init): Factored out the code that now is in checkForLegacyHTMLStyleChange.
2747         (khtml::StyleChange::checkForLegacyHTMLStyleChange): New helper for case where we want
2748         special handling for "legacy" HTML styles like <B> and <I>.
2749         (khtml::ApplyStyleCommand::doApply): Much refactoring in this class to divide up the work of
2750         style changes into different kinds. CSS specifies certain properties only apply to certain
2751         element types. This set of changes now recognizes two such separate cases: styles that apply
2752         to blocks, and styles that apply to inlines.
2753         (khtml::ApplyStyleCommand::applyBlockStyle): New function to handle apply styles to whole blocks.
2754         (khtml::ApplyStyleCommand::applyInlineStyle): New function to handle apply styles to inlines.
2755         (khtml::ApplyStyleCommand::isHTMLStyleNode): Is now passed a CSSStyleDeclarationImpl to work
2756         with rather than working on the CSSStyleDeclarationImpl member variable of the class. This is
2757         done so that the function can be passed a portion of the styles being applied so that block styles
2758         and inline styles can be handled separately.
2759         (khtml::ApplyStyleCommand::removeCSSStyle): Ditto.
2760         (khtml::ApplyStyleCommand::removeBlockStyle): New function to handle removing styles from whole blocks.
2761         (khtml::ApplyStyleCommand::removeInlineStyle): New function to removing styles from inlines.
2762         (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): New function to handle applying style to whole blocks.
2763         (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): New function to handle applying style to inlines.
2764         * khtml/editing/htmlediting.h:
2765         (khtml::StyleChange::): Changed as described above.
2766         (khtml::StyleChange::usesLegacyStyles):
2767         (khtml::EditCommand::setEndingSelectionNeedsLayout): New function to that tells the ending selection
2768         it needs to layout, even though it has not changed position in the DOM. For instance, this is needed 
2769         when text align changes.
2770         * khtml/khtml_part.cpp:
2771         (KHTMLPart::setTypingStyle): Put in an early bail-out in the case where the current style matches
2772         the passed-in argument.
2773         (KHTMLPart::applyStyle): Modify this function so that block styles are applied when the selection
2774         is a caret. Formerly, this just set typing style and made no visible changes to the document.
2775
2776         New tests.
2777
2778         * layout-tests/editing/editing.js: Added some glue to change text align.
2779         * layout-tests/editing/style/block-style-001-expected.txt: Added.
2780         * layout-tests/editing/style/block-style-001.html: Added.
2781         * layout-tests/editing/style/block-style-002-expected.txt: Added.
2782         * layout-tests/editing/style/block-style-002.html: Added.
2783         * layout-tests/editing/style/block-style-003-expected.txt: Added.
2784         * layout-tests/editing/style/block-style-003.html: Added.
2785
2786 === Safari-169 ===
2787
2788 2004-10-29  Darin Adler  <darin@apple.com>
2789
2790         Reviewed by Kevin.
2791
2792         - fixed <rdar://problem/3751619> Safari crash in khtml::CircularSearchBuffer::append(QChar const&)
2793
2794         * khtml/editing/visible_text.cpp: (khtml::findPlainText): Fix exit condition to check for break
2795         before advancing one character; before it did it backwards.
2796
2797 2004-10-29  Chris Blumenberg  <cblu@apple.com>
2798
2799         Fixed: <rdar://problem/3853262> REGRESSION(166-168) gmail gets blank page when loading
2800
2801         Reviewed by kocienda, adele.
2802
2803         * khtml/rendering/render_frames.cpp:
2804         (RenderPartObject::updateWidget): remove infinite frame recursion check for iframes
2805
2806 2004-10-29  Darin Adler  <darin@apple.com>
2807
2808         Reviewed by Chris.
2809
2810         - fixed <rdar://problem/3857395> clicking on calendar in Apple Travel site crashes Safari in invalidateClick (getthere.net)
2811
2812         * khtml/khtmlview.cpp:
2813         (KHTMLView::viewportMousePressEvent): Use a SharedPtr<KHTMLView> to make sure the KHTMLView is not
2814         deleted before this function finishes running.
2815         (KHTMLView::viewportMouseDoubleClickEvent): Ditto.
2816         (KHTMLView::viewportMouseReleaseEvent): Ditto.
2817         (KHTMLView::dispatchMouseEvent): Removed ref/deref pairs that aren't needed since dispatchEvent
2818         is guaranteed to do ref/deref as needed.
2819
2820         * kwq/KWQObject.mm: (QObject::startTimer): Fixed a comment.
2821
2822 2004-10-28  Chris Blumenberg  <cblu@apple.com>
2823
2824         Enabled XSLT on Panther. See intrigue mail for compiling instructions.
2825
2826         Reviewed by darin.
2827
2828         * WebCore.pbproj/project.pbxproj: link against xslt unconditionally, link against specific version of libxml on Panther
2829         * WebCorePrefix.h: always use XSLT
2830
2831 2004-10-28  Ken Kocienda  <kocienda@apple.com>
2832
2833         Reviewed by Chris
2834
2835         Fix for these bugs:
2836         
2837         <rdar://problem/3854848> Tiger Mail Crash in WebCore - khtml::CompositeEditCommand::insertNodeAfter
2838         <rdar://problem/3803832> REGRESSION (Mail): incorrect behavior after Return + Delete in quoted text
2839         
2840         * khtml/editing/htmlediting.cpp:
2841         (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Added node pointer class members 
2842         to initialization list, zeroing them out.
2843         (khtml::DeleteSelectionCommand::canPerformSpecialCaseBRDelete): New special-case helper to
2844         handle a delete of content in special cases where the only thing selected is a BR. This
2845         code path is much simpler than the newly-named performGeneralDelete, and detects when no
2846         content merging should be done between blocks. This aspect of the change fixes 3854848.
2847         One of the special cases added fixes 3803832.
2848         (khtml::DeleteSelectionCommand::performGeneralDelete): Renamed, from performDelete.
2849         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Made this helper be a no-arg function, just
2850         like the other helpers in this class.
2851         (khtml::DeleteSelectionCommand::clearTransientState): Fix cut and paste error in deref code.
2852         (khtml::DeleteSelectionCommand::doApply): Updated for changed helpers.
2853         * khtml/editing/htmlediting.h: Added new helper and changed an old one.
2854
2855 2004-10-28  Chris Blumenberg  <cblu@apple.com>
2856
2857         Fixed: <rdar://problem/3856913> Panther-only crash in QString code copying front page of store.apple.com
2858
2859         Reviewed by darin.
2860
2861         * kwq/KWQKHTMLPart.mm:
2862         (KWQKHTMLPart::attributedString): check that the renderer is a list item before making list item calls on it
2863
2864 2004-10-28  Ken Kocienda  <kocienda@apple.com>
2865
2866         Reviewed by Harrison
2867
2868         Reorganization of delete command functionality so that doApply is not
2869         several hundred lines long. This is not a squeaky-clean cleanup, but
2870         it is a step in the right direction. No functionality changes.
2871
2872         * khtml/editing/htmlediting.cpp:
2873         (khtml::DeleteSelectionCommand::DeleteSelectionCommand):
2874         (khtml::DeleteSelectionCommand::initializePositionData): New helper.
2875         (khtml::DeleteSelectionCommand::saveTypingStyleState): Ditto.
2876         (khtml::DeleteSelectionCommand::performDelete): Ditto.
2877         (khtml::DeleteSelectionCommand::fixupWhitespace): Ditto.
2878         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Ditto.
2879         (khtml::DeleteSelectionCommand::calculateEndingPosition): Ditto.
2880         (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete): Ditto.
2881         (khtml::DeleteSelectionCommand::clearTransientState): Ditto.
2882         (khtml::DeleteSelectionCommand::doApply): Factor out code into new helpers.
2883         * khtml/editing/htmlediting.h:
2884
2885 2004-10-28  Ken Kocienda  <kocienda@apple.com>
2886
2887         Reviewed by me
2888
2889         * khtml/editing/htmlediting.cpp:
2890         (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Typo in initializer caused
2891         new mergeBlocksAfterDelete flag to be set improperly, causing layout regressions.
2892
2893 2004-10-27  Ken Kocienda  <kocienda@apple.com>
2894
2895         Reviewed by Chris
2896
2897         * khtml/editing/htmlediting.cpp:
2898         (khtml::CompositeEditCommand::deleteSelection): Added new mergeBlocksAfterDelete flag to control
2899         whether content not in the block containing the start of the selection is moved to that block
2900         after the selection is deleted.
2901         (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Ditto.
2902         (khtml::DeleteSelectionCommand::doApply): Ditto.
2903         (khtml::InputNewlineInQuotedContentCommand::InputNewlineInQuotedContentCommand): New command
2904         to handle the case of inserting a newline when in quoted content in Mail.
2905         (khtml::InputNewlineInQuotedContentCommand::~InputNewlineInQuotedContentCommand): Ditto.
2906         (khtml::InputNewlineInQuotedContentCommand::isMailBlockquote): Ditto.
2907         (khtml::InputNewlineInQuotedContentCommand::isLastVisiblePositionInBlockquote): Ditto.
2908         (khtml::InputNewlineInQuotedContentCommand::doApply): Ditto.
2909         (khtml::TypingCommand::insertNewlineInQuotedContent): Support for new newline command.
2910         (khtml::TypingCommand::doApply): Ditto.
2911         (khtml::TypingCommand::preservesTypingStyle): Ditto.
2912         * khtml/editing/htmlediting.h: Add new delclarations.
2913         (khtml::TypingCommand::): Ditto.
2914         * kwq/WebCoreBridge.h: Added new bridge method called from WebKit.
2915         * kwq/WebCoreBridge.mm:
2916         (-[WebCoreBridge insertNewlineInQuotedContent]): Ditto.
2917
2918 2004-10-26  Chris Blumenberg  <cblu@apple.com>
2919
2920         Fixed: <rdar://problem/3774243> page up/down, arrow up/down, etc in Safari RSS should scroll main content
2921
2922         Reviewed by dave.
2923
2924         * khtml/ecma/kjs_dom.cpp:
2925         (DOMElementProtoFunc::tryCall): added scrollByLines and scrollByPages to HTML element for Safari RSS
2926         * khtml/ecma/kjs_dom.h:
2927         (KJS::DOMElement::):
2928         * khtml/ecma/kjs_dom.lut.h:
2929         (KJS::):
2930
2931 2004-10-26  David Hyatt  <hyatt@apple.com>
2932
2933         Fix for 3848214, deleting a partial word left a repaint artifact if the partial word was pulled back onto
2934         the previous line.
2935         
2936         Reviewed by kocienda
2937
2938         * khtml/rendering/bidi.cpp:
2939         (khtml::RenderBlock::layoutInlineChildren):
2940
2941 2004-10-26  David Hyatt  <hyatt@apple.com>
2942
2943         Convert selectionRect() from using a list to a dict and patch it to be like setSelection.  It was still trying
2944         to use the old dirty bit optimization (which had been removed), and so it was pathologically slow on large documents.
2945         
2946         Reviewed by kocienda
2947
2948         * khtml/rendering/render_canvas.cpp:
2949         (RenderCanvas::selectionRect):
2950         * khtml/rendering/render_object.h:
2951         (khtml::RenderObject::hasSelectedChildren):
2952
2953 2004-10-26  Ken Kocienda  <kocienda@apple.com>
2954
2955         Reviewed by Hyatt
2956         
2957         Fix for this bug::
2958         
2959         <rdar://problem/3851164> mail crashed when I pasted a large amount of text into a reply
2960
2961         * khtml/editing/htmlediting.cpp:
2962         (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): This now returns bool to
2963         let the caller know if a placeholder was removed.
2964         (khtml::ReplaceSelectionCommand::doApply): Use the bool return value from the call to
2965         removeBlockPlaceholderIfNeeded. If true, shift the selection to the now-empty block. In
2966         some cases, the selection was still set on the removed BR, and this was the cause of the
2967         crash.
2968         * khtml/editing/htmlediting.h: Change removeBlockPlaceholderIfNeeded return type.
2969
2970 2004-10-26  Darin Adler  <darin@apple.com>
2971
2972         Reviewed by Chris.
2973
2974         - fixed <rdar://problem/3851301> leak of one NSCFDictionary for each XMLHttpRequest issued
2975
2976         * kwq/KWQLoader.mm: (KWQServeSynchronousRequest): Add a release.
2977
2978 2004-10-26  Ken Kocienda  <kocienda@apple.com>
2979
2980         Reviewed by John
2981
2982         * khtml/editing/htmlediting.cpp:
2983         (khtml::CompositeEditCommand::deleteInsignificantText): Do not call replaceText
2984         with a zero-length string. That triggers an assert. Call deleteText instead, 
2985         using the same indices that are passed to replaceText.
2986         
2987         Cleaned up the asserts in these three functions below, making them
2988         more consistent. This is not needed for the fix, but I tripped over
2989         these in the course of debugging.
2990         
2991         (khtml::InsertTextCommand::InsertTextCommand):
2992         (khtml::InsertTextCommand::doApply):
2993         (khtml::InsertTextCommand::doUnapply):
2994
2995 2004-10-25  Adele Amchan <adele@apple.com>
2996
2997         Reviewed by Darin.
2998
2999         * khtml/xml/dom_docimpl.cpp: (DocumentImpl::inDesignMode): made inDesignMode const
3000         * khtml/xml/dom_docimpl.h:
3001
3002 2004-10-25  Adele Amchan  <adele@apple.com>
3003
3004         Reviewed by me, code change by Darin.
3005
3006         * khtml/xml/dom_docimpl.cpp: Moved design mode code outside the XSLT ifdef.
3007
3008 2004-10-25  Ken Kocienda  <kocienda@apple.com>
3009
3010         Oops. These two test results changed with my last checkin, for the better.
3011
3012         * layout-tests/editing/deleting/delete-3800834-fix-expected.txt
3013         * layout-tests/editing/inserting/insert-3775316-fix-expected.txt
3014
3015 2004-10-25  Ken Kocienda  <kocienda@apple.com>
3016
3017         Reviewed by Chris
3018
3019         Fix for this bug:
3020         
3021         <rdar://problem/3820349> REGRESSION (Mail): select all, delete does not always delete everything
3022
3023         * khtml/editing/htmlediting.cpp:
3024         (khtml::DeleteSelectionCommand::startPositionForDelete): New helper that determines when to
3025         expand the selection outwards when the selection is on the visible boundary of a root
3026         editable element. This fixes the bug. Note that this function also contains a little code
3027         I factored out of doApply: it also takes care of adjusting the selection in the smart delete case.
3028         (khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.
3029         (khtml::DeleteSelectionCommand::doApply): Call new helpers. Refactored out the code as described.
3030         * khtml/editing/htmlediting.h: Declare new helpers.
3031         * layout-tests/editing/deleting/delete-select-all-001-expected.txt: Added.
3032         * layout-tests/editing/deleting/delete-select-all-001.html: Added.
3033         * layout-tests/editing/deleting/delete-select-all-002-expected.txt: Added.
3034         * layout-tests/editing/deleting/delete-select-all-002.html: Added.
3035         * layout-tests/editing/deleting/delete-select-all-003-expected.txt: Added.
3036         * layout-tests/editing/deleting/delete-select-all-003.html: Added.
3037
3038 2004-10-25  Ken Kocienda  <kocienda@apple.com>
3039
3040         Added some more editing layout tests.
3041
3042         * layout-tests/editing/deleting/delete-ws-fixup-001-expected.txt: Added.
3043         * layout-tests/editing/deleting/delete-ws-fixup-001.html: Added.
3044         * layout-tests/editing/deleting/delete-ws-fixup-002-expected.txt: Added.
3045         * layout-tests/editing/deleting/delete-ws-fixup-002.html: Added.
3046         * layout-tests/editing/deleting/delete-ws-fixup-003-expected.txt: Added.
3047         * layout-tests/editing/deleting/delete-ws-fixup-003.html: Added.
3048         * layout-tests/editing/deleting/delete-ws-fixup-004-expected.txt: Added.
3049         * layout-tests/editing/deleting/delete-ws-fixup-004.html: Added.
3050         * layout-tests/editing/inserting/typing-003-expected.txt: Added.
3051         * layout-tests/editing/inserting/typing-003.html: Added.
3052
3053 2004-10-25  Ken Kocienda  <kocienda@apple.com>
3054
3055         Reviewed by John
3056
3057         * khtml/rendering/bidi.cpp:
3058         (khtml::RenderBlock::findNextLineBreak): I did not get my fix for 3848343 and 3848224
3059         yesterday quite right: words that should have been placed on the next line were instead
3060         appearing on the line before, beyond the right margin. This was a one-word only error
3061         based on moving the line break object when it should have stayed put. Here is the rule:
3062         The line break object only moves to after the whitespace on the end of a line if that 
3063         whitespace caused line overflow when its width is added in.
3064
3065 2004-10-25  Adele Amchan  <adele@apple.com>
3066
3067         Reviewed by Darin.
3068  
3069         Fix for <rdar://problem/3619890> Feature request: designMode        
3070
3071         This change implements the designMode property of a document.  This is an IE property that is also supported by Mozilla.  
3072         This will enable more JS editing compatibility.
3073
3074         * khtml/ecma/kjs_html.cpp:
3075         (KJS::HTMLDocument::tryGet): added case for designMode
3076         (KJS::HTMLDocument::putValue): added case for designMode
3077         * khtml/ecma/kjs_html.lut.h: (KJS::): regenerated
3078         * khtml/khtml_part.cpp: (KHTMLPart::isContentEditable): Now returns designMode value
3079         * khtml/xml/dom_docimpl.cpp:
3080         (DocumentImpl::DocumentImpl): initialize m_designMode member variable
3081         (DocumentImpl::setDesignMode): added function to assign m_designMode value
3082         (DocumentImpl::getDesignMode): return m_designMode value
3083         (DocumentImpl::inDesignMode): if designMode is inherited, this will find the appropriate parent document designMode and return that value. 
3084             Otherwise, it will just return the m_designMode value.
3085         (DocumentImpl::parentDocument):
3086         * khtml/xml/dom_docimpl.h: (DOM::DocumentImpl::): added InheritedBool enum, prototypes, and m_designMode member variable.
3087         * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::isContentEditable): added check for isContentEditable function in KHTMLPart
3088
3089 2004-10-22  Ken Kocienda  <kocienda@apple.com>
3090
3091         Reviewed by Hyatt
3092
3093         Fix for this bug:
3094         
3095         <rdar://problem/3844662> REGRESSION (Mail): Style changes can affect adjacent, unselected text
3096
3097         * khtml/editing/htmlediting.cpp:
3098         (khtml::ApplyStyleCommand::doApply): Move end position downstream to be sure we remove style from
3099         everything that could be affected.
3100         (khtml::ApplyStyleCommand::removeCSSStyle): Comma in intended function call was outside the
3101         braces, making it act as a comma operator, with a zero value as the right value!!! This made
3102         an important check always fail!!! It turns out that we do not want the constant at all, since
3103         that constant is only needed when checking a computed style, not an inline style as is being
3104         done here.
3105         (khtml::ApplyStyleCommand::removeStyle): Call nodeFullySelected with new interface.
3106         (khtml::ApplyStyleCommand::nodeFullySelected): Change interface and implementation to rely on
3107         RangeImpl::compareBoundaryPoints to perform the required check.
3108         * khtml/editing/htmlediting.h: Changed nodeFullySelected function interface.
3109
3110 2004-10-22  Ken Kocienda  <kocienda@apple.com>
3111
3112         Reviewed by Hyatt
3113         
3114         Fix for this bugs:
3115         
3116         <rdar://problem/3848343> REGRESSION (Mail, 166-168u): Typed text after space at end of line before block quote does not appear
3117         <rdar://problem/3848224> REGRESSION (Mail): space typed at end of line vanishes after typing next character
3118     
3119         * khtml/rendering/bidi.cpp:
3120         (khtml::RenderBlock::findNextLineBreak): When the khtmlLineBreak is in AFTER_WHITE_SPACE mode, as
3121         it is when we are editing, add in the space of the current character when calculating the width
3122         of committed plus uncommitted characters. If this value exceeds the width of the line, move up
3123         the line break object and call skipWhitespace to move past the end of the whitespace.
3124
3125 === Safari-168 ===
3126
3127 2004-10-22  Ken Kocienda  <kocienda@apple.com>
3128
3129         * WebCore.pbproj/project.pbxproj:
3130          Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
3131
3132 2004-10-21  David Hyatt  <hyatt@apple.com>
3133
3134         Reviewed by darin
3135         
3136         Clean up the inline run function so that it doesn't return incorrect answers when making children non-inline.
3137         
3138         <rdar://problem/3848724> REGRESSION (166-168u): RenderText::layout called, firing assertion that kills Mail
3139         <rdar://problem/3848357> RenderText::layout called, firing assertion that kills Safari (www.apple.com/downloads/macosx)
3140         
3141         * khtml/rendering/render_block.cpp:
3142         (khtml::getInlineRun):
3143         (khtml::RenderBlock::makeChildrenNonInline):
3144
3145 2004-10-21  David Hyatt  <hyatt@apple.com>
3146
3147         Fix for 3810389, crash because of continuation() craziness.  Revert back to the old behavior of
3148         making sure that all line boxes get deleted and recreated when inlines are split because of a block.
3149         
3150         Reviewed darin
3151
3152         * khtml/rendering/render_inline.cpp:
3153         (RenderInline::splitFlow):
3154
3155 2004-10-21  Ken Kocienda  <kocienda@apple.com>
3156
3157         Reviewed by Darin
3158         
3159         Significant improvement to the way that whitespace is handled during editing.
3160
3161         * khtml/editing/htmlediting.cpp:
3162         (khtml::CompositeEditCommand::deleteInsignificantText): New functions (there are actually
3163         two being added with this name) that delete "insignificant" unrendered text.
3164         (khtml::CompositeEditCommand::deleteInsignificantTextDownstream): Takes a position,
3165         calculates the downstream position to use as the endpoint for the deletion, and
3166         then calls deleteInsignificantText with this start and end.
3167         (khtml::DeleteSelectionCommand::doApply): Call new deleteInsignificantTextDownstream function.
3168         (khtml::InputNewlineCommand::doApply): Ditto.
3169         (khtml::InputTextCommand::input): Ditto.
3170         * khtml/editing/htmlediting.h: Add new declarations.
3171         
3172         Modified layout test results:
3173         * layout-tests/editing/deleting/delete-block-merge-contents-016-expected.txt:
3174         * layout-tests/editing/deleting/delete-block-merge-contents-017-expected.txt:
3175         * layout-tests/editing/deleting/delete-contiguous-ws-001-expected.txt:
3176         * layout-tests/editing/deleting/delete-selection-001-expected.txt:
3177         * layout-tests/editing/deleting/delete-tab-001-expected.txt:
3178         * layout-tests/editing/deleting/delete-tab-004-expected.txt:
3179         * layout-tests/editing/deleting/delete-trailing-ws-001-expected.txt:
3180         * layout-tests/editing/inserting/insert-3659587-fix-expected.txt:
3181         * layout-tests/editing/inserting/insert-3775316-fix-expected.txt:
3182         * layout-tests/editing/inserting/insert-3778059-fix-expected.txt:
3183         * layout-tests/editing/inserting/insert-br-001-expected.txt:
3184         * layout-tests/editing/inserting/insert-br-004-expected.txt:
3185         * layout-tests/editing/inserting/insert-br-005-expected.txt:
3186         * layout-tests/editing/inserting/insert-br-006-expected.txt:
3187         * layout-tests/editing/inserting/insert-tab-001-expected.txt:
3188         * layout-tests/editing/inserting/insert-tab-002-expected.txt:
3189         * layout-tests/editing/inserting/insert-tab-004-expected.txt:
3190         * layout-tests/editing/inserting/insert-text-with-newlines-expected.txt:
3191         * layout-tests/editing/inserting/typing-001-expected.txt:
3192         * layout-tests/editing/inserting/typing-around-br-001-expected.txt:
3193         * layout-tests/editing/inserting/typing-around-image-001-expected.txt:
3194         * layout-tests/editing/style/typing-style-003-expected.txt:
3195         * layout-tests/editing/undo/redo-typing-001-expected.txt:
3196         * layout-tests/editing/undo/undo-typing-001-expected.txt:
3197
3198 2004-10-21  David Hyatt  <hyatt@apple.com>
3199
3200         Fix for 3847054, assertion failure in RenderText::layout() on news.com page.  Fix getInlineRun so that
3201         it no longer breaks early (thus causing some children not to get properly wrapped by anonymous blocks).
3202         
3203         Reviewed by darin
3204
3205         * khtml/rendering/render_block.cpp:
3206         (khtml::getInlineRun):
3207
3208 2004-10-20  David Hyatt  <hyatt@apple.com>
3209
3210         Add better dumping of overflow information for scrolling regions.
3211
3212         Fix for 3726524, crash in updateLayerPosition.  Make sure anonymous elements properly remove themselves
3213         from the render tree so that layers and so forth are cleaned up.
3214         
3215         Reviewed by darin
3216
3217         * khtml/rendering/render_container.cpp:
3218         (RenderContainer::detach):
3219         * khtml/rendering/render_layer.h:
3220         (khtml::RenderLayer::scrollXOffset):
3221         (khtml::RenderLayer::scrollYOffset):
3222         * kwq/KWQRenderTreeDebug.cpp:
3223         (write):
3224
3225 2004-10-20  David Hyatt  <hyatt@apple.com>
3226
3227         Fix for 3791146, make sure all lines are checked when computing overflow.
3228         
3229         Reviewed by kocienda
3230
3231         * khtml/rendering/bidi.cpp:
3232         (khtml::RenderBlock::computeHorizontalPositionsForLine):
3233         (khtml::RenderBlock::layoutInlineChildren):
3234         (khtml::RenderBlock::findNextLineBreak):
3235         (khtml::RenderBlock::checkLinesForOverflow):
3236         * khtml/rendering/render_block.h:
3237
3238 2004-10-20  David Hyatt  <hyatt@apple.com>
3239
3240         Fix for 3790936, make the unicode-breaking on the layout tests match Panther.
3241         
3242         Reviewed by kocienda
3243
3244         * khtml/rendering/break_lines.cpp:
3245         (khtml::isBreakable):
3246
3247 2004-10-20  Darin Adler  <darin@apple.com>
3248
3249         Reviewed by John.
3250
3251         - fixed <rdar://problem/3317107> text input fields and text areas don't respect background color and text color CSS properties
3252
3253         * khtml/rendering/render_form.cpp: (RenderFormElement::updateFromElement):
3254         Create a palette with the background and foreground colors in it and set it on the widget.
3255
3256         * khtml/rendering/render_style.h: (khtml::StyleVisualData::operator==): No palette to compare
3257         with APPLE_CHANGES. Removed palette and palette-related function members.
3258         * khtml/rendering/render_style.cpp:
3259         (StyleVisualData::StyleVisualData): No palette to initialize with APPLE_CHANGES.
3260         (RenderStyle::diff): No palette to compare.
3261
3262         * kwq/KWQLineEdit.h: Added setPalette override. Made text function const.
3263         * kwq/KWQLineEdit.mm:
3264         (QLineEdit::setPalette): Added. Sets foreground and background color based on palette.
3265         (QLineEdit::text): Made const.
3266
3267         * kwq/KWQTextEdit.h: Added setPalette override.
3268         * kwq/KWQTextEdit.mm: (QTextEdit::setPalette): Added. Sets foreground and background color
3269         based on palette.
3270
3271         * kwq/KWQPalette.h: Removed most things, leaving only background and foreground colors
3272         per color group, and only a single color group per palette.
3273         * kwq/KWQColorGroup.mm: Removed.
3274         * kwq/KWQPalette.mm: Removed.
3275         * WebCore.pbproj/project.pbxproj: Removed KWQColorGroup.mm and KWQPalette.mm.
3276
3277         * kwq/KWQApplication.h: Removed unused palette function.
3278         * kwq/KWQApplication.mm: Ditto.
3279
3280         * kwq/KWQWidget.h: Removed unsetPalette.
3281         * kwq/KWQWidget.mm: Ditto.
3282
3283         - fixed storage leak
3284
3285         * khtml/html/html_formimpl.cpp: (DOM::HTMLGenericFormElementImpl::~HTMLGenericFormElementImpl):
3286         Roll in storage leak fix from KDE guys.
3287
3288 2004-10-19  David Hyatt  <hyatt@apple.com>
3289
3290         Reviewed by kocienda
3291
3292         More cleanup of block layout.  Eliminates the separate step for tables that dont fit on a line with a float
3293         and consolidates it with clearing.
3294
3295         Also patch dom_textimpl.cpp to reduce further the # of RenderTexts created.
3296         
3297         * khtml/rendering/render_block.cpp:
3298         (khtml::getInlineRun):
3299         (khtml::RenderBlock::layoutBlock):
3300         (khtml::RenderBlock::adjustFloatingBlock):
3301         (khtml::RenderBlock::collapseMargins):
3302         (khtml::RenderBlock::clearFloatsIfNeeded):
3303         (khtml::RenderBlock::estimateVerticalPosition):
3304         (khtml::RenderBlock::layoutBlockChildren):
3305         (khtml::RenderBlock::markAllDescendantsWithFloatsForLayout):
3306         (khtml::RenderBlock::getClearDelta):
3307         (khtml::RenderBlock::calcBlockMinMaxWidth):
3308         * khtml/rendering/render_block.h:
3309         * khtml/rendering/render_frames.cpp:
3310         (RenderFrameSet::layout):
3311         * khtml/xml/dom_textimpl.cpp:
3312         (TextImpl::rendererIsNeeded):
3313
3314         Fix for 3841060, regression with * in frames.  Reviewed by kocienda.
3315         
3316         * layout-tests/fast/frames/002-expected.txt: Added.
3317         * layout-tests/fast/frames/002.html: Added.
3318
3319  2004-10-19  Darin Adler  <darin@apple.com>
3320
3321         Reviewed by Maciej.
3322
3323         - follow-on to my fix yesterday, which broke a layout test because I rolled out a fix that Maciej had done
3324
3325         * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::write): Need to check the actual queue of external
3326         scripts being loaded here. If the current code being run is the external script itself, then we don't want
3327         to defer parsing. But loadingExtScript has to stay true until after the script runs. The old code would
3328         assume that any time we're running a script there's no need to look at loadingExtScript, but that was also
3329         wrong since there can be a script loading in that case too. Layout tests check for both problems.
3330
3331         * layout-tests/fast/tokenizer/external-script-document-write-expected.txt: Added.
3332         * layout-tests/fast/tokenizer/external-script-document-write.html: Added.
3333         * layout-tests/fast/tokenizer/resources/external-script-document-write.js: Added.
3334
3335         * layout-tests/fast/tokenizer/004.html: Fixed line endings (were CR, should be LF).
3336
3337 2004-10-18  Darin Adler  <darin@apple.com>
3338
3339         Reviewed by Dave Hyatt.
3340
3341         - fixed <rdar://problem/3807234> REGRESSION (152-153): can't get element by ID that was just written with document.write in separate JS file (lacoccinelle.net)
3342
3343         * khtml/html/htmltokenizer.cpp:
3344         (khtml::HTMLTokenizer::scriptHandler): Use !isEmpty instead of count != 0, since it's cheaper.
3345         (khtml::HTMLTokenizer::write): Roll back to the old version of the check here. The fix is that
3346         we only want to look at loadingExtScript if m_executingScript is 0.
3347
3348 2004-10-18  Ken Kocienda  <kocienda@apple.com>
3349
3350         Reviewed by Hyatt
3351
3352         Fix for this bug:
3353         
3354         <rdar://problem/3840907> textedit doesn't render italic or bold text in html documents
3355
3356         * khtml/css/css_valueimpl.cpp:
3357         (CSSPrimitiveValueImpl::getStringValue): This function did not return string values for idents.
3358         Also changed the return value to be DOMString, rather than DOMStringImpl, to deal with the 
3359         lifecycle issues associated with creating a string to be returned in the ident case.
3360         * khtml/css/css_valueimpl.h: Change getStringValue to return DOMString rather than DOMStringImpl.
3361         * khtml/css/cssstyleselector.cpp:
3362         (khtml::CSSStyleSelector::applyProperty): Two calls of getStringValue needed updating.
3363
3364 2004-10-18  Chris Blumenberg  <cblu@apple.com>
3365
3366         Fixed: <rdar://problem/3770135> hang loading page with EMBED tag pointing to same page (tridentantennas.co.uk)
3367
3368         Reviewed by kocienda.
3369
3370         * khtml/rendering/render_frames.cpp:
3371         (RenderPartObject::updateWidget): use completeURL before comparing the URL of the plug-in with the base URL of the document when avoiding frame recursion
3372
3373 2004-10-15  Chris Blumenberg  <cblu@apple.com>
3374
3375         Fixed: <rdar://problem/3841774> would like to get NSColor from DOM-CSS
3376
3377         Reviewed by john.
3378
3379         * kwq/DOM-CSS.mm:
3380         (-[DOMRGBColor _color]): new, returns getNSColor on KWQColor
3381         * kwq/DOMPrivate.h:
3382
3383 2004-10-15  Ken Kocienda  <kocienda@apple.com>
3384
3385         Reviewed by Hyatt
3386
3387         * khtml/rendering/bidi.cpp:
3388         (khtml::RenderBlock::skipNonBreakingSpace): Also need to forego the
3389         skipping after a clean line break, in addition to the cases already 
3390         checked for.
3391         * layout-tests/editing/inserting/insert-br-007-expected.txt: Added.
3392         * layout-tests/editing/inserting/insert-br-007.html: Added.
3393         * layout-tests/editing/inserting/insert-br-008-expected.txt: Added.
3394         * layout-tests/editing/inserting/insert-br-008.html: Added.
3395
3396 === Safari-167 ===
3397
3398 2004-10-14  Ken Kocienda  <kocienda@apple.com>
3399
3400         Reviewed by John
3401
3402         Fix for this bug:
3403         
3404         <rdar://problem/3839989> REGRESSION (Mail): Left arrow does nothing after inserting attachment
3405
3406         * khtml/editing/visible_position.cpp:
3407         (khtml::VisiblePosition::deepEquivalent): Remove code that attempted to bridge old-style
3408         position code to new-style VisiblePosition code. In retrospect, this code was misguided.
3409         Since we do a good job of insulating external code from the internal workings of 
3410         VisiblePosition, the "hop ahead" being done here was not doing anyone any real good, and
3411         in the case of this bug, was doing harm. Simply removing this code makes the bug
3412         go away and does not cause any editing layout test regresssions.
3413
3414 2004-10-14  Ken Kocienda  <kocienda@apple.com>
3415
3416         Reviewed by Hyatt
3417
3418         * khtml/rendering/bidi.cpp:
3419         (khtml::skipNonBreakingSpace): New helper.
3420         (khtml::RenderBlock::skipWhitespace): Do not skip non-breaking spaces that are
3421         at the start of a block. This was preventing users from typing spaces in empty
3422         documents.
3423         * layout-tests/editing/inserting/insert-space-in-empty-doc-expected.txt: Added.
3424         * layout-tests/editing/inserting/insert-space-in-empty-doc.html: Added.
3425
3426 2004-10-14  Adele Amchan  <adele@apple.com>
3427
3428         Reviewed by Darin and Ken.
3429
3430         fix for <rdar://problem/3821070> null de-ref in DelectSelectionCommand::doApply()
3431
3432         This change shifts some code around so that the code that determines what typing style
3433         is in effect is called before deleteUnrenderedText is called.  Two asserts are also added
3434         to ensure that start and end nodes of the selection are in the document.
3435
3436         * khtml/editing/htmlediting.cpp: (khtml::DeleteSelectionCommand::doApply):
3437
3438 2004-10-14  Adele Amchan  <adele@apple.com>
3439
3440         Reviewed by Ken
3441         
3442         This change makes these three functions virtual so that the work is being done in KWQHTMLPart 
3443         instead of khtml_part, eliminating the need for the "#if APPLE_CHANGES" statements in the khtml code.
3444
3445         * khtml/khtml_part.cpp:
3446         (KHTMLPart::shouldBeginEditing):
3447         (KHTMLPart::shouldEndEditing):
3448         (KHTMLPart::isContentEditable):
3449         * khtml/khtml_part.h:
3450         * kwq/KWQKHTMLPart.h:
3451
3452 2004-10-14  Ken Kocienda  <kocienda@apple.com>
3453
3454         Reviewed by John
3455
3456         Final fix for these bugs:
3457         
3458         <rdar://problem/3806306> HTML editing puts spaces at start of line
3459         <rdar://problem/3814252> HTML editing groups space with word causing wrapping
3460
3461         This change sets some new CSS properties that have been added to WebCore to 
3462         enable whitespace-handling and line-breaking features that make WebView work
3463         more like a text editor.
3464
3465         * khtml/css/cssstyleselector.cpp:
3466         (khtml::CSSStyleSelector::applyProperty): Add and remove special editing CSS properties 
3467         based on property value.
3468         * khtml/html/html_elementimpl.cpp:
3469         (HTMLElementImpl::setContentEditable): Add and remove special editing CSS properties 
3470         based on attribute value.
3471         * khtml/khtml_part.cpp:
3472         (KHTMLPart::applyEditingStyleToBodyElement): New helper. Calls applyEditingStyleToElement on
3473         body element.
3474         (KHTMLPart::removeEditingStyleFromBodyElement): New helper. Calls removeEditingStyleFromElement on
3475         body element.
3476         (KHTMLPart::applyEditingStyleToElement): Adds special editing CSS properties to passed in element.
3477         (KHTMLPart::removeEditingStyleFromElement): Removes special editing CSS properties from passed in element.
3478         * khtml/khtml_part.h: Add new declarations.
3479         * kwq/WebCoreBridge.h: Ditto.
3480         * kwq/WebCoreBridge.mm:
3481         (-[WebCoreBridge applyEditingStyleToBodyElement]): Call through to similarly-named function on KHTMLPart.
3482         (-[WebCoreBridge removeEditingStyleFromBodyElement]): Ditto.
3483         (-[WebCoreBridge applyEditingStyleToElement:]): Ditto.
3484         (-[WebCoreBridge removeEditingStyleFromElement:]): Ditto.
3485
3486 2004-10-14  John Sullivan  <sullivan@apple.com>
3487
3488         Reviewed by Ken.
3489         
3490         - fixed <rdar://problem/3840052> Crash in removeBlockPlaceholderIfNeeded attaching file to empty document
3491
3492         * khtml/editing/htmlediting.cpp:
3493         (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded):
3494         needed a nil check to handle empty document case
3495
3496 2004-10-13  Maciej Stachowiak  <mjs@apple.com>
3497
3498         Reviewed by Ken.
3499
3500         <rdar://problem/3824626> Change to do colormatching for DeviceRGB colorspace causes ~11% Safari slowdown
3501         
3502         - I fixed this by turning off all colormatching for WebKit
3503         content. We might turn it back on later. For now, it's possible to
3504         turn it on temporarily by defining COLORMATCH_EVERYTHING.
3505         
3506         * WebCorePrefix.h:
3507         * khtml/ecma/kjs_html.cpp:
3508         (KJS::Context2DFunction::tryCall):
3509         (Context2D::colorRefFromValue):
3510         (Gradient::getShading):
3511         * khtml/rendering/render_canvasimage.cpp:
3512         (RenderCanvasImage::createDrawingContext):
3513         * kwq/KWQColor.mm:
3514         (QColor::getNSColor):
3515         * kwq/KWQPainter.h:
3516         * kwq/KWQPainter.mm:
3517         (CGColorFromNSColor):
3518         (QPainter::selectedTextBackgroundColor):
3519         (QPainter::rgbColorSpace):
3520         (QPainter::grayColorSpace):
3521         (QPainter::cmykColorSpace):
3522         * kwq/WebCoreGraphicsBridge.h:
3523         * kwq/WebCoreGraphicsBridge.m:
3524         (-[WebCoreGraphicsBridge createRGBColorSpace]):
3525         (-[WebCoreGraphicsBridge createGrayColorSpace]):
3526         (-[WebCoreGraphicsBridge createCMYKColorSpace]):
3527
3528 2004-10-13  Ken Kocienda  <kocienda@apple.com>
3529
3530         Reviewed by Hyatt
3531
3532         * khtml/css/css_valueimpl.cpp:
3533         (CSSStyleDeclarationImpl::merge): A little cleanup. Also, make sure m_lstValues
3534         is non-null before appending.
3535
3536 2004-10-13  Ken Kocienda  <kocienda@apple.com>
3537
3538         Update expected results for improved behavior as a result of fix to 3816768.
3539     
3540         * layout-tests/editing/deleting/delete-3775172-fix-expected.txt
3541         * layout-tests/editing/deleting/delete-3800834-fix-expected.txt
3542         * layout-tests/editing/deleting/delete-block-merge-contents-002-expected.txt
3543
3544 2004-10-13  Ken Kocienda  <kocienda@apple.com>
3545
3546         Reviewed by Richard
3547
3548         * khtml/css/css_computedstyle.cpp:
3549         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Add support to computed style
3550         for getting -khtml-line-break and -khml-nbsp-mode.
3551
3552 2004-10-13  Ken Kocienda  <kocienda@apple.com>
3553
3554         Reviewed by John
3555
3556         Fix for this bug:
3557         
3558         <rdar://problem/3816768> REGRESSION (Mail): Deleting last character in block incorrectly 
3559         moves caret out of block.
3560
3561         The issue here is that an empty block with no explicit height set by style collapses
3562         to zero height, and does so immediately after the last bit of content is removed from
3563         it (as a result of deleting text with the delete key for instance). Since zero-height
3564         blocks are not eligible caret positions, the caret jumped to the closest eligible spot.
3565         
3566         The fix is to detect when a block has not been removed itself, but has had all its 
3567         contents removed. In this case, a BR element is placed in the block, one that is
3568         specially marked as a placeholder. Later, if the block ever receives content, this
3569         placeholder is removed.
3570
3571         * khtml/editing/htmlediting.cpp:
3572         (khtml::blockPlaceholerClassString): String which acts as a placeholder marker class.
3573         (khtml::CompositeEditCommand::insertBlockPlaceholderIfNeeded): Adds a placeholder BR if needed.
3574         (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Removes a placeholder BR if needed.
3575         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Call removeBlockPlaceholderIfNeeded.
3576         Also, do some cleanup on some old, crufty code in the move logic that is just so clearly wrong 
3577         (it's very clear that we needs to be able to move more than just text nodes). This may expose
3578         bugs, but these bugs needs to be filed and fixed, not ducked. Besides, undoing this silliness
3579         made the test case in the bug work.
3580         (khtml::DeleteSelectionCommand::doApply): Call insertBlockPlaceholderIfNeeded and
3581         removeBlockPlaceholderIfNeeded.
3582         (khtml::InputTextCommand::input): Call removeBlockPlaceholderIfNeeded.
3583         (khtml::ReplaceSelectionCommand::doApply): Call removeBlockPlaceholderIfNeeded.
3584         * khtml/editing/htmlediting.h: Declare new functions.
3585
3586 2004-10-13  Richard Williamson   <rjw@apple.com>
3587
3588         Added support for -apple-dashboard-region:none.  And fixed
3589         a few computed style problems.
3590
3591         Fixed <rdar://problem/3833532> -apple-dashboard-region: none; is needed
3592         Reviewed by Hyatt.
3593
3594         * khtml/css/css_computedstyle.cpp:
3595         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
3596         * khtml/css/css_valueimpl.cpp:
3597         (CSSPrimitiveValueImpl::cssText):
3598         * khtml/css/cssparser.cpp:
3599         (CSSParser::parseValue):
3600         (CSSParser::parseDashboardRegions):
3601         * khtml/css/cssstyleselector.cpp:
3602         (khtml::CSSStyleSelector::applyProperty):
3603         * khtml/rendering/render_style.cpp:
3604         (RenderStyle::noneDashboardRegions):
3605         * khtml/rendering/render_style.h:
3606         * kwq/KWQKHTMLPart.mm:
3607         (KWQKHTMLPart::dashboardRegionsDictionary):
3608
3609 2004-10-13  David Hyatt  <hyatt@apple.com>
3610
3611         Rework block layout to clean it up and simplify it (r=kocienda).  
3612
3613         Also fixing the style sharing bug (r=mjs).
3614         
3615         * khtml/rendering/render_block.cpp:
3616         (khtml::RenderBlock::MarginInfo::MarginInfo):
3617         (khtml::RenderBlock::layoutBlock):
3618         (khtml::RenderBlock::adjustPositionedBlock):
3619         (khtml::RenderBlock::adjustFloatingBlock):
3620         (khtml::RenderBlock::handleSpecialChild):
3621         (khtml::RenderBlock::handleFloatingOrPositionedChild):
3622         (khtml::RenderBlock::handleCompactChild):
3623         (khtml::RenderBlock::insertCompactIfNeeded):
3624         (khtml::RenderBlock::handleRunInChild):
3625         (khtml::RenderBlock::collapseMargins):
3626         (khtml::RenderBlock::clearFloatsIfNeeded):
3627         (khtml::RenderBlock::estimateVerticalPosition):
3628         (khtml::RenderBlock::determineHorizontalPosition):
3629         (khtml::RenderBlock::setCollapsedBottomMargin):
3630         (khtml::RenderBlock::adjustChildIfOverhangingFloatsExist):
3631         (khtml::RenderBlock::handleBottomOfBlock):
3632         (khtml::RenderBlock::layoutBlockChildren):
3633         (khtml::RenderBlock::getAbsoluteRepaintRectIncludingFloats):
3634         (khtml::RenderBlock::addOverHangingFloats):
3635         * khtml/rendering/render_block.h:
3636         (khtml::RenderBlock::maxTopMargin):
3637         (khtml::RenderBlock::maxBottomMargin):
3638         (khtml::RenderBlock::CompactInfo::compact):
3639         (khtml::RenderBlock::CompactInfo::block):
3640         (khtml::RenderBlock::CompactInfo::matches):
3641         (khtml::RenderBlock::CompactInfo::clear):
3642         (khtml::RenderBlock::CompactInfo::set):
3643         (khtml::RenderBlock::CompactInfo::CompactInfo):
3644         (khtml::RenderBlock::MarginInfo::setAtTopOfBlock):
3645         (khtml::RenderBlock::MarginInfo::setAtBottomOfBlock):
3646         (khtml::RenderBlock::MarginInfo::clearMargin):
3647         (khtml::RenderBlock::MarginInfo::setSelfCollapsingBlockClearedFloat):
3648         (khtml::RenderBlock::MarginInfo::setTopQuirk):
3649         (khtml::RenderBlock::MarginInfo::setBottomQuirk):
3650         (khtml::RenderBlock::MarginInfo::setDeterminedTopQuirk):
3651         (khtml::RenderBlock::MarginInfo::setPosMargin):
3652         (khtml::RenderBlock::MarginInfo::setNegMargin):
3653         (khtml::RenderBlock::MarginInfo::setPosMarginIfLarger):
3654         (khtml::RenderBlock::MarginInfo::setNegMarginIfLarger):
3655         (khtml::RenderBlock::MarginInfo::setMargin):
3656         (khtml::RenderBlock::MarginInfo::atTopOfBlock):
3657         (khtml::RenderBlock::MarginInfo::canCollapseWithTop):
3658         (khtml::RenderBlock::MarginInfo::canCollapseWithBottom):
3659         (khtml::RenderBlock::MarginInfo::canCollapseTopWithChildren):
3660         (khtml::RenderBlock::MarginInfo::canCollapseBottomWithChildren):
3661         (khtml::RenderBlock::MarginInfo::selfCollapsingBlockClearedFloat):
3662         (khtml::RenderBlock::MarginInfo::quirkContainer):
3663         (khtml::RenderBlock::MarginInfo::determinedTopQuirk):
3664         (khtml::RenderBlock::MarginInfo::topQuirk):
3665         (khtml::RenderBlock::MarginInfo::bottomQuirk):
3666         (khtml::RenderBlock::MarginInfo::posMargin):
3667         (khtml::RenderBlock::MarginInfo::negMargin):
3668         (khtml::RenderBlock::MarginInfo::margin):
3669         * khtml/rendering/render_box.cpp:
3670         (RenderBox::calcAbsoluteVertical):
3671         * khtml/rendering/render_box.h:
3672         (khtml::RenderBox::marginTop):
3673         (khtml::RenderBox::marginBottom):
3674         (khtml::RenderBox::marginLeft):
3675         (khtml::RenderBox::marginRight):
3676         * khtml/rendering/render_image.cpp:
3677         (RenderImage::setImage):
3678         * khtml/rendering/render_object.cpp:
3679         (RenderObject::sizesToMaxWidth):
3680         * khtml/rendering/render_object.h:
3681         (khtml::RenderObject::collapsedMarginTop):
3682         (khtml::RenderObject::collapsedMarginBottom):
3683         (khtml::RenderObject::maxTopMargin):
3684         (khtml::RenderObject::maxBottomMargin):
3685         (khtml::RenderObject::marginTop):
3686         (khtml::RenderObject::marginBottom):
3687         (khtml::RenderObject::marginLeft):
3688         (khtml::RenderObject::marginRight):
3689         * khtml/rendering/render_text.h:
3690         (khtml::RenderText::marginLeft):
3691         (khtml::RenderText::marginRight):
3692         * khtml/xml/dom_elementimpl.cpp:
3693         (ElementImpl::recalcStyle):
3694
3695 2004-10-12  Ken Kocienda  <kocienda@apple.com>
3696
3697         Reviewed by John
3698
3699         Fix for this bug:
3700         
3701         <rdar://problem/3836158> REGRESSION (Mail): command-right-arrow moves to beginning of next line
3702
3703         * khtml/editing/selection.cpp:
3704         (khtml::endOfLastRunAt): Do not let the end of the last run on a line be a BR.
3705         This will make it seem like the run ends on the next line.
3706
3707 2004-10-12  Ken Kocienda  <kocienda@apple.com>
3708
3709         Reviewed by Hyatt
3710
3711         Fix for this bug:
3712         
3713         <rdar://problem/3836986> Delete code removes elements of table structure; can result in very broken-looking web pages
3714
3715         * khtml/editing/htmlediting.cpp:
3716         (khtml::isTableStructureNode): New helper. Determines whether a node is a table cell,
3717         row, section, or column.
3718         (khtml::CompositeEditCommand::removeFullySelectedNode): New helper that recurses into elements
3719         of table structure when doing deletes, rather than deleting the structure elements themselves.
3720         (khtml::DeleteSelectionCommand::moveNodesAfterNode): Do not move content between elements
3721         of table structure. We may want to revisit this some day, but this seems like the best behavior
3722         to me now.
3723         (khtml::DeleteSelectionCommand::doApply): Call removeFullySelectedNode instead of removeNode
3724         where needed.
3725         * khtml/editing/htmlediting.h: Add declarations for new functions.
3726
3727 2004-10-12  Richard Williamson   <rjw@apple.com>
3728
3729         Fixed access to DOM object via WebScriptObject API.
3730         The execution context for DOM objects wasn't being found.       
3731         <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
3732         Reviewed by Chris
3733
3734         Fixed <rdar://problem/3831063> regions use left offset instead of top offset
3735         Reviewed by John
3736
3737         * khtml/khtml_part.h:
3738         * khtml/rendering/render_object.cpp:
3739         (RenderObject::addDashboardRegions):
3740         * kwq/DOM.mm:
3741         (-[DOMNode isContentEditable]):
3742         (-[DOMNode KJS::Bindings::]):
3743         * kwq/KWQKHTMLPart.h:
3744         * kwq/KWQKHTMLPart.mm:
3745         (KWQKHTMLPart::executionContextForDOM):
3746
3747 2004-10-12  Ken Kocienda  <kocienda@apple.com>
3748
3749         Reviewed by Hyatt
3750
3751         Fix for this bug:
3752
3753         <rdar://problem/3834779> Mail crashes when editing HTML message - khtml::Selection::layout()
3754     
3755         * kwq/KWQKHTMLPart.mm:
3756         (KWQKHTMLPart::styleForSelectionStart): Table code seems to be more robust when the call to
3757         insert our style-checking node is done with an appendChild rather than an insertBefore. Note 
3758         that this table-related problem was exposed by fixing Selection::layout(), which I did
3759         yesterday. This change simply improves things even more so that we do not crash in the
3760         scenario described in the bug.
3761
3762 2004-10-11  Ken Kocienda  <kocienda@apple.com>
3763
3764         Reviewed by John
3765
3766         This is a partial fix to this bug:
3767         
3768         <rdar://problem/3832886> increase quote level on new mail document leads to immediate 
3769         crash in caret painting code
3770         
3771         To eliminate the bad behavior for good, I have done some investigations in Mail code,
3772         and I have sent a suggested code change on to Grant. Basically, Mail can't add empty
3773         blocks (like blockquote elements used for quoting) to documents without giving those 
3774         blocks some content (so they have a height).
3775
3776         I added some other crash protections below.
3777
3778         * khtml/editing/selection.cpp:
3779         (khtml::Selection::layout): Check for non-null position after calls to VisiblePosition, since
3780         the VisiblePosition constructors may fail to find a visible spot in the document. Also, add
3781         a couple position-has-renderer assertion checks.
3782         * kwq/KWQKHTMLPart.mm:
3783         (KWQKHTMLPart::styleForSelectionStart): Take out pos.isNotNull() assertion since VisiblePosition
3784         may not yield a position. This assertion is a holdover from before we had VisiblePosition.
3785         (KWQKHTMLPart::fontForSelection): Rearrange the code a little to deal with possible null results from
3786         calls to helpers.
3787
3788 2004-10-11  Darin Adler  <darin@apple.com>
3789
3790         Reviewed by John.
3791
3792         - fixed <rdar://problem/3834230> empty table can result in division by 0
3793
3794         * khtml/rendering/render_table.cpp: (RenderTableSection::layoutRows):
3795         Added 0 check; rolled in from KDE.
3796
3797 2004-10-11  Darin Adler  <darin@apple.com>
3798
3799         Reviewed by John.
3800
3801         - fixed <rdar://problem/3818712> form checkbox value property is read only
3802
3803         The underlying problem was that we were storing two separate values for all
3804         form elements; one for the value property (JavaScript) and the other for the
3805         value attribute (DOM). This is a good idea for text input, but not for other types.
3806
3807         * khtml/html/html_formimpl.h: Changed setValue to take a const DOMString reference.
3808         Added private storesValueSeparateFromAttribute function.
3809         * khtml/html/html_formimpl.cpp:
3810         (DOM::HTMLInputElementImpl::setType): Handle type changes, including detaching and re-attaching
3811         if type changed, and moving value from m_value to ATTR_VALUE and vice versa.
3812         (DOM::HTMLInputElementImpl::type): Added a case for ISINDEX and moved the default out of the
3813         switch so that we will get a warning if a type is left out.
3814         (DOM::HTMLInputElementImpl::parseHTMLAttribute): Tweaked comment format.
3815         (DOM::HTMLInputElementImpl::reset): Changed to only nuke the value if the value property is stored
3816         separately from the attribute. Otherwise, we just want to lave it alone
3817         (DOM::HTMLInputElementImpl::value): Changed to always use m_value if it's not null, then fall back
3818         on the attribute, and finally fall back to the "on" for the checkbox only if both are null.
3819         (DOM::HTMLInputElementImpl::setValue): Changed to set the attribute unless the value property is
3820         supposed to be stored separate from the attribute.
3821         (DOM::HTMLInputElementImpl::storesValueSeparateFromAttribute): Added. Returns true for text-type
3822         input elements, and false for the others.
3823
3824 2004-10-11  Darin Adler  <darin@apple.com>
3825
3826         Reviewed by John.
3827
3828         - fixed <rdar://problem/3296652> checkbox input type does not respond to onchange
3829
3830         * khtml/rendering/render_form.cpp:
3831         (RenderFormElement::updateFromElement): Some new code, commented out, for form element colors.
3832         (RenderCheckBox::slotStateChanged): Added call to onChange.
3833
3834 2004-10-11  Ken Kocienda  <kocienda@apple.com>
3835
3836         Reviewed by Darin
3837
3838         Finish selection affinity implementation. This includes code to set the
3839         affinity correctly when clicking with the mouse, and clearing the
3840         affinity when altering the selection using any of the Selection object
3841         mutation functions.
3842
3843         Each instance of the positionForCoordinates, inlineBox and caretRect 
3844         functions have been changed to include an EAffinity argument to give results
3845         which take this bit into account.
3846
3847         * khtml/editing/selection.cpp:
3848         (khtml::Selection::init): Default affinity is now UPSTREAM, to match AppKit.
3849         (khtml::Selection::modifyAffinity): New function to compute affinity based on
3850         modification constants.
3851         (khtml::Selection::moveTo): Reset affinity to UPSTREAM.
3852         (khtml::Selection::modifyExtendingRightForward): Ditto.
3853         (khtml::Selection::modifyMovingRightForward): Ditto.
3854         (khtml::Selection::modifyExtendingLeftBackward): Ditto.
3855         (khtml::Selection::modifyMovingLeftBackward): Ditto.
385