ChangeLog   [plain text]


=== WebCore-415 ===

2005-03-28  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        <rdar://problem/4069161> REGRESSION (8A416-8A419): Safari crash bringing up context menu for non-HTML content in a frame

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject rendererForView:]):
        Nil-check node variable instead of rechecking document variable.

=== WebCore-413 ===

2005-03-27  Darin Adler  <darin@apple.com>

        Reviewed by me, fix by Kida-san.

        - fixed <rdar://problem/4067474> 8A424: Safari immediately quit by Cmd+Ctrll+'D'

        * kwq/WebCoreBridge.mm: (-[WebCoreBridge convertToNSRange:DOM::]):
        Added nil check.

=== Safari-412 ===

2005-03-24  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4052683> After adding/removing stocks from Stocks Widget, stock areas went blank

	The request was being collected before firing it's load handler.
	We now gc protect the request while it's loading.

        Reviewed by Maciej.

        * khtml/ecma/xmlhttprequest.cpp:
        (KJS::XMLHttpRequest::send):
        (KJS::XMLHttpRequest::abort):
        (KJS::XMLHttpRequest::slotFinished):
        (KJS::XMLHttpRequestProtoFunc::tryCall):

=== Safari-411 ===

2005-03-23  Darin Adler   <darin@apple.com>

	Further fix for 4053515.

	Covered cases where text position doesn't lie inside a
	text node.	

        Reviewed by Richard.

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::setRangeFromLocationAndLength):

2005-03-23  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4053515> REGRESSION (Mail): Kotoeri input method reconversion does not work in WebViews

	We now use actual document NSRanges to represent both marked text
	ranges and selection ranges.

        Reviewed by Ken.

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::rangeLength):
        (khtml::TextIterator::setRangeFromLocationAndLength):
        * khtml/editing/visible_text.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge convertToNSRange:DOM::]):
        (-[WebCoreBridge DOM::convertToDOMRange:]):
        (-[WebCoreBridge selectNSRange:]):
        (-[WebCoreBridge markedTextDOMRange]):
        (-[WebCoreBridge markedTextNSRange]):

2005-03-22  Kevin Decker  <kdecker@apple.com>

        Reviewed by Vicki.

	Fixed <rdar://problem/4062336> REGRESSION (406-407): HTML submenus not working at hrweb.apple.com after going back

	Rolled out the fix for <rdar://problem/4041374> REGRESSION (185-186): unload handlers (at least those added with addEventListener) are broken

	We clearly need a better solution to 4041374. We can't indiscriminately remove event listeners in closeURL() after-all. Since event listeners are registered in a <script> tag, which is evaluated and executed at page load time, this becomes a problem since we don't reevaluate a page's <script> that is in the back/forward cache.  Thus once you leave the page, the listeners are gone for good.  This is the problem.

        * khtml/khtml_part.cpp:
        (KHTMLPart::closeURL):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::detach): 

=== Safari-410 ===

2005-03-22  Vicki Murley  <vicki@apple.com>

        - roll the fix for <rdar://problem/4060266> back in, since its 
	now approved by CCC

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::handleTextBox):

2005-03-22  Vicki Murley  <vicki@apple.com>

	- roll out the fix for <rdar://problem/4060266> since it was denied by CCC

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::handleTextBox):

2005-03-22  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        <rdar://problem/4060266> Double-clicking in Dictionary.app doesn't work for some words (coming just after style change)

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::handleTextBox):
        Complete the check of whether to emit space for collapsed space.

2005-03-22  David Harrison  <harrison@apple.com>

        Reviewed by John.
        
        <rdar://problem/4061443> REGRESSION (8A420-8A421): Pasting in the Stickies widget is broken again

        * khtml/editing/htmlediting.cpp:
        (khtml::positionBeforeContainingSpecialElement):
        (khtml::positionAfterContainingSpecialElement):
        Return unchanged Position rather than a null or non-editable one.

=== Safari-409 ===

2005-03-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        I made an error in this test earlier. It was not testing what I intended. Fixed.

        * layout-tests/editing/unsupported-content/list-delete-001-expected.txt
        * layout-tests/editing/unsupported-content/list-delete-001.html
        
        New tests:

        * layout-tests/editing/unsupported-content/table-delete-001-expected.txt: Added.
        * layout-tests/editing/unsupported-content/table-delete-001.html: Added.
        * layout-tests/editing/unsupported-content/table-delete-002-expected.txt: Added.
        * layout-tests/editing/unsupported-content/table-delete-002.html: Added.
        * layout-tests/editing/unsupported-content/table-delete-003-expected.txt: Added.
        * layout-tests/editing/unsupported-content/table-delete-003.html: Added.
        * layout-tests/editing/unsupported-content/table-type-after-expected.txt: Added.
        * layout-tests/editing/unsupported-content/table-type-after.html: Added.
        * layout-tests/editing/unsupported-content/table-type-before-expected.txt: Added.
        * layout-tests/editing/unsupported-content/table-type-before.html: Added.

2005-03-20  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3923903> REGRESSION (164-165): Repro Safari crash in khtml::RenderLayer::scrollToOffset

        * khtml/rendering/render_layer.cpp: (RenderLayer::scrollToOffset): Check canvas for nil.

2005-03-20  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        <rdar://problem/4055127> Dictionary pop-up panel misplaced at beginning of text blocks (breaks double-clicking in Dictionary.app)

        SimplifiedBackwardsTextIterator::advance() needed to not limit to textnodes
        when checking whether moving back across block boundaries

        VisibleUnits previousBoundary() needed to INIT_DOWN when creating result VisiblePosition

        All editing tests pass.

        * khtml/editing/visible_text.cpp:
        (khtml::SimplifiedBackwardsTextIterator::advance):
        * khtml/editing/visible_units.cpp:
        (khtml::previousBoundary):

2005-03-20  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/4059914> when you select all of a frame's content, need to select the frame in the parent document so it can be easily deleted

        * khtml/khtml_part.h: Added selectFrameElementInParentIfFullySelected.
        * khtml/khtml_part.cpp:
        (isFrame): Added.
        (KHTMLPart::setFocusNodeIfNeeded): Changed to not set focus to a frame; was not what this function was
        intended to do, and caused trouble when trying to select a frame element.
        (KHTMLPart::khtmlMouseReleaseEvent): Call selectFrameElementInParentIfFullySelected.
        (KHTMLPart::selectAll): Call selectFrameElementInParentIfFullySelected.
        (KHTMLPart::selectFrameElementInParentIfFullySelected): Added. Selects the frame element in the parent
        if a frame is entirely selected, which makes it easier to delete or replace the frame and is consistent
        with the changes Maciej made recently for other elements.

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]): Call selectFrameElementInParentIfFullySelected.
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:]): Call selectFrameElementInParentIfFullySelected.

2005-03-20  Darin Adler  <darin@apple.com>

        Reviewed by me, code change by Ken.

        - fixed <rdar://problem/4059852> Deleting from first element of list makes content jump to wrong place

        * khtml/editing/htmlediting.cpp:
        (khtml::isListStructureNode): Added.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Check for list nodes as well as table nodes.

2005-03-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        Added tests to cover new "unsupported content" editing code.

        * layout-tests/editing/unsupported-content/list-delete-001-expected.txt: Added.
        * layout-tests/editing/unsupported-content/list-delete-001.html: Added.
        * layout-tests/editing/unsupported-content/list-delete-002-expected.txt: Added.
        * layout-tests/editing/unsupported-content/list-delete-002.html: Added.
        * layout-tests/editing/unsupported-content/list-delete-003-expected.txt: Added.
        * layout-tests/editing/unsupported-content/list-delete-003.html: Added.
        * layout-tests/editing/unsupported-content/list-type-after-expected.txt: Added.
        * layout-tests/editing/unsupported-content/list-type-after.html: Added.
        * layout-tests/editing/unsupported-content/list-type-before-expected.txt: Added.
        * layout-tests/editing/unsupported-content/list-type-before.html: Added.

2005-03-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej
        
        Fix for this bug:
        
        <rdar://problem/4059578> Entire list deleted, and caret disappears, when delete key hit at end of list

        The problem is that a new case in the delete code did not consider when the
        downstream end node of the selection might be an ancestor of the upstream start
        node. That is the case in this bug. The downstream end is the body element, and
        this line of code would delete all the children of the downstream end:
            removeChildrenInRangePreservingPosition(m_downstreamEnd.node(), 0, 
                m_downstreamEnd.offset(), m_upstreamStart);

        The fix is to check for this "is ancestor" case, and do some tree logic to find
        the right offset of the downstream end node for the call to
        removeChildrenInRangePreservingPosition().

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete): Fixed as described.

2005-03-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej

        Fix for this bug:
       
        <rdar://problem/4059384> Cannot place insertion point correctly in editable text that avoids floating elements

        Note: I strongly suspect this bug blocks a complete solution to this other Tiger/P2:
        <rdar://problem/4055748> AX: Dictionary pop-up panel shows at wrong place on specific parts of particular pages

        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect): Change the y-coordinate used to calculate the available width for a line. Height is wrong.
        Top of the box containing the text where the click is done is correct. Also, add in the x-offset for the start
        of the text box when calculating the available width. If this text box is avoiding a float at the y-coordinate
        for the relevant box, failure to add in the amount of float-avoidance will make the text at the coordinates
        greater than end-of-line minus float-avoidance ineligible for caret placement.

2005-03-19  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/4057594> REGRESSION (125-406): Unrepro crash in HTMLTokenizer::allDataProcessed after hitting Back button

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::allDataProcessed):
        To get the part safely after calling end, save a guarded pointer to the view.
        The old way could end trying to call a virtual function a part that was destroyed.

2005-03-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/4053506> Pasting Tables and Cells in Mail does not allow editing before or after
	<rdar://problem/4005954> REGRESSION (Mail): After copy/paste of content containing list element cannot go back to entering text at left side of page
	
        * khtml/editing/htmlediting.cpp:
        (khtml::maxDeepOffset):
        (khtml::CompositeEditCommand::removeFullySelectedNodePreservingPosition):
        (khtml::CompositeEditCommand::removeChildrenInRangePreservingPosition):
        (khtml::CompositeEditCommand::removeNodePreservingPosition):
        (khtml::CompositeEditCommand::insertBlockPlaceholder):
        (khtml::CompositeEditCommand::appendBlockPlaceholder):
        (khtml::CompositeEditCommand::forceBlockPlaceholder):
        (khtml::CompositeEditCommand::addBlockPlaceholderIfNeeded):
        (khtml::isSpecialElement):
        (khtml::isFirstVisiblePositionInSpecialElementInFragment):
        (khtml::positionBeforePossibleContainingSpecialElement):
        (khtml::positionAfterPossibleContainingSpecialElement):
        (khtml::ApplyStyleCommand::applyInlineStyle):
        (khtml::DeleteSelectionCommand::initializePositionData):
        (khtml::DeleteSelectionCommand::insertPlaceholderForAncestorBlockContent):
        (khtml::DeleteSelectionCommand::handleGeneralDelete):
        (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
        (khtml::DeleteSelectionCommand::doApply):
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::ReplacementFragment::ReplacementFragment):
        (khtml::ReplaceSelectionCommand::doApply):
        * khtml/editing/htmlediting.h:
        * khtml/editing/visible_position.cpp:
        (khtml::isRenderedBR):
        (khtml::VisiblePosition::initDownstream):
        (khtml::isLastVisiblePositionInBlock):
        * khtml/rendering/render_line.cpp:
        (khtml::RootInlineBox::closestLeafChildForXPos):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::isBlockFlowOrTable):
        (NodeImpl::isEditableBlock):
        (NodeImpl::enclosingBlockFlowOrTableElement):
        * khtml/xml/dom_nodeimpl.h:
        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream):
        (DOM::Position::downstream):
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-003-expected.txt:
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-004-expected.txt:
        * layout-tests/editing/deleting/delete-select-all-001-expected.txt:
        * layout-tests/editing/deleting/delete-select-all-003-expected.txt:
        * layout-tests/editing/inserting/insert-3786362-fix-expected.txt:

2005-03-19  John Sullivan  <sullivan@apple.com>

        Reviewed by Darin.
        
        - fixed <rdar://problem/4058740> Crash (nil-deref) editing Mail reply 
        message in KWQKHTMLPart::fontForSelection (MailViewer-723)

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection):
        Add nil check to loop. It shouldn't be necessary, but this crash trace seems to be
        running into it. We're not completely certain, but the check is harmless at worst.

=== Safari-408 ===

2005-03-18  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        <rdar://problem/3584942> AX: Safari Accessibility parent-child mismatch
        
        Also changed WebKit.

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject rendererForView:]):
        New to cover both the WebCore and WebKit NSViews.
        
        (-[KWQAccObject _accessibilityParentForSubview:]):
        Use rendererForView.
        
        * kwq/WebCoreFrameView.h:
        Add WebCoreBridgeHolder protocol to get access to WebKit NSViews.

2005-03-18  David Harrison  <harrison@apple.com>

        Reviewed by Darin, Ken.

        <rdar://problem/3735625> AX: add AXPress action if an element has an onclick handler

        * khtml/dom/html_form.cpp:
        (HTMLInputElement::click):
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::click):
        (HTMLElementImpl::accessKeyAction):
        * khtml/html/html_elementimpl.h:
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::submitClick):
        (DOM::HTMLButtonElementImpl::click):
        (DOM::HTMLButtonElementImpl::accessKeyAction):
        (DOM::HTMLInputElementImpl::click):
        (DOM::HTMLInputElementImpl::accessKeyAction):
        (DOM::HTMLInputElementImpl::defaultEventHandler):
        (DOM::HTMLLabelElementImpl::accessKeyAction):
        (DOM::HTMLSelectElementImpl::accessKeyAction):
        (DOM::HTMLTextAreaElementImpl::accessKeyAction):
        * khtml/html/html_formimpl.h:
        * khtml/html/html_inlineimpl.cpp:
        (HTMLAnchorElementImpl::defaultEventHandler):
        (HTMLAnchorElementImpl::accessKeyAction):
        * khtml/html/html_inlineimpl.h:
        * khtml/rendering/render_form.cpp:
        (RenderFileButton::click):
        * khtml/rendering/render_form.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::defaultEventHandler):
        * khtml/xml/dom_elementimpl.h:
        (DOM::ElementImpl::accessKeyAction):
        * kwq/DOMHTML.mm:
        (-[DOMHTMLInputElement click]):
        * kwq/KWQButton.h:
        * kwq/KWQButton.mm:
        (QButton::click):
        * kwq/KWQFileButton.h:
        * kwq/KWQFileButton.mm:
        (KWQFileButton::click):
        
        Add accessKeyAction parameter about whether to limit to HTMLElementImpl subclasses that JavaScript wants, or to apply to others as well.
        
        Add click() parameter about whether to send the mousedown and mouseup events in addition to the click event.
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject mouseButtonListener]):
        Locate a mousedown, mouseup, or click handler in the current element and its ancestors.
        
        (-[KWQAccObject actionElement]):
        (-[KWQAccObject accessibilityIsIgnored]):
        (-[KWQAccObject accessibilityPerformAction:]):
        Consider mouseButtonListener.

2005-03-18  John Sullivan  <sullivan@apple.com>

        Reviewed by Darin.
        
        - fixed <rdar://problem/4002164> maps that include start and end 
        location don't print right from maps.google.com

	I thought I checked this in yesterday but a ChangeLog conflict aborted my checkin
	without me noticing.

        * khtml/rendering/render_style.cpp:
        (RenderStyle::diff):
        flag name changed from _should_correct_text_color to _force_backgrounds_to_white
        
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::InheritedFlags::operator==):
        flag name changed from _should_correct_text_color to _force_backgrounds_to_white
        (khtml::RenderStyle::setBitDefaults):
        ditto
        (khtml::RenderStyle::forceBackgroundsToWhite):
        ditto, and method name changed too
        (khtml::RenderStyle::setForceBackgroundsToWhite):
        ditto
        
        * khtml/rendering/render_text.cpp:
        (InlineTextBox::paint):
        updated for name change; also, compare text against white instead of current bg color
        because we no longer actually modify the bg color (previously we would always set
        the bg color to white, so the result is the same)
        
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::recalcStyle):
        updated for name change
        
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge styleSheetForPrinting]):
        removed this method
        (-[WebCoreBridge reapplyStylesForDeviceType:]):
        removed the code that called styleSheetForPrinting; we no longer use a stylesheet
        for this behavior.

        * khtml/rendering/render_box.cpp:
        (RenderBox::paintBackgroundExtended):
        If forceBackgroundsToWhite flag is set, convert background images and
        background colors to white background color with no background image.
        
2005-03-18  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4056718> Pasting quotes the entire message

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): After pasting, nodes are moved to the block containing
        the end of the pasted content in certain cases. This move logic used to stop once it moved all the
        siblings of the node following the last node of the pasted-in content. This means that block elements
        could get moved, and if the pasted-in content included a mail blockquote, this could result in
        one quote level getting added. The fix is to stop the move of nodes once a <br>, block element, or
        <table> is seen. This only affected one of the many test cases we have for such scenarios, and 
        the change to that result makes sense given the code change.
        * layout-tests/editing/pasteboard/paste-text-003-expected.txt: This test result changed in a way that
        adequately tests the behavior change, so I did not add a new test.

2005-03-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/4051809> 8A413: Cursor-up in a mail message sometimes gets stuck (with specific reproducible case)

        * khtml/rendering/render_text.cpp:
        (RenderText::positionForCoordinates): Consider two lines: line-above and line-below. If the caret position in line-below
        was at an x coordinate between half way through the x coordinate of the last character on the line-above and the
        end of that same character, this bug would happen since the positioning code would assume that it could create a 
        VisiblePosition with a DOWNSTREAM affinity. Now, I check to see if the character position on the line-above is the 
        last character on that line, and if it is, I use UPSTREAM as the affinity.

=== Safari-407 ===

2005-03-17  David Harrison  <harrison@apple.com>

        Reviewed by Darin, Ken.

        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::setEndingSelection):
        Fixed typo so that it calls setEndingSelection rather than setStartingSelection.
        Commented out this unused method, tho, since this is late in Tiger.  Proved unused by successful build after temporarily removing method declaration or implemenation.

2005-03-16  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs.

	Fixed <rdar://problem/4046665> REGRESSION (403-405): mypage.apple.com login does not work (hits assertion in Development build)

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge canLoadURL:fromReferrer:hideReferrer:]): Check always came back false when callers would send a nil NSURL to this method. Now we allow the empty url cases, eg., <frame src="">

2005-03-16  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/4045203> REGRESSION (125-188): Redundant JS imports crash Safari

        * khtml/html/htmltokenizer.h: Take inWRite bool out of NDEBUG ifdef.
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::HTMLTokenizer): Take inWrite bool management code out of NDEBUG ifdef.
        (khtml::HTMLTokenizer::write): Ditto. Don't call end if inWrite is true, since it will be called
        when you return to the body of the outer write() call.
        (khtml::HTMLTokenizer::allDataProcessed): Don't call end() if inWrite is true for the same reason.
        (khtml::HTMLTokenizer::finish): Ditto.

        * kwq/KWQWidget.mm: (QWidget::getOuterView): Removed bogus assertion that has been vexing us of late.

2005-03-16  David Harrison  <harrison@apple.com>

        Reviewed by me (written by Patti Yeh).

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXNextWordEndTextMarkerForTextMarker:]):
        Use LeftWordIfOnBoundary instead of RightWordIfOnBoundary.

        (-[KWQAccObject doAXPreviousWordStartTextMarkerForTextMarker:]):
        Use RightWordIfOnBoundary instead of LeftWordIfOnBoundary.

2005-03-16  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/4054590> AX: Dictionary panel does not work when page is scrolled on Safari

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXTextMarkerForPosition:]):
        Add in the view's contentsX and contentsY to the point.

2005-03-16  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/4048506> Deleting from beginning of editable div deletes other document elements
        
        Also changed WebKit.
        
        * khtml/editing/visible_units.h:
        * khtml/editing/visible_units.cpp:
        (khtml::startOfEditableContent):
        (khtml::endOfEditableContent):
        (khtml::inSameEditableContent):
        (khtml::isStartOfEditableContent):
        (khtml::isEndOfEditableContent):
        New.
        
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge canDeleteRange:]):
        New.

2005-03-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/4042935> undo doesn't work properly during inline input

        * kwq/WebCoreBridge.h: Declare new method below.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge replaceMarkedTextWithText:]): New method. Wraps calls to TypingCommand::deleteKeyPressed and
        TypingCommand::insertText to map the way that international text input works onto the typing undo system.

2005-03-16  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4044336> REGRESSION (8A398-8A409): Option-Delete also deletes space to left of deleted word

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData):
        - skip smart delete if the selection to delete already starts or ends with whitespace
        
        * khtml/khtml_part.cpp:
        (KHTMLPart::handleMousePressEventDoubleClick):
        - preserve selection on double-click when range is already selected
        
        * khtml/xml/dom_position.cpp:
        (DOM::Position::leadingWhitespacePosition):
        (DOM::Position::trailingWhitespacePosition):
        - fix considerNonCollapsibleWhitespace action (logic was reversed)
        - add non-breaking space to the non-collapsable ones
        
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge rangeByExpandingSelectionWithGranularity:]):
        (-[WebCoreBridge rangeByAlteringCurrentSelection:direction:granularity:]):
        - these methods do not set the selection, so remove calls to setSelectionGranularity
          
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]):
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:]):
        - set the granularity back to character
        - the one exception is that we need to keep word granularity
          to preserve smart delete behavior when extending by word

2005-03-15  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	<rdar://problem/4053266> Pressing return a few times right after a link makes the new blank lines part of the link
	
        * khtml/editing/htmlediting.cpp:
	(khtml::InsertLineBreakCommand::doApply): Use
	positionOutsideContainingSpecialElement in the right two places.
        (khtml::InsertParagraphSeparatorCommand::doApply): Ditto.

	- move all these helper functions higher in the file
	
        * khtml/editing/htmlediting.cpp:
        (khtml::isSpecialElement):
        (khtml::isFirstVisiblePositionInSpecialElement):
        (khtml::positionBeforeNode):
        (khtml::positionBeforeContainingSpecialElement):
        (khtml::maxRangeOffset):
        (khtml::isLastVisiblePositionInSpecialElement):
        (khtml::positionAfterNode):
        (khtml::positionAfterContainingSpecialElement):
        (khtml::positionOutsideContainingSpecialElement):

2005-03-14  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/4049925> Pasting right after a link makes pasted content part of the link (without visible style change)
        
        * khtml/editing/htmlediting.cpp:
        (khtml::positionOutsideContainingSpecialElement): made a helper
	function that computes a position outside the outermost containing
	special element if the passed in position is right at the start or
	end of it
        (khtml::InsertTextCommand::prepareForTextInsertion): use new helper here
        (khtml::ReplaceSelectionCommand::doApply): use it here too: this is the fix
        (khtml::positionBeforeNode): made static
        (khtml::positionBeforeContainingSpecialElement): made static
        (khtml::positionAfterNode): made static
        (khtml::positionAfterContainingSpecialElement): made static

2005-03-15  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4053658> Crash getting direction at maps.google.com

	Add non nil style() check.

        Reviewed by Dave Harrison.

        * khtml/rendering/render_table.cpp:
        (RenderTableCell::collapsedRightBorder):

2005-03-15  Kevin Decker  <kdecker@apple.com>

        Reviewed by John
	
	Fixed: <rdar://problem/4041374> REGRESSION (185-186): unload handlers (at least those added with addEventListener) are broken

	The reason why UNLOAD_EVENT wouldn't dispatch was because the code would delete all event listeners at the detach() phase which is prior to closeURL(). 

	This fixes a recent regression from:

 <rdar://problem/3977973> pages on ebay leak referenced JavaScript objects -- over time browsing becomes super-slow

        * khtml/khtml_part.cpp:
        (KHTMLPart::closeURL): After dispatching event handlers, go ahead and remove them from the DOM. 
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::detach): Took out the call to removeAllEventListenersFromAllNodes(). If we remove all event listeners here then when KHTMLPart::closeURL() checks for even listeners, it will never have any because they'll already be gone. 

2005-03-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Vicki

        Fox for this bug:
        
        <rdar://problem/4052642> Each delete keystroke is in its own undo group; not included in undo group with other typing

        Calling -[WebCore setSelectedDOMRange:range affinity:] had the result of "closing" any active set of typing
        keystrokes grouped together in a single undo operation. A change on 27 Jan in WebKit to change the way delete
        keystrokes are handled made this feature regress. Previous to that change, the backwards delete
        key went through separate code that is no longer in the tree that did not set the selection in the way
        it is done now.
        
        The solution is to add an extra argument to the set-selection call. The WebCoreBridge now offers this method:
        -[WebCore setSelectedDOMRange:range affinity:closeTyping:]. Now, callers must indicate whether setting the 
        selection will act to close typing or not.

        * kwq/WebCoreBridge.h: Changed header accordingly to change method shown below.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:closeTyping:]): Added closeTyping argument to this method.

2005-03-15  John Sullivan  <sullivan@apple.com>

        Reviewed by Vicki.
        
        - fixed <rdar://problem/4052246> crash in KWQKHTMLPart::createPart() trying to display local file in frame

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::createPart):
        Check part for nil before trying to ref. This was probably a longstanding code flaw revealed by
        the recent security fix.

2005-03-15  Kevin Decker  <kdecker@apple.com>

        Reviewed by Ken and Maciej.

	New fix for <rdar://problem/3667701> crash in KHTMLPart::jScriptEnabled()
	
	The tokenizer has buffers which mean parsing can continue even after loading is supposed to be stopped. If the loading process was aborted, the tokenizer should abort, too.

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::HTMLTokenizer): Initialize loadStopped to false.
        (khtml::HTMLTokenizer::write): Go ahead and bail out if loadStopped is true. 
        (khtml::HTMLTokenizer::processToken):
        * khtml/html/htmltokenizer.h: Added loadStopped flag. Changed the view pointer from a standard pointer to a QGuardedPtr.  This fixes the crash.  Now the tokenizer's handle to the view will now automatically nil-out and never dangle.
        * khtml/khtml_part.cpp:
        (KHTMLPart::closeURL): Notify the tokenizer to stop parsing. 
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::XMLTokenizer::XMLTokenizer): Initialize loadStopped to false.
        * khtml/xml/xml_tokenizer.h:
        (khtml::Tokenizer::stopParsing): Added. 

2005-03-14  David Harrison  <harrison@apple.com>

        Reviewed by Darin, Maciej.

        <rdar://problem/4046103> REGRESSION (Mail): clicking after style change sets insertion point incorrectly
        
        Also fixes crash by adding nil check.

        * khtml/editing/htmlediting.cpp:
        (khtml::MoveSelectionCommand::doApply):
        Check the node for nil.
        
        * khtml/khtml_part.cpp:
        (KHTMLPart::khtmlMouseReleaseEvent):
        Use the node from the event rather than from the selection.

2005-03-14  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/4049776> Seed: Mail: Disable spellcheck leaves red artifacts

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl): Set markers list to be "auto-delete" so they don't all leak.
        (DocumentImpl::removeMarker): Remove markers list for a node when the last marker is removed
        for that node. Otherwise, we can have empty marker lists for each node forever until the
        document goes away.
        (DocumentImpl::removeAllMarkers): Added code to dirty the markers.
        (DocumentImpl::shiftMarkers): Remove unneeded empty check.

        * kwq/WebCoreBridge.h: Added unmarkAllMisspellings for WebKit.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge unmarkAllMisspellings]): Added. Calls removeAllMarkers.

2005-03-14  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4027928> Tiger_8A394:Acrobat crashes while tried to remove the subscription errors by clicking on "Would you like to remove the subscription" from Tracker details view pane

	A document may be deleted as a consequence of handling an event,
	as was the case with Acrobat.app.  Ensure that the document is still valid
	before passing the event on for further handling.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::dispatchUIEvent):

2005-03-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        Added a couple of comments about setChanged() to this code based on my experiences with 4047028.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::addParsedProperties)
        (DOM::CSSMutableStyleDeclarationImpl::merge)

2005-03-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4047028> Changing quote levels on stylized text causes it to be sent as colored (Blue). Tiger8A410

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::removePropertiesInSet): This function now calls setChanged() at the 
        end of its loop if any properties were removed. This makes the style system update correctly in response
        to changes made by this function. The code to paste removes style from the pasted content in a 
        preliminary step, and the fact that the style system did not update properly left unwanted color
        declarations in the document.

2005-03-14  Vicki Murley  <vicki@apple.com>

	- roll out this change for now, since it was denied by CCC

    2005-03-11  David Harrison  <harrison@apple.com>
        
        Reviewed by Darin.
        
        <rdar://problem/4046602> WebCore invokes undefined behavior when the spell checker isn't running

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::advanceToNextMisspelling):
        (KWQKHTMLPart::markMisspellings):
        Nil check checker.

2005-03-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4050403> Mail crashes after pasting and deleting the content of one Excel cell

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete): Add some null checks to the code. This fixes the crash, although
        following the steps described in the bug by John Sullivan on 3/14/05 at 10:49 AM will leave us with a "blank line" in 
        the document that cannot be removed (this is actually an empty table). This is undesirable, however, work Maciej is
        doing to fix the general-case problem of trying to edit constructs we do not handle well in editing should fix this
        particular case, making the deletion of this "blank line" possible. Maciej is doing this work as part of this bug:
        <rdar://problem/4036051> Hard to select (and thus delete) an IFRAME in an editable WebView

2005-03-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/4029632> Mail crashes in DOM::NodeImpl::isBlockFlow() after pasting text with alignment style and BR element from Safari
        
        The problem is that removeInlineStyle() can remove nodes, and if either the start or end node of the
        selection at the time of the call to removeInlineStyle() was in a node that got removed, bad things
        would happen. The fix is described below.

        * khtml/editing/htmlediting.cpp:
        (khtml::maxRangeOffset): Moved this static function to a different place in the file so the code below can use it.
        (khtml::ApplyStyleCommand::applyInlineStyle): Calling removeInlineStyle() now has the side effect of 
        setting the command's ending selection. Now resets start and end using the ending selection after the call to
        removeInlineStyle() as it is done elsewhere in this function.
        (khtml::ApplyStyleCommand::removeInlineStyle): Track the removal of the start or end node based on
        the positions passed in. If either the start or the end node is removed as part of style removal, 
        set an appropriate replacement start or end that is still in the document.

=== Safari-406 ===

2005-03-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        I need to roll out Kevin's change to fix 3667701. It breaks contextual fragments, and hence breaks
        paste in editing (among other things).

        * khtml/html/htmltokenizer.cpp: Roll out recent change.
        (khtml::HTMLTokenizer::write) 
        * khtml/html/htmltokenizer.h: Ditto.

2005-03-13  Darin Adler  <darin@apple.com>

        Reviewed by Ken and Maciej.

        - fixed <rdar://problem/4049040> REGRESSION (403-405): security check prevents user stylesheet from loading (Dictionary.app doesn't work at all!)

        * kwq/WebCoreBridge.mm: (-[WebCoreBridge canLoadURL:fromReferrer:hideReferrer:]): Changed to give "applewebdata:"
        documents the same privileges to open local files that "file:" documents have.

2005-03-13  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs.
        
        Fixed: <rdar://problem/3667701> crash in KHTMLPart::jScriptEnabled()
        
        The problem here was that the tokenizer would continue to receive chunks of data from the loader already
        after the view and part had been destroyed.  Situations like this could arise when clicking on another link 
        while still loading the current view, or during self test where we rapidly open, load, and close browser
        windows very fast. 

        * khtml/html/htmltokenizer.cpp: 
        (khtml::HTMLTokenizer::write): Simple nil check against the view. 
        * khtml/html/htmltokenizer.h: Changed the view pointer from a standard pointer to a QGuardedPtr.  The tokenizer's
        handle to the view will now automatically nil-out and never dangle.

2005-03-13  Darin Adler  <darin@apple.com>

        Reviewed by John and Ken.

        - fixed <rdar://problem/4044347> REGRESSION (Mail): Control-K in particular message moves insertion point to previous line

        Tweaked the deleting code, and added three new deleting layout tests to confirm the new code works.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Removed special case with comment that said it was
        for the case where a "selection contains only a BR right after a block ended". This code was being triggered in
        more cases than just that one, and in all the cases I tested, the general delete code works fine.
        (khtml::DeleteSelectionCommand::handleGeneralDelete): Changed the code that decides whether to delete an entire
        block to understand the case where the end block is outside the start block, but contains the start block.
        In that case, we want to delete the entire block. Not deleting the block was causing us to delete just the <br>,
        and not the enclosing <div> in the case in the bug.

        * layout-tests/editing/deleting/delete-line-015-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-015.html: Added.
        * layout-tests/editing/deleting/delete-line-016-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-016.html: Added.
        * layout-tests/editing/deleting/delete-line-017-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-017.html: Added.
        * layout-tests/editing/style/smoosh-styles-002-expected.txt: Updated to improved results. With the code change, the deletion
        now deletes more than it used to. The old results had an empty text node and <h1> element that were both 0-sized, and now
        we delete both of those.

2005-03-13  Darin Adler  <darin@apple.com>

        - fixed <rdar://problem/4049172> REGRESSION (403-405): Gmail: text box in "Invite a friend" section overlaps other sections

        Rolled out fix for <rdar://problem/3952698> Function buttons do not display properly with Telia Webmail

        * khtml/rendering/render_replaced.cpp: (RenderReplaced::calcMinMaxWidth): Back to previous version of this file.

2005-03-12  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Adele.

	<rdar://problem/4046144> RSS pages leave a hole in local file security policy (need to revert feed: exemption)
        
	* kwq/WebCoreBridge.mm:
        (-[WebCoreBridge canLoadURL:fromReferrer:hideReferrer:]): Revert
	emergency workaround for Safari RSS, now that a new Syndication
	has been submitted.

2005-03-11  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/4026787> text typed after a link (pasted or Mail Link to this Page) is part of the link, underlined and colored blue
        
	The concept of this change is every time you type at the very
	start or very end of a link (even if nested in further inner
	elements), the typed text goes outside the link instead of inside.
	
	* khtml/editing/htmlediting.cpp:
        (khtml::InsertTextCommand::prepareForTextInsertion): Check whether
	we are at the first visible position or last visible position of a
	special element. For now this only includes HTML A elements that
	are links (i.e. they have an href).
	(khtml::isSpecialElement): Helper function that identifies special
	elements (for now only links).
        (khtml::isFirstVisiblePositionInSpecialElement): Checks if a given DOM
	position is equivalent to the first visible position in some containing 
	editable special element.
        (khtml::positionBeforeNode): Returns the DOM position immediately
	before a node.
        (khtml::positionBeforeContainingSpecialElement): Gives a DOM
	position immediately before the outermost editable containing
	special element where the passed-in position is equivalent to the
	first visible position.
        (khtml::maxRangeOffset): Helper to get the maximum allowed
	range/position offset for a node, does the right thing based on
	whether the node would use a character offset or child offset.
        (khtml::isLastVisiblePositionInSpecialElement): Similar to above,
	but for end of node instead of start.
        (khtml::positionAfterNode): Ditto.
        (khtml::positionAfterContainingSpecialElement): Ditto.

	Some layout tests changed - I looked over all the diffs and found
	that the only changes were "junk nodes" like empty spans and text
	nodes moving from one spot in the tree to another. These changes
	are all harmless and do not affect layout or future editing.

        * layout-tests/editing/inserting/typing-003-expected.txt:
        * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt:
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
        * layout-tests/editing/style/remove-underline-after-paragraph-expected.txt:
        * layout-tests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
        * layout-tests/editing/style/remove-underline-expected.txt:
        * layout-tests/editing/style/remove-underline-from-stylesheet-expected.txt:
        * layout-tests/editing/style/remove-underline-in-bold-expected.txt:
        * layout-tests/editing/style/typing-style-003-expected.txt:
        * layout-tests/editing/style/unbold-in-bold-expected.txt:
        * layout-tests/editing/style/underline-expected.txt:

2005-03-11  Adele Amchan  <adele@apple.com>

        backing out fix for <rdar://problem/4021711> REGRESSION (125-188): blank pages when browsing forum at cooperativeresearch.org - cached external script problem

        This caused the following regressions (that we know of): 
        <rdar://problem/4047445> REGRESSION (Safari-400-403?): Some or all page contents sometimes don't appear (macworld.com)
        <rdar://problem/4046153> 8a409: Problem loading Citibank page in Safari 2 (403)
        <rdar://problem/4047801> REGRESSION (402-403): .Mac homepage links don't work

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::scriptHandler):

2005-03-11  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4046602> WebCore invokes undefined behavior when the spell checker isn't running

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::advanceToNextMisspelling):
        (KWQKHTMLPart::markMisspellings):
        Nil check checker.

2005-03-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * ForwardingHeaders/editing/visible_units.h: Added.

2005-03-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4045521> Hitting return key with full line selected does not add blank line as it should

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Removed some "special-case" code from this 
        function that would look for a selection that started and ended in a different block, and would
        then bail right after the deletion of the selection without inserting a paragraph separator.
        This was just wrong. So, the code change is removal only. When the general-case code runs instead
        of the erroneous special-case code, the bug goes away.
        
        New tests:
        
        * layout-tests/editing/inserting/return-key-with-selection-001-expected.txt: Added.
        * layout-tests/editing/inserting/return-key-with-selection-001.html: Added.
        * layout-tests/editing/inserting/return-key-with-selection-002-expected.txt: Added.
        * layout-tests/editing/inserting/return-key-with-selection-002.html: Added.
        * layout-tests/editing/inserting/return-key-with-selection-003-expected.txt: Added.
        * layout-tests/editing/inserting/return-key-with-selection-003.html: Added.

2005-03-11  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4009446> AX: kAXTextMarkerForPositionParameterizedAttribute not working correctly (required for Dictionary pop-up)

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityAttributeValue:]):
        Comment changes.
        
        (-[KWQAccObject doAXTextMarkerForPosition:]):
        Dig into widgets.
        
        (-[KWQAccObject doAXBoundsForTextMarkerRange:]):
        Use the selection's document instead of the top document, to accommodate frames, etc.
        
        (-[KWQAccObject accessibilityAttributeValue:forParameter:]):
        Fixed parameter processing to look for NSValue instead of AXValue.

2005-03-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/3972665> 8A360: HTML message partially truncated on left hand side, text-indent from Script Editor
        
        This was fixed, then regressed with Harrison's fix for this bug:
        
        <rdar://problem/3948453> Can't type accented chars as first character in Stickies widget

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): My now addresses both problems in a way that they no longer
        clobber each other.

2005-03-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:
        
        <rdar://problem/4045511> Copying and pasting end-of-paragraph selection puts insertion point in wrong place
        <rdar://problem/4045513> Copying and pasting selection starting at end of paragraph can incorrectly remove line break

        The copy/paste code before this patch had no notion of a "logical newline" at the start of the selection. We have
        had a similar notion for "logical newline" at the end of the selection for quite some time. To fix these bugs, we
        need to introduce the same idea for selection starts.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment): Process the "logical newline" at start as we write it out
        in markup. Set the bit we added to this object to signify we have such a newline.
        (khtml::ReplaceSelectionCommand::doApply): Many, many changes to introduce the new "logical newline" at start concept.
        I also tried to simply the code that sets the start position for inserting content to be pasted. I also improved a
        weakness in the smart-paste code. Now, we check before and after the paste for whether we need to add a leading or
        trailing space. The code previous to this patch only did a "before" check, with the result that we sometimes added
        a second space. In other words, the code did not realize that DOM changes done by pasting could cause formerly
        unrendered whitespace to become rendered. Also moved line placeholder clean up code to its own function.
        (khtml::ReplaceSelectionCommand::removeLinePlaceholderIfNeeded): New helper that further refines the notion
        of when we can remove a line placeholder. The definition is now, "If a line placeholder is at the visible start
        and visible end of its line, keep it; otherwise remove it".
        * khtml/editing/htmlediting.h: Declare new functions. Rework inlines in ReplacementFragment class to account for
        addition of new "logical newline" at start concept.
        (khtml::ReplacementFragment::hasInterchangeNewlineAtStart): New accessor.
        (khtml::ReplacementFragment::hasInterchangeNewlineAtEnd): Renamed from hasInterchangeNewline(), since before we
        only had a bit for the end, hence we did not need to distinguish it from the start.
        * khtml/editing/markup.cpp:
        (khtml::createMarkup): Added code to detect and write out markup for cases where we have a "logical newline" at start.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::startPosition): New helper.
        (DOM::RangeImpl::endPosition): Ditto.
        * khtml/xml/dom2_rangeimpl.h: Declare new helpers.
        
        New tests:
        * layout-tests/editing/pasteboard/paste-line-endings-001-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-001.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-002-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-002.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-003-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-003.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-004-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-004.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-005-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-005.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-006-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-006.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-007-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-007.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-008-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-008.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-009-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-009.html: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-010-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-line-endings-010.html: Added.

=== Safari-405 ===

2005-03-10  Darin Adler  <darin@apple.com>

        Reviewed by Richard.

        - fixed <rdar://problem/4037700> Every character typed causes stat call for /usr/share/icu/icudt32b_char.brk

        * khtml/rendering/render_text.cpp: (getCharacterBreakIterator): Set boolean "got iterator" to true.

2005-03-10  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/4042867> "Bigger" changes the font size of too much text when the selection is on a style-change boundary

        * khtml/editing/htmlediting.cpp: (khtml::ApplyStyleCommand::applyRelativeFontStyleChange):
        Advance out of the starting text node if we're at the end of it.

2005-03-10  Darin Adler  <darin@apple.com>

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::write): Fixed assertion for nested calls to write.

2005-03-10  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4032346> REGRESSION (Mail): changing 1st line of a URL that wraps to two lines doesn't always update 2nd line

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::matchedEndLine):
        Look at first clean line in case line wrap implicitly dirtied it.

2005-03-10  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Vicki.

	<rdar://problem/4046018> REGRESSION (TOT): RSS pages don't display anything
        
	* kwq/WebCoreBridge.mm:
        (-[WebCoreBridge canLoadURL:fromReferrer:hideReferrer:]): Exempt
	feed: and feeds: pages from the local file security check.

2005-03-10  Darin Adler  <darin@apple.com>

        Change written by Steve Peters, reviewed by me.

        - fixed <rdar://problem/4045924> improve compareBoundaryPoints to make style changes faster

        * khtml/xml/dom2_rangeimpl.cpp: (DOM::RangeImpl::compareBoundaryPoints):
        Do early outs in a couple of the loops to make things faster.

2005-03-10  Jens Alfke  <jens@apple.com>

        Reviewed by rjw.

	Fixes <rdar://problem/4040848> "REGR: Sun security-check demo applet does not load". My earlier fix for 3603191 deferred loading the applet until the </applet> tag is reached, so all <param>s will be available. Unfortunately that meant that if the </applet> tag was missing, the applet would never load at all. So instead, the loading needs to happen when the ID_APPLET tag is popped from the parser stack for any reason.

	I've restored the old NodeImpl::closeRenderer() method. Except it's now virtual, with a no-op base implementation, and is overridden by HTMLAppletElementImpl, replacing its setAllParamsAvailable method that I added a few weeks ago when fixing 3603191.

	This ensures that the applet will get loaded even if there is no explicit </applet> tag.

	The changes to htmlparser.cpp back out my earlier change and restore the lines that were deleted on 8/3/04 when the old closeRenderer was removed.

        * khtml/html/html_objectimpl.cpp:
        (HTMLAppletElementImpl::closeRenderer):
        * khtml/html/html_objectimpl.h:
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::insertNode):
        (KHTMLParser::processCloseTag):
        (KHTMLParser::popOneBlock):
        * khtml/xml/dom_nodeimpl.h:
        (DOM::NodeImpl::closeRenderer):

2005-03-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4024929> REGRESSION (Mail): Pasting text with multiple reply levels removes one level instead of all
        
        The code to figure out which node to use to merge into an existing line did not drill into the first inline element
        as needed to make the feature work as user expect. Instead, it looked at the first node, and if it was a block, it
        skipped that node. This worked for some cases (including the important "paste-as-quotation" case) but obviously 
        doesn't work for content quoted more than once.
        
        Now, mergeStartNode() will look for the first node in pasted content that is not a block. It will now also look
        for nodes specially marked by Mail as a node added to make "Paste As Quotation" work. It won't skip those. 
        
        NOTE: This change will break Mail's "Paste As Quotation" feature for TOT WebKit users, but this is only a temporary 
        problem that will exist until we sync up with Mail's pending change to mark nodes as needed in its pasteAsQuotation:
        method.
        
        * khtml/editing/html_interchange.h: Add ApplePasteAsQuotation constant used to check for "marked" blockquotes.
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::mergeStartNode): Look for first node that is either not a block or is marked as
        an ApplePasteAsQuotation node.
        (khtml::isMailPasteAsQuotationNode): New helper that looks for nodes marked with ApplePasteAsQuotation.
        * khtml/editing/htmlediting.h: Updated header for new function.
        
        This test result changed is an acceptable way.
        
        * layout-tests/editing/pasteboard/paste-text-013-expected.txt
        * layout-tests/editing/pasteboard/paste-text-013.html

        NOTE: This change causes a regression in this layout test:

        * layout-tests/editing/pasteboard/paste-text-013.html

        This problem will need to be fixed separately, and this bug has been filed to track this problem:
        <rdar://problem/4045513> Copying and pasting selection starting at end of paragraph can incorrectly remove line break

2005-03-09  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	<rdar://problem/4040776> Dashboard (Weather widget) is a memory hog
        
	Change things around so the event listeners for XMLHttpRequest
	mark their JS listener objects instead of holding a hard
	reference, to avoid an unbreakable reference cycle.

	* khtml/ecma/kjs_events.cpp:
        (JSAbstractEventListener::JSAbstractEventListener):
        (JSAbstractEventListener::~JSAbstractEventListener):
        (JSAbstractEventListener::handleEvent):
        (JSAbstractEventListener::eventListenerType):
        (JSUnprotectedEventListener::JSUnprotectedEventListener):
        (JSUnprotectedEventListener::~JSUnprotectedEventListener):
        (JSUnprotectedEventListener::listenerObj):
        (JSUnprotectedEventListener::windowObj):
        (JSUnprotectedEventListener::mark):
        (JSEventListener::JSEventListener):
        (JSEventListener::~JSEventListener):
        (JSEventListener::listenerObj):
        (JSEventListener::windowObj):
        (JSLazyEventListener::JSLazyEventListener):
        * khtml/ecma/kjs_events.h:
        * khtml/ecma/kjs_html.h:
        * khtml/ecma/kjs_window.cpp:
        (Window::getJSEventListener):
        (Window::getJSUnprotectedEventListener):
        * khtml/ecma/kjs_window.h:
        * khtml/ecma/xmlhttprequest.cpp:
        (KJS::XMLHttpRequest::putValue):
        (KJS::XMLHttpRequest::mark):
        * khtml/ecma/xmlhttprequest.h:
        * khtml/khtml_part.h:

2005-03-06  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/4005575> Arbitrary file disclosure vulnerability due to ability to load local html from remote content
        
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::putValue):
        * khtml/ecma/kjs_window.cpp:
        (Window::put):
        (WindowFunc::tryCall):
        (Location::put):
        (LocationFunc::tryCall):
        * khtml/khtml_part.cpp:
        (KHTMLPart::begin):
        (KHTMLPart::scheduleLocationChange):
        (KHTMLPart::slotRedirect):
        (KHTMLPart::processObjectRequest):
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::openURLRequest):
        (KWQKHTMLPart::urlSelected):
        (KWQKHTMLPart::createPart):
        * kwq/KWQKHTMLPartBrowserExtension.mm:
        (KHTMLPartBrowserExtension::createNewWindow):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (hasCaseInsensitivePrefix):
        (-[WebCoreBridge didNotOpenURL:pageCache:]):
        (-[WebCoreBridge canLoadURL:fromReferrer:hideReferrer:]):

2005-03-09  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4032938> Safari: text layout for MS P Gothic font is corrupted

	Remove our hacked special case now we have our own cache of
	which fonts are fixed  pitch.

        Reviewed by Maciej.

        * kwq/KWQFont.mm:
        (QFont::isFixedPitch):

2005-03-09  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/4037141> REGRESSION (Mail): Pasting deletes preceding blank lines with certain steps

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::insertPlaceholderForAncestorBlockContent):
        Add check for anonymous text after blocks.

2005-03-08  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:
        
        <rdar://problem/4039661> crash in ApplyStyleCommand::applyBlockStyle pasting contents of webpage into Mail or Blot
        <rdar://problem/4039672> hang in moveParagraphContentsToNewBlockIfNecessary after pasting contents of webpage into Blot

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): Fix for 4039672. Iteration needs to do
        a traverseNextSibling(), not a traverseNextNode(). The latter might iterate into a child that already got moved, and
        the code can infinite loop as a result.
        (khtml::ApplyStyleCommand::applyBlockStyle): Fix for 4039661. This function iterates over a set of nodes to apply
        block styles. Before, the iteration would go from the start to the end of the selection, and apply block styles
        as it went. However, the act of applying style could confuse the iteration. Now I iterate and store the relevant
        nodes in QPtrList before doing any style manipulation, and then iterate that set of nodes.

2005-03-08  Darin Adler  <darin@apple.com>

        Change written by Hyatt, reviewed by me.

        - fixed <rdar://problem/3952698> Function buttons do not display properly with Telia Webmail

        * khtml/rendering/render_replaced.cpp: (RenderReplaced::calcMinMaxWidth):
        Only use a minWidth of 0 for images with a percentage value. Other replaced elements aren't scalable
        so their minWidth should be their calculated width. This has been wrong all along, but it's a relatively
        safe change because it only affects replaced elements' min-width.

2005-03-08  David Harrison  <harrison@apple.com>

        Reviewed by Ken.

        <rdar://problem/4039006> REGRESSION (Mail): Command-left-arrow goes to the start of the wrong line in particular message

        * khtml/editing/visible_units.cpp:
        (khtml::startOfLine):
        Use firstLeafChild() instead of firstChild().

2005-03-08  Richard Williamson   <rjw@apple.com>

	Fixed by Tom Madden.

	Fixed <rdar://problem/4038586> 8A402: Osaka-Mono text overlaps when typing with input method

	We weren't clearing the "all ascii" flag when setting text on
	RenderText.

        Reviewed by Richard Williamson.

        * khtml/rendering/render_text.cpp:
        (RenderText::setText):

2005-03-08  Darin Adler  <darin@apple.com>

        Reviewed by Ken and Maciej.

        - fixed <rdar://problem/3988809> REGRESSION (Mail): wide space characters are turned into plain old spaces when typed or pasted

        Changed the few places where it matters to use a "collapsible whitespace" concept instead of
        the general whitespace concept. This means treating only ' ' and '\n' specially instead of
        including other space characters, which matches what the space-collapsing logic does in RenderText,
        although it really needs to behave differently based on whitespace mode.

        * khtml/editing/visible_text.h: (khtml::isCollapsibleWhitespace): Added. This returns true only for
        ' ' and '\n' since they are the only characters collapsed once text is in the DOM. But really it
        can't do the job ignoring white-space mode, so some day it must go.

        * khtml/editing/html_interchange.cpp: (convertHTMLTextToInterchangeFormat): Changed to use
        isCollapsibleWhitespace and removed unnecessary calls to latin1().

        * khtml/editing/htmlediting.cpp:
        (khtml::isNBSP): Removed unnecessary creation/destruction of QChar each time this is called.
        (khtml::nextCharacterIsCollapsibleWhitespace): Renamed from isWS and changed to use isCollapsibleWhitespace.
        (khtml::DeleteSelectionCommand::fixupWhitespace): Use isCollapsibleWhitespace instead of isWS,
        since we only want to do our NBSP tricks for collapsible whitespace.
        (khtml::InsertTextCommand::input): Changed use of isTab to instead say == "\t" since that does the
        same thing and is arguably just as clear. Changed use of isWS to == " " since the input text can't
        include any "\n" characters, and really a plain old space is the only collapsible thing that can
        be passed in. Use isCollapsibleWhitespace instead of isWS since we want to do NBSP tricks only for
        collapsible whitespace, not all whitespace.
        (khtml::InsertTextCommand::insertSpace): Use isCollapsibleWhitespace instead of isWS since we want
        to do NBSP tricks only for collapsible whitespace, not all whitespace.
        (khtml::RebalanceWhitespaceCommand::doApply): Ditto.

        * khtml/xml/dom_position.h: Changed treatNBSPAsWhiteSpace parameters to considerNonCollapsibleWhitespace
        parameters. The most common callers are only interested in collapsible whitespace, and the smart copy
        and paste callers want to include all whitespace, including non-breaking spaces and all the Unicode spaces.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::leadingWhitespacePosition): Rename the parameter, and use either QChar::isSpace or
        isCollapsibleWhitespace depending on the boolean passed in.
        (DOM::Position::trailingWhitespacePosition): Ditto.

2005-03-07  John Sullivan  <sullivan@apple.com>

        Reviewed by Darin.
        
        - <rdar://problem/4040868> REGRESSION (Mail, 403-403+): Drag and drop deletes text, 
        many other bad editing problems

        * khtml/rendering/render_text.cpp:
        (RenderText::caretMaxOffset):
        A "-" should have been a "+" in this method that was tweaked an hour ago. Editing
        was completely horked.

2005-03-07  Richard Williamson   <rjw@apple.com>

	Additional nil check from fix for 4040749.

        * khtml/rendering/render_box.cpp:
        (RenderBox::setStyle):

2005-03-07  Richard Williamson   <rjw@apple.com>

	Additional nil check from fix for 4040749.

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateLayerPosition):

2005-03-07  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4033202> REGRESSION (Mail): Can't arrow up at a particular spot in a particular Mail message

        Doublecheck that new position is really on a different line, because the VisiblePosition constructor does not.
        Filed <rdar://problem/4040763> for that problem.

        * khtml/editing/visible_units.cpp:
        (khtml::previousLinePosition):

2005-03-07  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4040749> REGRESSION (125-178): opacity style not working, breaks fading images on okcupid.com

	When layers are dynamically created/removed as a result of changing opacity they weren't being correctly
	sized and positioned.  This happens whenever opacity goes from < 1 to 1.

        Reviewed by Darin.

        * khtml/rendering/render_box.cpp:
        (RenderBox::setStyle):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateLayerPosition):

2005-03-07  Christy Warren  <kali@apple.com>

        Reviewed by Darin

        * khtml/rendering/render_text.cpp:
        (RenderText::caretMinOffset): modified to handle BIDI case by checking all text boxes for min offset
        (RenderText::caretMaxOffset): modified to handle BIDI case by checking all text boxes for max offset

2005-03-07  David Harrison  <harrison@apple.com>

        Reviewed by Ken.

        <rdar://problem/4029225> REGRESSION (Mail): Crash if hit return after dragging in attachment - DeleteSelectionCommand::initializePositionData

        Work around the fact that the height() of a BR is 0 if there are no text elements on the line, even if there are replaced elements.
        Filed <rdar://problem/4040358> RenderBR height() is not accurate.
        
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply):
        When height is 0, double check that the placeholder is the first position on the line.

=== Safari-403 ===

2005-03-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Vicki
    
        Fix for this bug:
        
        <rdar://problem/4040136> Expose SPI for WebCore's functions to create document fragments from plain text and markup strings

        * kwq/DOMHTML.mm: Add two new SPI functions.
        (-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:])
        (-[DOMHTMLDocument _createDocumentFragmentWithText:])
        * kwq/DOMPrivate.h: Declare the new SPI here, a privately-exported header, so Mail can make use of it.

2005-03-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4039676> REGRESSION (Mail): in reply, <cr> on pasted text (without trailing newline) is eaten when pasted above date

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Code to "eat" a <br> element, that was creating an otherwise empty line, was running
        when it should not. If the content being pasted in does not end in a "logical" newline itself, then the <br> already
        in the content needs to be preserved. A simple one-line change now sees to this.
        
        * layout-tests/editing/pasteboard/paste-text-010-expected.txt: This test now has an extra, but harmless,
        <br> at the end of a paragraph. This makes sense given the code change.

        New test:
        * layout-tests/editing/pasteboard/paste-text-018-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-018.html: Added.

2005-03-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4035648> REGRESSION (Mail): line feed in source HTML file causes bad copy/paste behavior

        The createMarkup() function in markup.cpp iterates over the nodes in a range,
        and does some bookkeeping to figure out when to add close tags to the markup.
        Some code added at the start of the loop to prevent markup from being written
        for unrendered nodes short-circuited the rest of the loop, and so prevented
        the close-tag-writing code from running when it should.

        This is why the "plain" text wound up inside of the bold tag in the example
        above. The addition of the unrendered return character caused an incorrect
        delay in the close tag for the bold element from being written out, with the
        result being that it wound up including additional content.

        The fix is to add checks for node renderers throughout the loop at the points
        where markup is written out for each node. This allows the additional close
        tag logic to run as needed.

        All layout tests pass with this change.

        * khtml/editing/markup.cpp:
        (khtml::createMarkup)

        New test:
        
        * layout-tests/editing/pasteboard/paste-4035648-fix-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-4035648-fix.html: Added.

2005-03-06  Christy Warren  <kali@appple.com>

        Reviewed by Ken

        * khtml/rendering/render_text.cpp:
        (lastRendererOnPrevLine): helper for RenderText::caretRect
        (RenderText::caretRect): added code to properly handle bidi ordered text boxes

2005-03-06  Christy Warren  <kali@apple.com>

        Reviewed by Darin.

        * khtml/editing/visible_position.cpp: Eliminated code that cuts off searching through the text boxes based on an assumption that breaks under bidi
        (khtml::VisiblePosition::isCandidate):
        * kwq/KWQFontMetrics.mm:
        (QFontMetrics::checkSelectionPoint): Made the initialization of the WebCoreStyle honor the reversed flag

2005-03-05  John Sullivan  <sullivan@apple.com>

        Reviewed by Maciej.
        
        - fixed <rdar://problem/4038417> Mail crashed in StyleChange::checkForLegacyHTMLStyleChange 
        when composing a reply

        * khtml/editing/htmlediting.cpp:
        (khtml::StyleChange::checkForLegacyHTMLStyleChange):
        Added missing nil check.

2005-03-05  Darin Adler  <darin@apple.com>

        Reviewed by Don.

        - fixed <rdar://problem/4038478> Crash in renderer viewing RSS feed at feed://wvs.topleftpixel.com/index.rdf

        * khtml/xml/dom_docimpl.cpp: (widgetForNode): Check for nil before going from node to renderer.

2005-03-05  Darin Adler  <darin@apple.com>

        Reviewed by Richard.

        - fixed <rdar://problem/4037700> Every character typed causes stat call for /usr/share/icu/icudt32b_char.brk

        * khtml/rendering/render_text.cpp:
        (getCharacterBreakIterator): Added. Helper that sets up an iterator for the passed-in text.
        Shares a single global iterator (fast, albeit not thread-safe).
        (RenderText::previousOffset): Changed to call getCharacterBreakIterator.
        (RenderText::nextOffset): Ditto.

2005-03-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/4038267> REGRESSION (Mail): Crash copying and pasting end of paragraph

        Code to handle content that has a "logical" newline at the end of the pasted content, and the code
        to adjust the selection at the end of the paste operation made an assumption that at least one
        node had been inserted by the paste command. This is not necessarily true in the case where the sole content
        in the pasted content is one of these "logical" newlines. Adjust some code around so that we don't deref
        null, but still adjust the selection correctly for this case. In each of the two functions below, some
        null checks have been added, and some code has been rearranged a little bit to continue on through
        the end of completeHTMLReplacement, even if no nodes have been inserted. The patch looks bigger and more
        complicated than the conceptual change.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply)
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement)
        
        * layout-tests/editing/pasteboard/paste-4038267-fix-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-4038267-fix.html: Added.

2005-03-05  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4025918> images copied from Safari with relative src URLs aren't pasted into Mail messages (KURL resolves base URLs incorrectly)

        * kwq/KWQKURL.mm: (KURL::KURL): Add a slash at the start of the path if a relative part is adding
        a path onto a URL that has "pre-path" bits like host name, but no path yet. This doesn't come up
        for http because in that case we add a trailing "/" as part of canonicalization.

2005-03-04  John Sullivan  <sullivan@apple.com>

        Reviewed by Kevin.
        
        - fixed <rdar://problem/4033705> REGRESSION (Mail): Copy/Paste from Excel 
        crashes Mail in KWQKHTMLPart::fontForSelection(bool*) const + 232

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection):
        Check for nil startNode, not just nil renderer.

2005-03-04  David Harrison  <harrison@apple.com>

        Reviewed by Ken, Richard.

        <rdar://problem/3996383> REGRESSION (Mail): Deleting all of first line also deletes line ending

        Problem was the placeholder check was based on 0 height block, but the block in this
        case is the BODY, which has other content even though the paragraph is gone.
        
        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::insertBlockPlaceholder):
        Now does insert instead of append!
    
        (khtml::CompositeEditCommand::appendBlockPlaceholder):
        New.  Actually does append.
        
        (khtml::CompositeEditCommand::addBlockPlaceholderIfNeeded):
        Renamed from insertBlockPlaceholderIfNeeded because it can insert or append.  Also accepts "force insert" flag.
        
        (khtml::CompositeEditCommand::removeBlockPlaceholder):
        Renamed for succinctness from removeBlockPlaceholderIfNeeded.
        
        (khtml::DeleteSelectionCommand::insertPlaceholderForAncestorBlockContent):
        (khtml::DeleteSelectionCommand::moveNodesAfterNode):
        Use renamed methods.
        
        (khtml::DeleteSelectionCommand::doApply):
        Use addBlockPlaceholderIfNeeded "force insert" flag if deleting whole paragraphs did not leave an empty one.
        
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply):
        (khtml::InsertTextCommand::input):
        Use renamed methods.
        
        * khtml/editing/htmlediting.h:
        Renamed and new methods per above.
        

2005-03-04  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4032840> REGRESSION (Mail): crash in RemoveNodeCommand after pasting attachment at end of message

        Reviewed by darin.

        * khtml/editing/visible_units.cpp:
        (khtml::endOfParagraph): don't consider text nodes that have no rendered characters

2005-03-04  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4034764> REGRESSION(125-188)Viewing text/plain page and going back/forward corrupts HTML pages (google.com)

	The parse mode wasn't be restored to the document when going
	back.

        Reviewed by Hyatt.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::openURLFromPageCache):
        * kwq/KWQPageState.h:
        * kwq/KWQPageState.mm:
        (-[KWQPageState initWithDocument:URL:windowProperties:locationProperties:interpreterBuiltins:]):

2005-03-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * layout-tests/editing/style/create-block-for-style-012-expected.txt: Shame on me!
        I landed my last fix without running layout tests. This one changes in a subtle, but
        acceptable way.

2005-03-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/4032543> REGRESSION (Mail): Mail hangs when quoted text is pasted twice
        
        This code change fixes the bug in a non-obvious way. The root cause of the problem was
        that a VisiblePosition created using an affinity originating in Mail code caused 
        two VisiblePosition objects that should have been equal to differ only in their 
        affinities, which in turn caused us to run a code path that should not have run.

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::VisiblePosition): Added copy constructor.
        (khtml::VisiblePosition::next): Factored out inline code that used to be here into new
        setAffinityUsingLinePosition() function.
        (khtml::isEqualIgnoringAffinity): New helper to handle cases when affinity in equality check does
        not matter. However, we want to know about such cases where a VisiblePosition differs only by affinity, 
        and the code will assert in development when this happens.
        (khtml::isNotEqualIgnoringAffinity): Ditto, but not. :)
        (khtml::setAffinityUsingLinePosition): New helper function mentioned above. This will "correct"
        upstream affinity to downstream if the affinity does not make a difference for the position.
        * khtml/editing/visible_position.h:
        * khtml/editing/visible_range.h: Wacky bug. The operator== for this class took VisiblePosition classes!
        * khtml/editing/visible_units.cpp:
        (khtml::isStartOfParagraph): Now performs equality check without regard to affinity.
        (khtml::isEndOfParagraph): Ditto.
        (khtml::isStartOfBlock): Ditto.
        (khtml::isEndOfBlock): Ditto.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:]): Adjusts the affinity using setAffinityUsingLinePosition()
        if necessary.

2005-03-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4036817> REGRESSION: ctrl-y broken when a line + carriage return cut

        * khtml/editing/htmlediting.h: Added insertTextRunWithoutNewlines.
        * khtml/editing/htmlediting.cpp:
        (khtml::InsertTextCommand::input): Added assertion to make sure strings with newlines don't get
        down to this level.
        (khtml::TypingCommand::insertText): Added. Takes the name of the old function, but is a new
        level that breaks runs into lines and inserts each one separately.
        (khtml::TypingCommand::insertTextRunWithoutNewlines): Renamed old insertText to this. 

        * khtml/dom/dom_string.h: Made substring be a const member function.
        * khtml/dom/dom_string.cpp: (DOM::DOMString::substring): Made this const.

2005-03-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4020413> REGRESSION (Mail): can't use fonts with names that start with "#" in Mail (Korean fonts)

        * khtml/css/css_valueimpl.cpp:
        (DOM::isLegalIdentifier): Added. Commented out and not used.
        (DOM::quoteStringIfNeeded): Quotes the string if needed. For now only if it starts with "#".
        (DOM::CSSPrimitiveValueImpl::cssText): Call quoteStringIfNeeded when asked for cssText for an arbitrary string, since we
        need text you can re-parse.
        (DOM::FontFamilyValueImpl::cssText): Ditto.

        * khtml/editing/markup.cpp:
        (khtml::startMarkup): Added comments about lack of quoting for attributes.
        (khtml::createMarkup): Ditto.

2005-03-04 Adele Amchan  <adele@apple.com>
 
       Reviewed by Maciej

	Fix for <rdar://problem/4021711> REGRESSION(125-188) blank pages when browsing forum at cooperativeresearch.org - cached external script problem

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::scriptHandler): set flag needToRefCachedScript so we can make sure 
        notifyFinished is called after pendingSrc is set up with the right data from the cached script

2005-03-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4029632> Tiger 8A398:- Mail crashes in DOM::NodeImpl::isBlockFlow() after pasting text with alignment style and BR element from Safari

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): VisiblePosition constructor
        was failing to yield a position for a node just pasted into the document since a layout was needed
        for the calculation to come out right. Layout added. Crash gone.

=== Safari-402 ===

2005-03-03  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3992803> Cannot navigate through list items with the keyboard, you're stuck in the same <li> block unless you click out

        Reviewed by harrison.

        * khtml/rendering/render_line.cpp:
        (khtml::RootInlineBox::closestLeafChildForXPos): avoid returning list markers when possible. Also improved heuristic for returning the best InlineBox given the passed X position.


2005-03-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Fix for this bug:
        
        <rdar://problem/4035198> Pasting text with different styles does not get reproducible results

        I had a good idea yesterday to improve the way we "fixup" styles after
        pasting, but i chose a poor data structure to do it, a map of
        nodes-to-styles. In the fixup step, I iterated over the map elements and
        did the fixup. However, since the order in which the items would come
        out of the map is indeterminate, we got unpredictable results.

        So, the concept was good, but the implementation was flawed. I have
        fixed this mapping to be a list instead, so the order that nodes are
        evaluated in the fixup step is document order. This works nicely.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::~ReplacementFragment): No longer need to explicity deref nodes and
        styles saved away for later fixup. This is now handled by the new NodeDesiredStyle class.
        (khtml::ReplacementFragment::computeStylesUsingTestRendering): Now calls computeAndStoreNodeDesiredStyle,
        function renamed from mapDesiredStyleForNode.
        Now accepts a QValueList<NodeDesiredStyle> in place of the old map.
        (khtml::NodeDesiredStyle::NodeDesiredStyle): New class that represents a node-to-style mapping.
        (khtml::NodeDesiredStyle::~NodeDesiredStyle): Ditto.
        (khtml::NodeDesiredStyle::operator=): Ditto.
        (khtml::ReplaceSelectionCommand::doApply): Now calls computeAndStoreNodeDesiredStyle,
        function renamed from mapDesiredStyleForNode.
        (khtml::ReplaceSelectionCommand::fixupNodeStyles): Now operates on a QValueList<NodeDesiredStyle> in 
        place of the old map.
        (khtml::computeAndStoreNodeDesiredStyle): Renamed from mapDesiredStyleForNode.  Now operates on a 
        QValueList<NodeDesiredStyle> in place of the old map.
        * khtml/editing/htmlediting.h:
        (khtml::NodeDesiredStyle): New class that represents a node-to-style mapping.
        (khtml::ReplacementFragment::desiredStyles): Now returns a QValueList<NodeDesiredStyle> in place of the old map.

        * layout-tests/editing/style/typing-style-003-expected.txt: Results changed in an acceptable way.

2005-03-02  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/4029741> REGRESSION (188-189): <input type=text> are cleared when you hide/show them

        * khtml/html/html_formimpl.h: Added detach functions for both input and text area elements, since
        both have m_valueMatchesRenderer flags.
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::detach): Set m_valueMatchesRenderer to false, since the renderer is going away.
        (DOM::HTMLTextAreaElementImpl::detach): Ditto.

2005-03-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/4006151> in reply, caret moves to next line after toggling bold style then typing

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::applyInlineStyle): Defer cleaning up empty style until the end of the
        function. In some situations, the render tree can get confused when we do this removal up front.
        I wish I understood the reasons more deeply, but this bit of code shuffling seems harmless, and 
        fixes the bug.

2005-03-02  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/4024966> crash happened twice in [KWQTextField setHasFocus:] + 0xe8

        Added more nil checks to the widget implementations. Anywhere a widget pointer is used, do a nil check,
        rather than relying on high level assumptions about which calls can and can't destroy the HTML element
        (and hence the widget). The case in the bug seems to be a case where scrolling destroyed the element.
        We can't be sure this fixes the bug, but we can be relatively sure we didn't introduce any new problems,
        because this just avoids nil-dereferencing.

        * kwq/KWQButton.mm:
        (-[KWQButton becomeFirstResponder]):
        (-[KWQButton nextKeyView]):
        (-[KWQButton previousKeyView]):
        * kwq/KWQListBox.mm:
        (-[KWQTableView mouseDown:]):
        (-[KWQTableView becomeFirstResponder]):
        (-[KWQTableView numberOfRowsInTableView:]):
        (-[KWQTableView tableViewSelectionDidChange:]):
        (-[KWQTableView tableView:shouldSelectRow:]):
        (-[KWQTableView selectionShouldChangeInTableView:]):
        * kwq/KWQScrollBar.mm:
        (-[KWQScrollBar scroll:]):
        * kwq/KWQSlider.mm:
        (-[KWQSlider mouseDown:]):
        (-[KWQSlider slide:]):
        (-[KWQSlider becomeFirstResponder]):
        (-[KWQSlider nextKeyView]):
        (-[KWQSlider previousKeyView]):
        * kwq/KWQTextArea.mm:
        (-[KWQTextAreaTextView becomeFirstResponder]):
        (-[KWQTextAreaTextView resignFirstResponder]):
        (-[KWQTextAreaTextView mouseDown:]):
        * kwq/KWQTextField.mm:
        (-[KWQTextFieldController action:]):
        (-[KWQTextFieldController controlTextDidEndEditing:]):
        (-[KWQTextFieldController controlTextDidChange:]):
        (-[KWQTextFieldController textView:didHandleEvent:]):
        (-[KWQTextFieldController setHasFocus:]):

2005-03-02  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4031483> Leak (RenderObject::createInlineBox) reproducible with Stock widget

	We were leaking inline block line boxes.  Argh!

        Reviewed by Hyatt.

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::dirtyLineBoxes):
        * khtml/rendering/render_line.cpp:
        (khtml::InlineBox::deleteLine):

2005-03-02  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3976872> REGRESSION (Mail): Pasted plain text doesn't get the proper style if pasted into newlines

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommand::styleAtPosition): new, factored out from calculateStyleBeforeInsertion
        (khtml::InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion): call styleAtPosition
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): clear new m_insertionStyle ivar
        (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand): deref new m_insertionStyle  ivar
        (khtml::ReplaceSelectionCommand::doApply): store the style so it later be applied when matching style
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): apply style from m_insertionStyle when matching style
        * khtml/editing/htmlediting.h:

2005-03-02  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/4031718> REGRESSION (401-401+): Safari reproducible crash setting up scope in JSLazyEventListener::parseCode authenticating to bugweb
        
	* khtml/ecma/kjs_events.cpp:
	(JSLazyEventListener::parseCode): If originalNode is NULL, don't
	mess with the scope chain.
	
        * khtml/html/html_baseimpl.cpp:
        (HTMLBodyElementImpl::parseHTMLAttribute): For handlers that are
	delcared on body but set on the document, pass NULL to avoid
	swizzling the scope chain. It turns out that this is what browsers
	do, and it finesses the crash.

2005-03-02  David Harrison  <harrison@apple.com>

        Reviewed by Ken.

        <rdar://problem/3948453> Can't type accented chars as first character in Stickies widget

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply):

2005-03-02  Ken Kocienda  <kocienda@apple.com>
        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4020574> REGRESSION (Mail): copy/paste first part of reply-quoted text alters downstream style
        
        The problem was that the operation to move nodes following the newly-pasted nodes did not preserve the
        style of these moved nodes. I have generalized some of the functions that compute and preserve styles
        for nodes and then apply these styles after a DOM operation.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::~ReplacementFragment): Call new derefNodesAndStylesInMap() helper function
        in place of old code that had this deref'ing inline.
        (khtml::ReplacementFragment::computeStylesUsingTestRendering): Now calls new mapDesiredStyleForNode() helper
        function place of old code that had this style computation inline.
        (khtml::ReplacementFragment::removeStyleNodes): Updated comment for new helper name.
        (khtml::ReplaceSelectionCommand::doApply): Now calls new helpers in place of helpers whose names were changed,
        or in place of pre-refactored inline code.
        (khtml::ReplaceSelectionCommand::fixupNodeStyles): Renamed from applyStyleToInsertedNodes(). Now generalized
        to take the map of nodes to use for the fixup. This makes it possible to call this code with different maps,
        and that is needed to fix the bug.
        (khtml::mapDesiredStyleForNode): New helper function to compute the inheritable styles for a given node
        and map this style to the given node in the given map. This function now also includes the code that was
        in the removeBlockquoteColorsIfNeeded(). This latter helper has now been removed.
        (khtml::derefNodesAndStylesInMap): Simple helper to deref map members.
        * khtml/editing/htmlediting.h:
        (khtml::ReplacementFragment::desiredStyles): New helper to return map of nodes-to-desiredStyles.

2005-03-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:

        <rdar://problem/4011358> REGRESSION(Mail): after dragging text to mail message and deleting, typing or dragging new text doesn't work

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::isCandidate): Insertion point disappearing was due to a failed
        check here after deleting all the content in the body element. The special "empty block"
        needs to add check for DOM children. A block may have straggling anonymous render children in
        some cases, and so the check needs to be (!DOM-kids || !render-kids).

        Also, I botched the last checkin trying to split these two patches in my tree. Wrong layout tests 
        got checked in, I checked in a conflict marker in the Changelog, etc. I fixed everything with this checkin.

2005-03-01  Ken Kocienda  <kocienda@apple.com>
 
        Reviewed by Maciej

        Improved fix for this bug:
        
        <rdar://problem/3996605> Insert paragraph command puts new block in wrong place, creating difficult-to-handle HTML

        Maciej and I discussed this situation at length, and we came up with a better fix than I did earlier.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Simplify one special case so that it only handles the 
        "last in block" situation. Remove special case for "downstream node is in different block" and handle
        this case with a little bit of special code in the general insertion case.

        Results studied to make sure there were no problems.

        * layout-tests/editing/deleting/delete-3959464-fix-expected.txt
        * layout-tests/editing/inserting/insert-div-001-expected.txt
        * layout-tests/editing/inserting/insert-div-002-expected.txt
        * layout-tests/editing/inserting/insert-div-004-expected.txt
        * layout-tests/editing/inserting/insert-div-005-expected.txt
        * layout-tests/editing/inserting/insert-div-009-expected.txt
        * layout-tests/editing/inserting/insert-div-014-expected.txt
        * layout-tests/editing/inserting/insert-div-018-expected.txt
        * layout-tests/editing/inserting/insert-div-024-expected.txt
        * layout-tests/editing/pasteboard/paste-text-011-expected.txt
        * layout-tests/editing/pasteboard/paste-text-013-expected.txt
        * layout-tests/editing/pasteboard/paste-text-015-expected.txt
        * layout-tests/editing/style/block-style-004-expected.txt
        * layout-tests/editing/style/block-style-005-expected.txt
        * layout-tests/editing/style/block-style-006-expected.txt

        New test:
        
        * layout-tests/editing/inserting/insert-div-027.html
        * layout-tests/editing/inserting/insert-div-027-expected.txt

2005-03-01  David Hyatt  <hyatt@apple.com>

	Fix for 4030890, regression with <sup> on Google.  Fix some bogus != comparison checks in verticalPositionHint.
	
        Reviewed by John

        (RenderObject::getVerticalPosition):
        
2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4030669> smart delete does not delete spaces from pasted content

        Reviewed by rjw.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): pass true for treatNBSPAsWhiteSpace to leadingWhitespacePosition and trailingWhitespacePosition when testing whether or not we have to delete those characters as well.
        * khtml/editing/jsediting.cpp: pass true for smartDelete when the selection granularity is WORD. This allows us to write smart delete layout tests.
        * layout-tests/editing/deleting/smart-delete-001-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-001.html: Added.
        * layout-tests/editing/deleting/smart-delete-002-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-002.html: Added.

2005-03-01  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4029772> Weather widgets use a lot of memory (more that other widgets)

	The string objects created by KWQHeaderStringFromDictionary() leaked.

        Reviewed by John Louch.

        * kwq/KWQLoader.mm:
        (KWQHeaderStringFromDictionary):

2005-03-01  Jens Alfke  <jens@apple.com>

        Reviewed by Darin.

	<rdar://problem/4004531> Simple Sun Signed Applet throws exceptions; doesn't run
	Two fixes for the way we extract the parameter-y goodness from <object> tags.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget):

2005-03-01  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3990258> REGRESSION (125.12-181): top of picture that spans two pages is cut off on print from Safari

	The problem was due to incorrect "object truncation" in  RenderFlow::paintLines.  
	We attempt to push objects down if they don't fit on a page at
	paint time.  If the attempt to push object down failed we just
	didn't paint at all.

        Reviewed by Hyatt.

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):

2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4030669> smart delete does not delete spaces from pasted content

        Reviewed by rjw.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): pass true for treatNBSPAsWhiteSpace to leadingWhitespacePosition and trailingWhitespacePosition when testing whether or not we have to delete those characters as well.
        * khtml/editing/jsediting.cpp: pass true for smartDelete when the selection granularity is WORD. This allows us to write smart delete layout tests.
        * layout-tests/editing/deleting/smart-delete-001-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-001.html: Added.
        * layout-tests/editing/deleting/smart-delete-002-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-002.html: Added.

2005-03-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Vicki

        Fix for this bug:
        
        <rdar://problem/4030068> Trailing <return> gets eaten when pasted at the end of a document

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Add code to handle formerly-unhandled end-of-document case.

2005-03-01  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Vicki.

	<rdar://problem/4003774> REGRESSION(125-181): JavaScript problems @ Yankee/Dixie quiz
        
	Reworked how scopes are set up for event handlers to match other
	browser. This includes the following changes:

	- Special scope entries are set up at the time the event handler
	is created, not at the time it fires.

	- Special scope is only set up for event handlers set in the html
	source through an html attribute, not for handlers set using
	addEventHandler or setting JS properties like onclick through
	JavaScript.

	- Special scope is based on the DOM node on which the handler is
	an attribute, not the event target.

	This fixes the regression while allowing the fix to
	<rdar://problem/3798453> (DIG: getting variable with same name as
	DOM element attribute gets attribute value instead) to keep
	working correctly.
	
	* khtml/ecma/kjs_events.cpp:
        (JSEventListener::handleEvent):
        (JSLazyEventListener::JSLazyEventListener):
        (JSLazyEventListener::parseCode):
        * khtml/ecma/kjs_events.h:
        * khtml/ecma/kjs_proxy.cpp:
        (KJSProxyImpl::createHTMLEventHandler):
        * khtml/ecma/kjs_proxy.h:
        * khtml/ecma/kjs_window.cpp:
        (Window::getJSLazyEventListener):
        * khtml/ecma/kjs_window.h:
        * khtml/html/html_baseimpl.cpp:
        (HTMLBodyElementImpl::parseHTMLAttribute):
        (HTMLFrameElementImpl::parseHTMLAttribute):
        (HTMLFrameSetElementImpl::parseHTMLAttribute):
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::parseHTMLAttribute):
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::parseHTMLAttribute):
        (DOM::HTMLButtonElementImpl::parseHTMLAttribute):
        (DOM::HTMLInputElementImpl::parseHTMLAttribute):
        (DOM::HTMLLabelElementImpl::parseHTMLAttribute):
        (DOM::HTMLSelectElementImpl::parseHTMLAttribute):
        (DOM::HTMLTextAreaElementImpl::parseHTMLAttribute):
        * khtml/html/html_imageimpl.cpp:
        (HTMLImageElementImpl::parseHTMLAttribute):
        * khtml/html/html_objectimpl.cpp:
        (HTMLObjectElementImpl::parseHTMLAttribute):
        * khtml/khtml_part.cpp:
        (KHTMLPart::createHTMLEventListener):
        * khtml/khtml_part.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLEventListener):
        * khtml/xml/dom_docimpl.h:

=== Safari-401 ===

2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Backed out my patch since the tree was closed.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData):
        * khtml/editing/jsediting.cpp:

2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4030669> smart delete does not delete spaces from pasted content

        Reviewed by rjw.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): pass true for treatNBSPAsWhiteSpace to leadingWhitespacePosition and trailingWhitespacePosition when testing whether or not we have to delete those characters as well.
        * khtml/editing/jsediting.cpp: pass true for smartDelete when the selection granularity is WORD. This allows us to write smart delete layout tests.
        * layout-tests/editing/deleting/smart-delete-001-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-001.html: Added.
        * layout-tests/editing/deleting/smart-delete-002-expected.txt: Added.
        * layout-tests/editing/deleting/smart-delete-002.html: Added.

2005-03-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Vicki

        Fix for this bug:
        
        <rdar://problem/4030068> Trailing <return> gets eaten when pasted at the end of a document

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Add code to handle formerly-unhandled end-of-document case.

2005-03-01  David Harrison  <harrison@apple.com>

        Reviewed by Chris.

        <rdar://problem/3915560> Mail would like an SPI to enable "smart" text paste/drop

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge smartDeleteRangeForProposedRange:]):
        (-[WebCoreBridge smartInsertForString:replacingRange:beforeString:afterString:]):
        New.

2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4030404> selection granularity should be set when extending selection via JS

        Reviewed by kocienda.

        * khtml/ecma/kjs_window.cpp:
        (SelectionFunc::tryCall): set the granularity on the part. This will allow us to write smart paste layout tests.
        * layout-tests/editing/pasteboard/smart-paste-001-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-001.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-002-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-002.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-003-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-003.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-004-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-004.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-005-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-005.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-006-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-006.html: Added.
        * layout-tests/editing/pasteboard/smart-paste-007-expected.txt: Added.
        * layout-tests/editing/pasteboard/smart-paste-007.html: Added.

2005-03-01  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4029934> smart paste with plain text can add too many spaces

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): pass true for treatNBSPAsWhitespace to leadingWhitespacePosition and trailingWhitespacePosition
        * khtml/xml/dom_position.cpp:
        (DOM::isWS): take treatNBSPAsWhitespace param
        (DOM::Position::leadingWhitespacePosition): ditto
        (DOM::Position::trailingWhitespacePosition): ditto
        * khtml/xml/dom_position.h:

2005-03-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3996605> Insert paragraph command puts new block in wrong place, creating difficult-to-handle HTML

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Look for the upstream-most block to insert after
        when at the visible end of a block. This helps to avoid some undesirable sequences of markup which
        Dave says will be vary hard to render. Changing the command in this way avoids the "limitations"
        of the render tree by not asking it to render markup we do not want to make anyway.
        
        All these tests change, but either in insignificant ways, or for the better.
        
        * layout-tests/editing/deleting/delete-3959464-fix-expected.txt:
        * layout-tests/editing/inserting/insert-div-001-expected.txt:
        * layout-tests/editing/inserting/insert-div-002-expected.txt:
        * layout-tests/editing/inserting/insert-div-004-expected.txt:
        * layout-tests/editing/inserting/insert-div-005-expected.txt:
        * layout-tests/editing/inserting/insert-div-009-expected.txt:
        * layout-tests/editing/inserting/insert-div-024-expected.txt:
        * layout-tests/editing/pasteboard/paste-text-011-expected.txt:
        * layout-tests/editing/pasteboard/paste-text-013-expected.txt:
        * layout-tests/editing/pasteboard/paste-text-015-expected.txt:
        * layout-tests/editing/style/block-style-004-expected.txt:
        * layout-tests/editing/style/block-style-005-expected.txt:
        * layout-tests/editing/style/block-style-006-expected.txt:
        * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt:
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
        * layout-tests/editing/style/remove-underline-after-paragraph-expected.txt:
        * layout-tests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt:

        New test to check specific problem mentioned in the bug.

        * layout-tests/editing/inserting/insert-div-026-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-026.html: Added.

2005-02-28  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/4002864> REGRESSION(125-146) getElementById in onload fails in a test case involving external resources
        
	Moved management of elementById hashtable from attach/detach to
	insertedIntoDocument/removedFromDocument, to avoid being thrown
	off by temporary detaches due to style recalcs.
	
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::insertedIntoDocument):
        (ElementImpl::removedFromDocument):
        (ElementImpl::attach):
        (ElementImpl::updateId):
        * khtml/xml/dom_elementimpl.h:

	Make sure that insertedIntoDocument is called before firing any
	DOM events.
	
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeBaseImpl::dispatchChildInsertedEvents): 

2005-02-28  David Hyatt  <hyatt@apple.com>

	Fix for 4028999, safari crashes when resetting if mallocsribble is on.  Clip rects were being cleared using dead
	render objects.  Change the ordering.
	
        Reviewed by rjw

        * khtml/rendering/render_box.cpp:
        (RenderBox::detach):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::~RenderLayer):

2005-02-28  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4024786> REGRESSION (Mail): "Smart paste" plain-text word into Blot leaves insertion point misplaced

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Call updateLayout so caretMinOffset and caretMaxOffset return correct values.

2005-02-28  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - WebCore part of fix for <rdar://problem/4023490> REGRESSION (125-185): Tabbing through links 
        on frameset page gets stuck at end (tivofaq.com)

        * kwq/WebCoreBridge.h:
        add nextValidKeyViewOutsideWebFrameViews (code is in WebKit)

2005-02-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3972665> 8A360: HTML message partially truncated on left hand side, text-indent from Script Editor

        * khtml/css/css_computedstyle.cpp: inheritableProperties array now defined in css_valueimpl.cpp.
        * khtml/css/css_valueimpl.cpp: Define inheritableProperties array here.
        (DOM::CSSMutableStyleDeclarationImpl::copyBlockProperties): Use new name for blockProperties, and use the new
        constant for the number of items in the array.
        (DOM::CSSMutableStyleDeclarationImpl::removeBlockProperties): Ditto.
        (DOM::CSSMutableStyleDeclarationImpl::removeInheritableProperties): New function.
        * khtml/css/css_valueimpl.h: Declare inheritableProperties array and numInheritableProperties extern so they
        can be defined in css_valueimpl.cpp and used in css_computedstyle.cpp.
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::removeStyleNodes): This code was misguided, and removed too much style from HTML
        elements. Now, it removes from HTML elements only the styles that we replace later with a call to applyStyle().
        Also, add ID_B to list of inline "style" nodes we are willing to remove. Leaving it off was an oversight.

        * layout-tests/editing/pasteboard/paste-text-011-expected.txt: ID_B fix made this result change, without any
        visible change in the test.
        
        New test:
        
        * layout-tests/editing/style/smoosh-styles-003.html
        * layout-tests/editing/style/smoosh-styles-003-expected.txt

2005-02-28  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4026985> CrashTracer: ...14 crashes at com.apple.WebCore: -[KWQPageState invalidate] + 32

	Added more nil checking and ASSERTS.
	Without a reproducible case this is hard to definitively resolve.

        Reviewed by John Sullivan.

        * kwq/KWQPageState.mm:
        (-[KWQPageState invalidate]):

2005-02-28  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4027702> 3.5% performance regression btwn Safari-188 and Safari-400

	I inadvertently checked in some debugging code that disabled
	style sharing.  Backed out that change.

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::styleForElement):

2005-02-28  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4026639> www.bmw.ca configurator does not work with Safari

        Reviewed by john.

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElement::tryGet): when frameset.<name of frame child> is called, return the window object of the frame child

2005-02-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/4026906> Paste of HTML table content can break table structure

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::pruneEmptyNodes): Call new isProbablyTableStructureNode() function to prevent
        removal of empty table structure nodes.
        (khtml::ReplacementFragment::removeUnrenderedNodesUsingTestRendering): Ditto.
        (khtml::isProbablyTableStructureNode): New helper function.
        * khtml/editing/htmlediting.h: Declare new helper.

2005-02-28  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4023566> Stickies: Crash in ReplacementFragment::insertFragmentForTestRendering on paste

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): ref and deref the element while it is "floating"
        (khtml::ReplacementFragment::insertFragmentForTestRendering): ditto
        (khtml::floatRefdElement): new, keeps an element alive while its ref count is 0
        (khtml::createDefaultParagraphElement): removed commented out code
        (khtml::createBlockPlaceholderElement): ref the element and return it as "floating"
        (khtml::createFontElement): ditto
        (khtml::createStyleSpanElement): ditto
        * khtml/editing/htmlediting.h:

2005-02-27  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Vicki.

	<rdar://problem/3993557> REGRESSION (125-180-ish): getElementsByTagName no longer works with namespace designations
        
	* khtml/xml/dom_nodeimpl.cpp:
        (NodeBaseImpl::getElementsByTagNameNS): When no namespace is specified, find elements
	of the specified name in any namespace to match Mozilla and earlier Safari behavior.

2005-02-25  Darin Adler  <darin@apple.com>

        Reviewed by Adele.

        - fixed <rdar://problem/4025618> Crash while searching at hollywoodvideo.com

        * khtml/html/html_formimpl.h: Added valueWithDefault.
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::appendFormData): Call valueWithDefault instead of going at the render object
        to try to get the default value; there may be no render object if this is display:none.
        (DOM::HTMLInputElementImpl::valueWithDefault): Added. Knows about the defaults for "submit" and "reset"
        buttons; otherwise just returns the value as-is.

        * khtml/rendering/render_form.h: Removed the defaultLabel member functions.
        * khtml/rendering/render_form.cpp:
        (RenderSubmitButton::rawText): Call valueWithDefault instead of using defaultLabel function here on
        the render side. The DOM needs to know how to deal with the default anyway for form submission.
        (RenderSubmitButton::defaultLabel): Removed.
        (RenderResetButton::defaultLabel): Removed.
        (RenderPushButton::defaultLabel): Removed.

2005-02-25  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4025088> window onblur and onfocus don't fire when text field has focus

        * kwq/KWQKHTMLPart.h: Added setWindowHasFocus function and m_windowHasFocus data member.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setDisplaysWithFocusAttributes): Took out the code that sends the focus and blur events.
        (KWQKHTMLPart::setWindowHasFocus): Put that code here instead.

        * kwq/WebCoreBridge.h: Added setWindowHasFocus: method to the bridge.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge setWindowHasFocus:]): Added. Calls method on the part.

2005-02-25  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - re-fixed <rdar://problem/3665430> horizontal scroll bar of text area does not show, even when text is wide in "no wrap" mode

        * kwq/KWQTextArea.mm: (-[KWQTextArea _updateTextViewWidth]): Don't change the text view width
        to match the text area's width in the "wrap" case.

2005-02-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/4021518> 8A394 Mail crashes during paste: khtml::RootInlineBox::closestLeafChildForXPos

        * khtml/editing/visible_units.cpp:
        (khtml::previousLinePosition): Adding an updateLayout call at the start of the function fixes the crash, since
        we caught line boxes in a not-completely-updated state.
        (khtml::nextLinePosition): Ditto.

2005-02-25  David Hyatt  <hyatt@apple.com>

	Fix for 4010774, make sure to avoid an O(N^2) algorithm in nextRenderer() that is triggered when large
	DOM subtrees are inserted into documents via one insert/append call.
	
        Reviewed by kocienda

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::nextRenderer):

2005-02-25  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.

	Second pass at fixing 3382926 w/o causing layout regressions.  Same concept:
	if directionality of text's element is RTL and first character has neutral directionality
	then set the initial directionality to RTL.

        Reviewed by Hyatt.

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::bidiReorderLine):
        (khtml::RenderBlock::determineStartPosition):

=== Safari-400 ===

2005-02-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        Roll out Chris' change to fix this bug:
        
        <rdar://problem/4023566> Stickies: Crash in ReplacementFragment::insertFragmentForTestRendering on paste
        
        That code change is responsible for all these new crashers:
        
        <rdar://problem/4025177> crash copying safari.apple.com into Blot document
        <rdar://problem/4025184> crash in DOM::NodeImpl::parentNode copying "New!" from google.com to Blot
        <rdar://problem/4025214> crash in DOM::NodeImpl::getRect loading paste-match-style-001.html

        Since we wish to close the tree for a build right now, I am rolling out rather than investigating.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded)
        (khtml::ReplacementFragment::insertFragmentForTestRendering)
        (khtml::createDefaultParagraphElement)
        (khtml::createBlockPlaceholderElement)
        (khtml::createFontElement)
        (khtml::createStyleSpanElement)
        * khtml/editing/htmlediting.h

2005-02-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4020108> Pasting text into message makes Mail crash reproducibly

        Note that, even with this fix, development build will crash until this bug is fixed:
        <rdar://problem/4024996> Applying block styles can cause assertion failure in inline style removal
        
        This will not crash deployment builds, so I am going to land.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::applyBlockStyle): Applying block styles can make the loop to reach beyondEnd
        fail since the structure of the document can change. Cache the next node first before operating on it,
        as we do elsewhere.

2005-02-25  Vicki Murley <vicki@apple.com>

	- recommit this change, since rolling it out did NOT fix the performance regression!

    2005-02-23  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4011405> REGRESSION (180-181): Unconfirmed text disappears when text focus moves

        The key was to change things around so that we don't push text from the DOM to the widget
        unless the DOM has actually been changed. This prevents the code path that wipes out inline input
        during the blur process.

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::HTMLInputElementImpl): Start m_valueMatchesRenderer as false.
        (DOM::HTMLInputElementImpl::parseHTMLAttribute): Set m_valueMatchesRenderer to false when a
        new value is set here.
        (DOM::HTMLInputElementImpl::setValue): Set m_valueMatchesRenderer to false when a new value
        is set here.
        (DOM::HTMLInputElementImpl::setValueFromRenderer): Added. Sets m_value, sets m_valueMatchesRenderer
        to true, and also sends out the input event. It's better to have this here than in the renderer code.
        (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl): Start m_valueIsValid as false (replaces
        m_dirtyvalue) and m_valueMatchesRenderer as false.
        (DOM::HTMLTextAreaElementImpl::updateValue): Added. Factored this out from the value function. Uses
        the new booleans and keeps them up to date, specifically setting m_valueMatchesRenderer based on
        where the value came from.
        (DOM::HTMLTextAreaElementImpl::value): Updated to call updateValue to do most of the work.
        (DOM::HTMLTextAreaElementImpl::setValue): Set both m_valueIsValid and m_valueMatchesRenderer.
        (DOM::HTMLTextAreaElementImpl::setDefaultValue): Take parameter by reference.

        * khtml/html/html_formimpl.h: Added setValueFromRenderer, valueMatchesRenderer, setValueMatchesRenderer,
        and m_valueMatchesRenderer to input element. For textarea element, made some parameters pass DOMString
        by reference, and added invalidateValue, updateValue, valueMatchesRenderer, and setValueMatchesRenderer.

        * khtml/rendering/render_form.cpp:
        (RenderLineEdit::updateFromElement): Don't re-get the value from the DOM if valueMatchesRenderer
        is true.
        (RenderLineEdit::slotTextChanged): Call setValueFromRenderer instead of manipulating the DOM
        directly.
        (RenderTextArea::detach): Call updateValue instead of calling value for its side effect.
        (RenderTextArea::handleFocusOut): Ditto.
        (RenderTextArea::updateFromElement): Call updateValue and then not re-get the value from the
        DOM if valueMatchesRenderer is true.
        (RenderTextArea::slotTextChanged): Call invalidateValue instead of directly setting m_dirtyvalue to true.

2005-02-25  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4023566> Stickies: Crash in ReplacementFragment::insertFragmentForTestRendering on paste

        Reviewed by darin.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
        (khtml::ReplacementFragment::insertFragmentForTestRendering):
        (khtml::floatRefdElement):
        (khtml::createDefaultParagraphElement):
        (khtml::createBlockPlaceholderElement):
        (khtml::createFontElement):
        (khtml::createStyleSpanElement):
        * khtml/editing/htmlediting.h:

2005-02-25  Darin Adler  <darin@apple.com>

        * kwq/character-sets.txt: Checked in updated file. This new file has no effect, because none of the
        changes affect character sets that we support, but it's good to have the latest file in here, and
        completely safe because I checked that the generated files have not changed.

2005-02-25  Vicki Murley <vicki@apple.com>

        Reviewed by Darin.
 
	- back out this change, since it causes a 3.5% performance regression

    2005-02-23  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4011405> REGRESSION (180-181): Unconfirmed text disappears when text focus moves

        The key was to change things around so that we don't push text from the DOM to the widget
        unless the DOM has actually been changed. This prevents the code path that wipes out inline input
        during the blur process.

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::HTMLInputElementImpl): Start m_valueMatchesRenderer as false.
        (DOM::HTMLInputElementImpl::parseHTMLAttribute): Set m_valueMatchesRenderer to false when a
        new value is set here.
        (DOM::HTMLInputElementImpl::setValue): Set m_valueMatchesRenderer to false when a new value
        is set here.
        (DOM::HTMLInputElementImpl::setValueFromRenderer): Added. Sets m_value, sets m_valueMatchesRenderer
        to true, and also sends out the input event. It's better to have this here than in the renderer code.
        (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl): Start m_valueIsValid as false (replaces
        m_dirtyvalue) and m_valueMatchesRenderer as false.
        (DOM::HTMLTextAreaElementImpl::updateValue): Added. Factored this out from the value function. Uses
        the new booleans and keeps them up to date, specifically setting m_valueMatchesRenderer based on
        where the value came from.
        (DOM::HTMLTextAreaElementImpl::value): Updated to call updateValue to do most of the work.
        (DOM::HTMLTextAreaElementImpl::setValue): Set both m_valueIsValid and m_valueMatchesRenderer.
        (DOM::HTMLTextAreaElementImpl::setDefaultValue): Take parameter by reference.

        * khtml/html/html_formimpl.h: Added setValueFromRenderer, valueMatchesRenderer, setValueMatchesRenderer,
        and m_valueMatchesRenderer to input element. For textarea element, made some parameters pass DOMString
        by reference, and added invalidateValue, updateValue, valueMatchesRenderer, and setValueMatchesRenderer.

        * khtml/rendering/render_form.cpp:
        (RenderLineEdit::updateFromElement): Don't re-get the value from the DOM if valueMatchesRenderer
        is true.
        (RenderLineEdit::slotTextChanged): Call setValueFromRenderer instead of manipulating the DOM
        directly.
        (RenderTextArea::detach): Call updateValue instead of calling value for its side effect.
        (RenderTextArea::handleFocusOut): Ditto.
        (RenderTextArea::updateFromElement): Call updateValue and then not re-get the value from the
        DOM if valueMatchesRenderer is true.
        (RenderTextArea::slotTextChanged): Call invalidateValue instead of directly setting m_dirtyvalue to true.

2005-02-25  Darin Adler  <darin@apple.com>

        Reviewed by Chris.

        - fixed <rdar://problem/4024786> REGRESSION (Mail): "Smart paste" plain-text word into Blot leaves insertion point misplaced

        * khtml/editing/htmlediting.cpp: (khtml::ReplaceSelectionCommand::doApply):
        Use the insertNodeAfterAndUpdateNodesInserted and insertNodeBeforeAndUpdateNodesInserted
        functions to add the leading and trailing spaces for smart paste.

2005-02-25  David Hyatt  <hyatt@apple.com>

	Back out fix for 3382926, since it breaks LTR text inside RTL contexts.
	
        Reviewed by john

        * khtml/rendering/bidi.cpp:
        (khtml::BidiIterator::direction):

2005-02-25  David Hyatt  <hyatt@apple.com>

	Fix for 3975039, scrolling is slow in huge RSS views.  Optimize the calculation of clip rects for overflow:hidden
	layers.  Also optimize layer movement when scrolling overflow sections.
	
        Reviewed by darin

        * khtml/rendering/render_layer.cpp:
        (throw):
        (ClipRects::operator delete):
        (ClipRects::detach):
        (RenderLayer::RenderLayer):
        (RenderLayer::~RenderLayer):
        (RenderLayer::updateLayerPosition):
        (RenderLayer::removeOnlyThisLayer):
        (RenderLayer::insertOnlyThisLayer):
        (RenderLayer::scrollToOffset):
        (RenderLayer::hitTest):
        (RenderLayer::calculateClipRects):
        (RenderLayer::calculateRects):
        (RenderLayer::containsPoint):
        (RenderLayer::clearClipRects):
        (RenderLayer::clearClipRect):
        * khtml/rendering/render_layer.h:
        (khtml::ClipRects::m_refCnt):
        (khtml::ClipRects::overflowClipRect):
        (khtml::ClipRects::fixedClipRect):
        (khtml::ClipRects::posClipRect):
        (khtml::ClipRects::ref):
        (khtml::ClipRects::deref):
        (khtml::RenderLayer::clipRects):
        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):

2005-02-24  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin and Dave a while ago.

	<rdar://problem/3996685> REGRESSION: Crash in KWQVectorImpl::at loading http://maps.google.com/mapfiles/homepanel.xsl
        
	* kwq/WebCoreBridge.mm:
        (formElementFromDOMElement): Check for isHTMLElement() as well as
	id() == ID_FORM. This seems like an impossible situation, but
	papering over it seems more expedient for the time being.

2005-02-24  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.

	Use mirror characters correctly when rendering with RTL directionality.

        Reviewed by Hyatt.

        * khtml/rendering/bidi.cpp:
        (khtml::BidiIterator::direction):

2005-02-24  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3985889> REGRESSION (125-180): setting <img> src to GIF that already animated does not animate; just shows final frame
	
        Reviewed by Hyatt.

        * WebCore.pbproj/project.pbxproj:
        * khtml/html/html_imageimpl.cpp:
        (HTMLImageLoader::updateFromElement):
        * khtml/rendering/render_image.cpp:
        (RenderImage::resetAnimation):
        * khtml/rendering/render_image.h:
        * khtml/rendering/render_list.cpp:
        (RenderListMarker::setStyle):
        (RenderListMarker::paint):
        * khtml/rendering/render_list.h:
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (QPixmap::QPixmap):
        (QPixmap::resetAnimation):
        * kwq/WebCoreImageRenderer.h:

2005-02-24  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/4020110> Safari crashes in setAllData while taking a www.zoomerang.com survey

        Reviewed by rjw.

        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishJobAndHandle:]): clear the job after we've deleted to avoid reentrancy

2005-02-24  Darin Adler  <darin@apple.com>

        Reviewed by Vicki.

        - fixed <rdar://problem/4023360> REGRESSION (186-187): image file upload is broken at pep.apple.com

        * khtml/html/html_formimpl.cpp: (DOM::HTMLInputElementImpl::appendFormData): Return true after
        setting up the form data for an uploaded file. The old code would fall through to the ISINDEX
        case and send double form data (the filename instead of the file contents the second time).

2005-02-24  David Harrison  <harrison@apple.com>

        Reviewed by Ken.
        
        <rdar://problem/3990849> AX: textMarkerRange for an AXUIElement within an AXWebArea

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject textMarkerRange]):
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject doAXTextMarkerRangeForUIElement:]):
        (-[KWQAccObject accessibilityAttributeValue:forParameter:]):
        Added AXTextMarkerRangeForUIElement, or you can send textMarkerRange to the UIElement itself.

2005-02-24  David Harrison  <harrison@apple.com>

        Reviewed by Vicki.

        <rdar://problem/4004279> 3 AXSelectedTextChanged notifications are firing each time I type a character

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection):
        Send notification only if the selection is not null.  This safely ignores transitory selections set during editing.

2005-02-24  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3987619> in some cases, text doesn't resize with Format->Style->Bigger/Smaller

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::applyRelativeFontStyleChange): Only call nodeFullySelected for non-text nodes.
        Text nodes are already split so they're either in the range and full selected or out of the range.
        And nodeFullySelected doesn't work for text nodes.
        (khtml::ApplyStyleCommand::nodeFullySelected): Add an assertion, since this function only works for elements,
        not text nodes.
        (khtml::ApplyStyleCommand::nodeFullyUnselected): Ditto.

        - make big improvement in <rdar://problem/3953636> Mail hung for ~10sec changing font of 84328 characters: khtml::ApplyStyleCommand::nodeFullySelected

        * khtml/xml/dom2_rangeimpl.cpp: (DOM::RangeImpl::compareBoundaryPoints): Improve algorithm based on suggestion
        from Nate Begeman.

        - fixed <rdar://problem/4020305> REGRESSION (185-186): loading image in new window using document.write fails

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::open): If there is no parent document, don't blow away the base URL.

        - fixed <rdar://problem/4021701> REGRESSION (188-188+): form not submitted after pressing <return> at http://hrweb.apple.com
        
        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::dispatchMouseEvent): Send activate event in the case where the event
        sent is a KHTML_CLICK_EVENT, not CLICK_EVENT.

2005-02-23  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs  
        
        Fixed <rdar://problem/4020747> REGRESSION: stray </applet> tags crash Safari

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::processCloseTag):  Made a typesafe check that prevents crashes
        whenever there is a closing applet tag without an actual <applet> in the first place. 
        Now verifies the current token is ID_APPLET before casting it to an HTMLAppletElementImpl.
         

2005-02-23  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3977962> font loses bold style after pasting next to existing text and pressing return

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion): Problem here was
        that we were doing work in cases where we should not, and content whose style would have
        been correct if we had done nothing was getting clobbered. It turns out that extra work
        to apply style to the new paragraph added in this command only needs to be done if we're 
        at the boundaries of a paragraph. Otherwise, content that is moved as part of the work 
        of the command will lend their styles to the new paragraph without any extra work needed.
        So, make this position check and return unless at a paragraph boundary.

        New test:

        * layout-tests/editing/style/block-styles-007-expected.txt
        * layout-tests/editing/style/block-styles-007.html

2005-02-23  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/4017641> REGRESSION (Mail): you can only bold/unbold a selection starting from end of line once

        Problem is with the way we figure out whether to add or remove a style based on
        the current selection. In this case, the code is looking at the end of the
        previous line, which is not bold, and deduces incorrectly that the operation is
        a "make bold". Then the style code runs to make bold, but there is nothing on
        the end of the previous line to embolden, so we get into a cycle where the same
        thing happens each time cmd-b is hit.

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionComputedStyle):  Call editingStartPosition() to get the right position for the font determination.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::editingStartPosition): New helper function that "does the right thing" based on whether the
        selection is a caret or a range, moving upstream for the former, and downstream for the latter.
        * khtml/xml/dom2_rangeimpl.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection): Call editingStartPosition() to get the right position for the font determination.

        New tests:

        * layout-tests/editing/style/style-boundary-001-expected.txt
        * layout-tests/editing/style/style-boundary-001.html
        * layout-tests/editing/style/style-boundary-002-expected.txt
        * layout-tests/editing/style/style-boundary-002.html
        * layout-tests/editing/style/style-boundary-003-expected.txt
        * layout-tests/editing/style/style-boundary-003.html
        * layout-tests/editing/style/style-boundary-004-expected.txt
        * layout-tests/editing/style/style-boundary-004.html

2005-02-23  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3985579> 8A367: Dashboard: Stock widget not visible when click remove to remove single char ticker symbol

	Explicitly remove scroll bar views when removing them from 
	the overflow.

	Don't paint synchronously when the scroll position changes,
	this caused funky clip problems.

        Reviewed by Hyatt.

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::scrollToOffset):
        (RenderLayer::setHasHorizontalScrollbar):
        (RenderLayer::setHasVerticalScrollbar):
        (RenderLayer::updateScrollInfoAfterLayout):

2005-02-23  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3959996> REGRESSION (Mail): cursor moves to beginning of document when click is past end

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::positionForCoordinates): Skip blocks that are invisible or have no height when 
        looking for a child to pass off to. And save away the last visible block with a height to pass off
        to if there is no child at the right y-coordinate.

2005-02-23  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4010059> BoundsForTextMarkerRange does not update with scrolled web area

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXBoundsForTextMarkerRange:]):
        Adjust for scrolling.

2005-02-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/3949790> hitting return after pasted styled line results in extra content getting the style
	
        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): In the case
	where the start block is the root, insert the newly created DIV at
	the end of the root block instead of after the last sibling in the
	start node, since the start node could be inside other
	style-affecting nodes and we don't want to reparent its cousins
	into that.

2005-02-23  David Harrison  <harrison@apple.com>

        Reviewed by Vicki.

        <rdar://problem/4014691> switch to correctly spelled NSAccessibilityForegroundColorTextAttribute constant
        
        Also removed two older, now unneeded, wrappers.

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject visiblePositionForStartOfTextMarkerRange:]):
        (-[KWQAccObject visiblePositionForEndOfTextMarkerRange:]):
        Removed these older, now unneeded, wrappers.
        
        (NSAccessibilityForegroundColorTextAttributeWrapper):
        New wrapper for NSAccessibilityForegroundColorTextAttribute.
        
        (AXAttributeStringSetStyle):
        Use NSAccessibilityForegroundColorTextAttributeWrapper.
        
        (-[KWQAccObject doAXTextMarkerRangeForUnorderedTextMarkers:]):
        Remove uses of visiblePositionForStartOfTextMarkerRange and visiblePositionForEndOfTextMarkerRange.

2005-02-23  David Harrison  <harrison@apple.com>

        Reviewed by Vicki.

        <rdar://problem/3524784> AX hit test doesn't return info when done in empty space of content area

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityHitTest:]):
        Return unignored object.

2005-02-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/4006509> REGRESSION (171-172): Setting CSS -khtml-user-modify property triggers crash

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty):
        Removed the code that changes the style of the element. This was never needed, and caused the
        style to be modified while we were iterating it.

2005-02-23  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3980209> Mail crashed when I pressed Cmd-Shift-[ (nil-deref in ApplyStyleCommand::addBlockStyleIfNeeded)

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): Reordered the new block
        insertion so that it come before the move. The logic stays exactly the same, however, with the old
        ordering, the new block could want to become a child of itself come insertion time. I considered
        making a more complicated code change to fix this problem, but the simple reordering works just
        as well, and seems less risky.
        
        These all changed in an insignificant way. It seems that with the new code, some empty text nodes
        got reordered in the document. This has no effect on anything visible to the user.
        
        * layout-tests/editing/style/create-block-for-style-003-expected.txt
        * layout-tests/editing/style/create-block-for-style-004-expected.txt
        * layout-tests/editing/style/create-block-for-style-009-expected.txt
        * layout-tests/editing/style/create-block-for-style-011-expected.txt
        * layout-tests/editing/style/create-block-for-style-013-expected.txt

2005-02-23  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4013986> REGRESSION (173-174): onclick event not sent when mouse click on checkbox is double-click

        We need to send an onclick event *and* an ondblclick event when we process a double click.

        * khtml/khtmlview.cpp: (KHTMLView::dispatchMouseEvent): In the case where we're sending a CLICK_EVENT,
        follow it by a KHTML_CLICK_EVENT, a KHTML_DBLCLICK_EVENT when handling a double click, and a DOMACTIVATE_EVENT.
        We no longer do the DOMACTIVATE_EVENT in dispatchGenericEvent.
        * khtml/rendering/render_form.cpp: (RenderFormElement::slotClicked): send only CLICK_EVENT here, and
        lets dispatchMouseEvent deal with the other subsequent events.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::dispatchGenericEvent): Remove the code that sends a DOMACTIVATE_EVENT, since there's no longer
        a good way to figure out if this is the last event that should be sent before it is.
        (NodeImpl::dispatchMouseEvent): Set the meta key modifier here (as it already is set elsewhere), and
        follow up a CLICK_EVENT with KHTML_CLICK_EVENT, a KHTML_DBLCLICK_EVENT, and DOMACTIVATE_EVENT as above.

2005-02-23  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4011405> REGRESSION (180-181): Unconfirmed text disappears when text focus moves

        The key was to change things around so that we don't push text from the DOM to the widget
        unless the DOM has actually been changed. This prevents the code path that wipes out inline input
        during the blur process.

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::HTMLInputElementImpl): Start m_valueMatchesRenderer as false.
        (DOM::HTMLInputElementImpl::parseHTMLAttribute): Set m_valueMatchesRenderer to false when a
        new value is set here.
        (DOM::HTMLInputElementImpl::setValue): Set m_valueMatchesRenderer to false when a new value
        is set here.
        (DOM::HTMLInputElementImpl::setValueFromRenderer): Added. Sets m_value, sets m_valueMatchesRenderer
        to true, and also sends out the input event. It's better to have this here than in the renderer code.
        (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl): Start m_valueIsValid as false (replaces
        m_dirtyvalue) and m_valueMatchesRenderer as false.
        (DOM::HTMLTextAreaElementImpl::updateValue): Added. Factored this out from the value function. Uses
        the new booleans and keeps them up to date, specifically setting m_valueMatchesRenderer based on
        where the value came from.
        (DOM::HTMLTextAreaElementImpl::value): Updated to call updateValue to do most of the work.
        (DOM::HTMLTextAreaElementImpl::setValue): Set both m_valueIsValid and m_valueMatchesRenderer.
        (DOM::HTMLTextAreaElementImpl::setDefaultValue): Take parameter by reference.

        * khtml/html/html_formimpl.h: Added setValueFromRenderer, valueMatchesRenderer, setValueMatchesRenderer,
        and m_valueMatchesRenderer to input element. For textarea element, made some parameters pass DOMString
        by reference, and added invalidateValue, updateValue, valueMatchesRenderer, and setValueMatchesRenderer.

        * khtml/rendering/render_form.cpp:
        (RenderLineEdit::updateFromElement): Don't re-get the value from the DOM if valueMatchesRenderer
        is true.
        (RenderLineEdit::slotTextChanged): Call setValueFromRenderer instead of manipulating the DOM
        directly.
        (RenderTextArea::detach): Call updateValue instead of calling value for its side effect.
        (RenderTextArea::handleFocusOut): Ditto.
        (RenderTextArea::updateFromElement): Call updateValue and then not re-get the value from the
        DOM if valueMatchesRenderer is true.
        (RenderTextArea::slotTextChanged): Call invalidateValue instead of directly setting m_dirtyvalue to true.

2005-02-22  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3937203> when a div adds a scrollbar (overflow:auto) we do not get regions

	Just set dashboard dirty bit when overflow scrolling changes.

	Don't do comparison of regions in before scroll regions are
	added, instead do it in WebKit after automatic scroll regions
	are added.

        Reviewed by Maciej.

        * khtml/css/cssparser.cpp:
        (CSSParser::parseDashboardRegions):  Cleaned up comments
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::styleForElement): Cleaned up comments

        * khtml/khtmlview.cpp:
        (KHTMLView::updateDashboardRegions):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateScrollInfoAfterLayout):
        * kwq/WebDashboardRegion.m:
        (-[WebDashboardRegion isEqual:]):

2005-02-22  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3976872> Pasted plain text doesn't get the proper style if pasted into newlines

        Reviewed by mjs.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): don't clear the typing style when matching style
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): apply the typing style when matching style
        * khtml/editing/jsediting.cpp:
        * khtml/khtml_part.cpp:
        (KHTMLPart::pasteAndMatchStyle): new
        * khtml/khtml_part.h:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::issuePasteAndMatchStyleCommand): new
        * kwq/WebCoreBridge.h:
        * layout-tests/editing/editing.js:

2005-02-22  Darin Adler  <darin@apple.com>

        Reviewed by Adele.

        - fixed <rdar://problem/4006596> REGRESSION (183-184): crash in DOM::DocumentImpl::setFocusNode(DOM::NodeImpl*)

        * khtml/xml/dom_docimpl.cpp:
        (widgetForNode): Added helper.
        (DocumentImpl::setFocusNode): Re-get the widget for the node after calling updateLayout.
        The updateLayout can destroy the old widget, so we can't keep a stale widget pointer around.

2005-02-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/4003463> Mail.app HTML uses inline styling markup not understood by Entourage and Eudora

        * khtml/editing/htmlediting.cpp:
        (khtml::isEmptyFontTag): Helper for removing <font> tags.
        (khtml::StyleChange::styleModeForParseMode): Helper to map a document parse mode to a use/don't use
        legacy-html-styles value.
        (khtml::StyleChange::checkForLegacyHTMLStyleChange): Add support for colors, font faces, and font sizes.
        (khtml::ApplyStyleCommand::isHTMLStyleNode):
        (khtml::ApplyStyleCommand::removeHTMLFontStyle):
        (khtml::ApplyStyleCommand::applyTextDecorationStyle): Now call styleModeForParseMode to determine
        whether to use legacy html styles or not.
        (khtml::ApplyStyleCommand::removeInlineStyle): Now properly removes <font> styles.
        (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): Ditto.
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): Ditto.
        (khtml::createFontElement): Helper for applying <font> elements.
        * khtml/editing/htmlediting.h: All the following support the new bits of data we need to store.
        (khtml::StyleChange::applyFontColor)
        (khtml::StyleChange::applyFontFace)
        (khtml::StyleChange::applyFontSize)
        (khtml::StyleChange::fontColor)
        (khtml::StyleChange::fontFace)
        (khtml::StyleChange::fontSize)

        Test results updated now that we will write out <font> tags for quirks mode documents.        
        
        * layout-tests/editing/execCommand/modifyForeColorByCharacter-expected.txt
        * layout-tests/editing/style/block-style-004-expected.txt
        * layout-tests/editing/editing/pasteboard/paste-text-011-expected.txt
        * layout-tests/editing/style/block-style-005-expected.txt
        * layout-tests/editing/style/block-style-006-expected.txt
        * layout-tests/editing/style/smoosh-styles-001-expected.txt
        * layout-tests/editing/style/smoosh-styles-002-expected.txt

2005-02-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/4017066> crash in KJS::ValueImp::dispatchType() every time I load www.nytimes.com/pages/automobiles

	When creating option elements, use lowercase "option" instead of
	uppercase "OPTION" to create option elements, because only
	lowercase works for XHTML.
	
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLSelectCollection::tryPut):
        (OptionConstructorImp::construct):

2005-02-22  Chris Blumenberg  <cblu@apple.com>

	WebCore fix for: <rdar://problem/3918056> Mail not line breaking my <pre> formatted emails on replies
	
	Mail must 4018993 to fully address the problem.

        Reviewed by kocienda.

        * khtml/editing/markup.cpp:
        (khtml::startMarkup): don't compute style for text in PRE tags
        (khtml::createMarkup): include PRE if it is an ancestor of the nodes in the range

2005-02-21  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4008338> REGRESSION (125-178): opacity style not working, breaks fading images on okcupid.com

	There was a long standing bug in cssText().  Double value were always cast int!  So,
	opacity values values were incorrectly converted to text, i.e. 0.75 became 0.
	
	The problem was newly triggered because we parse the css for opacity *TWICE*.  This is a result of 
	incorrectly "invalidating" the style attribute (from fix for 3790449).  The second parse was from
	the cssText() of the style.

        Reviewed by Hyatt.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSPrimitiveValueImpl::cssText):

2005-02-21  David Hyatt  <hyatt@apple.com>

	Fix for 4017204, apply the same fix to the base class nodeAtPoint that was already applied to RenderBlock.
	Skip elements with layers and inline flows.  Demoted <form>s can end up causing trouble otherwise.
	
        Reviewed by Richard Williamson

        * khtml/rendering/render_box.cpp:
        (RenderBox::nodeAtPoint):

2005-02-21  David Hyatt  <hyatt@apple.com>

	Fix for 4017033, CSS is being parsed twice.  Make sure to always validate the style attribute when it is
	initially parsed.  Add code to clean up decls when the style attribute is completely removed.  Add a new
	synchronizing boolean that avoids reparsing the style declaration when the attribute is simply
	being synced up to the declaration.

        Reviewed by John

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::setChanged):
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::invalidateStyleAttribute):
        (HTMLElementImpl::updateStyleAttributeIfNeeded):
        (HTMLElementImpl::HTMLElementImpl):
        (HTMLElementImpl::~HTMLElementImpl):
        (HTMLElementImpl::destroyInlineStyleDecl):
        (HTMLElementImpl::mapToEntry):
        (HTMLElementImpl::parseHTMLAttribute):
        * khtml/html/html_elementimpl.h:
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::ElementImpl):
        (ElementImpl::setAttribute):
        * khtml/xml/dom_elementimpl.h:
        (DOM::ElementImpl::updateStyleAttributeIfNeeded):

=== Safari-188 ===

2005-02-21  Darin Adler  <darin@apple.com>

        - fixed Panther deployment build

        * kwq/KWQTextEdit.mm: (QTextEdit::setScrollBarModes): Put more stuff inside #if.

2005-02-21  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3943090> REGRESSION (Mail): Spelling underline incompletely erased following certain steps

        * khtml/rendering/render_text.cpp:
        (InlineTextBox::paintMarker):
        Make sure underline is placed within the text bounds.
        
        * kwq/KWQPainter.h:
        * kwq/KWQPainter.mm:
        (QPainter::misspellingLineThickness):
        * kwq/WebCoreTextRenderer.h:
        Add misspellingLineThickness for use by InlineTextBox::paintMarker.

2005-02-21  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4012978> -[DOMRange markupString] crashes when range contains only a text node with a single space

        * khtml/editing/markup.cpp: (khtml::createMarkup): Added updateLayout calls, and added a missing
        nil check.

2005-02-21  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/4005435> Safari hung while pasting text into a <textarea> (Panther-only)

        * kwq/KWQTextEdit.mm: (QTextEdit::setScrollBarModes): Don't setAutohidesScrollers:YES on Panther.

2005-02-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4015499> REGRESSION (186-187): pasted quoted text starting with a blank line increases quote level of pasted text when pasted

        * khtml/editing/markup.cpp:
        (khtml::markup): Changed over to ASSERT instead of assert.
        (khtml::createMarkup): The issue was that the code to add parents all the way back to the common ancestor
        block did not check for blocks whose markup had already been added, and could result in adding markup for
        nodes twice (hence the additional and erroneous quote level). Now there is a new check that will
        only add markup for those nodes before the start of the selection range. This fixes the bug.
        (khtml::createFragmentFromMarkup): Changed over to ASSERT instead of assert.
        (khtml::createFragmentFromText): Ditto.

2005-02-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/4015494> REGRESSION (186-187) <cr> removed if quoted word is copy/pasted on line immediately above quoted text

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Relatively new check designed to remove a <br> element when
        that element was on a line by itself did not do an adequate check for this condition, causing the
        failure described in the bug. Fixed.

2005-02-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej

        * khtml/editing/htmlediting.cpp:
        (khtml::matchNearestBlockquoteColorString): New function which abstracts away the CSS property we use
        for this pseudo-color.
        (khtml::ReplacementFragment::removeBlockquoteColorsIfNeeded): Set the new nearestBlockquoteColorString
        psuedo-color here, rather than removing colors as was done before.
        (khtml::ReplaceSelectionCommand::applyStyleToInsertedNodes): Check for the pseudo-color in the desired
        style, and determine the real color based on the nearest blockquote (or none) to the node.
        (khtml::nearestMailBlockquote): Name change from closestMailBlockquote to match new property better.

        All the rest of this change is the mechanical coding you need to do to add a new CSS property, in this
        case, -khtml-match-nearest-mail-blockquote-color.

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue)
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty)
        * khtml/css/cssvalues.c:
        (findValue)
        * khtml/css/cssvalues.h:
        * khtml/css/cssvalues.in:
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::matchNearestMailBlockquoteColor)
        (khtml::RenderStyle::setMatchNearestMailBlockquoteColor)
        (khtml::RenderStyle::initialMatchNearestMailBlockquoteColor)

2005-02-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for these bugs:
        
        <rdar://problem/4014228> REGRESSION (186-187) extra, uneditable lines inserted above and below a line of pasted quoted text
        <rdar://problem/4014393> REGRESSION (186-187) pasted quoted text gets extra <cr>s when pasted at top of document

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment): Part of a general refactoring of how
        the fragment is inserted into the document, rendered, and then tested for certain
        important pieces of information that are required for pasting.
        (khtml::ReplacementFragment::insertFragmentForTestRendering): New helper. Handles inserting
        the fragment nodes into the document.
        (khtml::ReplacementFragment::restoreTestRenderingNodesToFragment): Removes nodes from the
        document, and restores them to the fragment.
        (khtml::ReplacementFragment::computeStylesUsingTestRendering): Factored out code that
        did this before into its own function.
        (khtml::ReplacementFragment::removeUnrenderedNodesUsingTestRendering): Ditto.
        (khtml::ReplacementFragment::countRenderedBlocks): This is a real improvement, as it
        eliminates a major use of the isProbablyBlock() function. Now, the blocks that are
        counted are real, rendered blocks.
        (khtml::ReplacementFragment::removeStyleNodes): Made this function retain margin-zeroing
        CSS properties on paragraphs. This does two things: 1) It helps us to maintain good behavior
        in the short term while there are still versions of Mail out there that use <p> elements
        instead of <div> elements for new paragraphs; and 2) It will help to maintain the compatibility
        with other mail clients that use <p> elements for their paragraphs but render them themselves
        with no margins as the result of quirks.
        (khtml::ReplaceSelectionCommand::doApply): Do some work to fix up and improve the handling
        of blank lines, be they <p> elements or <br> elements, that can be removed after pasting. This, 
        coupled with the refactoring, fixes 4014393.
        * khtml/editing/htmlediting.h: Updated for new functions.
        * layout-tests/editing/pasteboard/paste-text-010-expected.txt: Updated results, actually improved with this change.
        * layout-tests/editing/pasteboard/paste-text-011-expected.txt: Ditto.

2005-02-19  Kevin Decker  <kdecker@apple.com>

        Reviewed by Chris.

	Fixed <rdar://problem/4010765> Flash player can be used to arbitrarily open popup windows without user permission
	
	Our window.open() policy is to refuse the <script>window.open(...)</script> case and allow the inline the <a href="javascript:window.open('foo')> case.  Clever advertisers at some point realized that by executing their Javascript through the Flash plugin, Safari would always treat their code as the inline case, and thus, they were able to work around our popup blocker.

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge stringByEvaluatingJavaScriptFromString:]): Changed this to invoke the new stringByEvaluatingJavaScriptFromString:forceUserGesture method below.
        (-[WebCoreBridge stringByEvaluatingJavaScriptFromString:forceUserGesture:]): Let the WebKit make the determination if this was a user originated gesture or not; we must no longer assume this is always the case.

2005-02-18  Chris Blumenberg  <cblu@apple.com>
	
	Fixed: <rdar://problem/3951196> REGRESSION (Mail): too many levels of reply quotes after certain steps

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply):
	- If we find a new start node, update topBlockquote so we don't use too many block quotes for the contents following the new line.
	- Build up the list of ancestors after we've determined the actual topBlockquote.
	- Don't insert an extra new line if there is a new start node.

2005-02-19  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3978461> smart paste is broken

        Reviewed by kevin.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): properly check for leading and trailing whitespace. These checks were incorrectly reversed. Also check if we're pasting at the beginning or end of a line. We should not insert spaces in either case.

2005-02-18  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

        Fix for <rdar://problem/3975568> REGRESSION(125-180)Australian Open pages have drawing problem

        This patch fixes two problems caused by our added support for custom tags.  First, the layout problem at the sites mentioned in the bug
        was caused by custom tags within tables.  In checkChild, we needed to treat these tags as spans so they get placed correctly in the DOM tree.
        Also, we were indexing the tagPriority and endTag arrays with id values from the custom tags that were greater than the size of the array.  So now 
        we have functions to check for the custom tags, and again, treat them as spans.  To avoid confusion, we changed the names of the arrays to
        endTagArray and tagPriorityArray.

        * khtml/html/dtd.h: changed all uses of the endTag array to endTagArray for our new wrapper functions
        (DOM::tagPriority): added function to check array bounds and to treat custom tags as spans
        (DOM::endTagRequirement): added function to check array bounds and to treat custom tags as spans
        * khtml/html/dtd.cpp: changed name of endTag and tagPriority arrays to endTagArray and tagPriorityArray
        (DOM::checkChild): treat custom tags as spans during this check
        * khtml/html/html_elementimpl.cpp: changed all uses of the endTag array to the endTagRequirement function
        (HTMLElementImpl::createContextualFragment):
        (HTMLElementImpl::setInnerText):
        (HTMLElementImpl::setOuterText):
        (HTMLElementImpl::toString):
        * khtml/html/htmlparser.cpp: changed all uses of the endTag array to the endTagRequirement function and all uses of the tagPriority array to the tagPriority function.
        (KHTMLParser::parseToken):
        (KHTMLParser::insertNode):
        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::parseTag): changed all uses of the endTag array to the endTagRequirement function
       * khtml/editing/markup.cpp: changed all uses of the endTag array to the endTagRequirement function
        (khtml::endMarkup): 
        (khtml::markup):

2005-02-18  Jens Alfke  <jens@apple.com>

        Reviewed by Hyatt.

	Fixed build: Whoops, setNeedsLayout's parameter is NOT optional.

        * khtml/html/html_objectimpl.cpp:
        (HTMLAppletElementImpl::setAllParamsAvailable):

2005-02-18  Jens Alfke  <jens@apple.com>

        Reviewed by cblu, hyatt.

	Fixes <rdar://problem/3603191> "REGRESSION: Applets not receiving all of the Applet Parameters in Java 1.4.1/1.4.2"
	Defer instantiation of Java applet plugin until after all of the <applet> tag's nested <param> tags have been parsed, otherwise the list of parameters passed to the applet is incomplete. The regression was introduced (says Dave) when the parser's close-tag notifications were removed in the name of performance.

        * khtml/html/html_objectimpl.cpp:
        (HTMLAppletElementImpl::HTMLAppletElementImpl):
        (HTMLAppletElementImpl::getAppletInstance):
        (HTMLAppletElementImpl::setAllParamsAvailable):
        (HTMLAppletElementImpl::allParamsAvailable):
        * khtml/html/html_objectimpl.h:
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::processCloseTag):
        * khtml/rendering/render_applet.cpp:
        (RenderApplet::createWidgetIfNecessary):

2005-02-18  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4006161> Tiger8A380: Widgets leak dashboard regions
	
	We were leaking the DashboardRegionImpls.

        Reviewed by Kevin.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSPrimitiveValueImpl::cleanup):

2005-02-18  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3945271> REGRESSION (Mail): pasted plain text should pick up typing style instead of being unstyled

        Reviewed by kocienda.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): don't set class on element returned by createStyleSpanElement since that's already done
        (khtml::ReplacementFragment::ReplacementFragment): take matchStyle param, don't call computeStylesAndRemoveUnrendered() if !matchStyle
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): take matchStyle param
        (khtml::ReplaceSelectionCommand::doApply): if m_matchStyle, use selection.start() as the insertion position and don't call applyStyleToInsertedNodes()
        * khtml/editing/htmlediting.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]): take matchStyle param and pass it
        (-[WebCoreBridge replaceSelectionWithNode:selectReplacement:smartReplace:]): pass NO for matchStyle
        (-[WebCoreBridge replaceSelectionWithMarkupString:baseURLString:selectReplacement:smartReplace:]): pass NO for matchStyle
        (-[WebCoreBridge replaceSelectionWithText:selectReplacement:smartReplace:]): pass YES for matchStyle

2005-02-18  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for these bugs:
        
        <rdar://problem/4013025> Copy/Paste of quoted word results in removal of any following <cr>
        <rdar://problem/4013100> Copy/Paste quoted text and then decrease quote level does not change text color

        For the most part, these bugs were caused by errors and lack of foresight on my part when
        I added the better paste code. Chalk these fixes up to the result of bake time.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment): Need to move count of number of blocks in
        fragment after the call to remove unrendered nodes. Meant to do this before, but forgot to.
        (khtml::ReplacementFragment::removeStyleNodes): Need to remove inline styles from elements!
        Terrible omission now fixed.
        (khtml::ReplacementFragment::removeBlockquoteColorsIfNeeded): Remove blockquote colors for now.
        Code has a more extensive comment in it now to explain the difficulty, and the need for more
        study and changes.
        (khtml::ReplaceSelectionCommand::doApply): Need to call applyStyleToInsertedNodes() in the 
        m_fragment.hasInterchangeNewline() case. This was just missed before.
        * layout-tests/editing/pasteboard/paste-text-011-expected.txt: Updated results, subtly different, but OK.
        * layout-tests/editing/pasteboard/paste-text-017-expected.txt: Updated for <p> to <div> change in test content.
        * layout-tests/editing/pasteboard/paste-text-017.html: Needed to change <p> to <div> to 
        make this test go with the new design of using <div> tags for default paragraphs.

2005-02-18  David Hyatt  <hyatt@apple.com>

	Fix for 3974263 (and possibly others).  Don't let fixed tables use maxint as their maxwidth when some
	cells have percentage values.
	
        Reviewed by kocienda

        * khtml/misc/arena.cpp:
        (ArenaAllocate):
        * khtml/rendering/table_layout.cpp:
        (FixedTableLayout::calcWidthArray):
        (FixedTableLayout::calcMinMaxWidth):
        (AutoTableLayout::layout):

2005-02-17  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3998627> WebKit crashes when deleting text in a modified div

        * khtml/khtml_part.cpp: (KHTMLPart::selectionComputedStyle): Add a ref and deref to keep
        the element alive until it's added to the DOM tree.
        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::styleForSelectionStart): Ditto.

2005-02-17  Richard Williamson   <rjw@apple.com>

        Fixed <rdar://problem/3999467> when Osaka-Mono is specified as fixed width font, Osaka used instead

	Fixed w/o introducing a performance regression.  Add early
	check for Osaka-Mono to avoid expensive call into WebKit.

        Reviewed by Vicki.

        * kwq/KWQFont.mm:
        (QFont::isFixedPitch):

2005-02-17  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/4011210> REGRESSION (180-181): Maxlength property for INPUT object not working

        * kwq/KWQTextField.mm:
        (-[KWQTextField textView:shouldChangeTextInRange:replacementString:]): If controller returns
        YES, go on to call super, since super does the text formatter handling, which we need.
        (-[KWQSecureTextField textView:shouldChangeTextInRange:replacementString:]): Ditto.
        (-[KWQSearchField textView:shouldChangeTextInRange:replacementString:]): Ditto.

=== Safari-187 ===

2005-02-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/4012058> Copy from quoted text and paste results in blue text

        The relatively-new paste code tries hard to retain style of the content from the
        source location. However, in the case of quoted material in mail messages, we do 
        not want to carry the quoting color along. This fixes the problem by factoring
        out such colors.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::computeStylesAndRemoveUnrendered): Now calls removeBlockquoteColorsIfNeeded()
        to fix bug.
        (khtml::ReplacementFragment::removeBlockquoteColorsIfNeeded): New function. Factors out colors that are
        the result of text being quoted. 
        (khtml::isNodeRendered): Function moved in file. No other change.
        (khtml::isProbablyBlock): Function moved in file. No other change.
        (khtml::closestMailBlockquote): New function. Helps fix bug.
        (khtml::isMailBlockquote): Function moved to be free-floating instead of being a 
        member of CompositeEditCommand. No other change.
        * khtml/editing/htmlediting.h: Moved around some functions. Added removeBlockquoteColorsIfNeeded().
        * khtml/editing/markup.cpp: Remove redundant static implementation of isMailBlockquote.

2005-02-17  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/4008163> dynamic support for -apple-dashboard-region is flakey

	Style operator== wasn't including regions.

        Reviewed by Darin.

        * khtml/rendering/render_style.cpp:
        (StyleCSS3NonInheritedData::operator==):

2005-02-17  Adele Amchan  <adele@apple.com>

        Reviewed by Chris.

        fix for <rdar://problem/4010028> 8A383: Safari v185 crash loading united.com multi city fare finder page.

        * khtml/dom/dom_string.cpp: (DOM::DOMString::operator += ): prevent nil dereference when DOMString being added is nil

2005-02-17  Jens Alfke  <jens@apple.com>

        Reviewed by Hyatt.

	Fix for rdar://3963151 "Mail only pasted ~950 of 1407 text lines into my message!"
	Force tokenizer to run synchronously while parsing document fragments, so it doesn't stop halfway through and cause truncated content.

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::createContextualFragment):
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::reset):
        (khtml::HTMLTokenizer::begin):
        (khtml::HTMLTokenizer::setForceSynchronous):
        (khtml::HTMLTokenizer::continueProcessing):
        * khtml/html/htmltokenizer.h:

2005-02-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3982183> Mail's HTML paragraphs appear with unintended margins in Entourage and Eudora

        * khtml/editing/htmlediting.cpp:
        (khtml::createDefaultParagraphElement): Change element we make from <p> to <div>.
        This fixes the problem, as these other mailers show <div> elements without margins.
        
        Some test files needed to change to preserve the ability to "eyeball" the results.
        Many others changed just because their <p> elements changed to <div> elements.
        
        * layout-tests/editing/deleting/delete-3928305-fix-expected.txt
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-002-expected.txt
        * layout-tests/editing/inserting/insert-div-013-expected.txt
        * layout-tests/editing/inserting/insert-div-013.html
        * layout-tests/editing/inserting/insert-div-014-expected.txt
        * layout-tests/editing/inserting/insert-div-014.html
        * layout-tests/editing/inserting/insert-div-018-expected.txt
        * layout-tests/editing/inserting/insert-div-018.html
        * layout-tests/editing/inserting/insert-div-019-expected.txt
        * layout-tests/editing/inserting/insert-div-019.html
        * layout-tests/editing/inserting/insert-div-020-expected.txt
        * layout-tests/editing/inserting/insert-div-020.html
        * layout-tests/editing/inserting/insert-div-021-expected.txt
        * layout-tests/editing/inserting/insert-div-021.html
        * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt
        * layout-tests/editing/style/remove-underline-after-paragraph-expected.txt
        * layout-tests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt

2005-02-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3996737> REGRESSION (Mail): Copy/paste in Mail inserts returns

        The root cause of the problem is that a couple of pieces of code in AppKit and Mail 
        insert newlines into markup as it is generated, and the paste code in WebCore was 
        not smart about nodes that do not render (as is the case with these added newlines). 
        So, the solution is to remove these unrendered nodes in the paste code in a pre-pass. 
        Fortunately, my recent addition of such a pass to the paste code to handle styles 
        gave me a convenient place to put this new logic.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment): Use new name for function below.
        (khtml::ReplacementFragment::computeStylesAndRemoveUnrendered): Name change from computeStylesForNodes().
        Now does the additional work of removing unrendered nodes, as mentioned above.
        (khtml::isNodeRendered): New helper function.
        * khtml/editing/htmlediting.h: Updated as necessary.

2005-02-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3998892> REGRESSION (Mail): bolding a selection from end of line changes unselected text on starting line.
        
        The styling code did not move to the next node when the starting position was 
        at the last offset of a node. Instead, it styled it. Clearly wrong. Solution 
        is to borrow a check from the delete algorithm. Though I call caretMaxOffset(),
        which I consider deprecated, it is still the simplest and most strightforward
        way to ask the right question for this kind of problem.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::applyInlineStyle): Fixed, as described above.
        * layout-tests/editing/style/style-3998892-fix-expected.txt: Added.
        * layout-tests/editing/style/style-3998892-fix.html: Added.

2005-02-16  Chris Blumenberg  <cblu@apple.com>
	
	Fixed: <rdar://problem/3954842> Forward/reply to an HTML email can result in nothing (in cases with <link> tags for CSS)

        Reviewed by john.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeBaseImpl::addChild): don't call insertedIntoDocument on the added child if "this" itself is not in the document.

2005-02-16  John Sullivan  <sullivan@apple.com>

        Written by Darin, reviewed by Maciej and me
        
        - change required to make previous checkin work with English language RSS pages

        * kwq/KWQKURL.h:
        new private method isHierarchical
        * kwq/KWQKURL.mm:
        (KURL::KURL):
        add hierarchical base URL check when determining whether the URL is absolute
        (KURL::isHierarchical):
        new method, returns true if this is a valid URL with a slash just past the scheme's trailing colon

2005-02-16  John Sullivan  <sullivan@apple.com>

        Written by Darin, reviewed by me.
        
        - WebCore part of fix for <rdar://problem/4007384> 
        FILTER: Bookmark of RSS with Japanese search word & multiple RSS pages loses filter

        * kwq/DOM.mm:
        (-[DOMElement _getURLAttribute:]):
        new SPI method, uses parseURL and completeURL to get valid URL from attribute value

        * kwq/DOMPrivate.h:
        declare new SPI method

2005-02-15  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3942428> reproducible crash loading cbs.sportsline.com
	
	This change reverts the fix for <rdar://problem/3805311>, and
	re-fixes it in a different (better) way. Instead of preventing
	programmatic open from setting the parsing flag, instead make sure
	that programmatic close resets it.

        * khtml/khtml_part.cpp:
        (KHTMLPart::openURL):
        (KHTMLPart::didExplicitOpen):
        (KHTMLPart::closeURL):
        (KHTMLPart::begin):
        (KHTMLPart::end):
        (KHTMLPart::endIfNotLoading):
        (KHTMLPart::slotFinishedParsing):
        (KHTMLPart::checkEmitLoadEvent):
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:
        (KHTMLPartPrivate::KHTMLPartPrivate):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::open):
        (DocumentImpl::implicitOpen):
        (DocumentImpl::close):
        (DocumentImpl::implicitClose):
        * khtml/xml/dom_docimpl.h:

2005-02-15  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/3933665> smart delete seems to delete too much after expanding selection with arrow keys

        Fixed by updating the selection granularity.  Only byWord granularity enables smart delete, but in this
        case the granularity changed from byWord to byCharacter.

        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelectionGranularity):
        * khtml/khtml_part.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge rangeByExpandingSelectionWithGranularity:]):
        (-[WebCoreBridge rangeByAlteringCurrentSelection:direction:granularity:]):
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]):

2005-02-15  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        (continued) <rdar://problem/4004305> REGRESSION (Mail): Command-right-arrow on wrapped text goes to end of previous line

        This was supposed have been committed yesterday with the other part of the fix, but was not.
        
        * khtml/editing/visible_units.cpp:
        (khtml::endOfWord):

2005-02-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Fix for this bug:
        
        <rdar://problem/3951178> REGRESSION (Mail): blank line lost after pasting as quotation
        
        Problem was that the blank line after the selection was getting deleted incorrectly since the
        paste code thought this was an unneeded placeholder rather than a placeholder outside of the
        selection.

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Now calls findBlockPlaceholder.
        (khtml::CompositeEditCommand::findBlockPlaceholder): Moved finding code formerly in 
        removeBlockPlaceholderIfNeeded to this new helper.
        (khtml::ReplaceSelectionCommand::doApply): Do not delete placeholder up front. Call 
        findBlockPlaceholder, and delete it later if needed in the already-existing cleanup step.
        * khtml/editing/htmlediting.h: Add new function.

        New layout test.

        * layout-tests/editing/pasteboard/paste-text-017-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-017.html: Added.

        Result changed for the better.

        * layout-tests/editing/pasteboard/paste-text-011-expected.txt

2005-02-14  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4004305> REGRESSION (Mail): Command-right-arrow on wrapped text goes to end of previous line

        Reviewed by Darin.

        <rdar://problem/4004305> REGRESSION (Mail): Command-right-arrow on wrapped text goes to end of previous line

        * khtml/editing/visible_text.cpp:
        (khtml::SimplifiedBackwardsTextIterator::advance):
        Add BR in for <rdar://problem/3917929> fix only if leaving a visible text node.
        
        * khtml/editing/visible_units.cpp:
        (khtml::endOfWord):
        Do not move left over a paragraph boundary.

2005-02-14  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3686434> Safari uses too much RAM on file upload, leading to malloc errors and crashes (HP printers)

        * khtml/html/html_formimpl.cpp:
        (DOM::FormDataList::begin): Updated to use a list of FormDataListItem instead of QCString.
        (DOM::FormDataList::end): Ditto.
        (DOM::HTMLFormElementImpl::formData): Same here, and also use appendFile rather than appendData
        when we encounter a path name rather than data.
        (DOM::HTMLInputElementImpl::appendFormData): Use appendFile here rather than reading the file
        in; the reading now happens inside WebKit.
        (DOM::FormDataList::appendString): Updated for FormDataListItem.
        (DOM::FormDataList::appendFile): Added.

        * ForwardingHeaders/kfileitem.h: Emptied out the file; no longer includes KWQKFileItem.h.
        * ForwardingHeaders/netaccess.h: Emptied out the file; no longer includes KWQKIONetAccess.h.
        * kwq/KWQKFileItem.h: Removed.
        * kwq/KWQKFileItem.mm: Removed.
        * kwq/KWQKIONetAccess.h: Removed.
        * kwq/KWQKIONetAccess.mm: Removed.
        * WebCore.pbproj/project.pbxproj: Removed the 4 files above.

        - small unrelated fix (not reviewed by John)

        * khtml/ecma/kjs_window.cpp: (Window::isSafeScript): Put some logging code outside if statements so it works all the time.

2005-02-14  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/4004305> REGRESSION (Mail): Command-right-arrow on wrapped text goes to end of previous line

        Fixed nextLinePosition to calculate affinity rather than take it as a parameter.  Propagated the parameter change out to related methods.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData):
        (khtml::InsertLineBreakCommand::doApply):
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::InsertTextCommand::input):
        (khtml::ReplaceSelectionCommand::doApply):
        (khtml::ReplaceSelectionCommand::applyStyleToInsertedNodes):
        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyExtendingRightForward):
        (khtml::Selection::modifyMovingRightForward):
        (khtml::Selection::modifyExtendingLeftBackward):
        (khtml::Selection::modifyMovingLeftBackward):
        (khtml::Selection::modify):
        (khtml::Selection::validate):
        * khtml/editing/visible_position.cpp:
        (khtml::visiblePositionsOnDifferentLines):
        * khtml/editing/visible_units.cpp:
        (khtml::rootBoxForLine):
        (khtml::startOfLine):
        (khtml::endOfLine):
        (khtml::inSameLine):
        (khtml::isStartOfLine):
        (khtml::isEndOfLine):
        (khtml::previousLinePosition):
        (khtml::nextLinePosition):
        (khtml::previousSentencePosition):
        (khtml::nextSentencePosition):
        (khtml::previousParagraphPosition):
        (khtml::nextParagraphPosition):
        * khtml/editing/visible_units.h:
        * khtml/khtml_events.cpp:
        (khtml::MouseEvent::offset):
        * khtml/khtml_part.cpp:
        (KHTMLPart::isPointInsideSelection):
        (KHTMLPart::selectClosestWordFromMouseEvent):
        (KHTMLPart::handleMousePressEventTripleClick):
        (KHTMLPart::handleMousePressEventSingleClick):
        (KHTMLPart::handleMouseMoveEventSelection):
        (KHTMLPart::khtmlMouseReleaseEvent):
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::positionForCoordinates):
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::positionForCoordinates):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::positionForCoordinates):
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::positionForCoordinates):
        * khtml/rendering/render_inline.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect):
        (RenderObject::positionForCoordinates):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_replaced.cpp:
        (RenderReplaced::positionForCoordinates):
        * khtml/rendering/render_replaced.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::positionForCoordinates):
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousCharacterPosition):
        (DOM::Position::nextCharacterPosition):
        (DOM::Position::leadingWhitespacePosition):
        (DOM::Position::trailingWhitespacePosition):
        * khtml/xml/dom_position.h:
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject value]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        (-[KWQAccObject doAXLineForTextMarker:]):
        (-[KWQAccObject doAXTextMarkerRangeForLine:]):
        (-[KWQAccObject doAXTextMarkerForPosition:]):
        (-[KWQAccObject doAXLeftLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousLineStartTextMarkerForTextMarker:]):
        * kwq/KWQKHTMLPart.mm:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge _visiblePositionForPoint:]):

05-02-07  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken and John.

	Re-fixed a specific case of the following:

	<rdar://problem/3790449> REGRESSION (Mail): underline behavior is flaky because of how CSS handles text-decoration

	Oddly, Cmd-B, Cmd-U, type some text, return, Cmd-U, Cmd-B, type
	some text, worked fine. But hitting the second Cmd-B before the
	second Cmd-U still failed to remove underlining. The reason for
	this is that our code to compute the style of the current position
	did not work when you had a typing style and were positioned right
	at a <br> element. For various reasons, this did not show up for
	bold and italic, since those are handled through the font manager.

	The following change fixes this - for elements that can't have
	children, we add the dummy span after the element of interest,
	rather than as a child of it.
	
        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionComputedStyle): 

2005-02-11  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3978980> Double Clicking on a line in Mail selected the entire body

        * khtml/editing/visible_units.cpp:
        (khtml::startOfWord):
        (khtml::endOfWord):
        Pay attention to being at the end of a paragraph.
        
        (khtml::previousLinePosition):
        (khtml::nextLinePosition):
        (khtml::endOfParagraph):
        Use DOWNSTREAM per recent affinity changes.

2005-02-11  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls

	Re-factored how 'native' wrappers for JS objects are created.  The interpreter now
	creates these wrappers.  The WebCore subclass of the interpreter now overrides
	createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.

        * WebCore.pbproj/project.pbxproj:
        * khtml/ecma/kjs_binding.cpp:
        (ScriptInterpreter::createLanguageInstanceForValue):
        * khtml/ecma/kjs_binding.h:
        * kwq/DOMUtility.mm: Added.
        (KJS::ScriptInterpreter::createObjcInstanceForValue):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::getAppletInstanceForView):
        (getInstanceForView):
        (KWQKHTMLPart::getEmbedInstanceForView):
        (KWQKHTMLPart::getObjectInstanceForView):

2005-02-11  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3937352> Quote level not maintained when copied and pasted within a Mail message

        Reviewed by harrison.

        * khtml/editing/markup.cpp:
        (khtml::isMailBlockquote): new 
        (khtml::createMarkup): retain the Mail quote level by including all ancestor mail block quotes
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::positionForCoordinates): default to downstream for the affinity since the affinity is only upstream when the cursor is clicked to the right of a wrapped line
        * khtml/rendering/render_text.cpp:
        (RenderText::positionForCoordinates): ditto

2005-02-11  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

        fix for <rdar://problem/4004004> no need to add body element for xml documents

        In the fix for <rdar://problem/3758785> we decided to add a body element when closing a document 
        to ensure that the onload handler would fire.  This is unnecessary for xml documents, 
        so now we also check to see if we're dealing with an html document before adding the body element.

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::close): 

2005-02-11  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

        * layout-tests/apple-only/base/www.excite.com/index-expected.txt: updates tests because of custom tag change.
        * layout-tests/apple-only/base/www.msnbc.com/index-expected.txt:
        * layout-tests/apple-only/base/www.time.com/index-expected.txt:
        * layout-tests/apple-only/base/www.travelocity.com/index-expected.txt:
        * layout-tests/apple-only/base/www.zdnet.com/index-expected.txt:
        * layout-tests/fast/overflow/003-expected.txt:

        * layout-tests/fast/js/window-object-cross-frame-calls-expected.txt: updated test because of added Body (see rdar://problem/3758785)

=== Safari-186 ===

2005-02-11  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3915449> paths are relative to the old src URL after document.open, which is supposed to clear the document, including the URL

        * khtml/xml/dom_docimpl.h: Added a new openInternal function for use by KHTMLPart.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::open): Changed to do everything we did before, but also clear the URL and set the
        base URL based on the enclosing document. This is the basic JavaScript/DOM operation of opening a
        document, which is supposed to clear the document, including the URL. In the long run we might want
        to do even more document "resetting and clearing" in here, but this URL clearing is what's needed
        now to fix the most important problem.
        (DocumentImpl::openInternal): Moved the old open code in here, except for the "parsing" check, which
        is unnecessary and inappropriate in the one place we call this.

        * khtml/khtml_part.cpp: (KHTMLPart::begin): Call openInternal instead of open.

2005-02-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3992092> 8A374: Mail crash while pasting - RemoveNodeCommand

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Code tried to remove a node that was no longer in 
        the document. We try to do a good job of detecting all these cases, and generally do. This
        one was missed. Fixed.

2005-02-10  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - added support needed to fix <rdar://problem/3991225> Format->Style->Underline menu item does not get checked when selected text is underlined

        * kwq/WebCoreBridge.h: Added selectionHasStyle: method.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge selectionHasStyle:]): Added. Calls selectionHasStyle on the part.

2005-02-10  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/3990484> cursor changes to I-beam when moving over text in widgets, even when selection off via CSS

        * khtml/khtmlview.cpp: (KHTMLView::viewportMouseMoveEvent): Changed code to check canSelect when deciding
        whether to show an I-beam cursor.

        * khtml/rendering/render_object.h: Added canSelect.
        * khtml/rendering/render_object.cpp:
        (selectStartNode): Added. Helper function with the guts of shouldSelect.
        (RenderObject::canSelect): Added. Like shouldSelect, but does not call the "start selecting" event handler.
        (RenderObject::shouldSelect): Refactored to use selectStartNode.

        * khtml/css/cssvalues.c: Regnerated with newer gperf.

2005-02-10  David Hyatt  <hyatt@apple.com>

	Fix for 3867759, .mac regression where scrollers don't show up.  Make sure you can set the .width and
	.height properties on the Image object.
	
        Reviewed by John Sullivan

        * khtml/ecma/kjs_html.cpp:
        (ImageConstructorImp::construct):
        (Image::getValueProperty):
        (Image::putValue):
        (Image::Image):
        * khtml/ecma/kjs_html.h:

2005-02-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3965158> Drag-n-drop within a rich text message sometimes changes the color of the dragged text
        
        This change fixes the bug....and much more. Now, for the first time, the paste code can do "smart merging"
        or "smooshing" of styles during its operation. Since this new code is actively, rather than passively
        working with styles, it fixes the bug, and lays the groundwork for similar work we need to do to
        preserve quote levels in Mail.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::clear): New method.
        (DOM::CSSMutableStyleDeclarationImpl::removeBlockProperties): Ditto.
        (DOM::CSSMutableStyleDeclarationImpl::removePropertiesInSet): Ditto.
        (DOM::operator==): Add operator for CSSProperty.
        * khtml/css/css_valueimpl.h: Declare new functions.
        * khtml/editing/htmlediting.cpp:
        (khtml::isEmptyStyleSpan): Improved the test in this function, rolling together the old implementation
        with some code that did this work inline elsewhere. Sum of the parts is better than either test was by itself.
        (khtml::isStyleSpan): Check for ID_SPAN.
        (khtml::ApplyStyleCommand::removeCSSStyle): Call isEmptyStyleSpan. This was the place with an inline implementation before.
        (khtml::ReplacementFragment::ReplacementFragment): Now takes a DocumentImpl argument. No longer does a "default style"
        check, but rather calls functions which do a similar check to that, and much more.
        (khtml::ReplacementFragment::~ReplacementFragment): Deref document, and computed styles.
        (khtml::ReplacementFragment::styleForNode): New helper. Looks up and returns computed style for a node.
        (khtml::ReplacementFragment::removeNodePreservingChildren): New helper.
        (khtml::ReplacementFragment::computeStylesForNodes): New function which computes the "desired" style for
        every node in the fragment. This information is used later after paste is done as a reference for testing
        what styles need to be added, and which can be removed as redundant, from all the nodes inserted by the
        replacement code.
        (khtml::ReplacementFragment::removeStyleNodes): Clears out all style nodes from the fragment. They are
        no longer needed after the call to computeStylesForNodes(),
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): Add a document to the call to initialize the
        command's ReplacementFragment.
        (khtml::ReplaceSelectionCommand::doApply): Call applyStyleToInsertedNodes() after inserting nodes to make
        styles come out right.
        (khtml::ReplaceSelectionCommand::applyStyleToInsertedNodes): This is the "style smooshing" function. It 
        computes the styles that need to be added to each node inserted, comparing the style it gets from just
        being inserted into its correct destination with the computed "desired style" done in the 
        ReplacementFragment constructor. It then adds in all the necessary styles, and will also remove redundant styles.
        * khtml/editing/htmlediting.h: Update declarations and member variables as needed.
        * khtml/editing/markup.cpp:
        (khtml::startMarkup): Add additional style annotations to the markup we generate, so that paste code can preserve it.
        (khtml::markup): Ditto.
        (khtml::createMarkup): Ditto.
        
        These test results are subtly better with this change. They no longer have an unneeded empty span.
        Visually the same as before.
        
        * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt
        * layout-tests/editing/style/remove-underline-expected.txt
        * layout-tests/editing/style/remove-underline-from-stylesheet-expected.txt

        New tests:

        * layout-tests/editing/style/smoosh-styles-001-expected.txt
        * layout-tests/editing/style/smoosh-styles-002-expected.txt
        * layout-tests/editing/style/smoosh-styles-001.html
        * layout-tests/editing/style/smoosh-styles-002.html

2005-02-10  Darin Adler  <darin@apple.com>

        Reviewed by Adele.

        - fixed <rdar://problem/3974988> WebHTMLView drops scroll wheel events when deltas are 0

        * kwq/WebCoreScrollView.m: (-[WebCoreScrollView autoforwardsScrollWheelEvents]): Added, for Tiger only.
        For Tiger, removed the override of scrollWheel:, which doesn't work quite right because of how the
        delta attributes return all 0 for newfangled scrolling events from the new trackpads.

2005-02-10  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3991532> REGRESSION (Mail): Triple-click on trailing blank line should select previous line but doesn't

        * khtml/css/cssvalues.c:
        (hash_val):
        (findValue):
        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):
        Do moral equiavalent of LeftWordIfOnBoundary for PARAGRAPH.

2005-02-10  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3991848> Double-click on first character selects wrong item

        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):
        Honor the fact that clicking on a character positions the cursor on the left side of the character.

2005-02-10  David Hyatt  <hyatt@apple.com>

	Fix for 3980778, repro crash in RootInlineBox::paint.  Make sure that when merging blocks we dirty them for layout
	up front. That way as we do the merge, we dont attempt to examine the lines in dirtyLinesForChangedChild.
	
        Reviewed by mjs

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::removeChild):

2005-02-10  David Hyatt  <hyatt@apple.com>

	Fix for 3987010, fix a bug that caused the self-collapsing-block-cleared-float bit to never get set correctly.
	
        Reviewed by mjs

        * khtml/rendering/render_block.h:
        (khtml::RenderBlock::MarginInfo::setSelfCollapsingBlockClearedFloat):

2005-02-10  David Hyatt  <hyatt@apple.com>

	Fix  for 3992440, text not wrapping correctly on half moon bay web site.  Refine an incorrect optimization I
	added to be less restrictive.
	
        Reviewed by mjs

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::layoutBlockChildren):

2005-02-08  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3977973> pages on ebay leak referenced JavaScript objects -- over time browsing becomes super-slow

	I fixed this by removing all event listeners for a document, it's
	children, and any disconnected nodes that used to be in the
	document at document detach time. Mozilla temporarily disables
	event listeners on such nodes, but re-enables them if you
	re-parant a node into a new document. However, in WebCore, you
	can't re-parent a node into another document, so there is no
	observable change in behavior.

	We have to do this to break the possible reference cycles between
	event listeners and the dom nodes they are attached to (e.g. via
	scope chain, as in this case).

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::detach):
        (DocumentImpl::removeAllEventListenersFromAllNodesx):
        (DocumentImpl::registerDisconnectedNodeWithEventListeners):
        (DocumentImpl::unregisterDisconnectedNodeWithEventListeners):
        (DocumentImpl::removeAllDisconnectedNodeEventListeners):
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::~NodeImpl):
        (NodeImpl::addEventListener):
        (NodeImpl::removeEventListener):
        (NodeImpl::removeAllEventListeners):
        (NodeImpl::removeHTMLEventListener):
        (NodeImpl::insertedIntoDocument):
        (NodeImpl::removedFromDocument):
        * khtml/xml/dom_nodeimpl.h:

2005-02-09  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3999213> Sometimes 2 Windows Media Player plugin instances are loaded

        Reviewed by hyatt.

        * khtml/html/html_objectimpl.cpp:
        (HTMLObjectElementImpl::attach): Set needWidgetUpdate to false before calling updateWidget because updateWidget may cause this method or another method (which also calls updateWidget) to be called.
        (HTMLObjectElementImpl::recalcStyle): ditto

2005-02-09  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        <rdar://problem/3937447> Mail-689: Arrow key navigation in new message body stops working when a line ends with a bold word
        
        Added affinity to VisiblePosition.  Changed Selection code to use affinity more.
        
        (Partial) <rdar://problem/3982096> editing/pasteboard/paste-text-007 is failing
        
        Changed ReplaceSelectionCommand to also pay attention to the top children of the incoming fragment, not just the very last node inserted, when deciding whether to insert a paragraph for the Apple interchange newline.

        * khtml/ecma/kjs_window.cpp:
        (SelectionFunc::tryCall):
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::setStartingSelection):
        (khtml::EditCommandPtr::setEndingSelection):
        (khtml::EditCommand::setStartingSelection):
        (khtml::EditCommand::setEndingSelection):
        (khtml::CompositeEditCommand::deleteInsignificantTextDownstream):
        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
        (khtml::ApplyStyleCommand::splitTextAtStartIfNeeded):
        (khtml::ApplyStyleCommand::splitTextAtEndIfNeeded):
        (khtml::ApplyStyleCommand::splitTextElementAtStartIfNeeded):
        (khtml::ApplyStyleCommand::splitTextElementAtEndIfNeeded):
        (khtml::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
        (khtml::ApplyStyleCommand::mergeEndWithNextIfIdentical):
        (khtml::ApplyStyleCommand::joinChildTextNodes):
        (khtml::DeleteSelectionCommand::initializePositionData):
        (khtml::DeleteSelectionCommand::handleGeneralDelete):
        (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
        (khtml::DeleteSelectionCommand::doApply):
        (khtml::InsertLineBreakCommand::doApply):
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply):
        (khtml::InsertTextCommand::input):
        (khtml::MoveSelectionCommand::doApply):
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand):
        (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand):
        (khtml::ReplaceSelectionCommand::doApply):
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement):
        (khtml::ReplaceSelectionCommand::updateNodesInserted):
        (khtml::TypingCommand::deleteKeyPressed):
        (khtml::TypingCommand::forwardDeleteKeyPressed):
        (khtml::TypingCommand::markMisspellingsAfterTyping):
        * khtml/editing/htmlediting.h:
        * khtml/editing/selection.cpp:
        (khtml::Selection::Selection):
        (khtml::Selection::init):
        (khtml::Selection::moveTo):
        (khtml::Selection::modifyExtendingRightForward):
        (khtml::Selection::modifyMovingRightForward):
        (khtml::Selection::modifyExtendingLeftBackward):
        (khtml::Selection::modifyMovingLeftBackward):
        (khtml::Selection::modify):
        (khtml::Selection::xPosForVerticalArrowNavigation):
        (khtml::Selection::clear):
        (khtml::Selection::setBase):
        (khtml::Selection::setExtent):
        (khtml::Selection::setBaseAndExtent):
        (khtml::Selection::layout):
        (khtml::Selection::validate):
        * khtml/editing/selection.h:
        (khtml::Selection::startAffinity):
        (khtml::Selection::endAffinity):
        (khtml::Selection::baseAffinity):
        (khtml::Selection::extentAffinity):
        (khtml::operator==):
        * khtml/editing/text_affinity.h:
        (khtml::):
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::VisiblePosition):
        (khtml::VisiblePosition::init):
        (khtml::VisiblePosition::initUpstream):
        (khtml::VisiblePosition::initDownstream):
        (khtml::VisiblePosition::next):
        (khtml::VisiblePosition::previous):
        (khtml::startVisiblePosition):
        (khtml::endVisiblePosition):
        * khtml/editing/visible_position.h:
        (khtml::VisiblePosition::):
        (khtml::VisiblePosition::VisiblePosition):
        (khtml::VisiblePosition::affinity):
        (khtml::VisiblePosition::setAffinity):
        (khtml::operator==):
        * khtml/editing/visible_units.cpp:
        (khtml::previousBoundary):
        (khtml::nextBoundary):
        (khtml::startOfLine):
        (khtml::endOfLine):
        (khtml::previousLinePosition):
        (khtml::nextLinePosition):
        (khtml::startOfParagraph):
        (khtml::endOfParagraph):
        (khtml::previousParagraphPosition):
        (khtml::nextParagraphPosition):
        (khtml::startOfBlock):
        (khtml::endOfBlock):
        (khtml::startOfDocument):
        (khtml::endOfDocument):
        * khtml/editing/visible_units.h:
        * khtml/khtml_part.cpp:
        (KHTMLPart::findTextNext):
        (KHTMLPart::selectClosestWordFromMouseEvent):
        (KHTMLPart::handleMousePressEventTripleClick):
        (KHTMLPart::handleMousePressEventSingleClick):
        (KHTMLPart::handleMouseMoveEventSelection):
        (KHTMLPart::khtmlMouseReleaseEvent):
        (KHTMLPart::selectAll):
        (KHTMLPart::computeAndSetTypingStyle):
        (KHTMLPart::selectionComputedStyle):
        * khtml/rendering/render_br.cpp:
        (RenderBR::positionForCoordinates):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeBaseImpl::setFocus):
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousCharacterPosition):
        (DOM::Position::nextCharacterPosition):
        * khtml/xml/dom_position.h:
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject value]):
        (-[KWQAccObject visiblePositionForStartOfTextMarkerRange:]):
        (-[KWQAccObject visiblePositionForEndOfTextMarkerRange:]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        (-[KWQAccObject doAXLineForTextMarker:]):
        (-[KWQAccObject doAXTextMarkerRangeForLine:]):
        (-[KWQAccObject doAXTextMarkerForPosition:]):
        (-[KWQAccObject doAXLeftLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXNextWordEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousWordStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousLineStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doSetAXSelectedTextMarkerRange:]):
        * kwq/KWQAccObjectCache.mm:
        (KWQAccObjectCache::textMarkerForVisiblePosition):
        (KWQAccObjectCache::visiblePositionForTextMarker):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::findString):
        (KWQKHTMLPart::advanceToNextMisspelling):
        (KWQKHTMLPart::styleForSelectionStart):
        (KWQKHTMLPart::baseWritingDirectionForSelectionStart):
        (KWQKHTMLPart::setSelectionFromNone):
        (KWQKHTMLPart::respondToChangedSelection):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:]):
        (-[WebCoreBridge selectionAffinity]):
        (-[WebCoreBridge setMarkDOMRange:]):
        (-[WebCoreBridge _visiblePositionForPoint:]):
        (-[WebCoreBridge moveDragCaretToPoint:]):
        (-[WebCoreBridge editableDOMRangeForPoint:]):
        (-[WebCoreBridge ensureSelectionVisible]):
        (-[WebCoreBridge rangeOfCharactersAroundCaret]):

2005-02-09  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3985211> Seed: Mail: Drag-and-drop destination indicator / insertion point disappears

        Reviewed by kocienda.

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::paintCaret): new
        (khtml::RenderBlock::paintObject): call paintCaret for the cursor caret and the drag caret
        * khtml/rendering/render_block.h:

=== Safari-185 ===

2005-02-08  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3996344> Entire document content is deleted when only the first paragraph was supposed to be

        Problem stems from my attempt to fix this bug: <rdar://problem/3986155> Insertion point goes 
        to beginning of doc after deleting.
        
        I added an "optimization" that proved to do more harm than good. So, basically, the fix is to remove code.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete)

2005-02-07  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3890352> REGRESSION (125-170, Panther-only): pasted textarea contents disappear (exception in NSText)

        * kwq/KWQTextArea.mm: (-[KWQTextArea tile]): Don't resize the text view immediately here.
        Use performWithDelay to defer it to avoid the re-entrancy that bothers the Panther version
        of NSTextView. On Tiger, leave the code alone.

2005-02-07  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

        Fix for <rdar://problem/3993628> REGRESSION (180-181): Logitelnet bank's website doesn't work

        This fixes an oversight in the fix for <rdar://problem/3964286>.  
        We're now making sure there is a document before calling checkCompleted in slotLoaderRequestDone.
       	That function is called even when other parts finish loads of their subresources, so we could end
	up calling checkCompleted before we had a document. We also looked over all the other calls to
	checkCompleted to convince ourselves no other call sites had a similar issue.

        * khtml/khtml_part.cpp: (KHTMLPart::slotLoaderRequestDone): Check if doc is nil before calling
	checkCompleted.

2005-02-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3953302> Replacing quoted text ends up with blue-colored text that is not quoted

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::doApply): Removed special case delete code for select all. It was
        causing as many bugs as it fixed. What's more, the design concept is a bit shaky. By removing
        this special case, the bug goes away.
        * khtml/editing/htmlediting.h: Remove declaration.
        
        Test results using selectAll() updated to reflect changed behavior.
        
        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt:
        * layout-tests/editing/deleting/delete-select-all-001-expected.txt:
        * layout-tests/editing/deleting/delete-select-all-003-expected.txt:
        * layout-tests/editing/inserting/insert-3654864-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3775316-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3851164-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3907422-fix-expected.txt:
        * layout-tests/editing/pasteboard/paste-text-015-expected.txt:

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3994164> setting a new style attribute with setAttribute("style") doesn't blow away the old style

        * khtml/css/css_valueimpl.h: Renamed parseProperty to parseDeclaration, since it's used to parse
        an entire style declaration, not a single property.
        * khtml/css/css_valueimpl.cpp: (DOM::CSSMutableStyleDeclarationImpl::parseDeclaration): Renamed,
        and added code to clear m_values.
        * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Call function by its
        new name, and remove some unnecessary comments.

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3993722> need oncut and onpaste handlers implemented for <textarea> (needed for widgets)

        * kwq/KWQTextArea.mm:
        (-[KWQTextAreaTextView dispatchHTMLEvent:]): Added.
        (-[KWQTextAreaTextView cut:]): Dispatch "before cut" and "cut" events.
        (-[KWQTextAreaTextView copy:]): Dispatch "before copy" and "copy" events.
        (-[KWQTextAreaTextView paste:]): Dispatch "before paste" and "paste" events.
        (-[KWQTextAreaTextView pasteAsPlainText:]): Ditto.
        (-[KWQTextAreaTextView pasteAsRichText:]): Ditto.

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3943038> <input type=search> that is focused in onload handler doesn't have a visible editor

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::setFocusNode): Always update layout before giving focus to a widget.
        This prevents the bad case where we give a widget focus before it has been positioned or sized, causing us to
        exercise edge cases AppKit doesn't handle well.

        * kwq/KWQTextField.mm: (-[KWQTextFieldController initWithTextField:QLineEdit:]): Remove workaround code I added
        to fix bug 3943049. Updating the layout fixes the same problem in a cleaner, safer way, and solves another problem,
        with the way the clip view is set up.

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3425232> textarea won't trigger onchange action when clicking to new field

        * khtml/rendering/render_form.h: Added new m_dirty data member.
        * khtml/rendering/render_form.cpp:
        (RenderTextArea::RenderTextArea): Initialize m_dirty to false.
        (RenderTextArea::detach): Call value() on the DOM element to cause it to fetch the value from this object.
        (RenderTextArea::handleFocusOut): Ditto. Also send the onchange event based only on the m_dirty flag.
        (RenderTextArea::updateFromElement): Clear the m_dirty flag if the edited value is blown away by a value
        that comes from the DOM element. Remove code to clear the element's m_dirtyvalue flag; that's an unnecessary
        optimization, and ideally we'll stop having code in the render object that knows about that flag later.
        (RenderTextArea::slotTextChanged): Set the m_dirty flag.

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - re-fixed <rdar://problem/3760910> please add support for custom tag names in HTML

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::tagId): Use ID_LAST_TAG + 1 for the ID of the first assigned tag ID. Before we'd use ID_LAST_TAG,
        which resulted in the same number being used for ID_COMMENT and the first custom tag.
        (DocumentImpl::tagName): Use ID_LAST_TAG + 1, as above.
        (DocumentImpl::namespaceURI): Change a < ID_LAST_TAG to <= ID_LAST_TAG in the same spirit as above.

2005-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3986639> Crash occurs after choosing Undo Typing from the Edit menu

        * kwq/KWQTextArea.mm: (-[KWQTextArea viewWillMoveToWindow:]): Remove actions from undo manager when the view is
        removed from the window. Unfortunately, to do this the code has to know that the target of NSTextView actions
        will be the text storage object, but given the NSText architecture, that's pretty clear.

2005-02-05  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3991974> REGRESSION: www.jabra.com world location screen does not work

        Reviewed by hyatt.

        * kwq/KWQKJavaAppletWidget.mm:
        (KJavaAppletWidget::KJavaAppletWidget): fallback to the document's base URL if there is no baseURL attribute
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge baseURL]): new

2005-02-04  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        Rolled out Ken's accidental checkin when committing <rdar://problem/3986155> fix yesterday.
        
        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):

2005-02-04  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

        Fix for <rdar://problem/3758785> Safari no longer works at BankOfAmerica online banking for military users
  
        When closing the document, if a body doesn't exist we now create one.  This bug was preventing the onload handler from
        firing in cases where there wasn't a body.  In the BankOfAmerica case, the page was just a bit of script where the onload
        handler redirected to the correct page.

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::close):

2005-02-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3986155> Insertion point goes to beginning of doc after deleting

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::setStartNode): New convenience to handle reference counting when setting.
        (khtml::DeleteSelectionCommand::handleGeneralDelete): This contains the crux of the bug fix. Improve tests
        that detect when a selected node needs to be retained, rather than deleted, to preserve the intent of the user.
        This has the side effect of causing the insertion point placement code to succeed rather than fail. Before
        this fix, the failure of the insertion point placement code caused the insertion point to jump to the start
        of the document, which is the symptom that can be perceived by users when editing.
        * khtml/editing/htmlediting.h: Add setStartNode declaration.
        * khtml/editing/visible_units.cpp:
        (khtml::startOfBlock): This function had a stubbed-in non-tested implementation. Implement and 
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-001.html: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-002.html: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-003.html: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-004-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-004.html: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-005-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-005.html: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-006-expected.txt: Added.
        * layout-tests/editing/deleting/delete-at-paragraph-boundaries-006.html: Added.

=== Safari-183 ===

2005-02-03  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3987419> Stocks and Weather leak what appears to XMLHTTPRequest results

	XMLHTTPRequests were causing massive leaks.  _webcore_initWithHeaderString: did funky things with
	self replacement.  Re-wrote to use more traditional factory constructor avoiding self replacement.
	
        Reviewed by David Harrison.

        * kwq/KWQLoader.mm:
        (+[NSDictionary _webcore_dictionaryWithHeaderString:]):
        (KWQServeRequest):
        (KWQServeSynchronousRequest):

2005-02-03  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3938763> Cannot view Windows Media Player videos (soundtrack is played twice with delay)

        Reviewed by hyatt.

        * khtml/html/html_objectimpl.cpp:
        (HTMLObjectElementImpl::attach): set needWidgetUpdate to false right after calling updateWidget because dispatchHTMLEvent can end up calling this method again
        (HTMLObjectElementImpl::recalcStyle): ditto

2005-02-02  John Sullivan  <sullivan@apple.com>

        Reviewed by Chris.

        - WebCore part of fix for <rdar://problem/3980651> REGRESSION (125-180): Huge number of pages printed from certain page, 
        iFrame involved
        
        This also fixes the problems with printing from GMail, yay!

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):
        If the current line is taller than the entire page height (e.g. tall iFrame), don't try
        to avoid splitting it across pages.
        
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge computePageRectsWithPrintWidthScaleFactor:printHeight:]):
        Handle error cases in a more obvious manner; this will cause future problems like this
        to print a blank page and complain to the console on debug builds, rather than print a 
        zillionty mostly-blank pages.

2005-02-02  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3960304> can't load a particular applet (at www.escape.de) unless it's the first applet to be loaded

        Reviewed by hyatt.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): when getting the MIME type from the PARAM tag, make sure the MIME type is the text from the left of the semi-colon if there is one. We do this elsewhere as well.

2005-02-02  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3983628> control-click on WebView is not selecting the word under the cursor (Mail, non-editable WebView)

        Reviewed by rjw.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendContextMenuEvent): check if SPI to always enable selecting closest word is enabled
        * kwq/WebCoreBridge.h:

2005-02-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * khtml/editing/markup.cpp:
        (khtml::createMarkup): Removed debug spam I committed earlier in error.

2005-02-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3823109> WebKit should support -toggleBaseWritingDirection: (bidi editing support)

        Since base writing direction is a paragraph-level property in AppKit, and we use the CSS direction
        property in WebCore, which can be applied to inline elements as well as blocks, a new notion has
        been added to the WebCore apply style logic. It is now possible to force all properties in a 
        style declaration to be applied as though they were block properties.

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::ApplyStyleCommand): Add an enum and a flag to this command that controls whether to force all
        properties in the style to be applied as block styles. Default is "no", retaining previous behavior.
        (khtml::ApplyStyleCommand::doApply): Switch on new flag to apply styles as before, or force all preoperties to be applied
        as block styles.
        * khtml/editing/htmlediting.h:
        (khtml::ApplyStyleCommand::): Add an enum and a flag, as above.
        * khtml/khtml_part.cpp:
        (KHTMLPart::applyParagraphStyle): New method to force application of all style properties as block styles.
        * khtml/khtml_part.h: Update header declarations.
        * kwq/KWQKHTMLPart.h: Update header declarations.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::baseWritingDirectionForSelectionStart): Accessor to help WebKit do a toggle operation on 
        writing direction.
        * kwq/WebCoreBridge.h: Update header declarations.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge applyParagraphStyle:withUndoAction:]): New method to force application of all style properties as block styles.
        (-[WebCoreBridge baseWritingDirectionForSelectionStart]): Accessor to help WebKit do a toggle operation on 
        writing direction.

        Fix for this bug:
        
        <rdar://problem/3985035> REGRESSION (Mail): Text copied from wrapped line contains extra character when pasted

        * khtml/editing/markup.cpp:
        (khtml::renderedText): Add an enum and a flag to this command that controls whether to force all
        This is the result of an error in the code that computes the rendered text that is selected 
        when copying. Since spaces collapse at the end of lines, and these spaces need to be copied 
        when the selection spans line endings, code runs to compute this text. However, this code 
        was also running incorrectly in cases where lines wrapped. I have now added the missing 
        test to check that the selection does indeed extend to the end of the line.


2005-02-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for these bugs:
        
        <rdar://problem/3984894> REGRESSION (Mail): Command-right-arrow in reply does the wrong thing (two ways)
        <rdar://problem/3985130> REGRESSION (Mail): command-right-arrow in pasted RTF selects only up to tab

        * khtml/editing/visible_units.cpp:
        (khtml::endOfLine): Two separate problems in this new function recently added to take the place of
        selectionForLine. In the first, endOfLine did not stop at BR elements, and returned the position
        beyond them. In the second, the VisiblePosition constructor gives the wrong answer in certain cases.
        Darin is going to work on a solution for that problem. In the meantime, I can fix the symptom of this
        bug by going down to the last leaf child of the root line box; a one line change we will roll out when
        Darin's fix is in.

2005-02-01  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3985535> QT Plug-in JavaScript support now fails in <embed> tag only case

        Reviewed by Maciej.

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):

2005-02-01  John Sullivan  <sullivan@apple.com>

        Written by Darin, reviewed and tested by me
        
        - fixed <rdar://problem/3969684> Panther-only: extra blank lines between 
        pasted content from Blot

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::attributedString):
        don't emit paragraph breaks if the margins are tiny; matches what
        we do for plain-text conversion

=== Safari-182 ===

2005-02-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3985160> Deficiencies in pasting architecture blocking progress on other bugs

        * khtml/editing/html_interchange.h: Move style span text used to mark element added to 
        add style to this header.
        * khtml/editing/htmlediting.cpp:
        (khtml::styleSpanClassString): Change to use constant moved to html_interchange.h.
        (khtml::isStyleSpan): New helper function. Checks if this is a span we added to apply style.
        (khtml::CompositeEditCommand::insertNodeBefore): Added an assert to check that the node
        we are inserting before is not the body.
        (khtml::CompositeEditCommand::insertNodeAfter): Ditto, but check is for after.
        (khtml::ReplacementFragment::ReplacementFragment): Added code to process the "default style"
        that is added by the copy code.
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): first and last nodes inserted are
        now member variables instead of function locals. Initialize them here.
        (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand): Deref first and last nodes inserted
        if necessary.
        (khtml::ReplaceSelectionCommand::doApply): Change design to fix the bug. Major change is to
        separate out the code that inserts nodes into the tree so additional styling checks can
        be done in a centralized way. Also got rid of the notion of "merging into the end block." That
        concept was just wrong.
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Tweak interface now that first and 
        last nodes inserted are member variables.
        (khtml::ReplaceSelectionCommand::insertNodeAfterAndUpdateNodesInserted): New helper used
        by replace code to do the stated DOM operation and update state internal to the command.
        This will also be a catch point to handle the kinds of additional style checks needed to
        make paste work right.
        (khtml::ReplaceSelectionCommand::insertNodeAtAndUpdateNodesInserted): Ditto.
        (khtml::ReplaceSelectionCommand::insertNodeBeforeAndUpdateNodesInserted): Ditto.
        (khtml::ReplaceSelectionCommand::updateNodesInserted): Ditto.
        * khtml/editing/htmlediting.h: Update declarations as needed.
        * khtml/editing/markup.cpp:
        (khtml::createMarkup): Adds a "default style" span to the content written to the pasteboard.
        This will help us to fix some of the bugs blocked by the bug above.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::lastDescendent): New helper.
        * khtml/xml/dom_nodeimpl.h: Ditto.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream): Fixed a bug which would allow the upstream position returned to be
        in unrendered content.
        (DOM::Position::downstream): Ditto.

        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt: Ending positions tweaked due to 
        changes in upstream() and downstream() functions.
        * layout-tests/editing/inserting/insert-3851164-fix-expected.txt: Ditto
        * layout-tests/editing/inserting/insert-3907422-fix-expected.txt: Ditto
        * layout-tests/editing/selection/extend-by-character-006-expected.txt: Ditto

        * layout-tests/editing/pasteboard/paste-text-003-expected.txt: Changed what we expect, given
        new behavior of paste code.

2005-01-31  John Sullivan  <sullivan@apple.com>

        Reviewed by Dave Hyatt.
        
        - fixed <rdar://problem/3983097> Tabbing on RSS pages gets stuck in search field 
        with "full keyboard navigation" off

        * kwq/KWQSlider.h:
        * kwq/KWQSlider.mm:
        (QSlider::focusPolicy):
        Implemented this method for KWQSlider. It is needed for our widget subclasses that
        can become focused in some situations. I missed this when fixing 3949203 because
        it only comes into play when tab-to-controls is on, and because the other relevant
        methods are objective-C methods.

2005-01-31  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3964164> AXWebArea needs to unregister on going invisible

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::detach):
        Detach the AX UIElement for the AXWebArea.

2005-01-31  David Harrison  <harrison@apple.com>

        Reviewed by Darin

        <rdar://problem/3850876> AX: button exposed as only an AXImage at http://appleseed.apple.com/ site (<input type=image>)

        * khtml/rendering/render_form.h:
        (khtml::RenderImageButton::isImageButton):
        New.
        * khtml/rendering/render_image.h:
        (khtml::RenderImage::isImageButton):
        New.
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject isImageButton]):
        (-[KWQAccObject actionElement]):
        (-[KWQAccObject role]):
        (-[KWQAccObject accessibilityActionNames]):
        (-[KWQAccObject accessibilityPerformAction:]):
        Represent RenderImageButton elements as buttons instead of images.

2005-01-31  David Harrison  <harrison@apple.com>

        Prevent nil dereference in debug code.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::displayTree):
        Stop when parent is 0, too.

2005-01-31  John Sullivan  <sullivan@apple.com>

        Reviewed by Dave Hyatt.
        
        - fixed <rdar://problem/3949203> cannot tab to, within, or out of the RSS sidebar

        * kwq/KWQSlider.mm:
        (-[KWQSlider becomeFirstResponder]):
        (-[KWQSlider resignFirstResponder]):
        (-[KWQSlider nextKeyView]):
        (-[KWQSlider previousKeyView]):
        (-[KWQSlider canBecomeKeyView]):
        (-[KWQSlider nextValidKeyView]):
        (-[KWQSlider previousValidKeyView]):
        Copied these methods from KWQButton. The lack of special handling for first-responder-ness
        here was causing the focus to get "stuck" on the RSS page's slider widget. Added FIXME
        about how it would be nice to share more of this code rather than replicating it in each
        KWQ widget subclass.

2005-01-31  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/3980066> Double-click on single character moves insertion point to previous line

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectClosestWordFromMouseEvent): Set affinity too.
        (KHTMLPart::handleMousePressEventTripleClick): Ditto.
        (KHTMLPart::handleMouseMoveEventSelection): Ditto.
        (KHTMLPart::khtmlMouseReleaseEvent): Ditto.

        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyExtendingRightForward): Use endOfLine and endOfDocument.
        (khtml::Selection::modifyMovingRightForward): Ditto.
        (khtml::Selection::modifyExtendingLeftBackward): Use startOfLine and startOfDocument.
        (khtml::Selection::modifyMovingLeftBackward): Ditto.
        (khtml::Selection::validate): Rewrote the section that handles double-click. Two main fixes: 1) use isStartOfLine to
        check for another case where we want to select the word to the right, and 2) use isEndOfParagraph, which seems
        to work correctly in cases where isLastVisiblePositionInParagraph is giving the wrong answer. Also changed the line
        code to use startOfLine/endOfLine and the document code to use startOfDocument/endOfDocument.

2005-01-31  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/3935275> unexpected quit scrolling over link; last.fm (works in IE and Firefox)

        * kwq/WebCoreBridge.mm: (-[WebCoreBridge elementAtPoint:]): By using the correct document, fix the crash reported here.
        The page still crashes when you close the browser window, but it's not trivial to fix so I'll file a new bug after that.

2005-01-31  Darin Adler  <darin@apple.com>

        Reviewed by Ken and Harrison.

        - fixed <rdar://problem/3947901> REGRESSION (Mail): Pasting paragraph of rich text leaves insertion point before pasted text
        - fixed <rdar://problem/3949790> hitting return after underlined line results in too much or too little underlined
        - fixed <rdar://problem/3981759> nil-deref and crash when pasting just a paragraph break
        - fixed a couple problems I discovered while working with bug 3949790

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::applyInlineStyle): Pass StayInBlock to upstream. Without this, we end up going too far
        upstream in the test case in bug 3949790.
        (khtml::ApplyStyleCommand::removeInlineStyle): Pass StayInBlock to upstream and downstream. Same reason as above.
        (khtml::ReplaceSelectionCommand::doApply): Update endPos if inserting a new node and endPos is using that node's
        parent and an offset past the node being inserted. That change fixes a problem with the position of the insertion point
        after pasting into the top level of a document (from test cases in 3947901 and 3949790). When setting insertionPos, use
        code that works when lastNodeInserted is a block rather than a text node. That change fixes a problem where a newline is
        not added when pasting an entire paragraph into the end of a document (from test case in 3949790). Added nil check before
        checking if lastNodeInserted is a <br> element, which fixes the crash when pasting just a paragraph break.

        * khtml/editing/visible_units.h: Filled out the set of calls to add some boolean checks for lines (needed for the
        bug fix), and calls for blocks (not yet implemented), and documents. The document checks may need refinement to
        properly handle documents with a mix of editable and non-editable content, but for now they just refactor code
        and make things a little clearer. Also removed the "include line break" parameter from endOfSentence.
        * khtml/editing/visible_units.cpp:
        (khtml::rootBoxForLine): Added.
        (khtml::startOfLine): Added. Algorithm taken from selectionForLine in selection.cpp.
        (khtml::endOfLine): Ditto.
        (khtml::inSameLine): Added.
        (khtml::isStartOfLine): Added.
        (khtml::isEndOfLine): Added.
        (khtml::endOfSentence): Removed "include line break" parameter.
        (khtml::inSameParagraph): Added a null check.
        (khtml::isStartOfParagraph): Ditto.
        (khtml::isEndOfParagraph): Ditto.
        (khtml::startOfBlock): Added.
        (khtml::endOfBlock): Added.
        (khtml::inSameBlock): Added.
        (khtml::isStartOfBlock): Added.
        (khtml::isEndOfBlock): Added.
        (khtml::startOfDocument): Added.
        (khtml::endOfDocument): Added.
        (khtml::inSameDocument): Added.
        (khtml::isStartOfDocument): Added.
        (khtml::isEndOfDocument): Added.

2005-01-30  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3977000> form data set posted for <input type="image" ...> omits name/value pair

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::appendFormData): Append a name/value pair for type IMAGE in addition to the X/Y
        coordinates.

2005-01-30  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3974246> REGRESSION (125-180): popup menus are missing item text on Harmony Remote web site

        * khtml/html/html_formimpl.cpp: (DOM::HTMLOptionElementImpl::text): Change this function to traverse the entire tree
        and gather all the text rather than just looking at immediate children.

        * khtml/xml/dom_nodeimpl.h: Added const.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::traverseNextNode): Added const.
        (NodeImpl::traverseNextSibling): Ditto.
        (NodeImpl::traversePreviousNodePostOrder): Ditto.
        (NodeImpl::detach): Add a missing nil check.

2005-01-30  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3864536> crash copying text from other apps and pasting in a sticky in dashboard

        * khtml/editing/markup.cpp: (khtml::createFragmentFromText): Added missing ref/deref of newly created element.

2005-01-28  Darin Adler  <darin@apple.com>

        * khtml/css/cssproperties.c: Regenerated with newer gperf.

2005-01-28  David Harrison  <harrison@apple.com>

        Reviewed by John Sullivan.

        <rdar://problem/3968144> AX need to be able to focus an AXLink by setting AXFocused to true
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityPerformAction:]):
        (-[KWQAccObject accessibilityIsAttributeSettable:]):
        Add AXFocused for AXLinks.

2005-01-28  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3584942> AX: Safari Accessibility parent-child mismatch

        Use AppKit SPI _accessibilityParentForSubview to return KWQAccObject parent of AppKit AX object.
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject _accessibilityParentForSubview:]):
        New.

2005-01-27  Adele Amchan  <adele@apple.com>

        fixed by Darin, reviewed by me.

        <rdar://problem/3976314> REGRESSION (180-TOT): submitting password fields fail on Panther

        * kwq/KWQTextField.mm: (-[KWQTextFieldController string]): on panther, the secure text field's editor 
        does not contain the real string, so now we just call stringValue on the field in that case.

2005-01-26  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin, Hyatt and Ken.

	<rdar://problem/3790449> REGRESSION (Mail): underline behavior is flaky because of how CSS handles text-decoration
	
        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Add support
	for -khtml-text-decorations-in-effect property. This works like text-docration
	but follows proper inline semantics, that is, if a parent is causing text
	decoration then -khtml-text-decorations-in-effect on this element will reflect that.
        * khtml/css/cssproperties.in: Add -khtml-text-decorations-in-effect property.
        * khtml/css/cssproperties.h: regenerated
        * khtml/css/cssvalues.c: regenerated
        * khtml/css/cssparser.cpp: regenerated
        * khtml/css/cssproperties.c: regenerated

        * khtml/css/css_valueimpl.h: Made copyPropertiesInSet public.

        * khtml/editing/htmlediting.cpp:
        (khtml::StyleChange::init): Handle -khtml-text-decorations-in-effect
	specially, translate to text-decoration
        (khtml::ApplyStyleCommand::applyInlineStyle): Fix a comment.
        (khtml::ApplyStyleCommand::removeInlineStyle): Add new way of pushing down
	text-decoration styles around the edges of the selected range.
        (khtml::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): Helper for this.
        (khtml::ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries): ditto
        (khtml::ApplyStyleCommand::nodeFullyUnselected): ditto
        (khtml::hasTextDecorationProperty): ditto
        (khtml::highestAncestorWithTextDecoration): ditto
        (khtml::ApplyStyleCommand::extractTextDecorationStyle): ditto
        (khtml::ApplyStyleCommand::extractAndNegateTextDecorationStyle): ditto
        (khtml::ApplyStyleCommand::applyTextDecorationStyle): ditto
        * khtml/editing/htmlediting.h: Prototype new methods.
        * khtml/editing/jsediting.cpp: Make underline execCommand use the new CSS property.

	- as a necessary part of the fix, fixed the longstanding problem
	that mutating an element's inlineStyleDecl would not property
	update its style attribute. now it does.
	
        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::setChanged): If this is an inline style
	declaration, tell the element it's style attribute needs updating.
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::invalidateStyleAttribute): New method, just calls down
	to the dom element.
        (HTMLElementImpl::updateStyleAttribute): Regenerate style attribute from
	inline style declaration.
        * khtml/html/html_elementimpl.h: Prototype new stuff.
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::ElementImpl): Initialize new attribute.
        (ElementImpl::updateStyleAttributeIfNeeded): New method to check if the style
	is dirty and this is an html element, and if so call the html element to
	regenerate the style attribute.
        (ElementImpl::attributes): update style if needed
        (ElementImpl::getAttribute): ditto
        (ElementImpl::hasAttributes): ditto
        (ElementImpl::dump): ditto
        (XMLElementImpl::cloneNode): ditto
        * khtml/xml/dom_elementimpl.h:
        (DOM::ElementImpl::isStyleAttributeValid): new method to manage style attr
	dirty bit
        (DOM::ElementImpl::setStyleAttributeValid): ditto

	- added new layout tests for underlining:
	
        * layout-tests/editing/editing.js:
        * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-across-paragraph-in-bold.html: Added.
        * layout-tests/editing/style/remove-underline-across-paragraph.html: Added.
        * layout-tests/editing/style/remove-underline-after-paragraph-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-after-paragraph-in-bold.html: Added.
        * layout-tests/editing/style/remove-underline-after-paragraph.html: Added.
        * layout-tests/editing/style/remove-underline-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-from-stylesheet-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-from-stylesheet.html: Added.
        * layout-tests/editing/style/remove-underline-in-bold-expected.txt: Added.
        * layout-tests/editing/style/remove-underline-in-bold.html: Added.
        * layout-tests/editing/style/remove-underline.html: Added.
        * layout-tests/editing/style/underline-expected.txt: Added.
        * layout-tests/editing/style/underline.html: Added.

2005-01-27  David Hyatt  <hyatt@apple.com>

	Fix for 3875199, search field needs to be able to  show a magnifying  glass without a dropdown menu.
	
        Reviewed by kocienda

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::HTMLInputElementImpl):
        (DOM::HTMLInputElementImpl::parseHTMLAttribute):
        * kwq/KWQLineEdit.mm:
        (QLineEdit::setMaxResults):

2005-01-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej

        Fix for this bug:
        
        <rdar://problem/3973254> Deletions of ranges does not coalesce correctly with subsequent typing

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertTextCommand::deleteCharacter): Remove this dead code.
        (khtml::ReplaceSelectionCommand::editingAction): Moved this code to a better place in the file. 
        It was in with unrelated functions.
        (khtml::TypingCommand::TypingCommand): Reorganize initialization list so it is easier to read.
        (khtml::TypingCommand::issueCommandForDeleteKey): Remove dead code. Roll in remaining code into deleteKeyPressed.
        (khtml::TypingCommand::deleteKeyPressed): Add in support for carrying along smart delete flag.
        (khtml::TypingCommand::forwardDeleteKeyPressed): New function. Makes forward delete work like
        "regular" delete in terms of coalescing typing.
        (khtml::TypingCommand::doApply): Add case for ForwardDeleteKey.
        (khtml::TypingCommand::preservesTypingStyle): Ditto.
        * khtml/editing/htmlediting.h:
        (khtml::TypingCommand::): Add ForwardDeleteKey constant. Remove a couple declarations for now-dead code.
        (khtml::TypingCommand::smartDelete): New accessor.
        (khtml::TypingCommand::setSmartDelete): Ditto.
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge deleteKeyPressedWithSmartDelete:]): Add smart delete flag.
        (-[WebCoreBridge forwardDeleteKeyPressedWithSmartDelete:]): New method.
        * khtml/editing/jsediting.cpp: Add supprt for ForwardDelete command
        * layout-tests/editing/editing.js: Ditto.
        * layout-tests/editing/deleting/delete-and-undo-expected.txt: Added.
        * layout-tests/editing/deleting/delete-and-undo.html: Added.
        * layout-tests/editing/deleting/forward-delete-expected.txt: Added.
        * layout-tests/editing/deleting/forward-delete.html: Added.

=== Safari-181 ===

2005-01-27  David Harrison  <harrison@apple.com>

        Reviewed by Ken.

        <rdar://problem/3962214> AX: AXLeftLineTextMarkerRangeForTextMarker returns incorrect range

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        Allowed for selection to end of line including the linebreak.
        
2005-01-27  David Harrison  <harrison@apple.com>

        Reviewed by Darin, Ken.

        <rdar://problem/3964470> AX: Include attachments in AXAttributedStringForTextMarkerRange

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject isAttachment]):
        (-[KWQAccObject attachmentView]):
        (-[KWQAccObject role]):
        (-[KWQAccObject subrole]):
        (-[KWQAccObject roleDescription]):
        (-[KWQAccObject value]):
        (-[KWQAccObject title]):
        (-[KWQAccObject accessibilityDescription]):
        (-[KWQAccObject accessibilityIsIgnored]):
        (-[KWQAccObject accessibilityAttributeNames]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        Make attachments accessible.
        
        (CreateCGColorIfDifferent):
        (AXAttributeStringSetColor):
        (AXAttributeStringSetNumber):
        (AXAttributeStringSetFont):
        (AXAttributeStringSetStyle):
        (AXAttributeStringSetElement):
        (AXLinkElementForNode):
        (AXAttributedStringAppendText):
        (AXAttributedStringAppendReplaced):
        (-[KWQAccObject doAXAttributedStringForTextMarkerRange:]):
        Add attachments and more text attributes to AXAttributedStringForTextMarkerRange.

2005-01-27  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3807935> DOM CSS computed style line-height is wrong in two ways

        * khtml/css/css_computedstyle.cpp: (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        Use specified size rather than computed size when dealing with a percentage for line height.

2005-01-27  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3971372> SWB: template function DOM_cast() won't compile with gcc 4.0
        - fixed other gcc 4.0 compiling problems Patrick Beard pointed out on the phone

        * kwq/DOMInternal.h: (DOM_cast): Change the "failToCompile()" trick to use a dependent name.
        Nowadays, if a name is not dependent, it is checked at template definition time. But we want
        a failure only at template instantiation time.

        * ForwardingHeaders/editing/text_granularity.h: Added. Needed but a bug in the 3.3 compiler made
        it compile anyway without this.

        - other changes

        * khtml/html/html_miscimpl.h: For clarity, mark these functions virtual too. They are automatically
        virtual because the base class ones are virtual, but it's ugly to leave it this way.

2005-01-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3971609> REGRESSION (Mail): up/down arrow navigation broken after rewrapping text by resizing window
        <rdar://problem/3975661> REGRESSION (Mail): left/right arrow navigation can place insertion point after last character on line

        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyAffinity): PARAGRAPH and LINE movements should not alter affinity. This was
        just a mistake before when it reset to upstream in some cases.
        * khtml/rendering/render_line.cpp:
        (khtml::RootInlineBox::closestLeafChildForXPos): Move this function down from InlineBox, and 
        rework the implementation. This fixes 3971609.
        * khtml/rendering/render_line.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect): Rework the algorithm to fix 3975661. This regressed when we began placing
        the spaces on the end of lines in text boxes when lines wrap.

2005-01-26  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test

	I added a member variable to ObjectImp.  This changed it's size and consequently
	hampered the optimizations built into the garbage collector.  Objects no longer
	fit within the allocators cell size, and thus allocation fell back to a slower
	allocator.

	As a result of this fix I also dramatically cleaned up how runtime objects are
	accessed.  The path mostly *removes* code.
	
        Reviewed by Chris.

        * khtml/ecma/kjs_dom.cpp:
        (DOMDocumentProtoFunc::tryCall):
        (DOMElementProtoFunc::tryCall):
        (KJS::getRuntimeObject):
        * khtml/ecma/kjs_dom.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):
        (KJS::HTMLElement::tryGet):
        (KJS::HTMLElement::implementsCall):
        (KJS::HTMLElement::call):
        (KJS::HTMLElement::tryPut):
        (KJS::HTMLCollection::tryGet):
        (KJS::HTMLCollection::getNamedItems):
        * khtml/ecma/kjs_html.h:
        * khtml/ecma/kjs_window.cpp:
        (Window::get):

2005-01-26  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3757712> REGRESSION (Mail): WebCore does not allow Devanagari ligature input

	For now we are using ICU UBreakIterator to determine grapheme boundaries for
	cursor and deletion.  This does not match what Cocoa does exactly, but does match
	what Carbon does.  The areas are difference are obscure, but, according to
	Deborah Goldsmith, using the UBreakIterator is the reasonable approach.

        Reviewed by Ken.

        * khtml/rendering/render_text.cpp:
        (RenderText::previousOffset):
        (RenderText::nextOffset):

2005-01-25  David Harrison  <harrison@apple.com>

        Reviewed by Maciej and Richard.

        <rdar://problem/3963731> AX VO: Changing window sizes causes a crash using with Voice Over - KWQPtrDictImpl::clear

        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::HTMLCollectionImpl):
        Ensure that isHTMLDocument before calling HTMLDocument-only method.

2005-01-25  Richard Williamson   <rjw@apple.com>

	Part one of fix for <rdar://problem/3757712> REGRESSION (Mail): WebCore does not allow Devanagari ligature input

	This patch changes the semantics of next() and previous() on
	VisiblePosition to move a grapheme (character cluster) at a
	time.  This means that cursor navigation with correctly move
	over an entire cluster.

	However, the expected behavior for deleting a grapheme is to
	delete individual code points, thus decomposing the grapheme
	into it constituent parts.  That will be addressed in the next
	part of the fix.

        Reviewed by Ken.

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::previousPosition):
        (khtml::VisiblePosition::nextPosition):
        * khtml/editing/visible_position.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::previousOffset):
        (RenderObject::nextOffset):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::previousOffset):
        (RenderText::nextOffset):
        (RenderText::findNextInlineTextBox):
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::previousOffset):
        (NodeImpl::nextOffset):
        * khtml/xml/dom_nodeimpl.h:

2005-01-25  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/3973067> AXWebArea for http://apple.netscape.com/ has an empty AXLinkUIElements

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityAttributeValue:]):
        Omit ignored AXLinks from AXLinkUIElements result

2005-01-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3972851> REGRESSION (179-180+): Repro crash in ApplyStyleCommand::cleanUpEmptyStyleSpans

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::cleanUpEmptyStyleSpans): Added two null checks.

2005-01-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3954710> Mail crashed while editing signatures - NodeImpl::isBlockFlow

        The fix is more general than for this one bug, and may work to fix many crashers. The problem
        is that the ReplaceSelectionCommand never checked whether its starting selection is empty. If
        it is, then we need to bail before doing the work of the command, which we need to deref the
        start and end points of the selection in order to do its work. I think you can see the crash
        potential.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Assert selection is not empty.
        * kwq/WebCoreBridge.mm:
        (partHasSelection): New helper function to test that bridge has a part with a selection.
        
        Use new helper function to test part and selection; return from these function if this test fails.
        
        (-[WebCoreBridge rangeByExpandingSelectionWithGranularity:])
        (-[WebCoreBridge rangeByAlteringCurrentSelection:direction:granularity:])
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:])
        (-[WebCoreBridge rangeByAlteringCurrentSelection:verticalDistance:])
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:])
        (-[WebCoreBridge documentFragmentWithText:])
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:])
        (-[WebCoreBridge insertLineBreak])
        (-[WebCoreBridge insertParagraphSeparator])
        (-[WebCoreBridge insertParagraphSeparatorInQuotedContent])
        (-[WebCoreBridge insertText:selectInsertedText:])
        (-[WebCoreBridge deleteSelectionWithSmartDelete:])
        (-[WebCoreBridge ensureSelectionVisible])

2005-01-24  Kevin Decker  <kdecker@apple.com>

        Reviewed by Darin.

	Fixed <rdar://problem/3932374> REGRESSION: 'ReferenceError - Can't find variable' JavaScript error at webxpress.fidelity.com

        * khtml/html/html_miscimpl.h: Missing virtual identifiers for namedItem() and nextNamedItem() exposed a flaw that prevented finding variables in form [HTMLFormCollectionImpl] scopes.
	

2005-01-24  Vicki Murley <vicki@apple.com>

        Reviewed by kocienda.

	- fix <rdar://problem/3810661> computed style not handled for Apple extensions
 
        * khtml/css/css_computedstyle.cpp: (DOM::):
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): add -apple-line-clamp and -apple-text-size-adjust

2005-01-24  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3969884> REGRESSION (179-180): Typing password not echoed as "bullets" at paypal.com when field is first focused

        * kwq/KWQTextField.mm: (-[KWQTextFieldController initWithTextField:QLineEdit:]):
        Sizing up the form editor, which fixes things for normal fields and search fields,
        screws things up for password fields. Eventually, I'll need to figure out why this is
        and file a bug so that the AppKit team fixes it. In the mean time, just check for the
        case of the secure text field, and don't size up in that case.

2005-01-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3963560> 8A354: Inserting Japanese text to the line head causes line break

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Add one more case where we merge content into the
        existing line. This covers the situation see using the steps to reproduce this bug.

2005-01-21  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3967572> Editing should split elements before removing style
	
        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::splitElement):
        (khtml::CompositeEditCommand::mergeIdenticalElements):
        (khtml::CompositeEditCommand::wrapContentsInDummySpan):
        (khtml::CompositeEditCommand::splitTextNodeContainingElement):
        (khtml::ApplyStyleCommand::applyInlineStyle):
        (khtml::ApplyStyleCommand::splitTextAtStartIfNeeded):
        (khtml::ApplyStyleCommand::splitTextAtEndIfNeeded):
        (khtml::ApplyStyleCommand::splitTextElementAtStartIfNeeded):
        (khtml::ApplyStyleCommand::splitTextElementAtEndIfNeeded):
        (khtml::areIdenticalElements):
        (khtml::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
        (khtml::ApplyStyleCommand::mergeEndWithNextIfIdentical):
        (khtml::ApplyStyleCommand::cleanUpEmptyStyleSpans):
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply):
        (khtml::InsertTextCommand::prepareForTextInsertion):
        (khtml::SplitTextNodeCommand::doUnapply):
        (khtml::SplitElementCommand::SplitElementCommand):
        (khtml::SplitElementCommand::~SplitElementCommand):
        (khtml::SplitElementCommand::doApply):
        (khtml::SplitElementCommand::doUnapply):
        (khtml::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
        (khtml::MergeIdenticalElementsCommand::~MergeIdenticalElementsCommand):
        (khtml::MergeIdenticalElementsCommand::doApply):
        (khtml::MergeIdenticalElementsCommand::doUnapply):
        (khtml::WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand):
        (khtml::WrapContentsInDummySpanCommand::~WrapContentsInDummySpanCommand):
        (khtml::WrapContentsInDummySpanCommand::doApply):
        (khtml::WrapContentsInDummySpanCommand::doUnapply):
        (khtml::SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand):
        (khtml::SplitTextNodeContainingElementCommand::~SplitTextNodeContainingElementCommand):
        (khtml::SplitTextNodeContainingElementCommand::doApply):
        * khtml/editing/htmlediting.h:

	New layout test that shows the side benefit of this.
        
	* layout-tests/editing/style/unbold-in-bold-expected.txt: Added.
        * layout-tests/editing/style/unbold-in-bold.html: Added.

2005-01-24  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3933435> -[DOMRange cloneContents] sometimes alters the original DOMRange

        * khtml/xml/dom2_rangeimpl.cpp: (DOM::RangeImpl::processContents): Fixed code that was collapsing
        the range after processing the contents. That's right for extract and delete, but not clone.

        - fixed <rdar://problem/3714184> inline input works incorrectly when I type Korean slowly in textfield in form on www.google.co.kr
        - fixed <rdar://problem/3193848> Can't enter SSN to sign up for Chase visa online account (changing focus inside key press handler)
        - fixed <rdar://problem/3874683> REGRESSION (161-162): Crash after typing command-Z to undo after pasting text with newline in it into a text field <input type=text>

        * kwq/KWQLineEdit.mm:
        (QLineEdit::text): Changed to call a new string method on the controller instead of calling
        stringValue, since stringValue has a bad side effect of ending inline input.
        (QLineEdit::selectAll): Changed to only call selectText: when the field is already selected.
        When you are giving the field focus, it automatically gets all selected, and this change
        is required in the case where we defer the focus change.

        * kwq/KWQTextField.h: Added a new string method to the controller.
        * kwq/KWQTextField.mm:
        (-[KWQTextFieldController setMaximumLength:]): Call the new string method instead of using stringValue.
        (-[KWQTextFieldController controlTextDidChange:]): Removed the code to truncate at the first CR or LF.
        That's now handled in the shouldChangeTextInRange method instead.
        (-[KWQTextFieldController textView:shouldHandleEvent:]): Add new logic to defer responder changes until
        after the event is handled. This makes sure the key gets into the field that's already handling it at
        rather than ending up in the newly-focused field if the key press handler focuses a different element.
        (-[KWQTextFieldController textView:didHandleEvent:]): Turn off deferral here, now that the key press
        has been handled.
        (-[KWQTextFieldController string]): Added. Calls stringValue only if there's no editor. If there is
        an editor, calls string on that instead.
        (-[KWQTextFieldController textView:shouldChangeTextInRange:replacementString:]): Added. Called by
        the three field subclasses. Truncates incoming strings at the first CR or LF character. This works
        properly with Undo, and the old technique did not.
        (-[KWQTextFieldController preprocessString:]): Added. Helper used for all the setStringValue methods
        so they all truncate at the first CR or LF as well as truncating to the appropriate length.
        (-[KWQTextField setStringValue:]): Changed to call the controller.
        (-[KWQTextField textView:shouldChangeTextInRange:replacementString:]): Added. Calls the controller.
        (-[KWQSecureTextField setStringValue:]): More of the same.
        (-[KWQSecureTextField textView:shouldChangeTextInRange:replacementString:]): Ditto.
        (-[KWQSearchField setStringValue:]): Ditto.
        (-[KWQSearchField textView:shouldChangeTextInRange:replacementString:]): Ditto.

        * kwq/KWQWidget.h: Added the new setDeferFirstResponderChanges function.
        * kwq/KWQWidget.mm:
        (QWidget::~QWidget): Clear out the deferredFirstResponder global just in case we are destroyed
        while we "have the ball".
        (QWidget::hasFocus): If we are in the deferred mode, use the global to decide who to say is focused.
        (QWidget::setFocus): If we are in the deferred mode, set the global instead of making something be
        the first responder.
        (QWidget::setDeferFirstResponderChanges): Set the boolean. If the boolean is being cleared, then
        get the deferred first responder and call setFocus on it again, which will do the work we didn't
        want to do earlier.

2005-01-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3964350> Deleting all content and typing in a message gets one letter, then beeps

        This is a problem with the way we turn key events, when a user starts typing, into editing commands. 
        Right now, that initial delete key in an empty window is turned into an editing command, and much 
        editing code runs that need not run. What's more, this is confusing the selection machinery. The
        solution is to detect the "delete in an empty window" case and don't turn this into an editing
        command at all.

        * khtml/editing/htmlediting.cpp:
        (khtml::TypingCommand::deleteKeyPressed)

2005-01-23  Adele Amchan  <adele@apple.com>

        Fixed <rdar://problem/3964286> REGRESSION (178-179): menus and "go to old site" link at Ameritrade's new site don't work

        Removed check for document from checkCompleted.  In this case, WebCore never knew that a WebImageView was complete because 
        it fell into this document check case in checkCompleted.  
        Added check for document to tokenizerProcessedData (see <rdar://problem/3807144>)

        Reviewed by Darin.

        * khtml/khtml_part.cpp:
        (KHTMLPart::stop):
        (KHTMLPart::checkCompleted):
        * khtml/khtml_part.h:
        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::tokenizerProcessedData):

2005-01-21  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3759399> Javascript / Liveconnect problems ((event handler):Undefined value)

	Java applets specified with <object> or <embed> weren't scriptable.  Now they are.

        Reviewed by Chris.

        * khtml/html/html_objectimpl.cpp:
        (HTMLEmbedElementImpl::getEmbedInstance):
        (HTMLObjectElementImpl::getObjectInstance):

2005-01-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3959464> REGRESSION (Mail): Insertion point goes back to beginning of document after deleting

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete): Add special case to handle retaining a fully-selected block.
        This fixes the bug.
        * layout-tests/editing/deleting/delete-3959464-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3959464-fix.html: Added.

2005-01-21  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3966998> REGRESSION(179-TOT) clicking on gmail message brings me to blank screen

	getElementById() sometimes returns Undefined() instead of Null().

        Reviewed by Hyatt.

        * khtml/ecma/kjs_dom.cpp:
        (DOMDocumentProtoFunc::tryCall):

2005-01-21  David Hyatt  <hyatt@apple.com>

	Fix for 3773809, make sure that overflow regions never end up at an invalid scroll offset because of a layout change.
	
        Reviewed by kocienda

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateScrollInfoAfterLayout):

2005-01-21  David Hyatt  <hyatt@apple.com>

	Fix for 3966349, hang loading page.  Make sure that loops using popOneBlock properly check for a null
	blockStack to avoid an infinite loop.
	
        Reviewed by kocienda

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::parseToken):
        (KHTMLParser::insertNode):
        (KHTMLParser::popInlineBlocks):

2005-01-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3957204> Mail crashed when sending a message in ~InsertParagraphSeparatorInQuotedContentCommand

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):
        InsertParagraphSeparatorInQuotedContentCommand has this member variable: DOM::ElementImpl *m_breakNode;
        I failed to initialize this variable to null in the constructor, and there is an uncommonly-traveled 
        code path which does not set this variable to something good. In the destructor, we check for null, 
        and deref if non-null. Obvious "BOOM" potential. Fixed.

2005-01-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3966311> REGRESSION (Mail): Hitting return makes space character disappear

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): When writing the code to insert a block
        in response to the return key, I did not write code to cover the case described in the bug.
        Now I have.
        * layout-tests/editing/inserting/insert-div-025-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-025.html: Added.

2005-01-20  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/3965196> security fix for javascript: exploit missed one case (already fixed in updates)
        
	* khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall): correct mistake in earlier fix for the following bug, caught by Adele:

2005-01-20  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/3965466> editing needs to insert text before applying typing style
	
        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): Remove a FIXME comment.
        (khtml::InsertLineBreakCommand::doApply): Apply style to the BR
	node after inserting it.
        (khtml::InsertTextCommand::prepareForTextInsertion): Don't try to
	apply style to any new nodes created before inserting.
        (khtml::InsertTextCommand::input): Apply style to the inserted range
	after doing the text insert.
        * khtml/editing/htmlediting.h:

	This change leads to improved results on one of the layout tests:
        
	* layout-tests/editing/inserting/insert-div-024-expected.txt:

=== Safari-180 ===

2005-01-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3964646> REGRESSION (179-180): Typing space at end of line makes following paragraph disappear

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Recent change to block placeholder removal code 
        caused this regression. The code became too aggressive in removing block placeholders, and would remove them
        from blocks other than the block containing the selection.
        * layout-tests/editing/inserting/insert-div-023-expected.txt: This file had a spurious BR element in it that
        I did not notice earlier.
        * layout-tests/editing/inserting/insert-div-024-expected.txt: Ditto.

2005-01-20  David Hyatt  <hyatt@apple.com>

	Fix for oddness on albertsons.com.  Make sure not to crash when setting/removing style properties on a node
	with no document.  The bug # is 3813900.
	
        Reviewed by john

2005-01-20  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        PARTIAL fix for following bug.  Create attributed string with fonts and links.  Still need to add attachments.
        <rdar://problem/3942606> AX: Support kAXAttributedStringForTextMarkerRangeParameterizedAttribute
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject textUnderElement]):
        Touched up previous checkin to match code review comments.
        
        (-[KWQAccObject value]):
        Use plainText for this one instead of obsolete attributedString.
        
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        Advertise AXAttributedStringForTextMarkerRange.
        
        (AXAttributeStringAddFont):
        (AXAttributeStringAddElement):
        (-[KWQAccObject linkUIElementForNode:]):
        (-[KWQAccObject _addAttachmentForElement:URL:needsParagraph:usePlaceholder:]):
        (-[KWQAccObject accessibilityAttributedStringForRange:]):
        New routines to support AXAttributedStringForTextMarkerRange.
        
        (-[KWQAccObject doAXAttributedStringForTextMarkerRange:]):
        Use new routines instead of obsolete attributedString.

2005-01-20  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3960196> AX Crash in DOM::Range::setStartBefore

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::getAccObjectCache):
        Adjust when detecting cache in non-top level WebArea.
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject textUnderElement]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        Make sure the elements document is the current one for the part.

2005-01-20  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3922980> Mail not crashing, just quitting itself suddenly in -[WebHTMLView(MailExtras) findString:options:]

        * khtml/dom/dom2_range.cpp: (DOM::operator==): Handle null and detached ranges without raising exceptions.
        The uncaught exception would make the entire program terminate.

        - fixed <rdar://problem/3885729> attempting to modify a computed style does nothing, but should raise a DOM exception

        * kwq/DOM-CSS.mm: (-[DOMCSSStyleDeclaration setProperty:::]): Uncommented this code which I had to disable
        back in November because Mail was stumbling over it.

        - fixed <rdar://problem/3943049> focus() called during onload handler results in square text field on <input type=search>        

        * kwq/KWQLineEdit.mm: (QLineEdit::baselinePosition): Change computation so it will work even for fields
        that position their text in a way that depends on vertical size. In the case of a search field, the text
        is centered, so the old logic was broken.
        * kwq/KWQTextField.mm: (-[KWQTextFieldController initWithTextField:QLineEdit:]): Set the frame size to
        something large enough to accomodate the field editor. If we start the frame at size 0,0 we run into
        AppKit trouble when it insets the frame to figure out the frame for the field editor. In the case of this
        bug this happens because we become first responder before being sized and positioned by the HTML layout code.

        - improved debugging output when using "po" from gdb with Objective-C DOM

        * kwq/DOM.mm:
        (-[DOMNode description]): Added. Includes node name ("<tr>") and node value (e.g., string for text node).
        (-[DOMRange description]): Tweaked format.

2005-01-19  Richard Williamson   <rjw@apple.com>

	After further discussion with Real we have decided to NOT include the
	additional CLSID for the real plugin.  See 3958601.

        Reviewed by Darin.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget):

2005-01-19  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/3949429> AX: word marker routines returns incorrect data for empty line

        Previous checkin for this bug was missing some of the patch.  Editing snafu with multiple changes in tree.
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXNextWordEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousWordStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousLineStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousSentenceStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousParagraphStartTextMarkerForTextMarker:]):

2005-01-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::applyStyleAfterInsertion): Small, cosmetic change John and I decided
        to do on my last checkin, but I forgot to do before landing.

2005-01-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3959727> REGRESSION (Mail): Style not preserved on blank lines

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::applyStyle):
        (khtml::CompositeEditCommand::insertBlockPlaceholder): New function that unconditionally adds a block placeholder.
        (khtml::CompositeEditCommand::insertBlockPlaceholderIfNeeded): Now returns bool based on whether
        placeholder was added or not.
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Now searches all the descendents of a block
        looking for a placeholder. The old code, which just looked at the last child of a node, started missing
        once block placeholders became styled (which started happening with this patch).
        (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete): Now handles applying typing style
        to a block placeholder at call time, rather than setting the typing style as a latent style that
        might be applied later. This is an important part of the bug fix.
        (khtml::DeleteSelectionCommand::doApply): Now uses bool return value from insertBlockPlaceholderIfNeeded()
        and passes it along to calculateStyleBeforeInsertion, so the case where a block placeholder needs to
        be styled can be detected.
        (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): Changed the way this class
        managed style. Before it would calculate and set typing style for the block added. This is not
        sufficient. Added blocks need to styled immediately. Some name changes to instance variables in 
        this class due to the change to accommodate this change.
        (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): Name changes, as above.
        (khtml::InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion): Ditto.
        (khtml::InsertParagraphSeparatorCommand::applyStyleAfterInsertion): Ditto.
        (khtml::InsertParagraphSeparatorCommand::doApply): Ditto.
        (khtml::ReplaceSelectionCommand::doApply): Improve check for testing when a placeholder
        block can be removed in its entirety after the insertion.
        * khtml/editing/htmlediting.h: Update header accordingly.
        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionComputedStyle): Move position for computed style check downstream before
        doing check when the position is in an empty block (this makes sure any style on any block
        placeholder is accounted for).

        New layout tests to check bug fix.

        * layout-tests/editing/style/block-style-004-expected.txt: Added.
        * layout-tests/editing/style/block-style-004.html: Added.
        * layout-tests/editing/style/block-style-005-expected.txt: Added.
        * layout-tests/editing/style/block-style-005.html: Added.
        * layout-tests/editing/style/block-style-006-expected.txt: Added.
        * layout-tests/editing/style/block-style-006.html: Added.

        Results updated to reflect new block placeholder code.

        * layout-tests/editing/inserting/insert-div-004-expected.txt 
        * layout-tests/editing/inserting/insert-div-005-expected.txt
        * layout-tests/editing/inserting/insert-div-006-expected.txt
        * layout-tests/editing/inserting/insert-div-008-expected.txt
        * layout-tests/editing/inserting/insert-div-011-expected.txt
        * layout-tests/editing/inserting/insert-div-012-expected.txt
        * layout-tests/editing/inserting/insert-div-013-expected.txt
        * layout-tests/editing/inserting/insert-div-014-expected.txt
        * layout-tests/editing/inserting/insert-div-015-expected.txt
        * layout-tests/editing/inserting/insert-div-016-expected.txt
        * layout-tests/editing/inserting/insert-div-017-expected.txt
        * layout-tests/editing/inserting/insert-div-018-expected.txt
        * layout-tests/editing/inserting/insert-div-019-expected.txt
        * layout-tests/editing/inserting/insert-div-021-expected.txt
        * layout-tests/editing/inserting/insert-div-022-expected.txt
        * layout-tests/editing/inserting/insert-div-023-expected.txt
        * layout-tests/editing/inserting/insert-div-024-expected.txt

2005-01-19  David Hyatt  <hyatt@apple.com>

	Dont null-check the renderer before submitting, since a script can set it to display:none and still expect the
	submission to occur.  Fixes bug #3477282.
	
        Reviewed by kdecker

        (DOM::HTMLInputElementImpl::defaultEventHandler):

2005-01-18  Richard Williamson   <rjw@apple.com>
	
	Fixed several issues all arising from analysis of plugin detection code at ifilm.com:

	Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
	Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
	Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
	Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in

	We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
	tags.  Also, if any of these elements are named they can be accessed from the document or window objects.
	Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.

        Reviewed by Chris.

        * khtml/dom/html_document.cpp:
        (HTMLDocument::objects):
        * khtml/dom/html_document.h:
        * khtml/ecma/kjs_dom.cpp:
        (DOMDocumentProtoFunc::tryCall):
        (DOMElementProtoFunc::tryCall):
        (KJS::getRuntimeObject):
        * khtml/ecma/kjs_dom.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):
        (KJS::HTMLElement::tryGet):
        (KJS::HTMLCollection::tryGet):
        (KJS::HTMLCollection::getNamedItems):
        * khtml/ecma/kjs_window.cpp:
        (Window::get):
        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::traverseNextItem):
        * khtml/html/html_miscimpl.h:
        (DOM::HTMLCollectionImpl::):
        * khtml/html/html_objectimpl.cpp:
        (HTMLAppletElementImpl::getAppletInstance):
        (HTMLObjectElementImpl::HTMLObjectElementImpl):
        (HTMLObjectElementImpl::getObjectInstance):
        * khtml/html/html_objectimpl.h:
        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::getObjectInstanceForView):

2005-01-18  David Hyatt  <hyatt@apple.com>

	Fix for 3948123, rolling over link erases nearby text.  The repaint rect check for lines was wrong whenever
	two lines overlapped.
	
        Reviewed by kocienda

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):

2005-01-18  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug:
        
        <rdar://problem/3960116> Focus rings paint incorrectly for contenteditable blocks in web pages

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::addFocusRingRects): Fix painting of focus rings so that ring only paints around
        outermost contenteditable elements.

2005-01-18  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3959668> accessibilityFocusedUIElement sometimes returns an ignored element; it must not

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityFocusedUIElement]):
        Return parentObjectUnignored if focused object is ignored.

2005-01-18  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3952877> REGRESSION (Mail): Command-left/right-arrows don't work with file attachment

        * khtml/editing/selection.cpp:
        (khtml::nodeForInlineBox): New helper function used in reimplementation of function below.
        (khtml::selectionForLine): Reimplemented using line box smarts. I originally wrote this code when
        I had a less than full understanding of line layout. I can do better now, and my new version no
        longer fails to notice attachments when doing the kind of navigation mentioned in the bug.

2005-01-17  David Harrison  <harrison@apple.com>

        Reviewed by John Sullivan.

        <rdar://problem/3949429> AX: word marker routines returns incorrect data for empty line
        <rdar://problem/3949848> AX: paragraph marker routines do not work when given a paragraph end marker

        Also fixed sentence support in the same way.
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextSentenceEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousSentenceStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextParagraphEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousParagraphStartTextMarkerForTextMarker:]):
        Move one position in desired direction before calling visible_units.cpp code.

2005-01-17  David Harrison  <harrison@apple.com>

        Updated expected test results.
        
        <rdar://problem/3945880> line-ending space seems not to be present

        * layout-tests/editing/deleting/delete-ws-fixup-001-expected.txt:
        * layout-tests/editing/deleting/delete-ws-fixup-002-expected.txt:
        * layout-tests/editing/inserting/insert-div-020-expected.txt:
        * layout-tests/editing/inserting/insert-div-021-expected.txt:
        * layout-tests/editing/inserting/insert-div-022-expected.txt:
        * layout-tests/editing/inserting/insert-div-023-expected.txt:
        * layout-tests/editing/inserting/insert-div-024-expected.txt:

2005-01-17  David Harrison  <harrison@apple.com>

        Reviewed by Dave Hyatt (bidi.cpp) and Darin Adler (selection.cpp).

        <rdar://problem/3945880> line-ending space seems not to be present

        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):
        Extend AFTER_WHITE_SPACE code to support white spac in the middle of paragraphs, not just the end.
        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::findNextLineBreak):
        Pick left/rightness of word selection based on being at the end of paragraph (i.e. after a hard line break).

2005-01-17  Darin Adler  <darin@apple.com>

        Reviewed by John Louch.

        - fixed <rdar://problem/3958503> need screenX and screenY to use WebKit windowFrame delegate

        * khtml/ecma/kjs_window.cpp: (Window::get): Change screenX and screenY to use frameGeometry instead
        of using mapToGlobal and screen in a complicated way.
        * kwq/KWQKHTMLView.mm: Removed unused mapToGlobal function.
        * kwq/KWQWindowWidget.h: Ditto.
        * kwq/KWQWindowWidget.mm: Ditto.

2005-01-17  David Hyatt  <hyatt@apple.com>

	Fix a screwup in rightmost/lowets position computation.  3955207.  Make sure floats with layers are still checked.

        Reviewed by kocienda
	
	* khtml/rendering/render_block.cpp

2005-01-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        <rdar://problem/3953366> Problems with typing attributes in HTML compose

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete): Remove misguided "optimization"
        that tried to sense when typing style could be cleared without actually doing a style diff between
        before-delete and after-delete positions. Removing this extra check and running the 
        general-purpose code fixes the bug.

2005-01-17  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)

	Keep track of originating execution context and target execution
	context for native JS object wrappers, and perform appropriate
	security checks.

        Reviewed by David Harrison.

        * khtml/ecma/kjs_binding.cpp:
        (ScriptInterpreter::isGlobalObject):
        (ScriptInterpreter::isSafeScript):
        (ScriptInterpreter::interpreterForGlobalObject):
        * khtml/ecma/kjs_binding.h:
        * khtml/ecma/kjs_window.cpp:
        (Window::interpreter):
        (Window::isSafeScript):
        * khtml/ecma/kjs_window.h:
        * kwq/DOMInternal.mm:
        (-[WebScriptObject _initializeScriptDOMNodeImp]):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::windowScriptObject):
        (KWQKHTMLPart::windowScriptNPObject):
        * kwq/WebCoreBridge.mm:
        (rootForView):
        (-[WebCoreBridge init]):

2005-01-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3786659> REGRESSION (Mail): editable WebViews don't work with 
        "size up" and "size down" NSFontManager changes

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue): Add support for parsing new font size delta property.
        * khtml/css/cssproperties.c: Generated file.
        * khtml/css/cssproperties.h: Ditto.
        * khtml/css/cssproperties.in: Add support for parsing new font size delta property.
        * khtml/editing/htmlediting.cpp:
        (khtml::isEmptyStyleSpan): New helper function. Code existed before, but now factored out for convenient use.
        (khtml::CompositeEditCommand::removeNodeAttribute): Does check on value to see it exists before creating
        and running command to do the removal.
        (khtml::ApplyStyleCommand::doApply): Now calls new applyRelativeFontStyleChange() function as part of its work.
        (khtml::ApplyStyleCommand::applyRelativeFontStyleChange): New function that does the "heavy lifting" to handle 
        relative font size changes.
        (khtml::ApplyStyleCommand::applyInlineStyle): Range check the start and end positions to make sure the start is
        before or equal to the end. Swap them if not true. I ran into this problem in some similar code in 
        applyRelativeFontStyleChange(). Moving that goodness here too.
        (khtml::ApplyStyleCommand::splitTextAtEndIfNeeded): Uses a local variable to save a value used often.
        Code is the same, but reads better now. Function now returns bool as well, just like splitTextAtStartIfNeeded.
        I use the bool return value now (I obviously did not need it before).
        (khtml::ApplyStyleCommand::computedFontSize): New helper function.
        (khtml::ApplyStyleCommand::joinChildTextNodes): Ditto.
        (khtml::createStyleSpanElement): Ditto.
        * khtml/editing/htmlediting.h: Update header accordingly.
        * khtml/editing/jsediting.cpp: Add new command string to enable relative font size changes.
        * kwq/DOM-CSS.mm:
        (-[DOMCSSStyleDeclaration _fontSizeDelta]): New convenience.
        (-[DOMCSSStyleDeclaration _setFontSizeDelta:]): Ditto.
        * kwq/DOMPrivate.h: Declare new conveniences.
        * layout-tests/editing/editing.js: Add new JS to enable relative font size changes, as well as explicit font size setting.
        * layout-tests/editing/style/relative-font-size-change-001-expected.txt: Added.
        * layout-tests/editing/style/relative-font-size-change-001.html: Added.
        * layout-tests/editing/style/relative-font-size-change-002-expected.txt: Added.
        * layout-tests/editing/style/relative-font-size-change-002.html: Added.
        * layout-tests/editing/style/relative-font-size-change-003-expected.txt: Added.
        * layout-tests/editing/style/relative-font-size-change-003.html: Added.
        * layout-tests/editing/style/relative-font-size-change-004-expected.txt: Added.
        * layout-tests/editing/style/relative-font-size-change-004.html: Added.

2005-01-14  Darin Adler  <darin@apple.com>

        * khtml/css/cssproperties.c: Regenerated with gperf 3.0.1.
        * khtml/css/cssvalues.c: Regenerated with gperf 3.0.1.
        * khtml/misc/htmlattrs.c: Regenerated with gperf 3.0.1.
        * khtml/misc/htmltags.c: Regenerated with gperf 3.0.1.

2005-01-14  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3886415> arrow keys don't work when the user hits Back to return to RSS page

        Reviewed by hyatt.

        (KWQKHTMLPart::openURLFromPageCache): restore mousePressNode
        (KWQKHTMLPart::mousePressNode): new
        * kwq/KWQPageState.h:
        * kwq/KWQPageState.mm:
        (-[KWQPageState initWithDocument:URL:windowProperties:locationProperties:interpreterBuiltins:]): save the mousePressNode
        (-[KWQPageState clear]): clear the mousePressNode
        (-[KWQPageState dealloc]): deref the mousePressNode
        (-[KWQPageState mousePressNode]): new

=== Safari-179 ===

2005-01-13  Vicki Murley <vicki@apple.com>

        Reviewed by Adele.

        - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005

        * WebCore.pbproj/project.pbxproj: bump "2004" to "2005"

2005-01-13  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.
        
        Better fix for 3905066.
        
        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply):

2005-01-10  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3758033> REGRESSION (Mail): Support attributes in marked text (International input)
        
        * khtml/rendering/render_text.cpp:
        (InlineTextBox::paint): Support painting custom underline markers for
	marked text in place of generic yellow.
        (InlineTextBox::paintMarkedTextUnderline): New method that handles this.
        * khtml/rendering/render_text.h:
        * kwq/KWQKHTMLPart.h: Declare new methods and structs.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::clear): Clear marked test underlines.
        (KWQKHTMLPart::setMarkedTextRange): Takes attributes and ranges now.
        (convertAttributesToUnderlines): Converts NSAttributedString attributes
	to simplified and C++-friendly form.
        (KWQKHTMLPart::markedTextUsesUnderlines): New method.
        (KWQKHTMLPart::markedTextUnderlines): New method.
        * kwq/KWQPainter.mm:
        (QPainter::drawLineForText): Handle pen width.
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setMarkedTextDOMRange:customAttributes:ranges:]): Take attributes
	and ranges.
        * kwq/WebCoreTextRenderer.h:

2005-01-12  David Harrison  <harrison@apple.com>

        Reviewed by Dave Hyatt.

        <rdar://problem/3888973> AX: Parent AXWebArea of nested AXWebAreas is messed up
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject addChildrenToArray:]):
        Use the widget's outer view.

2005-01-12  David Harrison  <harrison@apple.com>

        Reviewed by Darin Adler.

        <rdar://problem/3949908> Crash when asking for the kAXLengthForTextMarkerRangeParameterizedAttribute
        
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::displayNode):
        Add quotes around text node content.
        (NodeBaseImpl::childNode):
        Add nil check to return nil rather than crash when child node not found.
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject doAXStringForTextMarkerRange:]):
        Pass range compliant positions to TextIterator.

2005-01-12  David Hyatt  <hyatt@apple.com>

	Fix for 3951203, CSS border style incorrectly clipped on inline elements.  Make sure the repaint rect set during
	line layout is smarter about including the overflow for both old states and new states.
	
        Reviewed by john

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::layoutInlineChildren):

2005-01-12  David Hyatt  <hyatt@apple.com>

	Fix for bug 3937608, versiontracker.com flashes and displays the right column below content.  Make sure to move
	tables/overflows that dont fit within a block only in strict mode.

	Fix for bug 3931049, characters dont show up when typing.  Make sure to dirty the right lines when this specific
	case in editing is hit.
	
        Reviewed by darin (first one), kocienda (second one)

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::getClearDelta):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::dirtyLinesFromChangedChild):
        * khtml/rendering/render_line.cpp:
        (khtml::InlineFlowBox::verticallyAlignBoxes):

2005-01-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3926142> REGRESSION (Mail): Deleting text decreases quote level

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): Change test that will prevent block
        merging. End-of-line test was just wrong. Call new start-of and end-of paragraph functions
        added to visible_position files.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Add tests for BR elements, which makes
        tests to determine when to stop moving nodes more complete and correct. Also improved comments.
        * khtml/editing/visible_position.cpp:
        (khtml::isFirstVisiblePositionInParagraph): New function.
        (khtml::isLastVisiblePositionInParagraph): New function.
        * khtml/editing/visible_position.h: Update header accordingly.
        * layout-tests/editing/deleting/delete-block-merge-contents-002-expected.txt: New results, slightly different from former
        results but still correct.
        * layout-tests/editing/deleting/delete-block-merge-contents-007-expected.txt: Ditto.
        * layout-tests/editing/deleting/delete-block-merge-contents-018-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-018.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-019-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-019.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-020-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-020.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-021-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-021.html: Added.
        * layout-tests/editing/deleting/delete-line-014-expected.txt: These new results are actually better, and fix a bug.

2005-01-11  Richard Williamson   <rjw@apple.com>

	Fixed 3922875.  Fall back to DOM object is EMBED element
	has no associated runtime object.

        Reviewed by Chris.

        * khtml/ecma/kjs_dom.cpp:
        (KJS::getRuntimeObject):
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):
        (KJS::HTMLElement::tryGet):
        (KJS::HTMLCollection::tryGet):
        (KJS::HTMLCollection::getNamedItems):

2005-01-11  David Hyatt  <hyatt@apple.com>

        Fix for 3882299, missing content on gibson.com.  Change our handling of " and ' in certain states of the parser to match
	other browsers.
	
        Reviewed by Maciej

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::parseTag):

2005-01-11  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3930733> Mail prints second page of email blank

        Reviewed by dave.

        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::paint): cache the print rect since the dirty rect can get changed during printing
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines): removed null check since the print rect should never be null
        * khtml/rendering/render_list.cpp:
        (RenderListMarker::paint): ditto
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::adjustPageHeight): don't set the print rect here since this method is not called for the last page

2005-01-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3943648> extra line is inserted after pressing return within quoted text of reply

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): This bug was the result of a 
        simple coding mistake. A local variable was erroneously redefined in a deeper scope, and so the 
        result calculated in that deeper scope was not available when tested.

2005-01-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3946852> Option-e goes to next line

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Tweak case used to determine when merging content
        into the start line is done. We plan to change pretty substantially soon to better handle
        the problem described in <rdar://problem/3937352> Quote level not maintained when copied 
        and pasted within a Mail message. In the meantime, this change does no harm, and fixes the bug.

2005-01-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3907005> Applying block styles to a line of text can unexpectedly affect other lines

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): New function which moves "paragraphs"
        to their own blocks if needed so that a block style can be applied.
        (khtml::CompositeEditCommand::isMailBlockquote): Moved this function to base class so it can be used more generally.
        (khtml::ApplyStyleCommand::applyBlockStyle): Pass a node instead of a block to addBlockStyleIfNeeded().
        (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): Now accepts a node instead of a block for styling.
        This function also now calls moveParagraphContentsToNewBlockIfNecessary() to make sure that only the current
        paragraph is styled.
        (khtml::SetNodeAttributeCommand::doUnapply): Should not assert on undo if old value of attribute was null.
        Should remove attributue instead.
        * khtml/editing/htmlediting.h: Touch function declarations accordingly.
        * layout-tests/editing/style/create-block-for-style-001-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-001.html: Added.
        * layout-tests/editing/style/create-block-for-style-002-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-002.html: Added.
        * layout-tests/editing/style/create-block-for-style-003-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-003.html: Added.
        * layout-tests/editing/style/create-block-for-style-004-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-004.html: Added.
        * layout-tests/editing/style/create-block-for-style-005-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-005.html: Added.
        * layout-tests/editing/style/create-block-for-style-006-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-006.html: Added.
        * layout-tests/editing/style/create-block-for-style-007-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-007.html: Added.
        * layout-tests/editing/style/create-block-for-style-008-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-008.html: Added.
        * layout-tests/editing/style/create-block-for-style-009-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-009.html: Added.
        * layout-tests/editing/style/create-block-for-style-010-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-010.html: Added.
        * layout-tests/editing/style/create-block-for-style-011-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-011.html: Added.
        * layout-tests/editing/style/create-block-for-style-012-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-012.html: Added.
        * layout-tests/editing/style/create-block-for-style-013-expected.txt: Added.
        * layout-tests/editing/style/create-block-for-style-013.html: Added.

        Unrelated updates to these expected results.
        * layout-tests/editing/inserting/insert-div-007-expected.txt
        * layout-tests/editing/pasteboard/paste-text-013-expected.txt

2005-01-10  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3936844> Mail: Messages with rich text do not print

        Reviewed by john.

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines): don't do pagination work if printRect is not set
        * khtml/rendering/render_list.cpp:
        (RenderListMarker::paint): ditto

2005-01-10  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        * kwq/KWQTextUtilities.mm:
        (currentTextBreakLocaleID):
        Return empty string (AKA root locale) if locale pref can not be canonicalized.

2005-01-10  John Sullivan  <sullivan@apple.com>

        Fixed broken Panther build.

        * kwq/KWQTextUtilities.mm:
        (currentTextBreakLocaleID):
        This recently-added function was using code copy/pasted from CarbonCore UnicodeUtilities.
        That code used a Tiger-only function, CFLocaleCreateCanonicalLanguageIdentifierFromString.
        To fix the build, I added a BUILDING_ON_PANTHER #ifdef that avoids the call to the Tiger
        function. However, the Tiger-only code was wrong; the string generated using 
        CFLocaleCreateCanonicalLanguageIdentifierFromString was not used at all, so I fixed that
        as well.

2005-01-09  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

        <rdar://problem/3786362> REGRESSION (Mail): pasted text loses one newline
        
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply):
        Tune check for need for insertParagraphSeparator when hasInterchangeNewline.

2005-01-09  Darin Adler  <darin@apple.com>

        Reviewed by Harrison.

        - fixed <rdar://problem/3939176> select() method does not work on <input type=search>

        * khtml/html/html_formimpl.cpp: (DOM::HTMLInputElementImpl::select): Changed if statement
        to a switch statement. Added SEARCH to the set of types that treat the renderer as a
        RenderLineEdit.

2005-01-09  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

        <rdar://problem/3905066> REGRESSION (Mail): Hitting return key with caret in front of space causes space to become lost (resize fixes)

        Problem was that InsertParagraphSeparatorCommand::doApply() was not collapsing
        whitespace to a single non-breaking space when splitting a text node.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply):

2005-01-08  Kevin Decker  <kdecker@apple.com>

        Reviewed by Ken.

	Fixed: <rdar://problem/3924219> Calling setOuterHTML: on a DOMHTMLHtmlElement can crash a program

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::setOuterHTML): Added a nil check for fragments who don't have parents.

2005-01-07  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.
	
	<rdar://problem/3807144> REGRESSION (125-TOT): my bank's website doesn't work (Societe Generale, socgen.com)

        * Khtml/khtml_part.cpp:
        (KHTMLPart::checkCompleted): If the document is NULL, assume this frame has
	not started loading yet so it could not possibly be finishing here...
        (KHTMLPart::stop): ...unless the part is explicitly stopped and there is still
	no document, in this case we must have hit an error or been loading a non-HTML
	frame.
        * khtml/khtml_part.h:

2005-01-08  David Harrison  <harrison@apple.com>

        Reviewed by Maciej.

        <rdar://problem/3943415> REGRESSION (Mail): double-clicking past word selects previous word instead of only blank space
        
        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):
        Tune word selections left/right choice to use right if on empty last line.

2005-01-07  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

        <rdar://problem/3942619> AX: Support sentence ax attributes

        Needed to use the unicode utilities properly.  Twas lame before.

        * khtml/editing/visible_units.cpp:
        (khtml::previousBoundary):
        (khtml::nextBoundary):
        (khtml::startOfWord):
        (khtml::endOfWord):
        (khtml::previousWordPosition):
        (khtml::nextWordPosition):
        (khtml::startOfSentence):
        (khtml::endOfSentence):
        (khtml::previousSentencePosition):
        (khtml::nextSentencePosition):
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityAttributeNames]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject doAXAttributedStringForTextMarkerRange:]):
        * kwq/KWQTextUtilities.mm:
        (currentTextBreakLocaleID):
        (KWQFindSentenceBoundary):
        (KWQFindNextSentenceFromIndex):

2005-01-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Kevin

        Fix for these bugs:
        
        <rdar://problem/3939523> in some cases, text does not retain style info after pressing return twice
        <rdar://problem/3944492> after pressing return twice, text is bold when it shouldn't be

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::setFullTypingStyleBeforeInsertion):
        Merge the typing style with the computed style for the current position. Fixes both bugs.
        * khtml/editing/htmlediting.h:
        * layout-tests/editing/inserting/insert-div-023-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-023.html: Added.
        * layout-tests/editing/inserting/insert-div-024-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-024.html: Added.

2005-01-07  David Hyatt  <hyatt@apple.com>

	Fix for 3941364, make sure tables reset overflowWidth/Height when they lay out again.  Fixes the odd scrolling
	behavior on worldofwarcraft.com.
	
        Reviewed by kevin

        * khtml/rendering/render_table.cpp:
        (RenderTable::layout):

2005-01-06  David Hyatt  <hyatt@apple.com>

	Fix for 3932418 and 3920998, assertion failures caused by stray inline content inside tables.  Bulletproof the hit testing to
	ignore inline flows in this case.
	
        Reviewed by kevin

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::nodeAtPoint):

2005-01-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3848412> for forwarded message, tabbing to message view scrolls to bottom of view

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::nextKeyViewInFrame): Don't scroll the focus node to visible if it is not
        in the document, or if it is not a descendent of the document element. In the case of the bug,
        since the selection has not yet been set up, the focus node passed here is the HTML element, and
        that does not yield a rect that is useful to us here. So now, in the case the bug mentions, we do nothing.

2005-01-06  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs.

	Fixed: <rdar://problem/3932215> REGRESSION (125-177): iFrame example at developer.apple.com fails in Safari

        * khtml/khtml_part.cpp:
        (KHTMLPart::processObjectRequest): m_bComplete was never true for frames generated by Javascript due to our synchronous loading and as a result, scheduled redirects wouldn't fire in KHTMLPart::scheduleLocationChange().  By virtue of being an empty document, a document is complete.  In this special case it's safe at this point to call checkCompleted() which sets m_bComplete true. 

=== Safari-178 ===

2005-01-06  David Harrison  <harrison@apple.com>

        Reviewed by Chris.

        (addendum to previous checkin for this bug) 
        <rdar://problem/3776056> AX: Editable HTML should not be viewed as AXStaticText

        Fix line navigation.  Add AXUIElementForTextMarker.

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject doAXUIElementForTextMarker:]):
        (-[KWQAccObject doAXLineForTextMarker:]):
        (-[KWQAccObject doAXTextMarkerRangeForLine:]):
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousLineStartTextMarkerForTextMarker:]):
        (-[KWQAccObject accessibilityAttributeValue:forParameter:]):

2005-01-06  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - re-fixed <rdar://problem/3760910> Request to include support for custom tag names in HTML (they already work in XML)

        (turns out the PLT regression was a false alarm)

        * khtml/html/htmlparser.h: Change forbidden tag array to be allocated in the object rather than on
        the heap. Also use ID_LAST_TAG for the array size; the old code used ID_CLOSE_TAG which is now a
        much larger number.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Remove code that creates the forbidden tag array on the heap; makes more
        sense to just have the array be a member so we don't have to use new and delete on it. Also needed
        to eliminate code that used ID_CLOSE_TAG for an array size.
        (KHTMLParser::~KHTMLParser): Remove code that deletes the forbidden tag array. Also changed the code
        that manages isindex to use deref instead of delete.
        (KHTMLParser::reset): Use safer sizeof for clearing the forbidden tag array. Old code had the
        mistake of using ID_CLOSE_TAG for the array size too.
        (KHTMLParser::parseToken): Removed code that checks for bogus tags; it's not clear why it was ever
        there and it would prevent custom tags from working. Added range check before using the forbidden
        tag array with the token ID since custom tags will use index values past the end of the array.
        (KHTMLParser::getElement): Removed most of the code that makes an element by ID; now the work is done
        inside the DocumentImpl createHTMLElement. Any code that needs to be different than a dynamic
        createElement call is still here. Last time I left out a few form element types from this switch;
        fixed now.
        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::parseTag): Call the tagId function in the
        document if getTagID fails; this creates a unique per-document ID.

        * khtml/misc/htmltags.c: Regenerated.
        * khtml/misc/htmltags.h: Regenerated.

        * khtml/misc/maketags: Changed the generated constants to use "const unsigned short" instead of "#define".
        Changed ID_CLOSE_TAG to be a fixed value of 32000 rather than being just past the IDs of the HTML tags.
        Also rewrote getTagName to work with the new scheme.

2005-01-06  David Harrison  <harrison@apple.com>
        
        Fixed Panther build.  Also, do not advertize sentence support since it is incomplete.
        
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject visiblePositionForEndOfTextMarkerRange:]):
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject accessibilityIsAttributeSettable:]):

2005-01-06  David Harrison  <harrison@apple.com>

        Reviewed by Dave Hyatt.

        <rdar://problem/3776056> AX: Editable HTML should not be viewed as AXStaticText
        <rdar://problem/3588548> AX: tabbing does not work correctly with the screen reader and a focused link; need AXFocusedUIElement to work
        
        Many more AX attributes supported.  Numerous fixes to previous AX work.
        
        * khtml/editing/visible_units.cpp:
        (khtml::startSentenceBoundary):
        (khtml::startOfSentence):
        (khtml::endSentenceBoundary):
        (khtml::endOfSentence):
        (khtml::previousSentencePositionBoundary):
        (khtml::previousSentencePosition):
        (khtml::nextSentencePositionBoundary):
        (khtml::nextSentencePosition):
        * khtml/editing/visible_units.h:
        * khtml/khtmlview.cpp:
        (KHTMLView::layout):
        * khtml/misc/helper.cpp:
        (khtml::findSentenceBoundary):
        (khtml::nextSentenceFromIndex):
        * khtml/misc/helper.h:
        * khtml/misc/htmltags.c:
        (hash_tag):
        (findTag):
        * khtml/rendering/render_container.cpp:
        (RenderContainer::removeChildNode):
        (RenderContainer::appendChildNode):
        (RenderContainer::insertChildNode):
        * khtml/rendering/render_object.cpp:
        (RenderObject::remove):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::getAccObjectCache):
        (DocumentImpl::updateSelection):
        (DocumentImpl::close):
        (DocumentImpl::setFocusNode):
        (DocumentImpl::parentDocument):
        (DocumentImpl::topDocument):
        * khtml/xml/dom_docimpl.h:
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityShouldUseUniqueId]):
        (-[KWQAccObject detach]):
        (-[KWQAccObject anchorElement]):
        (-[KWQAccObject firstChild]):
        (-[KWQAccObject lastChild]):
        (-[KWQAccObject previousSibling]):
        (-[KWQAccObject nextSibling]):
        (-[KWQAccObject parentObject]):
        (-[KWQAccObject value]):
        (-[KWQAccObject accessibilityAttributeNames]):
        (-[KWQAccObject accessibilityPerformAction:]):
        (-[KWQAccObject textMarkerForVisiblePosition:]):
        (-[KWQAccObject visiblePositionForTextMarker:]):
        (-[KWQAccObject textMarkerRangeFromVisiblePositions:andEndPos:]):
        (-[KWQAccObject topDocument]):
        (-[KWQAccObject topRenderer]):
        (-[KWQAccObject topView]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject doAXLineForTextMarker:]):
        (-[KWQAccObject doAXTextMarkerRangeForLine:]):
        (-[KWQAccObject doAXStringForTextMarkerRange:]):
        (-[KWQAccObject doAXTextMarkerForPosition:]):
        (-[KWQAccObject doAXBoundsForTextMarkerRange:]):
        (-[KWQAccObject doAXAttributedStringForTextMarkerRange:]):
        (-[KWQAccObject doAXTextMarkerRangeForUnorderedTextMarkers:]):
        (-[KWQAccObject doAXNextTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXLeftWordTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightWordTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXLeftLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXSentenceTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXParagraphTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXNextWordEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousWordStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextLineEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousLineStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextSentenceEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousSentenceStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXNextParagraphEndTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousParagraphStartTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXLengthForTextMarkerRange:]):
        (-[KWQAccObject accessibilityAttributeValue:forParameter:]):
        (-[KWQAccObject accessibilityHitTest:]):
        (-[KWQAccObject accessibilityFocusedUIElement]):
        (-[KWQAccObject accessibilityIsAttributeSettable:]):
        (-[KWQAccObject doSetAXSelectedTextMarkerRange:]):
        (-[KWQAccObject setAccObjectID:]):
        (-[KWQAccObject removeAccObjectID]):
        * kwq/KWQAccObjectCache.h:
        * kwq/KWQAccObjectCache.mm:
        (KWQAccObjectCache::setAccObject):
        (KWQAccObjectCache::removeAccObject):
        (KWQAccObjectCache::visiblePositionForTextMarker):
        (KWQAccObjectCache::postNotificationToTopWebArea):
        (KWQAccObjectCache::postNotification):
        (KWQAccObjectCache::handleFocusedUIElementChanged):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::respondToChangedContents):
        * kwq/KWQTextUtilities.h:
        * kwq/KWQTextUtilities.mm:
        (KWQFindNextWordFromIndex):
        (KWQFindSentenceBoundary):
        (KWQFindNextSentenceFromIndex):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge accessibilityTree]):

2005-01-05  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - re-landing a subset of my custom tag change that does not fix the bug, but also does
          not introduce a performance regression

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector): Changed
        some code that used ID_LAST_TAG in a slightly wrong, but harmless, way.

        * khtml/editing/htmlediting.cpp:
        (khtml::debugPosition): Use nodeName rather than getTagName, since the latter works for
        per-document tags and is just better all around for things like the document.
        (khtml::debugNode): Ditto.
        * khtml/editing/selection.cpp: (khtml::Selection::debugPosition): Ditto.
        * khtml/editing/visible_position.cpp: (khtml::VisiblePosition::debugPosition): Ditto.
        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::displayNode): Ditto.
        * khtml/xml/dom_position.cpp: (DOM::Position::debugPosition): Ditto.

        * khtml/html/dtd.cpp: (DOM::checkChild): Use ID_LAST_TAG rather than 1000 for the check that allows
        non-HTML elements to be nested as desired.

        * khtml/misc/htmlhashes.h: Changed return types to unsigned short.
        * khtml/misc/htmlhashes.cpp:
        (khtml::getTagID): Changed return type to unsigned short.
        (khtml::getAttrID): Ditto.

        * khtml/xml/dom_docimpl.h: Added overload of createHTMLElement, made it non-virtual since it's not overriden.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLElement): Refactored into two separate functions, one that takes the tag ID.
        Also updated for a few tags that the parser handled but this did not.

        * kwq/KWQRenderTreeDebug.cpp:
        (getTagName): Added. Works for custom nodes, because it calls nodeName rather than using getTagName on
        the tag ID directly, which only works for standard nodes.
        (operator<<): Update to call getTagName.
        (nodePositionRelativeToRoot): Ditto.
        (writeSelection): Ditto.

2005-01-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3941203> REGRESSION (Mail): Paste inserts content in wrong place

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Some cleanup and refinement of the concepts used to make
        this operation work correctly, particularly in the logic to figure out whether to merge content, and
        also performing merges.
        * khtml/editing/visible_position.cpp:
        (khtml::isFirstVisiblePositionInBlock): Simplification of test used to make this determination.
        * khtml/editing/visible_units.cpp:
        (khtml::isStartOfParagraph): New helper, used in khtml::ReplaceSelectionCommand::doApply().
        (khtml::isEndOfParagraph): Ditto.
        * khtml/editing/visible_units.h: Declare new functions.

2005-01-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3926522> Pressing return in a quoted block inserts too many newlines

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Call to insertBlockPlaceholderIfNeeded()
        for the block we are adding was being done at the wrong time, which led to the placeholder remaining
        in the document when it was not needed. This resulted in the extra space reported in the bug.

2005-01-04  Kevin Decker  <kdecker@apple.com>

        Reviewed by Hyatt.

	Fixed: <rdar://problem/3936879> nil-deref, crash in InlineFlowBox::nodeAtPoint closing DHTML menus at hrweb.apple.com

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::fillInlineSelectionGaps): Added a nil check. If there is no selection, don't try to get the selection's containing block. If we do, we'll crash. 

2005-01-04  David Hyatt  <hyatt@apple.com>

	Fix for 3937203, force an update of the dashboard regions when scrollbars are added/removed.
	
        Reviewed by kevin

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateScrollInfoAfterLayout):

2005-01-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these two bugs:
        
        <rdar://problem/3938935> REGRESSION (Mail): Pasting into an empty document mangles content
        <rdar://problem/3939148> REGRESSION (Mail): Pasting mistakenly reverses lines

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): For 3938935, add one more case to handle an empty document; merge
        neither start nor end. For 3939148, improve the code which adjusts the insertion point during 
        the process of pasting. It formerly handled only one of the possible cases.
        * layout-tests/editing/pasteboard/paste-text-015-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-015.html: Added.

2005-01-04  David Hyatt  <hyatt@apple.com>

	Fix for 3936571, placeholder attribute should work for normal inputs for Dashboard.
	
        Reviewed by john

        * khtml/rendering/render_form.cpp:
        (RenderLineEdit::updateFromElement):
        * kwq/KWQLineEdit.mm:
        (QLineEdit::setPlaceholderString):

2005-01-04  David Hyatt  <hyatt@apple.com>

	Fix for 3830936, hang on changeforamerica.com.  Make sure to ignore the style not yet available option when
	returning pseudo-styles.
	
        Reviewed by john

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::matchRulesForList):
        (khtml::CSSStyleSelector::pseudoStyleForElement):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::addPseudoStyle):

2005-01-04  Darin Adler  <darin@apple.com>

        - rolled out my custom tag name change again -- it caused a 1 ms PLT regression

        * khtml/css/cssstyleselector.cpp:
        * khtml/editing/htmlediting.cpp:
        * khtml/editing/selection.cpp:
        * khtml/editing/visible_position.cpp:
        * khtml/html/dtd.cpp:
        * khtml/html/htmlparser.cpp:
        * khtml/html/htmlparser.h:
        * khtml/html/htmltokenizer.cpp:
        * khtml/misc/htmlhashes.cpp:
        * khtml/misc/htmlhashes.h:
        * khtml/misc/htmltags.c:
        * khtml/misc/htmltags.h:
        * khtml/misc/maketags:
        * khtml/xml/dom_docimpl.cpp:
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        * khtml/xml/dom_position.cpp:
        * kwq/KWQRenderTreeDebug.cpp:

2005-01-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3927554> Style info applied to remainder of document after a newline is entered

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Clean up and simplification in code that inserts
        a paragraph separator. The bug was all about applying styles to the new paragraph that did not need
        to be applied. Now the code will detect when at the end of a style run and will not move and apply 
        that ending style to the new paragraph, though it will place that style into the typing style. This
        seems to match NSText behavior.
        * layout-tests/editing/inserting/insert-div-021-expected.txt: This test result exhibited the bug fixed 
        here. The only reason it was not noticed is that the erroneously copied inline was a span, and so did
        not have any visible effect on the document.
        * layout-tests/editing/inserting/insert-div-022-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-022.html: Added.

2005-01-04  David Hyatt  <hyatt@apple.com>

	Fix for 3904562, make sure to clear the outline dictionary when drawing so that random focus rings dont get drawn
	all over the place.
	
        Reviewed by john

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):

2005-01-03  David Hyatt  <hyatt@apple.com>

	Fix for float painting regressions 3932524, 3931664, and 3933068.  Make the noPaint flag setting more
	robust and make it work regardless of which objects get a layout or not.
	
        Reviewed by mjs

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::insertFloatingObject):
        (khtml::RenderBlock::addOverhangingFloats):
        (khtml::RenderBlock::addIntrudingFloats):
        * khtml/rendering/render_block.h:
        (khtml::RenderBlock::FloatingObject::FloatingObject):

2005-01-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/3935390> Tiger 8A341: nil deref crash in DOM::NodeImpl::traverseNextNode
        
	* khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::traverseNextItem): Assert that the starting point is not nil,
	it should not ever be (now).
        (HTMLCollectionImpl::item): When traversing items stop when we hit
	nil, meaning the end to avoid triggering above assert (formerly crash).

2005-01-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John and Kevin.

	<rdar://problem/3870317> REGRESSION(125.9-125.11) broken behavior at test.profoundlearning.com - used to
        
	* khtml/ecma/kjs_window.cpp:
        (Window::get): Look up frame names before buitin window properties
	to match other browsers. This regressed because we added a builtin
	"toolbar" property but this site had a frame with that name.

2004-12-21  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3888931> frame naming allows malicious site to bring up a window when you click on a link in another
        
	Added opener bridge method to help WebKit implement security check
	for named frame visibility.
	
	* khtml/khtml_part.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge opener]):

2005-01-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3933926> Tiger8A341: Mail crashes while forwarding embedded HTML message in -[WebCoreBridge ensureSelectionVisible]

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge ensureSelectionVisible]): Put in some null checks to prevent crash experienced in bug.

2005-01-03  David Hyatt  <hyatt@apple.com>

	Fix for 3936881, make sure positioned objects prooperly update y-position.
	
        Reviewed by john

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::layoutPositionedObjects):

2005-01-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison
        
        Fix for this bug:
        
        <rdar://problem/3928250> REGRESSION (Mail): Typing style lost after hitting return key

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertLineBreakCommand::preservesTypingStyle): Now implemented, returning yes for this command.
        (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): Initialize new typing style member variable.
        (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): Deref new typing style member variable.
        (khtml::InsertParagraphSeparatorCommand::preservesTypingStyle): Now implemented, returning yes for this command.
        (khtml::InsertParagraphSeparatorCommand::setFullTypingStyleBeforeInsertion): New function to set the typing style
        (khtml::InsertParagraphSeparatorCommand::calculateAndSetTypingStyleAfterInsertion): Function called after the <p>
        insertion is done. This function diffs the style created in setFullTypingStyleBeforeInsertion() with the style
        of the new <p> and only sets those styles needed to preserve the style in effect before the insertion.
        (khtml::InsertParagraphSeparatorCommand::doApply): Call new functions.
        (khtml::TypingCommand::preservesTypingStyle): Now yes for inserting line breaks and paragraphs.
         * khtml/editing/htmlediting.h: Declare new functions.

2004-12-25  Kevin Decker  <kdecker@apple.com>

        Reviewed by Hyatt.

	Fixed: <rdar://problem/3505072> hang in KHTMLParser::parseToken (consulting.soroos.net)
	
        * khtml/html/dtd.cpp: <label> needed a much higher priority such that it will close block elements.  Malformed HTML (ugh) is the only reason why we need to do this. 

2004-12-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - re-fixed <rdar://problem/3760910> Request to include support for custom tag names in HTML (they already work in XML)

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector): Changed
        some code that used ID_LAST_TAG in a slightly wrong, but harmless, way.

        * khtml/editing/htmlediting.cpp:
        (khtml::debugPosition): Use nodeName rather than getTagName, since the latter works for
        per-document tags and is just better all around for things like the document.
        (khtml::debugNode): Ditto.
        * khtml/editing/selection.cpp: (khtml::Selection::debugPosition): Ditto.
        * khtml/editing/visible_position.cpp: (khtml::VisiblePosition::debugPosition): Ditto.
        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::displayNode): Ditto.
        * khtml/xml/dom_position.cpp: (DOM::Position::debugPosition): Ditto.

        * khtml/html/dtd.cpp: (DOM::checkChild): Use ID_LAST_TAG rather than 1000 for the check that allows
        non-HTML elements to be nested as desired.

        * khtml/html/htmlparser.h: Change forbidden tag array to be allocated in the object rather than on
        the heap. Also use ID_LAST_TAG for the array size; the old code used ID_CLOSE_TAG which is now a
        much larger number.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Remove code that creates the forbidden tag array on the heap; makes more
        sense to just have the array be a member so we don't have to use new and delete on it. Also needed
        to eliminate code that used ID_CLOSE_TAG for an array size.
        (KHTMLParser::~KHTMLParser): Remove code that deletes the forbidden tag array. Also changed the code
        that manages isindex to use deref instead of delete.
        (KHTMLParser::reset): Use safer sizeof for clearing the forbidden tag array. Old code had the
        mistake of using ID_CLOSE_TAG for the array size too.
        (KHTMLParser::parseToken): Removed code that checks for bogus tags; it's not clear why it was ever
        there and it would prevent custom tags from working. Added range check before using the forbidden
        tag array with the token ID since custom tags will use index values past the end of the array.
        (KHTMLParser::getElement): Removed most of the code that makes an element by ID; now the work is done
        inside the DocumentImpl createHTMLElement. Any code that needs to be different than a dynamic
        createElement call is still here. Last time I left out a few form element types from this switch;
        fixed now.
        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::parseTag): Call the tagId function in the
        document if getTagID fails; this creates a unique per-document ID.

        * khtml/misc/htmlhashes.h: Changed return types to unsigned short.
        * khtml/misc/htmlhashes.cpp:
        (khtml::getTagID): Changed return type to unsigned short.
        (khtml::getAttrID): Ditto.

        * khtml/misc/htmltags.c: Regenerated.
        * khtml/misc/htmltags.h: Regenerated.

        * khtml/misc/maketags: Changed the generated constants to use "const unsigned short" instead of "#define".
        Changed ID_CLOSE_TAG to be a fixed value of 32000 rather than being just past the IDs of the HTML tags.
        Also rewrote getTagName to work with the new scheme.

        * khtml/xml/dom_docimpl.h: Added overload of createHTMLElement, made it non-virtual since it's not overriden.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLElement): Refactored into two separate functions, one that takes the tag ID.
        Also updated for a few tags that the parser handled but this did not.

        * kwq/KWQRenderTreeDebug.cpp:
        (getTagName): Added. Works for custom nodes, because it calls nodeName rather than using getTagName on
        the tag ID directly, which only works for standard nodes.
        (operator<<): Update to call getTagName.
        (nodePositionRelativeToRoot): Ditto.
        (writeSelection): Ditto.

=== Safari-177 ===

2004-12-22  Darin Adler  <darin@apple.com>

        - rolled out my custom tag name change -- it broke amazon.com

        * khtml/css/cssstyleselector.cpp:
        * khtml/editing/htmlediting.cpp:
        * khtml/editing/selection.cpp:
        * khtml/editing/visible_position.cpp:
        * khtml/html/dtd.cpp:
        * khtml/html/htmlparser.cpp:
        * khtml/html/htmlparser.h:
        * khtml/html/htmltokenizer.cpp:
        * khtml/misc/htmlhashes.cpp:
        * khtml/misc/htmlhashes.h:
        * khtml/misc/htmltags.c:
        * khtml/misc/htmltags.h:
        * khtml/misc/maketags:
        * khtml/xml/dom_docimpl.cpp:
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        * khtml/xml/dom_position.cpp:
        * kwq/KWQRenderTreeDebug.cpp:

2004-12-22  David Harrison  <harrison@apple.com>

        Reviewed by Darin Adler.

        * khtml/editing/selection.cpp:
        (khtml::Selection::validate):
        The selecting/deselecting bad behavior is because the Selection code that expands by words
        had an inaccurate test for being at the end of the document (where double-clicking needs
        to select the last word).  Fixed that check.

2004-12-22  Adele Amchan  <adele@apple.com>

        Reviewed by Chris.

        Fix for <rdar://problem/3911650> tabs at safeway.com stop working after a while

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::scrollToAnchor): removed call to cancelRedirection 
          so that we match Firefox and WinIE behavior.

2004-12-22  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3760910> Request to include support for custom tag names in HTML (they already work in XML)

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector): Changed
        some code that used ID_LAST_TAG in a slightly wrong, but harmless, way.

        * khtml/editing/htmlediting.cpp:
        (khtml::debugPosition): Use nodeName rather than getTagName, since the latter works for
        per-document tags and is just better all around for things like the document.
        (khtml::debugNode): Ditto.
        * khtml/editing/selection.cpp: (khtml::Selection::debugPosition): Ditto.
        * khtml/editing/visible_position.cpp: (khtml::VisiblePosition::debugPosition): Ditto.
        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::displayNode): Ditto.
        * khtml/xml/dom_position.cpp: (DOM::Position::debugPosition): Ditto.

        * khtml/html/dtd.cpp: (DOM::checkChild): Use ID_LAST_TAG rather than 1000 for the check that allows
        non-HTML elements to be nested as desired.

        * khtml/html/htmlparser.h: Change forbidden tag array to be allocated in the object rather than on
        the heap. Also use ID_LAST_TAG for the array size; the old code used ID_CLOSE_TAG which is now a
        much larger number.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Remove code that creates the forbidden tag array on the heap; makes more
        sense to just have the array be a member so we don't have to use new and delete on it. Also needed
        to eliminate code that used ID_CLOSE_TAG for an array size.
        (KHTMLParser::~KHTMLParser): Remove code that deletes the forbidden tag array. Also changed the code
        that manages isindex to use deref instead of delete.
        (KHTMLParser::reset): Use safer sizeof for clearing the forbidden tag array. Old code had the
        mistake of using ID_CLOSE_TAG for the array size too.
        (KHTMLParser::parseToken): Removed code that checks for bogus tags; it's not clear why it was ever
        there and it would prevent custom tags from working. Added range check before using the forbidden
        tag array with the token ID since custom tags will use index values past the end of the array.
        (KHTMLParser::getElement): Removed most of the code that makes an element by ID; now the work is done
        inside the DocumentImpl createHTMLElement. Any code that needs to be different than a dynamic
        createElement call is still here.
        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::parseTag): Call the tagId function in the
        document if getTagID fails; this creates a unique per-document ID.

        * khtml/misc/htmlhashes.h: Changed return types to unsigned short.
        * khtml/misc/htmlhashes.cpp:
        (khtml::getTagID): Changed return type to unsigned short.
        (khtml::getAttrID): Ditto.

        * khtml/misc/htmltags.c: Regenerated.
        * khtml/misc/htmltags.h: Regenerated.

        * khtml/misc/maketags: Changed the generated constants to use "const unsigned short" instead of "#define".
        Changed ID_CLOSE_TAG to be a fixed value of 32000 rather than being just past the IDs of the HTML tags.
        Also rewrote getTagName to work with the new scheme.

        * khtml/xml/dom_docimpl.h: Added overload of createHTMLElement, made it non-virtual since it's not overriden.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLElement): Refactored into two separate functions, one that takes the tag ID.
        Also updated for a few tags that the parser handled but this did not.

        * kwq/KWQRenderTreeDebug.cpp:
        (getTagName): Added. Works for custom nodes, because it calls nodeName rather than using getTagName on
        the tag ID directly, which only works for standard nodes.
        (operator<<): Update to call getTagName.
        (nodePositionRelativeToRoot): Ditto.
        (writeSelection): Ditto.

2004-12-21  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

        <rdar://problem/3924934> REGRESSION: double click at end of line selects start of next line

        Problem was the TextIterator was not handling exitNode() from a P block properly.
        
        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::TextIterator):
        Add new param that specifies whether the iterator is for content or for searching.
        Search iterators do not prevent newlines at the beginning.
        (khtml::TextIterator::advance):
        Added some comments.
        (khtml::TextIterator::handleTextNode):
        Added some comments.
        (khtml::TextIterator::exitNode):
        Emit newline for P (and other) blocks with position following the block, instead of the m_lastTextNode.
        (khtml::TextIterator::emitCharacter):
        Added some comments.
        (khtml::TextIterator::range):
        Added some comments.
        (khtml::CharacterIterator::CharacterIterator):
        Specify search type TextIterator.
        (khtml::CharacterIterator::advance):
        * khtml/editing/visible_text.h:
        (khtml::):
        Add new TextIterator::TextIterator param that specifies whether the iterator is for content or for searching.
        * khtml/editing/visible_units.cpp:
        (khtml::nextWordBoundary):
        Specify search type TextIterator.

2004-12-21  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

        <rdar://problem/3924695> REGRESSION (Mail): double-clicking past end of line shows no selection, should select to EOL
        
        Problem was that RenderText::setSelectionState did not handle the SelectionStart case where start and end are the end of the line.
        Fixed by pretending the start == end-1 in that situation, as long as end > 0.
        
        * khtml/rendering/render_text.cpp:
        (RenderText::setSelectionState)

2004-12-21  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	<rdar://problem/3929187> WebKit needs to restrict access to certain window operations by domain
        
	* khtml/ecma/kjs_window.cpp:
        (Window::get): Change most window functions to be restricted by
	XSS domain check.

2004-12-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3928305> selecting an entire line and typing over causes new inserted text at top of document

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::insertPlaceholderForAncestorBlockContent): New function to detect case
        formerly undetected and unhandled. This is the crux of the bug fix.
        (khtml::DeleteSelectionCommand::doApply): Call insertPlaceholderForAncestorBlockContent() during
        execution of command.
        * khtml/editing/htmlediting.h: Declare new function.
        * layout-tests/editing/deleting/delete-3928305-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3928305-fix.html: Added.

2004-12-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Note to self: Must compile code before
        checking in (aka must return false from function returning bool).

2004-12-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Fix for this bug:
        
        <rdar://problem/3927752> Crash in khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded(DOM::NodeImpl*)

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::insertBlockPlaceholderIfNeeded): Added some null checks.
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Ditto.

2004-12-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::mergeStartNode): Refine concept of how this node is found based on
        further experiements.
        (khtml::ReplaceSelectionCommand::doApply): Add a special case for determining merges that need to
        be done if the insertion point is in an empty block.
        * layout-tests/editing/pasteboard/paste-text-012-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-012.html: Added.
        * layout-tests/editing/pasteboard/paste-text-013-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-013.html: Added.
        * layout-tests/editing/pasteboard/paste-text-014-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-014.html: Added.

2004-12-21  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3899133> text search in a Safari window takes a very long time on Tiger updates page (and some other pages)

        * khtml/editing/visible_text.h: Add an "offset base node" parameter to emitCharacter, and also
        add a field to track it. Must make a few things mutable so we can update them in the range accessor.
        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::advance): Pass in base node and offsets rather than computing actual offsets
        using the node's index. We only compute the node index if actually asked for the range.
        (khtml::TextIterator::handleTextNode): Pass 0 for base node and set base node to 0 when setting
        up the offsets.
        (khtml::TextIterator::handleTextBox): Ditto.
        (khtml::TextIterator::handleReplacedElement): Pass base node and set base node instead of calling
        nodeIndex.
        (khtml::TextIterator::handleNonTextNode): Pass 0 for offset.
        (khtml::TextIterator::exitNode): More of the same.
        (khtml::TextIterator::emitCharacter): Ditto.
        (khtml::TextIterator::range): If an offset base node is stored, then get its node index, and then
        add that in to the offsets. Doing the work here guarantees it's done only once when doing a text search.

        - another small fix

        * khtml/khtml_part.cpp: Removed SPEED_DEBUG define. Not sure why it was on.

=== Safari-176 ===

2004-12-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): My one-liner for this bug introduced layout test
        regressions: <rdar://problem/3926142> REGRESSION (Mail): Deleting text decreases quote level
        Rolling out until I can develop a real fix.

2004-12-20  David Harrison  <harrison@apple.com>

        Reviewed by Dave Hyatt.
        
        Initial checkin of AXTextMarkerRef support.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection):
        (DocumentImpl::setFocusNode):
        * kwq/KWQAccObject.h:
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject detach]):
        (-[KWQAccObject anchorElement]):
        (-[KWQAccObject addChildrenToArray:]):
        (-[KWQAccObject accessibilityAttributeNames]):
        (-[KWQAccObject accessibilityActionDescription:]):
        (-[KWQAccObject accessibilityPerformAction:]):
        (-[KWQAccObject textMarkerRangeFromMarkers:andEndMarker:]):
        (-[KWQAccObject textMarkerForVisiblePosition:]):
        (-[KWQAccObject visiblePositionForTextMarker:]):
        (-[KWQAccObject AXTextMarkerRangeCopyStartMarkerWrapper:]):
        (-[KWQAccObject AXTextMarkerRangeCopyEndMarkerWrapper:]):
        (-[KWQAccObject visiblePositionForStartOfTextMarkerRange:]):
        (-[KWQAccObject visiblePositionForEndOfTextMarkerRange:]):
        (-[KWQAccObject accessibilityAttributeValue:]):
        (-[KWQAccObject accessibilityParameterizedAttributeNames]):
        (-[KWQAccObject textMarkerRangeFromVisiblePositions:andEndPos:]):
        (-[KWQAccObject getSelectedTextMarkerRange]):
        (-[KWQAccObject doAXLineForTextMarker:]):
        (-[KWQAccObject doAXTextMarkerRangeForLine:]):
        (-[KWQAccObject doAXStringForTextMarkerRange:]):
        (-[KWQAccObject doAXNextTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXPreviousTextMarkerForTextMarker:]):
        (-[KWQAccObject doAXLeftWordTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightWordTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXLeftLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject doAXRightLineTextMarkerRangeForTextMarker:]):
        (-[KWQAccObject accessibilityAttributeValue:forParameter:]):
        (-[KWQAccObject accessibilityFocusedUIElement]):
        (-[KWQAccObject clearChildren]):
        (-[KWQAccObject accObjectID]):
        (-[KWQAccObject setAccObjectID:]):
        (-[KWQAccObject removeAccObjectID]):
        * kwq/KWQAccObjectCache.h:
        * kwq/KWQAccObjectCache.mm:
        (KWQAccObjectCache::KWQAccObjectCache):
        (KWQAccObjectCache::~KWQAccObjectCache):
        (KWQAccObjectCache::getAccObjectID):
        (KWQAccObjectCache::removeAccObjectID):
        (KWQAccObjectCache::textMarkerForVisiblePosition):
        (KWQAccObjectCache::visiblePositionForTextMarker):

2004-12-19  Darin Adler  <darin@apple.com>

        * kwq/KWQFoundationExtras.h: (KWQCFAutorelease): Added nil check.

2004-12-19  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - a garbage collection fix

        * kwq/KWQFoundationExtras.h: (KWQCFAutorelease): Added a more-extensive comment and fixed the BUILDING_ON_PANTHER
        #ifndef to use #if (in practice, either is OK).
        * kwq/KWQKURL.mm: (KURL::getNSURL): Use KWQCFAutorelease instead of autorelease.

2004-12-17  David Hyatt  <hyatt@apple.com>

	Fix for 3923255, specified percentage heights of divs with overflow auto inside tables not honored.
	
        Reviewed by kocienda

        * khtml/rendering/render_box.cpp:
        (RenderBox::calcPercentageHeight):
        * khtml/rendering/render_table.cpp:
        (RenderTableSection::layoutRows):

2004-12-17  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

        <rdar://problem/3924930> REGRESSION: triple click does not select to end of line
        
        * khtml/editing/visible_units.cpp:
        (khtml::endOfParagraph):
        When includeLineBreak is true, allow traversal to next node after enclosingBlockFlowElement.

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Vicki

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Missed deleting some now-obsolete expcetion
        codes when I added the createBreakElement() function.

2004-12-17  Richard Williamson   <rjw@apple.com>

	Set the floor of max cacheable object size to 40K.  This restores
	the long standing floor.  Lower floor deleteriously impacts the PLT.
        Reviewed by Hyatt.

        * khtml/khtml_part.cpp:
        (KHTMLPart::checkCompleted):
        * khtml/misc/loader.cpp:
        (Cache::setSize):

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3926142> REGRESSION (Mail): Deleting text decreases quote level

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Stop merging nodes when a <br> is hit.
        Formerly checked only for block boundary.

2004-12-17  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

		Add KWQCFAutorelease for autoreleasing CF objects.
        * kwq/KWQFoundationExtras.h:
        (KWQCFAutorelease):
        New.

2004-12-17  David Harrison  <harrison@apple.com>

        Reviewed by Darin.

		Fix GC compatibility in getNSString.

        * kwq/KWQString.mm:
        (QString::getNSString):
		Use NSString allocator instead of CFString, so that autorelease works under GC.

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3890973> REGRESSION (Mail): Deleting reorders remaining text

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Added check to ensure that moving content will not
        move it after the <body> element.

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        Added new layout tests covering cases from recent bug fixes.

        * layout-tests/editing/inserting/insert-div-018-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-018.html: Added.
        * layout-tests/editing/inserting/insert-div-019-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-019.html: Added.
        * layout-tests/editing/inserting/insert-div-020-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-020.html: Added.
        * layout-tests/editing/inserting/insert-div-021-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-021.html: Added.

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        Changes in layout resulting from giving <p> elements no margin rather than 0.1em margin.

        * layout-tests/editing/inserting/insert-div-013-expected.txt
        * layout-tests/editing/inserting/insert-div-014-expected.txt

2004-12-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3925317> Increase quote in email and with cursor below the quote the new line appears above the quote

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply):
        * khtml/editing/visible_position.cpp: Refine rules for whether to use the starting node or the starting
        block as the reference node for the insertion of the new block.
        (khtml::isLastVisiblePositionInBlock): Tweak rules again. Descendants of following blocks should answer true.
        I worked this all out on the whiteboard this time. This should be the last tweak.

2004-12-17  Kevin Decker  <kdecker@apple.com>

        Reviewed by Ken.

	Fixed <rdar://problem/3824438> Need a clean way for Dashboard to detect when an XML parsing error occurs

        * khtml/xml/xml_tokenizer.cpp:
        (khtml::XMLTokenizer::insertErrorMessageBlock): In the xml error report, instead of a generic <div>, use <parsererror> to match Mozilla.

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3924888> REGRESSION (Mail): Hitting return key at end of line does not insert visible newline

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Tweaked code I added just before to fix 3924486, so that
        it checks the downstream node for the starting position.

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Added new createBreakElement() function that makes creating a <br> element a one-liner.
        Converted all the code that used to call the DocumentImpl, and dealt with the exceptionCode,
        over to this new helper.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Now uses new helper function.
        (khtml::InsertLineBreakCommand::doApply): Ditto.
        (khtml::InsertParagraphSeparatorCommand::doApply): Ditto.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
        (khtml::ReplaceSelectionCommand::doApply): Ditto.
        (khtml::createBreakElement): New helper.
        * khtml/editing/htmlediting.h: Ditto.

2004-12-16  David Hyatt  <hyatt@apple.com>

	Fix a bug where vertical-align values that depended on their parent's value went crazy if the parent was
	vertical-align top or bottom.  The bug is 3771007, bankofamerica's ebills page.
	
        Reviewed by kocienda

        * khtml/rendering/render_object.cpp:
        (RenderObject::getVerticalPosition):

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:
        
        <rdar://problem/3924486> REGRESSION (Mail): Hitting return key does not insert visible newline
        <rdar://problem/3924579> REGRESSION (Mail): After deleting, hitting return key does not insert visible newline

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): For the first bug, detect when inserting a <p> will
        make a visible <br> collapse. For the second bug, move the code that inserts the new <p> after
        a check which may move the node used as the reference node for the insertion. Also change this code to
        insert the <p> after the last sibling of the starting position, to move it past the nodes we're going
        to want to shift into the new <p>.

2004-12-16  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - use <p> elements rather than <br> when pasting plain text; also use margin of 0 rather than 0.1 em
          after talking this over with Dave and Ken

        * khtml/editing/htmlediting.h: Added createDefaultParagraphElement and createBlockPlaceholderElement.
        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::insertBlockPlaceholderIfNeeded): Use new createBlockPlaceholderElement
        helper so this can share code with the plain-text conversion code.
        (khtml::InsertParagraphSeparatorCommand::createParagraphElement): Use new createDefaultParagraphElement
        helper so this can share code with the plain-text conversion code.
        (khtml::createDefaultParagraphElement): Added.
        (khtml::createBlockPlaceholderElement): Added.

        * khtml/editing/markup.cpp: (khtml::createFragmentFromText): Use paragraphs rather than
        <br> elements for pasting plain text.

        - regenerated these files with the newer gperf

        * khtml/css/cssproperties.c: Regenerated.
        * khtml/css/cssvalues.c: Regenerated.
        * khtml/misc/htmlattrs.c: Regenerated.
        * khtml/misc/htmltags.c: Regenerated.

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3924291> REGRESSION (Mail): Crash deleting content following a <p> element

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::enclosingInlineElement): Fixed problem in this function where recursive search for
        parent that is not an inline would skip past previous siblings of nodes which were blocks. Now
        it stops looking in this situation. This problem eventually caused the delete code to try to 
        merge a node under a descendent.

2004-12-16  Adele Amchan  <adele@apple.com>

        Change by Richard, reviewed by me.

	Fix for: <rdar://problem/3923983> background image decoding prevents page with 0Kb image from finishing to load

        * khtml/misc/loader.cpp: (CachedImage::data): Added call to notifyFinished so the 0Kb image case finishes loading.

2004-12-16  Adele Amchan  <adele@apple.com>

        Reviewed by Chris.

        Fix for: <rdar://problem/3534824> VIP: some navigation links on safeway.com don't work due to a JavaScript quirk

        Added a call to ObjectImp::get before Window::get just returns Undefined.  
        This was preventing us from getting the toString function from a Window object.

        * khtml/ecma/kjs_window.cpp: (Window::get):

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Fix for this bug:
        
        <rdar://problem/3918351> REGRESSION (Mail, 173-175+): Return before first char of line leaves insertion point in wrong place
        
        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Basically, did a rewrite of this function
        to do a better job than it was doing before. Added several test cases to prove I am on a 
        better track.
        * khtml/editing/visible_position.cpp:
        (khtml::isFirstVisiblePositionInBlock): Tweaked the rules a bit to fix an issue very similar to the
        leaving-the-bar-node case problem I just fixed in a recent checkin (relevant markup: <p>foo</p>bar).
        This function was returning true for the first position in "bar". Wrong. Also tightened up other 
        rule: Should not report true when relationship between blocks cannot be determined.
        (khtml::isLastVisiblePositionInBlock): Tightened up rule as above: Should not report true 
        when relationship between blocks cannot be determined.
        * layout-tests/editing/inserting/insert-div-010-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-010.html: Added.
        * layout-tests/editing/inserting/insert-div-011-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-011.html: Added.
        * layout-tests/editing/inserting/insert-div-012-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-012.html: Added.
        * layout-tests/editing/inserting/insert-div-013-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-013.html: Added.
        * layout-tests/editing/inserting/insert-div-014-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-014.html: Added.
        * layout-tests/editing/inserting/insert-div-015-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-015.html: Added.
        * layout-tests/editing/inserting/insert-div-016-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-016.html: Added.
        * layout-tests/editing/inserting/insert-div-017-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-017.html: Added.
            
2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        Added a layout test based on my last checkin.

        * layout-tests/editing/selection/move-by-word-001-expected.txt: Added.
        * layout-tests/editing/selection/move-by-word-001.html: Added.

2004-12-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3917929> REGRESSION (Mail): Command-left-arrow leaves insertion point too high after specific steps

        * khtml/editing/visible_text.cpp:
        (khtml::SimplifiedBackwardsTextIterator::advance): Add new check for leaving a text node and iterating
        backwards into a different block that is an descendent of the block containing the text node (as in leaving 
        the "bar" node in this example: <p>foo</p>bar).
        (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode): Call new emitNewlineForBROrText helper.
        (khtml::SimplifiedBackwardsTextIterator::emitNewlineForBROrText): Factor out code from handleNonTextNode, since
        it is called from there, and now also from advance().

2004-12-15  Darin Adler  <darin@apple.com>

        Reviewed by Ken.
        
        - fixed problem where plain-text would put a blank line between each <p> even when they have no margins

        * khtml/editing/visible_text.cpp: (khtml::TextIterator::exitNode): Add more checks and only set the
        "add one more newline" flag if the margin is sufficient. A more complete fix would ignore the node
        type altogether and use the render tree instead.

2004-12-14  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - rest of WebCore fix for <rdar://problem/3790011> undoable operations all say "Undo" 
        in the menu, no specific action names

        * khtml/editing/edit_actions.h: new header, contains EditAction enum
        (renamed from HTMLEditAction, formerly in htmlediting.h)

        * ForwardingHeaders/editing/edit_actions.h: new forwarding header
        
        * khtml/editing/htmlediting.h:
        removed HTMLEditAction enum in favor of including edit_actions.h; added khtml::
        namespace to EditAction usages; added m_editingAction ivar to ApplyStyleCommand

        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::editingAction):
        update for enum name change
        (khtml::EditCommand::editingAction):
        ditto
        (khtml::ApplyStyleCommand::ApplyStyleCommand):
        added editingAction parameter to this constructor
        (khtml::ApplyStyleCommand::editingAction):
        return new ivar
        (khtml::DeleteSelectionCommand::editingAction):
        update for enum name change
        (khtml::MoveSelectionCommand::editingAction):
        ditto
        (khtml::TypingCommand::editingAction):
        ditto
        (khtml::ReplaceSelectionCommand::editingAction):
        ditto
        
        * khtml/khtml_part.h:
        added EditAction parameter to applyStyle and computeAndSetTypingStyle
        * khtml/khtml_part.cpp:
        (KHTMLPart::computeAndSetTypingStyle):
        added EditAction parameter
        (KHTMLPart::applyStyle):
        ditto

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::registerCommandForUndoOrRedo):
        do the cast from EditAction to WebUndoAction a different way to match other code
        
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setTypingStyle:withUndoAction:]):
        added WebUndoAction parameter, passed into ApplyStyleCommand constructor
        (-[WebCoreBridge applyStyle:withUndoAction:]):
        ditto

        * WebCore.pbproj/project.pbxproj:
        updated for new files

2004-12-14  David Hyatt  <hyatt@apple.com>

	Fix for 3562458, rowspan and colspan converted to ints so that large values will work for them.  Remove
	the ridiculous 1024 limit on the span values.

        * khtml/html/html_tableimpl.cpp:
        (HTMLTableCellElementImpl::parseHTMLAttribute):
        * khtml/rendering/render_table.cpp:
        (RenderTableCell::collapsedBottomBorder):
        * khtml/rendering/render_table.h:
        (khtml::RenderTableCell::colSpan):
        (khtml::RenderTableCell::setColSpan):
        (khtml::RenderTableCell::rowSpan):
        (khtml::RenderTableCell::setRowSpan):
        (khtml::RenderTableCol::span):
        (khtml::RenderTableCol::setSpan):

2004-12-14  David Hyatt  <hyatt@apple.com>

	Make sure <col> and <colgroup> can have spans updated dynamically as well.
	
        Reviewed by rjw

        * khtml/html/html_tableimpl.cpp:
        (HTMLTableColElementImpl::parseHTMLAttribute):
        * khtml/rendering/render_table.cpp:
        (RenderTableCell::updateFromElement):
        (RenderTableCol::updateFromElement):

2004-12-14  David Hyatt  <hyatt@apple.com>

	Fix for 3833123, setting a cell's colspan does not update rendering like it should.
	
        Reviewed by rjw

        * khtml/html/html_tableimpl.cpp:
        (HTMLTableCellElementImpl::parseHTMLAttribute):
        * khtml/rendering/render_table.cpp:
        (RenderTableCell::RenderTableCell):
        (RenderTableCell::updateFromElement):

2004-12-14  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3864536> crash copying text from other apps and pasting in a sticky in dashboard

        Reviewed by hyatt.

        * khtml/editing/markup.cpp:
        (khtml::createFragmentFromText): ref and deref the fragment since calling appendChild can completely deref it

2004-12-14  David Hyatt  <hyatt@apple.com>

	Fix for 3785211. Make sure to do a layout with the old position before doing a layout after changing to the new position.
	This is actually a regression from my positioned object DHTML optimization.
	
        Reviewed by kocienda

        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):

2004-12-14  David Hyatt  <hyatt@apple.com>

	Make sure the class attribute works when newlines are present in the attribute.

        Reviewed by kocienda

        * khtml/html/html_elementimpl.cpp:
        (HTMLNamedAttrMapImpl::parseClassAttribute):

2004-12-14  David Hyatt  <hyatt@apple.com>

	Fix for 3724938, float element is duplicated and paints twice.  The logic for when to paint floats was
	actually fairly screwed up.  This patch simplifies the logic and makes addOverhangingFloats easier to
	read by splitting it into two separate functions.
	
        Reviewed by kocienda

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::layoutBlockChildren):
        (khtml::RenderBlock::clearFloats):
        (khtml::RenderBlock::addOverhangingFloats):
        (khtml::RenderBlock::addIntrudingFloats):
        * khtml/rendering/render_block.h:

2004-12-14  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - added Undo action names for Cut, Paste, and Drag

        * khtml/editing/htmlediting.h:
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::editingAction):
        overridden to return HTMLEditActionCut
        (khtml::MoveSelectionCommand::editingAction):
        overridden to return HTMLEditActionDrag
        (khtml::ReplaceSelectionCommand::editingAction):
        overridden to return HTMLEditActionPaste

2004-12-14  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - architecture for WebCore part of fix for <rdar://problem/3790011> undoable operations all say "Undo" in the menu, 
        no specific action names
          
        The remaining step is to make each EditCommand subclass override editingAction() to return an
        appropriate value. (Unfortunately the mapping between subclass and user-distinguishable action
        is not completely straightforward, so this next step isn't trivial.)

        * khtml/editing/htmlediting.h:
        new enum for HTMLEditAction

        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::editingAction):
        new method, calls through to EditCommand
        (khtml::EditCommand::editingAction):
        new method for subclasses to override, returns HTMLEditActionUnspecified at this level
        (khtml::TypingCommand::editingAction):
        proof of concept override, returns HTMLEditActionTyping
                
        * kwq/KWQKHTMLPart.h:
        declare new private bottleneck method registerCommandForUndoOrRedo
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::registerCommandForUndoOrRedo):
        new bottleneck method to reduce code duplication; now calls over the bridge
        to get the localized string to use for the Undo action name
        (KWQKHTMLPart::registerCommandForUndo):
        now calls new bottleneck method
        (KWQKHTMLPart::registerCommandForRedo):
        now calls new bottleneck method
        
        * kwq/WebCoreBridge.h:
        new enum for WebUndoAction, maps directly to HTMLEditAction.
        Declaration of nameForUndoAction:

2004-12-14  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - added a bunch of missing nil checks; our old version of inherits used to work for nil (by accident)

        * khtml/rendering/render_frames.cpp:
        (RenderPart::~RenderPart): Check widget for nil.
        (RenderPart::setWidget): Ditto.
        (RenderFrame::slotViewCleared): Ditto.
        (RenderPartObject::slotViewCleared): Ditto.

2004-12-13  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - moved markup-related functions into new sources files in the editing directory
        - removed all of the uses of dynamic_cast, preparing to turn off RTTI to make our code smaller and slightly faster

        * ForwardingHeaders/editing/markup.h: Added.
        * khtml/editing/markup.h: Added.
        * khtml/editing/markup.cpp: Added.

        * WebCore.pbproj/project.pbxproj: Added markup.h/cpp.

        * khtml/dom/dom_node.cpp: (Node::toHTML): Call createMarkup since there's no toHTML in NodeImpl any more.
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::innerHTML): Changed to call createMarkup.
        (HTMLElementImpl::outerHTML): Ditto.

        * khtml/ecma/kjs_window.cpp:
        (Window::retrieveWindow): Comment out assert that uses dynamic_cast.
        (Window::retrieveActive): Ditto.

        * khtml/editing/htmlediting.h: Added forward class declaration needed now that I removed one elsewhere.
        * khtml/xml/dom_docimpl.h: Ditto.

        * khtml/khtml_part.cpp:
        (KHTMLPart::slotDebugDOMTree): Use createMarkup instead of toHTML.
        (KHTMLPart::processObjectRequest): Use inherits instead of dynamic_cast.

        * khtml/rendering/render_image.cpp: (RenderImage::paint): Add an explicit QChar conversion so this code
        still works even with the additional replace overloads added to QString.
        * kwq/KWQTextCodec.mm: (QTextCodec::fromUnicode): Ditto.

        * khtml/rendering/render_object.h: Removed the version of arenaDelete that does not take an object
        base pointer, because it used dynamic_cast in its implementation. Made the other version public.
        * khtml/rendering/render_object.cpp: Ditto.
        * khtml/rendering/render_replaced.cpp: (RenderWidget::deref): Pass object base pointer to arenaDelete.

        * khtml/xml/dom2_rangeimpl.h: Removed extra parameters from toHTML, and unneeded includes and declarations.
        * khtml/xml/dom2_rangeimpl.cpp: (DOM::RangeImpl::toHTML): Changed to call createMarkup, and moved all
        the support code into markup.cpp.

        * khtml/xml/dom_nodeimpl.h: Moved toHTML and related functions into markup.cpp.
        * khtml/xml/dom_nodeimpl.cpp: Ditto.

        * khtml/xml/dom_position.cpp:
        (DOM::startPosition): Implemented the version of this that takes a RangeImpl. Also added null checks
        so these return null positions rather than raising exceptions.
        (DOM::endPosition): Ditto.

        * khtml/khtmlview.h: Added an APPLE_CHANGES function so inherits can detect this class without dynamic_cast.
        * kwq/KWQFrame.h: Ditto.
        * kwq/KWQFrame.mm: (QFrame::isQFrame): Ditto.
        * kwq/KWQKPartsPart.h: Ditto.
        * kwq/KWQKPartsPart.mm: (KParts::ReadOnlyPart::isKPartsReadOnlyPart): Ditto.
        * kwq/KWQScrollView.h: Ditto.
        * kwq/KWQScrollView.mm: (QScrollView::isQScrollView): Ditto.
        * kwq/KWQKHTMLPart.h: Ditto.
        * kwq/KWQKHTMLPart.mm:
        (KHTMLView::isKHTMLView): Ditto.
        (KWQKHTMLPart::setTitle): Added an explicit QChar conversion so this code still works even with the additional
        replace overloads added to QString.
        (KWQKHTMLPart::setStatusBarText): Ditto.
        (KWQKHTMLPart::runJavaScriptAlert): Ditto.
        (KWQKHTMLPart::runJavaScriptConfirm): Ditto.
        (KWQKHTMLPart::runJavaScriptPrompt): Ditto.
        (KWQKHTMLPart::attributedString): Ditto.
        (KWQKHTMLPart::isCharacterSmartReplaceExempt): Ditto.
        (KWQKHTMLPart::isKHTMLPart): That dynamic_cast thing (see above).

        * kwq/KWQObject.h: Added virtual methods for the few cases where we need dynamic_cast-like behavior.
        * kwq/KWQObject.mm:
        (QObject::inherits): Changed to not use dynamic cast.
        (QObject::isKHTMLPart): Added. Returns false.
        (QObject::isKHTMLView): Ditto.
        (QObject::isKPartsReadOnlyPart): Ditto.
        (QObject::isQFrame): Ditto.
        (QObject::isQScrollView): Ditto.

        * kwq/KWQRenderTreeDebug.cpp:
        (write): Changed to use inherits rather than dynamic_cast.
        (writeSelection): Ditto.

        * kwq/KWQSlot.mm: (KWQSlot::call): Call through to the version with just a job pointer parameter rather
        than going straight on to the "no parameters at all" version.

        * kwq/KWQString.h:
        * kwq/KWQString.mm: (QString::replace): Added overloads.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge markupStringFromNode:nodes:]): Changed to call functions in markup.h.
        (-[WebCoreBridge markupStringFromRange:nodes:]): Ditto.
        (-[WebCoreBridge selectedString]): Added an explicit QChar conversion so this code still works even with
        the additional replace overloads added to QString.
        (-[WebCoreBridge stringForRange:]): Ditto.
        (-[WebCoreBridge copyDOMNode:copier:]): Changed to call functions in markup.h.
        (-[WebCoreBridge elementAtPoint:]): QChar conversion.
        (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): Changed to call functions in markup.h.
        (-[WebCoreBridge documentFragmentWithText:]): Changed to call functions in markup.h.

2004-12-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3917956> REGRESSION (Mail): pasting can leave insertion point inside pasted text

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Fix coding mistake. Calculations of bool flag based on 
        leading and trailing whitespace positions was reversed! I must have introduced this error recently
        when changing around this code.

2004-12-13  David Hyatt  <hyatt@apple.com>

	Fix for 3915787, macobserver doesn't paint.  floatRect() needed to be const in the base class.  Also hit-testing
	and painting was using the wrong rect when setting up the x/y of the rect.
	
        Reviewed by mjs

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::paint):
        (khtml::RenderBlock::nodeAtPoint):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::floatRect):

2004-12-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3917863> REGRESSION (Mail): pasting two lines of plain text copied from an RTF document results in two styles

        Code to figuire out the end node to merge was missing the font tag in the second paragraph
        written out by AppKit convert-to-HTML function. I refined the algorithm to be smarter.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::mergeEndNode): Refine algorithm used to walk through the fragment being pasted
        looking for the node that is the last inline in the last block of the fragment. The old algorithm was 
        insufficiently powerful.
        (khtml::ReplacementFragment::enclosingBlock): New helper function.
        * khtml/editing/htmlediting.h: Add declaration for new helper function.
        * layout-tests/editing/pasteboard/paste-text-011-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-011.html: Added.

2004-12-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        WebCore side of fix for this bug:
        
        <rdar://problem/3768372> REGRESSION (Mail): paste of text ending in whitespace loses whitespace

        Note that we are coordinating with Doug Davidson on the AppKit team to make a complete fix for this
        bug. This change involves our half of the needed changes.
        
        Note that a lot of this change has to do with changing code to use a <br> element instead of
        a comment node as the mechanism to annotate HTML with information used to fix the bug. In some
        other places, code to handle comments in markup can be removed since we do not use comments for
        such annotations after this change.

        * khtml/editing/htmlediting.cpp: Remove isComment() helper; no longer needed.
        (khtml::ReplacementFragment::ReplacementFragment): Change m_hasInterchangeNewlineComment name to m_hasInterchangeNewline.
        (khtml::ReplacementFragment::isInterchangeNewlineNode): Name changed from isInterchangeNewlineComment.
        (khtml::ReplacementFragment::isInterchangeConvertedSpaceSpan): Local variable name convertedSpaceSpanClass changed to
        convertedSpaceSpanClassString to match other uses of the idiom used here.
        (khtml::ReplaceSelectionCommand::doApply): Change hasInterchangeNewlineComment() name to hasInterchangeNewline().
        * khtml/editing/htmlediting.h: Change names as noted in .cpp file. Remove isComment() helper; no longer needed.
        (khtml::ReplacementFragment::hasInterchangeNewline):  Change hasInterchangeNewlineComment() name to hasInterchangeNewline().
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::createContextualFragment): No longer has includeCommentsInDOM flag; no longer needed as we do not
        annotate fragments with comments any longer.
        * khtml/html/html_elementimpl.h: Ditto.
        * khtml/xml/dom2_rangeimpl.cpp: Remove addCommentToHTMLMarkup() helper. No longer needed.
        (DOM::interchangeNewlineMarkupString): New helper to return <br> element markup we use to annotate content for interchange.
        (DOM::RangeImpl::toHTML): No longer uses addCommentToHTMLMarkup; now calls interchangeNewlineMarkupString(). Remove
        spurious semi-colon.
        * khtml/xml/dom2_rangeimpl.h: Remove obsolete addCommentToHTMLMarkup() function and EAddToMarkup enum.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): No longer pass bool to ask for including comments
        in DOM when calling createContextualFragment().

2004-12-10  John Sullivan  <sullivan@apple.com>

        fixed deployment build bustage that John Louch ran into

        * kwq/KWQTextEdit.mm:
        (QTextEdit::setScrollBarModes):
        move bool declaration inside exception-handling block to avoid obscure
        compiler error

2004-12-10  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	<rdar://problem/3907484> REGRESSION (125-173): crash when KWQTextField is dealloc'ed while setting focus (profoundlearning.com)
	
        * kwq/KWQWidget.mm:
        (QWidget::setFocus): Handle the case where setting focus removed
	us from the superview - this can happen due to style changes on
	focus change.

2004-12-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3915008> REGRESSION (Mail): Too much white space between lines separated by carriage returns

        There are a number of interesting things we could do to fix this bug, including SPI and involving
        the WebKit delegate, etc., however it seems reasonable to start with a hard-coded default that
        will fix the bug in the general case until such time as we can come up with more specific
        solutions. 
        
        So, I added a helper method to create <p> elements with an inline style that sets top and bottom margins
        to 0.1em.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::createParagraphElement): New factory method to create
        paragraph elements to insert. Also adds style information to keep the <p> from having "too-big" margins.
        (khtml::InsertParagraphSeparatorCommand::doApply): Call new factory method.
        * khtml/editing/htmlediting.h: Add createParagraphElement() declaration.

2004-12-10  Darin Adler  <darin@apple.com>

        Reviewed by Hyatt.

        - fixed <rdar://problem/3910419> setting style={overflow:hidden} for <textarea> does not prevent appearance of scrollbars

        * khtml/rendering/render_form.h: Remove now-unneeded wrap parameter.
        * khtml/rendering/render_form.cpp:
        (RenderSubmitButton::rawText): Convert to QChar explicitly.
        (RenderLineEdit::updateFromElement): Ditto.
        (RenderLineEdit::slotTextChanged): Ditto.
        (RenderSelect::updateFromElement): Ditto.
        (TextAreaWidget::TextAreaWidget): Moved out most of the initialization since it's not something
        that requires a derived class. Now we don't use this class at all for WebCore, but they still
        have it for KDE.
        (TextAreaWidget::event): Moved out the ifdefs.
        (RenderTextArea::RenderTextArea): Moved setting code from TextAreaWidget here. Put a bunch that
        we don't need at all inside !APPLE_CHANGES, and removed the setting for scroll bars, since that's
        now done in setStyle.
        (RenderTextArea::handleFocusOut): Use type QTextEdit instead of TextAreaWidget since that's all
        that's needed and WebCore no longer has TextAreaWidget.
        (RenderTextArea::calcMinMaxWidth): Ditto.
        (RenderTextArea::setStyle): Add code to set scroll bar modes based on wrap setting combined with
        overflow style.
        (RenderTextArea::updateFromElement): Use type QTextEdit.
        (RenderTextArea::text): Ditto.
        (RenderTextArea::select): Ditto.

        * kwq/KWQTextArea.mm:
        (-[KWQTextArea _configureTextViewForWordWrapMode]): Don't set horizontal scroller visibility here,
        since it's now handled by QTextEdit.
        (-[KWQTextArea initWithFrame:]): Don't set vertical scroller visibility or scroller auto-hiding.

        * kwq/KWQTextEdit.h: Add setScrollBarModes function to be used instead of separate setter for
        the horizontal and vertical mode; needed because AppKit switches "autohide" for both at once.
        * kwq/KWQTextEdit.mm: (QTextEdit::setScrollBarModes): Added.

2004-12-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3915047> HItting return in empty document inserts <p> but 
        insertion point does not move

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): The issue is that the
        code to insert the <p> element for the return is not detecting the fact
        that the document is empty. Inserting a <p> into an empty body will not
        "add a new line" as the user expects. With this change, we'll add a second 
        <p> when the root editable element has no rendered kids.

2004-12-10  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	<rdar://problem/3912979> REGRESSION (125-173): repro crash in HTMLCollectionImpl code (www.clubtravel.ie)

        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::traverseNextItem): Pass base when traversing
	the initial one step, otherwise we might inadvertantly step
	outside the collection base, thereby causing assertion failures or
	other badness later.

2004-12-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): There is a starting block which is supposed to 
        act as the root node for this operation. However, a loop was incorrectly coded, and a parent node
        search could escape this node. Also, one other piece to code to move nodes to the new <p> element
        should do nothing if the starting point for the selection is itself the starting block.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Similar changes, in spirit, to the above
        function, though the names and concepts are slightly different.

2004-12-10  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/3907705> REGRESSION (172-173): DHTML menus are broken at hrweb.apple.com
        
	* khtml/dom/html_document.cpp:
        (HTMLDocument::nameableItems): New method, wrapper for HTMLCollection creation.
        * khtml/dom/html_document.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet): use doc.nameableItems(), not doc.all()!
        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::traverseNextItem): Added new DOC_NAMEABLE_ITEMS type, this represents
	the items that can be accessed directly as a document propery, in particular forms, images,
	objects, applets and embeds.
        (HTMLCollectionImpl::updateNameCache): Fix some nameCache/idCache confusion.
        (HTMLFormCollectionImpl::updateNameCache): Ditto.
        * khtml/html/html_miscimpl.h:
        (DOM::HTMLCollectionImpl::): Added new type.

2004-12-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3914779> REGRESSION (Mail): Cannot arrow navigate to position before last character on text-wrapped line

        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect): Code was not detecting space at the end of a line correctly. Now it does.

2004-12-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:

        <rdar://problem/3914755> REGRESSION (Mail): Insertion point disappears after pasting paragraph

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Selection could end up in a "placeholder" node
        that was removed from the document when pasting. This caused the disappearance. Now this
        is detected, and the selection is shifted to a node that is in the document.

2004-12-09  Richard Williamson   <rjw@apple.com>

	Check to disable threaded decoding during
	layout tests wasn't invoking function, just checking address of 
	function, which would always return true.
	
        * kwq/WebCoreImageRendererFactory.m:
        (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]):

2004-12-09  David Hyatt  <hyatt@apple.com>

	Fix for 3892686, left/top overflow was not being propagated properly up to containing blocks because of a math
	error.

	Also fix a bug I noticed on the same page where relative position offsets were not being added in properly for
	all inlines when repainting.
	
        Reviewed by rjw

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::layoutBlockChildren):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::getAbsoluteRepaintRect):

2004-12-09  David Hyatt  <hyatt@apple.com>

	Fix for 3867545, finance.yahoo.com lays out incorrectly.  Add a quirk that will prevent tables from moving
	down below floats when there is insufficient space.  Instead we will match Gecko and just spill out of the
	containing block to the right.  This appears to be the more common desired behavior, despite being wrong.
	WinIE sometimes wraps and sometimes doesn't, but it's really hard for us to match its inconsistency.
	
        Reviewed by john

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::getClearDelta):
        * layout-tests/apple-only/base/www.cnn.com/index-expected.txt:
        * layout-tests/apple-only/base/www.ebay.com/index-expected.txt:
        * layout-tests/apple-only/base/www.excite.com/index-expected.txt:
        * layout-tests/fast/block/margin-collapse/102-expected.txt:
        * layout-tests/fast/block/margin-collapse/102.html:

2004-12-09  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3914078> worldclock crashing gc related

	Use ProtectedValue for Context2D instance members.

        Reviewed by Maciej.

        * khtml/ecma/kjs_html.h:

2004-12-09  John Sullivan  <sullivan@apple.com>

        Reviewed by Dave.
        
        - fixed <rdar://problem/3731099> Move AXTitle string for image elements to AXDescription

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject title]): moved image alt tag code out of here
        (-[KWQAccObject accessibilityDescription]): moved image alt tag code into this new method
        (-[KWQAccObject accessibilityAttributeNames]): include AXDescription in the set of attributes
        that ordinary elements return; this means that ordinary elements that aren't images will return
        a nil description, which isn't ideal, but is in keeping with the way the rest of these attributes
        work here.
        (-[KWQAccObject accessibilityAttributeValue:]):
        call accessibilityDescription when asked for AXDescription

2004-12-09  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/3910425> REGRESSION (Mail): Crash in ReplaceSelectionCommand; selection is empty, leading to null deref

        * khtml/editing/htmlediting.cpp:
        (khtml::MoveSelectionCommand::doApply): The node representing the destination for the move may have
        been deleted. If this is the case, set the destination to the node the delete command provides in
        its ending selection.

=== Safari-175 ===

2004-12-09  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Fix for this bug:
        
        <rdar://problem/3912841> REGRESSION (173-TOT): Some images report 0x0 dimensions on layout tests, causes spurious test failures

        The new threaded image decoding capability can throw off layout tests. The issue is that the decoding
        callback may not be delivered before the program asks for the dimensions of an image in order to
        wrote the layout dimensions. More generally, I think we need to ensure that there are no races in
        layout tests, so I have added a flag to the render tree debug code that we can set when debugging.

        * kwq/KWQRenderTreeDebug.cpp:
        (debuggingRenderTree): New function. Returns flag which tells whether the program is debugging the render tree.
        (externalRepresentation): Sets debuggingRenderTree flag to true;
        * kwq/KWQRenderTreeDebug.h:
        * kwq/WebCoreImageRendererFactory.m:
        (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]): Checks debuggingRenderTree flag and will not
        do threaded decoding in any case if the flag is set.

2004-12-09  Chris Blumenberg  <cblu@apple.com>

	Fix for busting XMLHTTPRequest.

        Reviewed by kocienda.

        * khtml/misc/loader.cpp:
        (Loader::servePendingRequests): pass true for deliverAllData
        * kwq/KWQKJob.h:
        (KIO::get): take deliverAllData param
        (KIO::http_post): ditto
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJob::TransferJob): if deliverAllData, create signal with data param
        (KIO::TransferJob::emitResult): if deliverAllData, call signal with data param

2004-12-09  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        <rdar://problem/3911011> REGRESSION (Mail): Spaces at end of line causing word wrap lost when copied/pasted

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::renderedText): Fixed the code so that spaces at the end of lines are not skipped.

2004-12-07  Richard Williamson   <rjw@apple.com>

	Support threaded image decoding on machines w/ > 2 CPUs.

        Reviewed by Maciej and Chris.

        * khtml/misc/loader.cpp:
        (CachedImageCallback::notifyUpdate):
        (CachedImageCallback::notifyFinished):
        (CachedImageCallback::notifyDecodingError):
        (CachedImageCallback::handleError):
        (CachedImageCallback::clear):
        (CachedImage::CachedImage):
        (CachedImage::clear):
        (CachedImage::data):
        (CachedImage::checkNotify):
        (Loader::servePendingRequests):
        (Loader::slotFinished):
        (Loader::numRequests):
        (Loader::cancelRequests):
        (Loader::removeBackgroundDecodingRequest):
        * khtml/misc/loader.h:
        (khtml::CachedImageCallback::CachedImageCallback):
        (khtml::CachedImageCallback::ref):
        (khtml::CachedImageCallback::deref):
        (khtml::CachedImage::decoderCallback):
        * khtml/rendering/render_object.cpp:
        (RenderObject::setPixmap):
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (-[WebImageCallback initWithCallback:khtml::]):
        (-[WebImageCallback _commonTermination]):
        (-[WebImageCallback dealloc]):
        (-[WebImageCallback finalize]):
        (-[WebImageCallback notify]):
        (-[WebImageCallback setImageSourceStatus:]):
        (-[WebImageCallback status]):
        (QPixmap::shouldUseThreadedDecoding):
        (QPixmap::receivedData):
        * kwq/WebCoreImageRenderer.h:
        * kwq/WebCoreImageRendererFactory.h:
        * kwq/WebCoreImageRendererFactory.m:
        (+[WebCoreImageRendererFactory shouldUseThreadedDecoding]):
        (+[WebCoreImageRendererFactory setShouldUseThreadedDecoding:]):

2004-12-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Fix a problem with my
        change in thei code yesterday. Call to insertBlockPlaceholderIfNeeded() must be done
        after new block has been inserted, otherwise a crash can result. Shuffle down call 
        to insertBlockPlaceholderIfNeeded() a couple of lines (where the node is inserted), 
        and all is good.

2004-12-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3907422> REGRESSION (Mail): Pasting quoted content can place content after body element

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Detect when the body element is the "reference block" used
        for determining the location for inserting content. Do not allow an insert before or after if the
        reference block is the body. Perform insertNodeAt(0) and appendNode, respectively, in the block-is-body case.
        * layout-tests/editing/inserting/insert-3907422-fix-expected.txt: Added.
        * layout-tests/editing/inserting/insert-3907422-fix.html: Added.

2004-12-07  Darin Adler  <darin@apple.com>

        Reviewed by Don.

        - fixed <rdar://problem/3908701> REGRESSION: Cursor does not change to "hand" over active links

        * kwq/KWQEvent.mm: (positionForEvent): Add NSMouseMoved to list of events that have mouse location.

2004-12-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Changed name of constant from KHTMLInterchangeNewline to AppleInterchangeNewline.
        I discussed this with Hyatt and he agreed that going with "Apple" names was OK.

        * khtml/editing/html_interchange.h: Name change, as described above.
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::isInterchangeNewlineComment): Ditto.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): Ditto.

2004-12-07  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        Added a couple more layout tests.

        * layout-tests/editing/deleting/delete-line-013-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-013.html: Added.
        * layout-tests/editing/deleting/delete-line-014-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-014.html: Added.

2004-12-06  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Hyatt.

	- fixed <rdar://problem/3906974> assertion failure in QWidget::beforeMouseDown clicking on <select multiple>
        
	* kwq/KWQListBox.mm:
        (QListBox::QListBox): Initialize KWQListBoxScrollView with this.
        (-[KWQListBoxScrollView initWithListBox:]): Make this class a KWQWidgetHolder.
        (-[KWQListBoxScrollView widget]): See above.
        (-[KWQTableView mouseDown:]): Pass outerView rather than self to beforeMouseDown and
	afterMouseDown, to avoid triggering an assertion failure.

2004-12-06  David Hyatt  <hyatt@apple.com>

	Fix for 3615411, the linesAppended optimization was old and broken, and it's easier with the new code fixes
	made by me, kocienda and harrison to just remove it.
	
        Reviewed by mjs

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::layoutInlineChildren):
        * khtml/rendering/render_block.cpp:
        (khtml:::RenderFlow):
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::dirtyLinesFromChangedChild):

2004-12-06  David Hyatt  <hyatt@apple.com>

	Fix for 3787133, some web pages print with many blank pages.  Make sure to use the real page print rect and
	not a damage rect that can be changed when intersected with the clip regions of the web page.
	
        Reviewed by john

        * khtml/rendering/render_canvas.h:
        (khtml::RenderCanvas::printRect):
        (khtml::RenderCanvas::setPrintRect):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):
        * khtml/rendering/render_list.cpp:
        (RenderListMarker::paint):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::adjustPageHeight):

2004-12-06  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda and Dave Hyatt (OOPS!).

		<rdar://problem/3849947> Typing after pasting line does not appear until after window resize.
		
		
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::dirtyLinesFromChangedChild):
		Dirty the line above because new child can inval the cached line break position of previous line.

2004-12-06  David Hyatt  <hyatt@apple.com>

	Fix for 3254464, radio buttons do not work for quiz on netscape.com.  Left/top overflow needed to be implemented.
	This also fixes 3106907, link hover color only partially set on rollover and the more general architecture bug
	3126929, handle top/left overflow.

	This patch also fixes 3902891, scroll bar of position:fixed content moves when a page is scrolled.

	Finally, the Emerson regression 3869718 (error involving computing the rightmost/lowest position of overflow:auto
	regions and web pages) has been fixed.
	
        Reviewed by mjs

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::computeHorizontalPositionsForLine):
        (khtml::RenderBlock::checkLinesForOverflow):
        * khtml/rendering/render_block.cpp:
        (khtml:::RenderFlow):
        (khtml::RenderBlock::overflowHeight):
        (khtml::RenderBlock::overflowWidth):
        (khtml::RenderBlock::overflowLeft):
        (khtml::RenderBlock::overflowTop):
        (khtml::RenderBlock::overflowRect):
        (khtml::RenderBlock::layoutBlock):
        (khtml::RenderBlock::layoutBlockChildren):
        (khtml::RenderBlock::paint):
        (khtml::RenderBlock::floatRect):
        (khtml::RenderBlock::lowestPosition):
        (khtml::RenderBlock::rightmostPosition):
        (khtml::RenderBlock::leftmostPosition):
        (khtml::RenderBlock::nodeAtPoint):
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_box.h:
        (khtml::RenderBox::borderBox):
        (khtml::RenderBox::borderTopExtra):
        (khtml::RenderBox::borderBottomExtra):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::paintScrollbars):
        (mustExamineRenderer):
        (RenderLayer::intersectsDamageRect):
        (RenderLayer::containsPoint):
        * khtml/rendering/render_line.cpp:
        (khtml::InlineFlowBox::placeBoxesHorizontally):
        (khtml::InlineFlowBox::verticallyAlignBoxes):
        * khtml/rendering/render_line.h:
        (khtml::InlineBox::leftOverflow):
        (khtml::InlineBox::rightOverflow):
        (khtml::InlineFlowBox::setVerticalOverflowPositions):
        (khtml::RootInlineBox::RootInlineBox):
        (khtml::RootInlineBox::leftOverflow):
        (khtml::RootInlineBox::rightOverflow):
        (khtml::RootInlineBox::setVerticalOverflowPositions):
        (khtml::RootInlineBox::setHorizontalOverflowPositions):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::borderBox):
        (khtml::RenderObject::overflowLeft):
        (khtml::RenderObject::overflowTop):
        (khtml::RenderObject::overflowRect):
        (khtml::RenderObject::floatRect):
        * khtml/rendering/render_table.cpp:
        (RenderTable::layout):
        (RenderTable::paint):
        (RenderTable::paintBoxDecorations):
        (RenderTable::calcMinMaxWidth):
        * khtml/rendering/render_table.h:
        (khtml::RenderTableCell::borderTopExtra):
        (khtml::RenderTableCell::borderBottomExtra):
        * kwq/KWQRect.h:
        * kwq/KWQRect.mm:
        (QRect::inflate):

2004-12-06  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	- fixed <rdar://problem/3903797> scripts can cause other frames/windows to execute arbitrary script using javascript: URLs
        
	I changed all unprotected places that can navigate a different
	window or frame from script to check for a javascript: URL, and if
	found, to check for safety using cross-site-script rules. 

	I considered a few other possible exploits and made no change:

	- document.location is already protected because the document
	object itself is protected

	- frame.src, frame.location, iframe.src and targetted links are
	all safe because setting the URL of a frame to a javascript: URL
	executes the script in the context of the parent

	* khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall):
        (Location::put):
        (LocationFunc::tryCall):

2004-12-06  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej

        Fix for this bug:
        
        <rdar://problem/3890955> 8A314: Forward delete sometimes fails to delete the selected quoted text

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Fixed bonehead coding mistake in the
        check for one of the special cases being checked for in this function. The specific case 
        intends to check for a selection that is only a <br> after a block ends (as in </div><br>). If it
        sees such markup, it deletes only the <br> and bails. However, this code would run in *any*
        case where a selection ended in a <br> after a block and would not delete any part of the
        selection preceding the <br>. Bad. I have tightened the check to see that only a <br> is
        selected.

        Fixing the bug above was accomplished with an additional call to DOM::Position::downstream. This
        new use of the function exposed this bug:
        
        <rdar://problem/3907666> Incorrectly coded loop in Position::downstream can lead to infinite loop

        * khtml/xml/dom_position.cpp:
        (DOM::Position::downstream): I am ashamed of my first cut at this. Rewrote the loop so it does 
        not have this fatal flaw. It is a much better design as well.
        
        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt: Changes made this test
        have what I consider to be a better result. Going with it.

2004-12-06  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3871718> REGRESSION (125-168): text marked bold with font that does not have bold variant copies as non-bold

        Reviewed by hyatt.

        * kwq/DOM.mm:
        (-[DOMElement _font]): new SPI for AppKit
        * kwq/DOMPrivate.h:

2004-12-06  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3906327> Select All of a large document is slow (>15 secs on my machine for attached specimen)

        * kwq/KWQScrollView.mm: (QScrollView::updateContents): Intersect with visibleRect before calling through
        to NSView to dirty; NSView could also be more efficient in this case (I filed 3906343).

2004-12-06  John Sullivan  <sullivan@apple.com>

        Darin found what appears to be the real leak that we were falsely blaming
        on the 'leaks' tool (3880245). I made the change, and ran layout tests and PLT to make
        sure nothing barfed.

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        call clearProperties() instead of just setting numParsedProperties to 0
        (CSSParser::parseDeclaration):
        ditto
        (CSSParser::createStyleDeclaration):
        ditto

2004-12-06  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        New layout tests.

        * layout-tests/editing/inserting/insert-div-001-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-001.html: Added.
        * layout-tests/editing/inserting/insert-div-002-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-002.html: Added.
        * layout-tests/editing/inserting/insert-div-003-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-003.html: Added.
        * layout-tests/editing/inserting/insert-div-004-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-004.html: Added.
        * layout-tests/editing/inserting/insert-div-005-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-005.html: Added.
        * layout-tests/editing/inserting/insert-div-006-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-006.html: Added.
        * layout-tests/editing/inserting/insert-div-007-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-007.html: Added.
        * layout-tests/editing/inserting/insert-div-008-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-008.html: Added.
        * layout-tests/editing/inserting/insert-div-009-expected.txt: Added.
        * layout-tests/editing/inserting/insert-div-009.html: Added.

2004-12-06  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/3906948> REGRESSION (Mail): Insert paragraph code can make the insertion point "stick" in place.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::doApply): Call insertBlockPlaceholderIfNeeded(), passing block
        being added to this function. This ensures that the added block has a height.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.

2004-12-06  Ken Kocienda  <kocienda@apple.com>
 
        Reviewed by John
        
        * khtml/dom/dom_string.cpp:
        (DOM::DOMString::substring): Expose method already on DOMStrimgImpl.
        * khtml/dom/dom_string.h: Ditto.
        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::rebalanceWhitespace): New helper to create and execute a
        RebalanceWhitespaceCommand instance.
        (khtml::DeleteSelectionCommand::doApply): Call rebalanceWhitespace() after running command.
        (khtml::InsertLineBreakCommand::doApply): Ditto.
        (khtml::InsertParagraphSeparatorCommand::doApply): Ditto.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
        (khtml::InsertTextCommand::input): Ditto.
        (khtml::RebalanceWhitespaceCommand::RebalanceWhitespaceCommand): New command.
        (khtml::RebalanceWhitespaceCommand::~RebalanceWhitespaceCommand): Ditto.
        (khtml::RebalanceWhitespaceCommand::doApply): Ditto.
        (khtml::RebalanceWhitespaceCommand::doUnapply): Ditto.
        (khtml::RebalanceWhitespaceCommand::preservesTypingStyle): Ditto.
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Ditto.
        * khtml/editing/htmlediting.h: Ditto.
        (khtml::RebalanceWhitespaceCommand::): Ditto.

2004-12-05  Darin Adler  <darin@apple.com>

        - fixed small problem in my check-in from yesterday

        * kwq/KWQEvent.mm:
        (positionForEvent): Get location from event without raising exception if it's the wrong type.
        (clickCountForEvent): Same, for clickCount.
        (QMouseEvent::QMouseEvent): Use the new helper functions so this can be constructed even with
        the wrong type of NSEvent. Required for cases where a keyboard event causes a "click" and we need
        to synthesize a QMouseEvent for KHTML internal use, using the key down NSEvent.

2004-12-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3878329> REGRESSION (169-170): colors are wrong for my.yahoo.com due to CSS background parsing changes

        * khtml/css/cssparser.cpp: (CSSParser::parseBackgroundShorthand): Changed function so it doesn't rely on the position
        attribute being at the end of the array and then moved position attribute before color attribute so it takes precedence.
        Since "0" can be both the X coordinate of a position and a legal color (meaning black), we need to do position first.

        - fixed <rdar://problem/3760869> click events for input type=button or type=checkbox don't have flags like shiftKey set

        * khtml/rendering/render_form.h: Remove unused RenderFormElement fields.
        * khtml/rendering/render_form.cpp:
        (RenderFormElement::RenderFormElement): Take out code to set a bunch of unused fields.
        (RenderFormElement::slotClicked): Change to create the QMouseEvent from the actual mouse event rather than
        creating it with all the flags set to 0, using the new QMouseEvent constructor that does so.

        * kwq/KWQEvent.h: Added constructor that takes no parameters which uses the current event from AppKit.
        Made the click count getter const and added an isDoubleClick that matches the logic used elsewhere.
        Added a fixState helper method so the constructors can save code.
        * kwq/KWQEvent.mm:
        (QMouseEvent::QMouseEvent): Factored out the state-fixing code that was in the two existing constructors
        and added a third constructor that uses the "current event" from AppKit (used above).
        (QMouseEvent::fixState): Compute state and click count based on event type.

        - fixed first symptom of <rdar://problem/3830936> REGRESSION (125-165): crash due to null font family, hang at changeforamerica.com

        * kwq/KWQFontFamily.mm: (KWQFontFamily::getNSFamily): Handle empty strings specially so we don't run into trouble when
        the family name is a null string. This prevents the crash, but there are still other problems that may have the same
        underlying cause in CSS.

        - fixed <rdar://problem/3829808> Safari crashes when adding a DOM node that was removed from an XMLHTTP request result

        * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::insertedIntoDocument):
        Added nil check before calling scheduleRelayout. This is new code so the nil-dereference is a recent regression.

2004-12-03  Chris Blumenberg  <cblu@apple.com>

	New fixes for:
	<rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
	<rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
	<rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
	<rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear

        Reviewed by darin, rjw, kocienda.

        * khtml/misc/loader.cpp:
        (CachedObject::~CachedObject):
        (CachedCSSStyleSheet::checkNotify):
        (Loader::servePendingRequests):
        (Loader::slotFinished):
        (Loader::slotReceivedResponse):
        (Cache::requestImage):
        (Cache::requestScript):
        * khtml/misc/loader.h:
        (khtml::CachedObject::CachedObject):
        (khtml::CachedObject::response):
        (khtml::CachedObject::allData):
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJobPrivate::TransferJobPrivate):
        (KIO::TransferJobPrivate::~TransferJobPrivate):
        (KIO::TransferJob::TransferJob):
        (KIO::TransferJob::assembleResponseHeaders):
        (KIO::TransferJob::retrieveCharset):
        (KIO::TransferJob::emitResult):
        (KIO::TransferJob::emitReceivedResponse):
        * kwq/KWQLoader.h:
        * kwq/KWQLoader.mm:
        (KWQHeaderStringFromDictionary):
        (KWQCheckCacheObjectStatus):
        (KWQIsResponseURLEqualToURL):
        (KWQResponseURL):
        (KWQResponseMIMEType):
        (KWQCacheObjectExpiresTime):
        (khtml::CachedObject::setResponse):
        (khtml::CachedObject::setAllData):
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (QPixmap::QPixmap):
        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishJobAndHandle:]):
        (-[KWQResourceLoader cancel]):
        (-[KWQResourceLoader reportError]):
        (-[KWQResourceLoader finishWithData:]):
        * kwq/KWQSignal.h:
        * kwq/KWQSignal.mm:
        (KWQSignal::call):
        * kwq/KWQSlot.h:
        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot):
        (KWQSlot::call):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreResourceLoader.h:

2004-12-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3876093> REGRESSION (166-167): Setting slider control's value from JavaScript has no effect (breaks RSS)

        * khtml/rendering/render_form.cpp:
        (RenderSlider::updateFromElement): Call setValue to update the value of the DOM element rather than
        modifying the m_value data member directly. We don't use m_value at all for sliders now, and in fact
        the code relies on the fact that m_value is null. Setting m_value to a non-null value was causing the bug.
        (RenderSlider::slotSliderValueChanged): Ditto.

2004-12-03  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - fixed <rdar://problem/3889411> REGRESSION (125-172): repro crash in 
        khtml::BackgroundLayer::cullEmptyLayers

        * khtml/rendering/render_style.cpp:
        (BackgroundLayer::cullEmptyLayers):
        added missing nil check

=== Safari-173 ===

2004-12-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        Roll out some recent changes by Chris that caused a performance regression.
        Fix is in hand, but it is a little risky this close to a submission. So,
        we have decided to roll back the change with the regression and roll in
        the new code after we submit.

        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssvalues.c:
        (hash_val):
        (findValue):
        * khtml/misc/htmlattrs.c:
        (hash_attr):
        (findAttr):
        * khtml/misc/htmltags.c:
        (hash_tag):
        (findTag):
        * khtml/misc/loader.cpp:
        (CachedObject::~CachedObject):
        (CachedObject::setResponse):
        (CachedCSSStyleSheet::checkNotify):
        (Loader::servePendingRequests):
        (Loader::slotFinished):
        (Loader::slotReceivedResponse):
        (Cache::requestImage):
        (Cache::requestScript):
        * khtml/misc/loader.h:
        (khtml::CachedObject::CachedObject):
        (khtml::CachedObject::response):
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJobPrivate::TransferJobPrivate):
        (KIO::TransferJobPrivate::~TransferJobPrivate):
        (KIO::TransferJob::TransferJob):
        (KIO::TransferJob::assembleResponseHeaders):
        (KIO::TransferJob::retrieveCharset):
        (KIO::TransferJob::emitResult):
        (KIO::TransferJob::emitReceivedResponse):
        * kwq/KWQLoader.h:
        * kwq/KWQLoader.mm:
        (KWQHeaderStringFromDictionary):
        (KWQCheckCacheObjectStatus):
        (KWQRetainResponse):
        (KWQReleaseResponse):
        (KWQIsResponseURLEqualToURL):
        (KWQResponseURL):
        (KWQResponseMIMEType):
        (KWQResponseTextEncodingName):
        (KWQResponseHeaderString):
        (KWQCacheObjectExpiresTime):
        (KWQLoader::KWQLoader):
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (QPixmap::QPixmap):
        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishJobAndHandle]):
        (-[KWQResourceLoader cancel]):
        (-[KWQResourceLoader reportError]):
        (-[KWQResourceLoader finish]):
        * kwq/KWQSignal.h:
        * kwq/KWQSignal.mm:
        (KWQSignal::call):
        * kwq/KWQSlot.h:
        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot):
        (KWQSlot::call):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreResourceLoader.h:

2004-12-03  John Sullivan  <sullivan@apple.com>

        Reviewed by Chris.
        
        - fixed <rdar://problem/3903990> can't tab to all items on www.google.com any more (other pages too?)

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::nextKeyViewInFrameHierarchy):
        when checking whether we moved the focus to another view, make sure we didn't "move" it to
        our documentView, because that's no move at all.

2004-12-03  Darin Adler  <darin@apple.com>

        Reviewed by Vicki.

        - fixed <rdar://problem/3901109> REGRESSION (171-172): repro crash in DOM::NodeImpl::setChanged at chick-fil-a.com

        * khtml/css/css_valueimpl.cpp: (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl):
        Added missing initialization for base class and node pointer.

        - fixed a few places that could leave dangling node pointers

        * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::~HTMLBodyElementImpl):
        Clear out the node pointer when the node is destroyed.
        * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::~HTMLElementImpl): Ditto.

2004-12-03  Chris Blumenberg  <cblu@apple.com>

	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. 
	Fixed: <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account

        Reviewed by rjw.

        * khtml/misc/loader.cpp:
        (Loader::servePendingRequests): pass data param to slotFinished, removed allData signal
        (Loader::slotFinished): take data param
        * khtml/misc/loader.h:
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJob::TransferJob): have m_result take a data param, removed m_allData
        (KIO::TransferJob::emitResult): take data param and pass it
        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishJobAndHandle:]): take data param and pass it
        (-[KWQResourceLoader cancel]): pass nil for data
        (-[KWQResourceLoader reportError]): ditto
        (-[KWQResourceLoader finishWithData:]): pass data
        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot): pass data param to slotFinished
        (KWQSlot::call): added support for slotFinished_Loader, removed slotAllData

2004-12-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Did some clean up in the Position class as a result of trying to write some new layout
        tests and discovering a bug along the way.

        I removed these three functions from the Position class:
        
        1. bool isFirstRenderedPositionOnLine() const;
        2. bool isLastRenderedPositionOnLine() const;
        3. static bool renderersOnDifferentLine(RenderObject *r1, long o1, RenderObject *r2, long o2);
        4. bool inFirstEditableInRootEditableElement() const;

        The first two have replacements in the VisiblePosition class, and some code has been
        moved to use these new variants. The third function was a helper used only by these
        first two function, and can be removed as well. The fourth function was not used by anyone.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertTextCommand::input): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
        * khtml/editing/visible_position.cpp:
        (khtml::visiblePositionsOnDifferentLines): Added an additional check for blocks to this function.
        Incorrect results were being returned when asking about positions at the starts of blocks.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousCharacterPosition): Change over to use VisiblePosition isFirstVisiblePositionOnLine().
        (DOM::Position::nextCharacterPosition): Change over to use VisiblePosition isLastVisiblePositionOnLine().
        (DOM::Position::rendersInDifferentPosition): Removed use of #3 helper in a log message. We can live without it.
        * khtml/xml/dom_position.h: Update header for deletions.

2004-12-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Terminology change in execCommand command identifiers. Specifically, the name of 
        "InsertNewline" command has been changed to "InsertLineBreak". This matches the 
        terminology used by AppKit. It is also more accurate, since the insertion of a
        "br" element is what the command does. The inspiration for this change is so the 
        -insertNewline AppKit method can be mapped to insert a new "div" element in 
        a document and avoid ambiguity with what the javascript editing command does.
        
        * khtml/editing/jsediting.cpp
        * layout-tests/editing/deleting/delete-tab-004.html
        * layout-tests/editing/editing.js
        * layout-tests/editing/inserting/insert-3654864-fix.html
        * layout-tests/editing/inserting/insert-3659587-fix.html
        * layout-tests/editing/inserting/insert-3775316-fix.html
        * layout-tests/editing/inserting/insert-3800346-fix.html
        * layout-tests/editing/inserting/insert-br-001.html
        * layout-tests/editing/inserting/insert-br-002.html
        * layout-tests/editing/inserting/insert-br-003.html
        * layout-tests/editing/inserting/insert-br-004.html
        * layout-tests/editing/inserting/insert-br-005.html
        * layout-tests/editing/inserting/insert-br-006.html
        * layout-tests/editing/inserting/insert-br-007.html
        * layout-tests/editing/inserting/insert-br-008.html
        * layout-tests/editing/inserting/insert-tab-004.html
        * layout-tests/editing/inserting/insert-text-with-newlines.html
        * layout-tests/editing/pasteboard/paste-text-010.html

2004-12-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3786362> REGRESSION (Mail): pasted text loses one newline

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertLineBreakCommand::doApply): Added check for strict mode before adding an extra br element
        at the end of a block. This is only necessary in quirks mode. Also, lower-case "br" used to make element.
        (khtml::ReplaceSelectionCommand::doApply): If the replacement adds a br element as the last element
        in a block and the document is in quirks mode, add an additional br to make the one in the 
        replacement content show up. This turns out to be much the same logic as is done in InsertLineBreakCommand.
        * layout-tests/editing/inserting/insert-3786362-fix-expected.txt: Added.
        * layout-tests/editing/inserting/insert-3786362-fix.html: Added.

2004-12-02  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images

	Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
	the b/f cache won't incorrectly trash the previous state when restoring.

        Reviewed by John.

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
        (-[WebCoreBridge canCachePage]):
        (-[WebCoreBridge clear]):

2004-12-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Richard

        Fix for this bug:
        
        <rdar://problem/3857775> 8A293: Mail.app crashes converting copy-pasted text into plain text

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::commonAncestorContainer): Return the document element if no common ancestor container
        was found. This can happen in cases where the DOM was built from malformed markup (as in the case
        of this bug where there is content after the body tag). Did a little code clean up as well.
        (DOM::RangeImpl::compareBoundaryPoints): Made code more robust by adding some null checks.

2004-12-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection was created right-to-left

        * khtml/khtml_part.cpp:
        (KHTMLPart::handleMousePressEventSingleClick): Use RangeImpl::compareBoundaryPoints
        to figure out which end of the selection to extend.

2004-12-02  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

		<rdar://problem/3834917> REGRESSION (Mail): double-clicking blank line selects end of previous line
		Fixed originally reported bug plus the case of double-clicking whitespace at the beginning of a line, which has a similar result.

        * khtml/editing/visible_text.cpp:
        (khtml::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
        (khtml::SimplifiedBackwardsTextIterator::handleTextNode):
        (khtml::SimplifiedBackwardsTextIterator::handleReplacedElement):
        (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode):
        (khtml::SimplifiedBackwardsTextIterator::emitCharacter):
        Distinguish BR from whitespace.
        * khtml/editing/visible_text.h:
        Distinguish BR from whitespace.
        * khtml/editing/visible_units.cpp:
        (khtml::previousWordBoundary):
        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. 

2004-12-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3900996> Crash dragging past end of contentEditable DIV, at DOM::RangeImpl::pastEndNode() const + 24

        * khtml/xml/dom_position.cpp:
        (DOM::Position::equivalentRangeCompliantPosition): Fixed this function so that it constrains the offset
        of the position to be >= 0 and <= number of kids of its node. Not doing this constraining led to a DOM
        exception trying to use a Position returned from this function to set the boundary point of a Range (which
        eventually led to the crash). Since this crash happened, it seems like this function was failing in its
        contract to return a range-compliant position, hence the need for this fix.

2004-12-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        Moving code only.

        * khtml/editing/htmlediting.cpp: Move ReplaceSelectionCommand into alphabetical order with
        regard to other editing commands. The class had a name change ages ago, and it was never
        moved.
        * khtml/editing/htmlediting.h: Ditto.

2004-12-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Some improvements for paste, including some new code to annotate
        whitespace when writing to the pasteboard to ensure that the meaning
        of the markup on the pasteboard is unambiguous.
        
        There is also new code for reading this annotated markup from the pasteboard,
        removing the nodes that were added only to prevent ambiguity.

        * WebCore.pbproj/project.pbxproj: Added html_interchange.h and html_interchange.cpp files.
        The header should have been added earlier, but I did not do so.
        * khtml/editing/html_interchange.cpp: Added.
        (convertHTMLTextToInterchangeFormat):
        * khtml/editing/html_interchange.h: Added some new constants for use with whitespace annotations.
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment): Now looks for and removes annotations added for whitespace.
        Also fixed a bug in the code that counts blocks in a fragment.
        (khtml::ReplacementFragment::isInterchangeConvertedSpaceSpan): New helper. Recognizes annotation spans.
        (khtml::ReplacementFragment::insertNodeBefore): New helper.
        (khtml::ReplaceSelectionCommand::doApply): Fixed a bug in the code that sets the start position
        for the replacement after deleting. This was causing a bug when pasting at the end of a block.
        * khtml/editing/htmlediting.h: Add some new declarations.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): Calls to startMarkup now pass true for the new annotate flag.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::stringValueForRange): New helper.
        (NodeImpl::renderedText): New helper to return only the rendered text in a node.
        (NodeImpl::startMarkup): Now takes an additional flag to control whether interchange annotations
        should be added. Called by the paste code.
        * khtml/xml/dom_nodeimpl.h: Added and modified function declarations.

        New test to check the khtml::ReplaceSelectionCommand::doApply fix.
        * layout-tests/editing/pasteboard/paste-text-010-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-010.html: Added.

2004-11-30  Chris Blumenberg  <cblu@apple.com>

        * ChangeLog: removed conflict marker

2004-11-30  Chris Blumenberg  <cblu@apple.com>

	Fixed:
	<rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
	<rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)

        Reviewed by darin.

        * khtml/misc/loader.cpp:
        (CachedObject::~CachedObject): release m_allData
        (CachedObject::setAllData): new
        (Loader::servePendingRequests): connect slotAllData
        (Loader::slotAllData): new
        (Cache::requestImage): tweak
        * khtml/misc/loader.h:
        (khtml::CachedObject::CachedObject): set allData to 0
        (khtml::CachedObject::allData): new
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJob::TransferJob): set m_allData
        (KIO::TransferJob::emitAllData): new
        * kwq/KWQLoader.mm:
        (KWQCheckCacheObjectStatus): pass WebKit the data instead of the length of the resource
        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishWithData:]): renamed to pass all data for the resource
        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot): support for slotAllData
        (KWQSlot::call):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreResourceLoader.h:

2004-11-30  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

2004-11-30  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	<rdar://problem/3805311> REGRESSION (159-163): onload in dynamically written document not called (causes blank search page at Japanese EPP site, many others)

        * khtml/khtml_part.cpp:
	(KHTMLPart::begin): call setParsing on document here after opening
	- from now on we'll only set parsing to true for a document open
	caused by page loading, not a programmatic one.
	* khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::open): don't setParsing to true here any more.

2004-11-30  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	- fix recent regression from collection perf fixes.
	
        * khtml/html/html_miscimpl.cpp:
        (HTMLFormCollectionImpl::updateNameCache): Look up the name
	attribute in the name cache, not the id cache (d'oh!)

2004-11-30  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - rolled in a KDE fix for a problem that may underlie a number of crashes

        * khtml/xml/dom2_rangeimpl.cpp: (RangeImpl::compareBoundaryPoints): Rolled in a change from
        the KDE guys to fix a subtle problem. Code said "n = n =".

        - rolled in a KDE fix for a containingBlock crash

        * khtml/rendering/render_object.cpp: Roll in a change from KDE that adds frameset to the list of
        elements that can not be a containingBlock. They said this fixes a crash, although I did not look
        into that further.

        - fixed <rdar://problem/3884660> 8A305: Repro crash in QScrollBar::setValue (affects Safari RSS)

        * kwq/KWQButton.mm:
        (-[KWQButton initWithQButton:]): Set up target and action here instead of in caller.
        (-[KWQButton detachQButton]): Added.
        (-[KWQButton sendConsumedMouseUpIfNeeded]): Check button for nil instead of checking target.
        (-[KWQButton mouseDown:]): Add calls to QWidget::beforeMouseDown/afterMouseDown.
        (-[KWQButton widget]): Added.
        (-[KWQButton becomeFirstResponder]): Added check to handle when button is 0.
        (-[KWQButton resignFirstResponder]): Ditto.
        (-[KWQButton canBecomeKeyView]): Ditto.
        (QButton::QButton): Remove target and action setup; handled in KWQButton now.
        (QButton::~QButton): Call detachQButton instead of setTarget:nil.

        * kwq/KWQComboBox.mm:
        (QComboBox::~QComboBox): Call detachQComboBox.
        (-[KWQPopUpButtonCell detachQComboBox]): Added.
        (-[KWQPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:]): Handle case where box is 0.
        (-[KWQPopUpButtonCell setHighlighted:]): Ditto.
        (-[KWQPopUpButton action:]): Ditto.
        (-[KWQPopUpButton widget]): Tweaked.
        (-[KWQPopUpButton mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.
        (-[KWQPopUpButton becomeFirstResponder]): Handle case where widget is 0.
        (-[KWQPopUpButton resignFirstResponder]): Ditto.
        (-[KWQPopUpButton canBecomeKeyView]): Ditto.

        * kwq/KWQLineEdit.mm: (QLineEdit::~QLineEdit): Updated to use new detachQLineEdit name.

        * kwq/KWQListBox.mm:
        (-[KWQTableView mouseDown:]): Added. Calls QWidget::beforeMouseDown/afterMouseDown.

        * kwq/KWQScrollBar.h: Removed m_scroller field.
        * kwq/KWQScrollBar.mm:
        (-[KWQScrollBar initWithQScrollBar:]): Rearranged a little bit.
        (-[KWQScrollBar detachQScrollBar]): Added.
        (-[KWQScrollBar widget]): Added.
        (-[KWQScrollBar mouseDown:]): Added.  Calls QWidget::beforeMouseDown and afterMouseDown.
        (QScrollBar::QScrollBar): Changed to no longer set m_scroller.
        (QScrollBar::~QScrollBar): Changed to call detachQScrollBar. No longer calls removeFromSuperview.
        (QScrollBar::setValue): Chagned to use getView instad of m_scrollBar.
        (QScrollBar::setKnobProportion): Ditto.
        (QScrollBar::scrollbarHit): Ditto.

        * kwq/KWQScrollView.mm:
        (QScrollView::addChild): Changed to call QWidget to add to superview to accomodate the
        hack where we don't remove right away when doing mouse tracking.
        (QScrollView::removeChild): Changed to call QWidget to remove from superview to accomodate
        the hack where we don't add right away when doing mouse tracking.

        * kwq/KWQSlider.h: Added destructor.
        * kwq/KWQSlider.mm:
        (-[KWQSlider initWithQSlider:]): Tweaked a little.
        (-[KWQSlider detachQSlider]): Added.
        (-[KWQSlider mouseDown:]): Added call to QWidget::beforeMouseDown/afterMouseDown.
        (-[KWQSlider widget]): Added.
        (QSlider::~QSlider): Added. Calls detachQSlider.

        * kwq/KWQTextArea.h: Added detachQTextEdit method.
        * kwq/KWQTextArea.mm:
        (-[KWQTextArea detachQTextEdit]): Added.
        (-[KWQTextArea textDidChange:]): Added check for widget of 0.
        (-[KWQTextArea becomeFirstResponder]): Ditto.
        (-[KWQTextArea nextKeyView]): Ditto.
        (-[KWQTextArea previousKeyView]): Ditto.
        (-[KWQTextArea drawRect:]): Ditto.
        (-[KWQTextAreaTextView insertTab:]): Ditto.
        (-[KWQTextAreaTextView insertBacktab:]): Ditto.
        (-[KWQTextAreaTextView shouldDrawInsertionPoint]): Ditto.
        (-[KWQTextAreaTextView selectedTextAttributes]): Ditto.
        (-[KWQTextAreaTextView mouseDown:]): Ditto.
        (-[KWQTextAreaTextView keyDown:]): Ditto.
        (-[KWQTextAreaTextView keyUp:]): Ditto.

        * kwq/KWQTextEdit.h: Added ~QTextEdit.
        * kwq/KWQTextEdit.mm: (QTextEdit::~QTextEdit): Added. Calls detachQTextEdit.

        * kwq/KWQTextField.h: Changed invalidate to detachQLineEdit.
        * kwq/KWQTextField.mm: (-[KWQTextFieldController detachQLineEdit]): Changed.

        * kwq/KWQWidget.h: Added addToSuperview/removeFromSuperview for use from QScrollView.
        Added beforeMouseDown and afterMouseDown for use in widget implementations.
        Removed unused hasMouseTracking function.
        * kwq/KWQWidget.mm:
        (QWidget::QWidget): Initialize two new fields.
        (QWidget::~QWidget): Added code to remove view when widget is destroyed.
        (QWidget::getOuterView): Remove unneeded exception blocking since we're just caling superview.
        (QWidget::addToSuperview): Added.
        (QWidget::removeFromSuperview): Added.
        (QWidget::beforeMouseDown): Added.
        (QWidget::afterMouseDown): Added.

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::setHasHorizontalScrollbar): Remove parent parameter; let addChild call addSubview:.
        (RenderLayer::setHasVerticalScrollbar): Ditto.

2004-11-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3863031> REGRESSION (Mail): caret continues flashing while mouse is down

        * khtml/khtml_part.cpp:
        (KHTMLPart::timerEvent): Add a check for whether the mouse is down. Keep the caret drawn
        with no blink if it is.

2004-11-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3861602> cursor gets lost trying to backspace to delete a form control

        * khtml/khtml_part.cpp:
        (KHTMLPart::setFocusNodeIfNeeded): This function would clear the selection if a <button>
        or <input type=image> was checked for focus since these elements are keyboard-focusable,
        but not mouse focusable. Also, this function did not work hard enough to set the focused
        node, and was content to clear it if the first element checked failed the test, rather
        than looking more at parents. This would have the effect of clearing, then resetting the
        focus on a DIV containing a button or image with content on either side of it in the
        process of arrowing over such content.

2004-11-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): Fix smart replace, which I (knowingly) broke with yesterday's checkin.
        Also, call updateLayout() in one more place to prevent stale information being returned from caretMaxOffset().
        * khtml/khtml_part.cpp:
        (KHTMLPart::isCharacterSmartReplaceExempt): Make this virtual and always return true. This gets rid of an
        ugly APPLE_CHANGES block and use of KWQ(part) in ReplaceSelectionCommand.
        * khtml/khtml_part.h: To help out with the isCharacterSmartReplaceExempt cleanup, add declaration.
        * kwq/KWQKHTMLPart.h: To help out with the isCharacterSmartReplaceExempt cleanup, make 
        isCharacterSmartReplaceExempt virtual.

2004-11-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::mergeEndNode): Fixed one-line coding mistake that created an endless loop.
        Seemed simple enough to land without review.

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris
    
        Rewrite of paste code (specifically the ReplaceSelectionCommand class). Many more cases
        are handled correctly now, including selections that span multiple blocks, and cases
        where content on the pasteboard ends in newlines (or what appear to be newlines to a
        user, really block ends or BRs). I also made one small, but important change in the 
        copy code to annotate the markup written to the pasteboard to support these selections 
        ending in newlines.

        New header that defines a couple of constants used in copying and pasting.

        * ForwardingHeaders/editing/html_interchange.h: Added.
        * khtml/editing/html_interchange.h: Added.
        
        Rewrite of the ReplaceSelectionCommand. There are several new helper functions, as well
        as a new helper class, ReplacementFragment, which encapsulates information and functions
        pertaining to a document fragment that is being inserted into a document.
        
        * khtml/editing/htmlediting.cpp:
        (khtml::ReplacementFragment::ReplacementFragment):
        (khtml::ReplacementFragment::~ReplacementFragment):
        (khtml::ReplacementFragment::firstChild): Simple accessor.
        (khtml::ReplacementFragment::lastChild): Ditto.
        (khtml::ReplacementFragment::mergeStartNode): Looks at the nodes in a fragment and determines
        the starting node to use for merging into the block containing the start of the selection.
        (khtml::ReplacementFragment::mergeEndNode): Same as above, but for the end of the selection.
        (khtml::ReplacementFragment::pruneEmptyNodes): Simple helper.
        (khtml::ReplacementFragment::isInterchangeNewlineComment): Determines if a node is the
        special annotation comment added in by the copy code.
        (khtml::ReplacementFragment::removeNode): Simple helper.
        (khtml::isComment): Simple helper.
        (khtml::isProbablyBlock): Determines if a node is of a type that is usually rendered as a block.
        I would like to do better than this some day, but this check will hold us until I can do better.
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand):
        (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand):
        (khtml::ReplaceSelectionCommand::doApply):
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Figures out the right ending selection.
        * khtml/editing/htmlediting.h: Declarations for the new ReplacementFragment class.
        (khtml::ReplacementFragment::root):
        (khtml::ReplacementFragment::type):
        (khtml::ReplacementFragment::isEmpty):
        (khtml::ReplacementFragment::isSingleTextNode):
        (khtml::ReplacementFragment::isTreeFragment):
        (khtml::ReplacementFragment::hasMoreThanOneBlock):
        (khtml::ReplacementFragment::hasLogicalNewlineAtEnd):
        
        This smaller set of changes markup generation to add the newline annotation described in the
        comment at the start of this entry.
        
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::addCommentToHTMLMarkup): Simple helper.
        (DOM::RangeImpl::toHTML): Added new EAnnotateForInterchange default argument to control whether
        comment annotations are added to the markup generated.
        * khtml/xml/dom2_rangeimpl.h: Add some new declarations.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge markupStringFromRange:nodes:]): Request that markup resulting from call to 
        DOM::RangeImpl::toHTML uses annotations when generating.
        
        New tests.        

        * layout-tests/editing/pasteboard/paste-text-001-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-001.html: Added.
        * layout-tests/editing/pasteboard/paste-text-002-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-002.html: Added.
        * layout-tests/editing/pasteboard/paste-text-003-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-003.html: Added.
        * layout-tests/editing/pasteboard/paste-text-004-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-004.html: Added.
        * layout-tests/editing/pasteboard/paste-text-005-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-005.html: Added.
        * layout-tests/editing/pasteboard/paste-text-006-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-006.html: Added.
        * layout-tests/editing/pasteboard/paste-text-007-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-007.html: Added.
        * layout-tests/editing/pasteboard/paste-text-008-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-008.html: Added.
        * layout-tests/editing/pasteboard/paste-text-009-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-009.html: Added.

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Made two small changes that make it possible for comments to have DOM nodes made for them
        when pasting. This relies on some earlier work I did some days ago.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::startMarkup): Get the string from the comment.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): Did some very minor
        rearranging. Now passes a flag when creating a contextual fragment, requesting that comments
        be included in the DOM.

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Added some new helpers to the VisiblePosition class. I will begin to use these when I check in
        my improved paste code.

        * khtml/editing/visible_position.cpp:
        (khtml::blockRelationship)
        (khtml::visiblePositionsInDifferentBlocks)
        (khtml::isFirstVisiblePositionInBlock)
        (khtml::isFirstVisiblePositionInNode)
        (khtml::isLastVisiblePositionInBlock)
        * khtml/editing/visible_position.h

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        * khtml/xml/dom_position.cpp:
        (DOM::Position::downstream): Fix a bug in downstream that prevented a call with DoNotStayInBlock
        specified from obeying that directive. The old code would stop at an outer block boundary in
        the case where that block had a block as its first child. The correct behavior is to drill into
        that inner block (and continue on drilling down, if possible), to find the correct position.

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Small improvements to the node-display debugging helpers.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::displayTree): Make the rootNode be this if there is no rootEditableElement.
        * khtml/xml/dom_nodeimpl.h: Make displayNode take a default argument of "" for its string.

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete): The downstream position in this function 
        may need to be adjusted when deleting text off the front part of a text node. This fixes a problem 
        I discovered while improving the paste command, where the insertion poitn wound up in the wrong
        place after the delete. 

2004-11-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Add a new helper function to insert a paragraph separator. Will be used in my
        upcoming paste improvments.

        * khtml/editing/htmlediting.cpp: Added function
        (khtml::CompositeEditCommand::insertParagraphSeparator)
        * khtml/editing/htmlediting.h: Ditto.

2004-11-23  David Harrison  <harrison@apple.com>

        Added various comments.

        * khtml/editing/htmlediting.cpp:
        (khtml::StyleChange::init):
        (khtml::ApplyStyleCommand::doApply):
        (khtml::ApplyStyleCommand::applyBlockStyle):
        (khtml::ApplyStyleCommand::applyInlineStyle):

2004-11-23  David Hyatt  <hyatt@apple.com>

	Hit testing in table cells with top/bottom space from vertical alignment didn't work.  I forgot about the
	super-secret yPos() lie that table cells do.  Use m_y instead of yPos().

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::nodeAtPoint):

2004-11-22  David Hyatt  <hyatt@apple.com>

	Make sure you can use document.createElement to make a <canvas> element.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLElement):

2004-11-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dave.

	<rdar://problem/3492044> performing JavaScript operations on form elements is slower than WinIE (HTMLFormCollection)
	<rdar://problem/3489679> selecting an item on the Apache bugzilla query page is very slow (HTMLFormCollection)
	<rdar://problem/3477810> checking 80 check boxes with JavaScript is 10x slower than in IE (HTMLFormCollection)
	<rdar://problem/3760962> JavaScript that toggles checkboxes is slow (HTMLCollection,HTMLFormCollection)
        
	* khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
        (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
        * khtml/html/html_formimpl.h:
        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::HTMLCollectionImpl):
        (HTMLCollectionImpl::~HTMLCollectionImpl):
        (HTMLCollectionImpl::CollectionInfo::CollectionInfo):
        (HTMLCollectionImpl::CollectionInfo::reset):
        (HTMLCollectionImpl::resetCollectionInfo):
        (HTMLCollectionImpl::checkForNameMatch):
        (appendToVector):
        (HTMLCollectionImpl::updateNameCache):
        (HTMLCollectionImpl::namedItems):
        (HTMLFormCollectionImpl::HTMLFormCollectionImpl):
        (HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
        (HTMLFormCollectionImpl::item):
        (HTMLFormCollectionImpl::updateNameCache):
        * khtml/html/html_miscimpl.h:

2004-11-22  David Hyatt  <hyatt@apple.com>

	Improve the WebCore cache so that the maximum cacheable object size is scaled based off the total cache
	size.
	
        Reviewed by mjs

        * khtml/misc/loader.cpp:
        (CachedObject::finish):
        (Cache::flush):
        (Cache::setSize):
        * khtml/misc/loader.h:
        (khtml::Cache::maxCacheableObjectSize):

2004-11-22  David Hyatt  <hyatt@apple.com>

	Fix for 3673381, huge directory listing so slow it seems like a hang.  Rework painting and hit testing so that
	it crawls the line box tree instead of the render tree.  This allows more precise intersection/containment testing
	that lets us short circuit earlier when painting and hit testing.
	
        Reviewed by mjs

        * khtml/khtml_part.cpp:
        (KHTMLPart::isPointInsideSelection):
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::paint):
        (khtml::RenderBlock::paintChildren):
        (khtml::RenderBlock::paintObject):
        (khtml::RenderBlock::paintFloats):
        (khtml::RenderBlock::nodeAtPoint):
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::nodeAtPoint):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::paint):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::paintLines):
        (RenderFlow::hitTestLines):
        (RenderFlow::caretRect):
        (RenderFlow::addFocusRingRects):
        (RenderFlow::paintFocusRing):
        (RenderFlow::paintOutlines):
        (RenderFlow::paintOutlineForLine):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_frames.cpp:
        (RenderFrameSet::nodeAtPoint):
        * khtml/rendering/render_frames.h:
        * khtml/rendering/render_image.cpp:
        (RenderImage::nodeAtPoint):
        * khtml/rendering/render_image.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::paint):
        (RenderInline::nodeAtPoint):
        * khtml/rendering/render_inline.h:
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::paintLayer):
        (RenderLayer::hitTest):
        (RenderLayer::hitTestLayer):
        * khtml/rendering/render_layer.h:
        * khtml/rendering/render_line.cpp:
        (khtml::InlineBox::paint):
        (khtml::InlineBox::nodeAtPoint):
        (khtml::InlineFlowBox::flowObject):
        (khtml::InlineFlowBox::nodeAtPoint):
        (khtml::InlineFlowBox::paint):
        (khtml::InlineFlowBox::paintBackgrounds):
        (khtml::InlineFlowBox::paintBackground):
        (khtml::InlineFlowBox::paintBackgroundAndBorder):
        (khtml::InlineFlowBox::paintDecorations):
        (khtml::EllipsisBox::paint):
        (khtml::EllipsisBox::nodeAtPoint):
        (khtml::RootInlineBox::paintEllipsisBox):
        (khtml::RootInlineBox::paint):
        (khtml::RootInlineBox::nodeAtPoint):
        * khtml/rendering/render_line.h:
        (khtml::InlineRunBox::paintBackgroundAndBorder):
        * khtml/rendering/render_object.cpp:
        (RenderObject::hitTest):
        (RenderObject::setInnerNode):
        (RenderObject::nodeAtPoint):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::PaintInfo::PaintInfo):
        (khtml::RenderObject::PaintInfo::~PaintInfo):
        (khtml::RenderObject::paintingRootForChildren):
        (khtml::RenderObject::shouldPaintWithinRoot):
        * khtml/rendering/render_table.cpp:
        (RenderTable::layout):
        (RenderTable::paint):
        * khtml/rendering/render_text.cpp:
        (simpleDifferenceBetweenColors):
        (correctedTextColor):
        (InlineTextBox::nodeAtPoint):
        (InlineTextBox::paint):
        (InlineTextBox::selectionStartEnd):
        (InlineTextBox::paintSelection):
        (InlineTextBox::paintMarkedTextBackground):
        (InlineTextBox::paintDecoration):
        (RenderText::posOfChar):
        * khtml/rendering/render_text.h:
        (khtml::RenderText::paint):
        (khtml::RenderText::layout):
        (khtml::RenderText::nodeAtPoint):
        * khtml/xml/dom2_eventsimpl.cpp:
        (MouseEventImpl::computeLayerPos):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::prepareMouseEvent):
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject accessibilityHitTest:]):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::scrollOverflowWithScrollWheelEvent):
        (KWQKHTMLPart::eventMayStartDrag):
        (KWQKHTMLPart::khtmlMouseMoveEvent):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge elementAtPoint:]):
        (-[WebCoreBridge _positionForPoint:]):

2004-11-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dave.

	<rdar://problem/3890961> selecting an item on the Apache bugzilla query page can be sped up 10% (HTMLFormCollection)
	<rdar://problem/3890958> JavaScript that toggles checkboxes can be improved 73% (HTMLCollection,HTMLFormCollection)

	This avoids the O(N^2) penalty for named item traversal for form collections.

	It also combines the item traversal logic for all non-form
	collection operations into a single traverseNextItem
	function. This avoids having 5 copies of the big switch statement
	for this.

	Also fixed a bug that prevented the last form element from being removed properly.
        
        * khtml/html/html_formimpl.cpp:
        (DOM::removeFromVector):
	* khtml/dom/html_misc.cpp:
        (HTMLCollection::namedItems):
        * khtml/dom/html_misc.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLCollection::getNamedItems):
        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::traverseNextItem):
        (HTMLCollectionImpl::calcLength):
        (HTMLCollectionImpl::length):
        (HTMLCollectionImpl::item):
        (HTMLCollectionImpl::nextItem):
        (HTMLCollectionImpl::checkForNameMatch):
        (HTMLCollectionImpl::namedItem):
        (HTMLCollectionImpl::namedItems):
        (HTMLCollectionImpl::nextNamedItem):
        (HTMLFormCollectionImpl::calcLength):
        (HTMLFormCollectionImpl::namedItem):
        (HTMLFormCollectionImpl::nextNamedItem):
        (HTMLFormCollectionImpl::namedItems):
        * khtml/html/html_miscimpl.h:

2004-11-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Change around the way we block the Javascript "Paste" command identifier from
        being available. Formerly, this was done with an ifdef we never compiled in.
        Now, this is done with a couple of cheap runtime checks. The advantage is that
        we can now compile this command into development builds, and still yet switch
        on the command in deployment builds through the use of WebCore SPI so we can
        write and run layout tests with all of our builds.

        * khtml/editing/jsediting.cpp:
        (DOM::JSEditor::queryCommandSupported): Checks state of paste command in case
        command being queried is the paste command. 
        (DOM::JSEditor::setSupportsPasteCommand): New SPI to turn on paste command.
        * khtml/editing/jsediting.h: Ditto.
        * khtml/khtml_part.cpp:
        (KHTMLPart::pasteFromPasteboard): Added.
        (KHTMLPart::canPaste): Added.
        * kwq/KWQKHTMLPart.mm:
        (KHTMLPart::canPaste): Added.
        * kwq/KWQRenderTreeDebug.cpp:
        (externalRepresentation): Turn on paste command.
        * kwq/WebCoreBridge.h: Add canPaste call so WebKit can fill in the answer.

2004-11-21  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	<rdar://problem/3889655> HTMLCollectionImpl should use traverseNextNode to improve speed and save recursion
        
	* khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::calcLength):
        (HTMLCollectionImpl::getItem):
        (HTMLCollectionImpl::item):
        (HTMLCollectionImpl::nextItem):
        (HTMLCollectionImpl::getNamedItem):
        (HTMLCollectionImpl::namedItem):
        (HTMLCollectionImpl::nextNamedItemInternal):
        (HTMLFormCollectionImpl::nextNamedItemInternal):

2004-11-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3482935> JavaScript so slow it seems like a hang (hrweb.apple.com) (HTMLCollection?)
	<rdar://problem/3759149> PeopleSoft page in Safari twice as slow as Mozilla engine (HTMLFormCollection)
	<rdar://problem/3888368> selecting an item on the Apache bugzilla query page can be improved 95% (HTMLFormCollection)

	Many optimizations to HTMLFormCollection. Iterating it should not
	be N^2 any more, though finding items by name could still be.
	
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
        (DOM::HTMLFormElementImpl::length):
        (DOM::HTMLFormElementImpl::submitClick):
        (DOM::HTMLFormElementImpl::formData):
        (DOM::HTMLFormElementImpl::submit):
        (DOM::HTMLFormElementImpl::reset):
        (DOM::HTMLFormElementImpl::radioClicked):
        (DOM::appendToVector):
        (DOM::removeFromVector):
        (DOM::HTMLFormElementImpl::registerFormElement):
        (DOM::HTMLFormElementImpl::removeFormElement):
        (DOM::HTMLFormElementImpl::makeFormElementDormant):
        (DOM::HTMLFormElementImpl::registerImgElement):
        (DOM::HTMLFormElementImpl::removeImgElement):
        * khtml/html/html_formimpl.h:
        * khtml/html/html_miscimpl.cpp:
        (HTMLFormCollectionImpl::FormCollectionInfo::FormCollectionInfo):
        (void::HTMLFormCollectionImpl::FormCollectionInfo::reset):
        (HTMLFormCollectionImpl::resetCollectionInfo):
        (HTMLFormCollectionImpl::calcLength):
        (HTMLFormCollectionImpl::item):
        (HTMLFormCollectionImpl::getNamedItem):
        (HTMLFormCollectionImpl::getNamedFormItem):
        (HTMLFormCollectionImpl::firstItem):
        (HTMLFormCollectionImpl::nextItem):
        * khtml/html/html_miscimpl.h:
        (DOM::HTMLFormCollectionImpl::~HTMLFormCollectionImpl):
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::setAttribute):
        (ElementImpl::setAttributeMap):
        * kwq/KWQPtrVector.h:
        (QPtrVector::findRef):
        * kwq/KWQVectorImpl.h:
        * kwq/KWQVectorImpl.mm:
        (KWQVectorImpl::findRef):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge elementWithName:inForm:]):
        (-[WebCoreBridge controlsInForm:]):

2004-11-19  David Harrison  <harrison@apple.com>

        Reviewed by Ken and Darin.

        <rdar://problem/3856215> Cannot remove bold from the beginning of a message

        Problem is that KHTMLPart::computeAndSetTypingStyle always looked upstream
        for the existing style, but in this case (hitting cmd-B with caret at top of
        file) there is nothing upstream.  Changed this to use the VisiblePosition
        deepEquivalent instead.
        
        * khtml/khtml_part.cpp:
        (KHTMLPart::computeAndSetTypingStyle):

=== Safari-172 ===

2004-11-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3864151> REGRESSION (125-167): Chrysler.com never stops loading
	
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::close): Don't fire the onload handler if there is a
	redirect pending. This is a very long-standing bug that was masked
	by our previously incorrect redirect logic. It used to be that an
	older redirect would always win. Recently we changed things so
	that a newer redirect would win, but a script that causes a
	redirect would stop parsing once complete (so if there are two
	redirects in the same script, the latter wins). However, we should
	have also prevented onload in this case. Testing with other
	browsers shows that onload handlers do not run at all when there
	is a pending redirect.

2004-11-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix some object lifetime issues in these two commands. This fixes some crashes
        I am seeing in some new code I am working on, but have not yet reproduced otherwise.

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): No longer deref nodes
        in the ancestor list. They are not ref'ed when put on list. D'uh.
        (khtml::InsertParagraphSeparatorCommand::doApply): Ref all cloned nodes that are created by the command
        before putting them on the cloned nodes list. This are still deref'ed in the destructor.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto
        destructor comment.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto doApply comment.

2004-11-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Fix for this bug:
        
        <rdar://problem/3655241> setTypingStyle: does not set the real typing style, and typingStyle does not return it

        * khtml/khtml_part.cpp:
        (KHTMLPart::computeAndSetTypingStyle): New helper that does the work of reducing a passed-in style
        declaration given the current selection, and then sets the minimum necessary style as the typing
        style on the part.
        (KHTMLPart::applyStyle): Call new computeAndSetTypingStyle. The guts of computeAndSetTypingStyle used
        to be here in the selection-as-caret case. But now [WebCoreBridge setTypingStyle:] needs this code
        as well.
        * khtml/khtml_part.h: Declare new computeAndSetTypingStyle() function.
        * kwq/WebCoreBridge.h: Declare new typingStyle and setTypingStyle: methods.
        * kwq/WebCoreBridge.mm: 
        (-[WebCoreBridge typingStyle]): Calls through to the part to retrieve the typing style.
        (-[WebCoreBridge setTypingStyle:]): Calls through to the part to set the typing style.

2004-11-18  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        Back out part of Darin's fix for <rdar://problem/3885729>, because the new exception gets triggered
        by Mail.app. Filed <rdar://problem/3886832> against Mail.app.

        * kwq/DOM-CSS.mm:
        (-[DOMCSSStyleDeclaration setProperty:::]):

2004-11-18  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3587481> Bug Reporter Login Page: Password AutoFill does not work reliably

        Reviewed by john.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::currentForm): just return the current form, don't scan the entire document looking for a form if there is no current form

2004-11-18  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Chris.

	- fix recursive item traversal, use traverseNextNode() instead of
	the buggy hand-rolled traversal.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeListImpl::recursiveItem):

2004-11-17  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3885744> crash with XMLHttpRequest test page (reported by KDE folks)

        * khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::slotFinished):
        Rolled in fix from KDE; make sure to set job to 0 before calling changeState.

        - fixed <rdar://problem/3885729> attempting to modify a computed style does nothing, but should raise a DOM exception
        - fixed <rdar://problem/3885731> style declarations use too many malloc blocks; switch to QValueList
        - fixed <rdar://problem/3885739> DOM::NodeImpl accessor in DOM::Node class is hot; should be inlined
        - changed NodeImpl calls like replaceChild to always ref/deref the parameter; this is a better way to fix
          an entire category of leaks we have been fixing one by one recently
        - changed computed styles so they hold a reference to the DOM node; the old code could end up with a
          stale RenderObject pointer, although I never saw it do that in practice
        - implemented the length and item methods for computed styles
        - implemented querying additional properties in computed styles (29 more)

        * khtml/khtml_part.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
        now a separate class rather than a typedef. Changed the parameter type of setTypingStyle to
        take a mutable style.
        * khtml/khtml_part.cpp:
        (KHTMLPart::setTypingStyle): Change parameter to take a mutable style.
        (KHTMLPart::applyStyle): Add code to make a mutable style in case we are passed
        a computed style; also change some types to mutable style.
        (updateState): Update iteration of CSSProperty objects in a style declaration to use
        the new valuesIterator interface.
        (KHTMLPart::selectionHasStyle): Add a call to makeMutable.
        (KHTMLPart::selectionStartHasStyle): Add call to makeMutable and update iteration.
        (editingStyle): Change type to mutable style, and simplify the style-creation calls,
        including accomodating the exception code that setCssText has now.
        (KHTMLPart::applyEditingStyleToElement): Change types to mutable style.
        (KHTMLPart::removeEditingStyleFromElement): Change code to call setChanged only if removing
        the style attributes really was a change, although it's not an important optimization it's
        good to do it right.

        * khtml/css/css_base.h: Remove unneeded setParsedValue method.
        * khtml/css/css_base.cpp: Remove unneeded setParsedValue method. All the places that were
        calling it were already removing the old property explicitly, so the code in here to remove
        the property again was redundant.

        * khtml/css/css_computedstyle.h: Updated virtual functions for changes to parameters in base class.
        Moved all the "set"-type functions so they are private. Store a node pointer instead of a renderer.
        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl): Hold a reference to
        the node we compute style for, so we don't end up with a pointer to a deallocated RenderObject.
        Before we had no guarantee the object would outlast us.
        (DOM::CSSComputedStyleDeclarationImpl::setCssText): Add exception parameter, and set the
        exception to NO_MODIFICATION_ALLOWED_ERR.
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Update to use node pointer rather
        than renderer pointer. Added implementation for box-align, box-direction, box-flex, box-flex-group,
        box-lines, box-ordinal-group, box-orient, box-pack, caption-side, clear, cursor, direction,
        list-style-image, list-style-position, list-style-type, marquee-direction, marquee-repetition,
        marquee-style, user-modify, opacity, orphans, outline-style, page-break-after, page-break-before,
        page-break-inside, position, unicode-bidi, widows, z-index.
        (DOM::CSSComputedStyleDeclarationImpl::removeProperty): Add exception parameter, and set the
        exception to NO_MODIFICATION_ALLOWED_ERR.
        (DOM::CSSComputedStyleDeclarationImpl::setProperty): Ditto.
        (DOM::CSSComputedStyleDeclarationImpl::length): Implemented.
        (DOM::CSSComputedStyleDeclarationImpl::item): Implemented, calls getPropertyValue.
        (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Changed return type to
        CSSMutableStyleDeclarationImpl.
        (DOM::CSSComputedStyleDeclarationImpl::copy): Added.
        (DOM::CSSComputedStyleDeclarationImpl::makeMutable): Added.

        * khtml/css/css_ruleimpl.h: Update forward declaration of CSSMutableStyleDeclarationImpl since it's
        now a separate class rather than a typedef.
        * khtml/css/cssparser.h: Ditto.

        * khtml/css/css_valueimpl.h: Refactor CSSStyleDeclarationImpl into two classes. New derived class
        CSSMutableStyleDeclarationImpl has the guts, and the base class has only some virtual functions.
        Removed a bunch of redundant stuff from other classes in this file too.
        (DOM::DashboardRegionImpl::setNext): Ref new before deref'ing old to handle the set-to-same case.
        (DOM::CSSProperty::CSSProperty): Added new overload so you can create a CSSProperty with initial values.
        (DOM::CSSProperty::operator=): Added.
        (DOM::CSSProperty::setValue): Use ref-before-deref pattern to simplify slightly.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Remove uneeded things.
        (DOM::CSSStyleDeclarationImpl::isStyleDeclaration): Put here now that it's no longer inline.
        (DOM::CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl): Added.
        (DOM::CSSMutableStyleDeclarationImpl::operator=): Added.
        (DOM::CSSMutableStyleDeclarationImpl::~CSSMutableStyleDeclarationImpl): Updated.
        (DOM::CSSMutableStyleDeclarationImpl::getPropertyValue): Removed now-uneeded check.
        (DOM::CSSMutableStyleDeclarationImpl::get4Values): Moved here from base class.
        (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue): Ditto.
        (DOM::CSSMutableStyleDeclarationImpl::getPropertyCSSValue): Update to use QValueList instead of QPtrList.
        (DOM::CSSMutableStyleDeclarationImpl::removeProperty): Added exception parameter, updated for QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::setChanged): Moved here from base class.
        (DOM::CSSMutableStyleDeclarationImpl::getPropertyPriority): Update to use QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::setProperty): Added more overloads to match new parameters.
        (DOM::CSSMutableStyleDeclarationImpl::setStringProperty): Update to use QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::setImageProperty): Ditto.
        (DOM::CSSMutableStyleDeclarationImpl::parseProperty): Remove unneeded initialization code due to QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::addParsedProperties): Added.
        (DOM::CSSMutableStyleDeclarationImpl::setLengthProperty): Moved here from base class.
        (DOM::CSSMutableStyleDeclarationImpl::length): Update to use QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::item): Moved here from base class.
        (DOM::CSSMutableStyleDeclarationImpl::cssText): Return empty string rather than null string when there are
        no styles in the list. Update to use QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::setCssText): Update to use QValueList and to take an exceptionCode
        parameter and set it.
        (DOM::CSSMutableStyleDeclarationImpl::merge): Update to use QValueList.
        (DOM::CSSStyleDeclarationImpl::diff): Update to use QValueList.
        (DOM::CSSMutableStyleDeclarationImpl::copyBlockProperties): Moved here from base class. Change return type.
        (DOM::CSSStyleDeclarationImpl::copyPropertiesInSet): Update to use QValueList and use stack, not new/delete.
        (DOM::CSSMutableStyleDeclarationImpl::makeMutable): Added.
        (DOM::CSSMutableStyleDeclarationImpl::copy): Added.

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue): Changed to use addParsedProperties.
        (CSSParser::parseDeclaration): Ditto.
        (CSSParser::createStyleDeclaration): Use new constructor to create declaration in a more efficient manner.

        * khtml/css/cssproperties.in: Removed unused font-size-adjust and -khtml-flow-mode.
        * khtml/css/cssproperties.c: Regenerated.
        * khtml/css/cssproperties.h: Regenerated.

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyDeclarations):
        Updated to use QValueList interface to CSSMutableStyleDeclarationImpl.

        * khtml/dom/css_value.cpp:
        (DOM::CSSStyleDeclaration::cssText): Removed unneeded cast.
        (DOM::CSSStyleDeclaration::setCssText): Added exception code handling.
        (DOM::CSSStyleDeclaration::getPropertyValue): Changed to call getPropertyValue directly instead of
        first doing getPropertyCSSValue and then doing cssText.
        (DOM::CSSStyleDeclaration::getPropertyCSSValue): Removed unneeded cast.
        (DOM::CSSStyleDeclaration::removeProperty): Added exception code handling. 
        (DOM::CSSStyleDeclaration::setProperty): Added exception code handling.
        (DOM::CSSStyleDeclaration::length): Removed unneeded cast.
        (DOM::CSSStyleDeclaration::item): Removed unneeded cast.
        (DOM::CSSStyleDeclaration::parentRule): Removed unneeded cast.
        (DOM::CSSValue::setCssText): Removed strange non-implementation (still not implemented).

        * khtml/dom/dom_node.h: Made isNull and handle functions inline.
        * khtml/dom/dom_node.cpp: Ditto.

        * khtml/editing/htmlediting.h: Change some types to mutable style.
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::typingStyle): Change return type to mutable style.
        (khtml::EditCommandPtr::setTypingStyle): Change parameter to mutable style.
        (khtml::StyleChange::init): Convert parameter to mutable style. Update to use QValueList.
        (khtml::EditCommand::assignTypingStyle): Change parameter to mutable type.
        (khtml::EditCommand::setTypingStyle): Ditto.
        (khtml::ApplyStyleCommand::ApplyStyleCommand): Convert parameter to mutable style.
        (khtml::ApplyStyleCommand::doApply): Change local variables to mutable style.
        (khtml::ApplyStyleCommand::applyBlockStyle): Change parameter to mutable style.
        (khtml::ApplyStyleCommand::applyInlineStyle): Ditto.
        (khtml::ApplyStyleCommand::isHTMLStyleNode): Ditto.
        (khtml::ApplyStyleCommand::removeCSSStyle): Ditto. Also update to use QValueList.
        (khtml::ApplyStyleCommand::removeBlockStyle): Change parameter to mutable style.
        (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
        (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): Ditto.
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): Ditto.
        (khtml::InsertLineBreakCommand::doApply): Convert locals to mutable style.
        (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
        (khtml::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand): Convert parameter to mutable style.

        * khtml/editing/jsediting.cpp: Convert types to mutable styles where we create styles.
        * khtml/html/html_baseimpl.h: Change type to mutable style.
        * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::createLinkDecl): Ditto.

        * khtml/html/html_elementimpl.h: Make CSSMappedAttributeDeclarationImpl use the mutable style
        class as a base class, and change types to mutable style as needed.
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::createInlineStyleDecl): Change type to mutable style.
        (HTMLElementImpl::parseHTMLAttribute): Call parseProperty method.
        (HTMLElementImpl::getInlineStyleDecl): Change type to mutable style.
        (HTMLElementImpl::additionalAttributeStyleDecl): Ditto.
        (HTMLElementImpl::createContextualFragment): Add ref/deref to fix potential node leak.
        (HTMLElementImpl::setInnerHTML): Remove ref/deref pair because this leak is now fixed by changes
        to appendChild.
        (HTMLElementImpl::setOuterHTML): Remove ref/deref pair because this leak is now fixed by changes
        to replaceChild.

        * khtml/html/html_tableimpl.h: Change types to mutable style.
        * khtml/html/html_tableimpl.cpp:
        (HTMLTableElementImpl::additionalAttributeStyleDecl): Change type to mutable style.
        (HTMLTableElementImpl::getSharedCellDecl): Change type to mutable style.
        (HTMLTableCellElementImpl::additionalAttributeStyleDecl): Change type to mutable style.

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::parseToken): Use a local variable to protect the node by ref'ing it. This is better
        than using an explicit delete to make the node go away, and is required for compatibility with the
        changes to the NodeImpl functions.
        (KHTMLParser::insertNode): Ditto.
        (KHTMLParser::createHead): Get rid of explicit delete, no longer needed because of changes to
        the NodeImpl functions.

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::createCSSStyleDeclaration): Call simpler constructor
        now that there's no need to make the property list explictly.

        * kwq/DOM-CSS.mm:
        (-[DOMCSSStyleDeclaration setCssText:]): Raise exception when appropriate.
        (-[DOMCSSStyleDeclaration removeProperty:]): Ditto.
        (-[DOMCSSStyleDeclaration setProperty:::]): Dito.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::insertBefore): Always do a ref/deref, so callers don't have to worry about whether the
        function succeeded or not for ownership purposes.
        (NodeImpl::replaceChild): Ditto.
        (NodeImpl::appendChild): Ditto.
        (NodeBaseImpl::insertBefore): Ditto.
        (NodeBaseImpl::replaceChild): Ditto.
        (NodeBaseImpl::appendChild): Ditto.
        (NodeBaseImpl::addChild): Ditto.

        * WebCore-tests.exp: Removed CSSStyleDeclaration::length; not sure why it was in here.
        * WebCore-combined.exp: Regenerated.

2004-11-18  Maciej Stachowiak  <mjs@apple.com>

        still even more build fixing

        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::resetCollectionInfo):

2004-11-18  Maciej Stachowiak  <mjs@apple.com>

        more build fixing

        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::resetCollectionInfo):

2004-11-18  Maciej Stachowiak  <mjs@apple.com>

        Fixed build problem.

        * khtml/html/html_miscimpl.h:
        (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo): it's haslength, not hasLenght.

2004-11-18  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	- merged and cleaned up HTMLCollection and HTMLFormCollection speedups from konqueror

	<rdar://problem/3822992> VIP: Program listings pages at directv.com take a really long time to load [HTMLCollection]
	<rdar://problem/3701991> Safari unresponsive loading (www.maxim-ic.com) (HTMLCollection)

	This is also a start on fixing 5 other bugs, but those need additional work to make
	HTMLFormCollection fast.

        * khtml/html/html_documentimpl.h:
        (DOM::HTMLDocumentImpl::collectionInfo):
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::~HTMLFormElementImpl):
        (DOM::HTMLFormElementImpl::isURLAttribute):
        (DOM::HTMLFormElementImpl::registerImgElement):
        (DOM::HTMLFormElementImpl::removeImgElement):
        * khtml/html/html_formimpl.h:
        * khtml/html/html_imageimpl.cpp:
        (HTMLImageElementImpl::HTMLImageElementImpl):
        (HTMLImageElementImpl::~HTMLImageElementImpl):
        * khtml/html/html_imageimpl.h:
        * khtml/html/html_miscimpl.cpp:
        (HTMLCollectionImpl::HTMLCollectionImpl):
        (HTMLCollectionImpl::~HTMLCollectionImpl):
        (HTMLCollectionImpl::updateCollectionInfo):
        (HTMLCollectionImpl::length):
        (HTMLCollectionImpl::item):
        (HTMLCollectionImpl::firstItem):
        (HTMLCollectionImpl::nextItem):
        (HTMLCollectionImpl::namedItem):
        (HTMLCollectionImpl::nextNamedItemInternal):
        (HTMLFormCollectionImpl::getNamedFormItem):
        * khtml/html/html_miscimpl.h:
        (DOM::HTMLCollectionImpl::):
        (DOM::HTMLCollectionImpl::CollectionInfo::CollectionInfo):
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::getElement):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::incDOMTreeVersion):
        (DOM::DocumentImpl::domTreeVersion):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::attach):
        (NodeImpl::detach):

2004-11-18  Kevin Decker  <kdecker@apple.com>

        Reviewed by Chris.

	fixed: <rdar://problem/3841842> getPropertyID expensive

        * kwq/DOM-CSS.mm:
        (getPropertyID): avoid unnecessary memory allocations by using a fixed-sized stack based buffer.

2004-11-17  David Hyatt  <hyatt@apple.com>

	Improve responsiveness by being willing to break out of the tokenizer.  (This patch was landed already
	and subsequently backed out).
	
        Reviewed by kocienda

        * khtml/html/html_baseimpl.cpp:
        (HTMLBodyElementImpl::insertedIntoDocument):
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::reset):
        (khtml::HTMLTokenizer::scriptHandler):
        (khtml::HTMLTokenizer::scriptExecution):
        (khtml::HTMLTokenizer::write):
        (khtml::HTMLTokenizer::continueProcessing):
        (khtml::HTMLTokenizer::timerEvent):
        (khtml::HTMLTokenizer::notifyFinished):
        * khtml/html/htmltokenizer.h:
        * khtml/khtmlview.cpp:
        (KHTMLViewPrivate::KHTMLViewPrivate):
        (KHTMLViewPrivate::reset):
        (KHTMLView::clear):
        (KHTMLView::layout):
        (KHTMLView::timerEvent):
        (KHTMLView::scheduleRelayout):
        (KHTMLView::layoutPending):
        (KHTMLView::haveDelayedLayoutScheduled):
        (KHTMLView::unscheduleRelayout):
        * khtml/khtmlview.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::close):
        (DocumentImpl::setParsing):
        (DocumentImpl::shouldScheduleLayout):
        (DocumentImpl::minimumLayoutDelay):
        (DocumentImpl::write):
        (DocumentImpl::finishParsing):
        (DocumentImpl::stylesheetLoaded):
        (DocumentImpl::updateStyleSelector):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::parsing):
        * kwq/KWQDateTime.mm:
        (KWQUIEventTime::uiEventPending):

2004-11-17  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.
        
        Make sure previousLineStart is non-null before calling compareBoundaryPoints.
        Treat null case as meaning no post-move merge is needed.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData):

2004-11-17  David Harrison  <harrison@apple.com>
        
        Added displayNode and displayTree methods for debugging.  Fixed comment typo in dispatchChildRemovalEvents.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::displayNode):
        (NodeImpl::displayTree):
        (NodeBaseImpl::dispatchChildRemovalEvents):
        * khtml/xml/dom_nodeimpl.h:

2004-11-16  John Sullivan  <sullivan@apple.com>

        Reviewed by Richard.
        
        - fixed <rdar://problem/3881929> 32 byte leak in editingStyle() in KHTMLPart (one-time only)

        * khtml/khtml_part.cpp:
        (editingStyle):
        delete the list we created when we're done with it

2004-11-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        It is unwise to use the QPtrList autodelete feature on shared objects like DOM nodes.
        Instead, I replaced this with a helper function that derefs DOM nodes stored in a 
        QPtrList when the list goes out of scope.

        * khtml/editing/htmlediting.cpp:
        (khtml::derefNodesInList): New helper to deref DOM nodes stored in a QPtrList.
        (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): No longer set lists to autodelete.
        (khtml::InsertParagraphSeparatorCommand::~InsertParagraphSeparatorCommand): Call new derefNodesInList helper.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):  
        No longer set lists to autodelete.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand):
         Call new derefNodesInList helper.
        * khtml/editing/htmlediting.h: Add virtual destructor for InsertParagraphSeparatorCommand. It had no need
        of one before, but now it does.

2004-11-15  David Harrison  <harrison@apple.com>

        Reviewed by Chris and Darin.
        
        <rdar://problem/3880304> Non-linear performance hit for style changes

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::traverseNextNode):
        (NodeImpl::traverseNextSibling):
        (NodeImpl::traversePreviousNodePostOrder):
        Return 0 rather than traversing beyond stayWithin when this == stayWithin.
        Add asserts that stayWithin is an ancestor of the returned node.

2004-11-15  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3880036> Many leaks from CSSComputedStyleDeclarationImpl::getPropertyCSSValue, seen in Mail and Blot

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Ref and deref the value returned from getPropertyCSSValue,
        since there's no guarantee it's already ref'd.
        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::getPropertyValue): Wrap result in a CSSValue to ref/deref.
        (CSSStyleDeclarationImpl::get4Values): Ref/deref explicitly.
        (CSSStyleDeclarationImpl::getShortHandValue): Ditto.
        (CSSStyleDeclarationImpl::merge): Ditto.
        (CSSStyleDeclarationImpl::diff): Ditto.
        * khtml/editing/htmlediting.cpp:
        (khtml::StyleChange::currentlyHasStyle): Ditto.
        (khtml::ApplyStyleCommand::removeCSSStyle): Ditto.
        * khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::parseHTMLAttribute): Ditto.
        * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::parseHTMLAttribute): Ditto.

2004-11-15  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        Use separate mutable style and computed style types as appropriate.
        For now this should have no effect, but it prepares us for refactoring later.
        Also remove some unnecessary "DOM::" prefixes and in one case factor out
        some shared code.

        * khtml/khtml_part.cpp:
        (KHTMLPart::typingStyle):
        (KHTMLPart::setTypingStyle):
        (updateState):
        (KHTMLPart::selectionHasStyle):
        (KHTMLPart::selectionStartHasStyle):
        (KHTMLPart::selectionComputedStyle):
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:

        * khtml/css/css_base.h:
        * khtml/css/css_ruleimpl.cpp:
        (CSSStyleRuleImpl::setDeclaration):
        * khtml/css/css_ruleimpl.h:
        (DOM::CSSFontFaceRuleImpl::style):
        (DOM::CSSPageRuleImpl::style):
        (DOM::CSSStyleRuleImpl::style):
        (DOM::CSSStyleRuleImpl::declaration):
        * khtml/css/css_valueimpl.h:
        (DOM::CSSPrimitiveValueImpl::):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseColor):
        (CSSParser::parseDeclaration):
        (CSSParser::createStyleDeclaration):
        * khtml/css/cssparser.h:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::addMatchedDeclaration):
        (khtml::CSSStyleSelector::matchRulesForList):
        (khtml::CSSStyleSelector::styleForElement):
        (khtml::CSSStyleSelector::applyDeclarations):
        * khtml/css/cssstyleselector.h:
        * khtml/css/parser.cpp:
        * khtml/css/parser.y:
        * khtml/dom/css_rule.h:
        * khtml/dom/css_stylesheet.h:
        * khtml/dom/css_value.h:
        * khtml/dom/dom2_views.cpp:
        * khtml/xml/dom2_viewsimpl.cpp:
        (DOM::AbstractViewImpl::getComputedStyle):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::importNode):
        (DocumentImpl::setStyleSheet):
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_xmlimpl.cpp:
        (DOM::ProcessingInstructionImpl::setStyleSheet):
        * khtml/xml/dom_xmlimpl.h:

        * khtml/dom/css_value.cpp:
        (DOM::throwException): Added.
        (DOM::CSSStyleDeclaration::setCssText): Call throwException, but always on 0 for now.
        The real thing is coming with the next change to refactor.
        (DOM::CSSPrimitiveValue::setFloatValue): Call throwException.
        (DOM::CSSPrimitiveValue::setStringValue): Ditto.

2004-11-15  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3878489> REGRESSION: modifying attribute of <textarea> blows away edited text (breaks simplemachines.org forum)

        * khtml/xml/dom_nodeimpl.h: Added boolean "children changed" parameter to
        dispatchSubtreeModifiedEvent, so it can be called in cases where only the
        node's attributes changed without sending a misleading childrenChanged call,
        but the childrenChanged call can happen at the exact right moment.
        * khtml/xml/dom_nodeimpl.cpp: Removed some uneeded "DOM::".
        (NodeImpl::dispatchSubtreeModifiedEvent): Only call "children changed" if
        the boolean true is passed in.

        * khtml/xml/dom_elementimpl.cpp:
        (NamedAttrMapImpl::addAttribute): Pass false for "children changed".
        (NamedAttrMapImpl::removeAttribute): Ditto.

2004-11-15  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - fixed <rdar://problem/3880075> leak in CSSStyleDeclarationImpl::copyPropertiesInSet, 
        seen often in Mail and Blot

        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::copyPropertiesInSet):
        delete temporary list after we're done using it

2004-11-15  Richard Williamson   <rjw@apple.com>

	Fixed leak (3879883) that John found.  Early return leaked
	allocated instance.

        Reviewed by John.

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):

2004-11-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3879569> Many leaks in EditCommand mechanism, seen in Mail

        Fixed a couple of object lifetime issues. The EditCommand class used to hold an
        EditCommandPtr to its parent, but this caused a a reference cycle in composite 
        commands as the children held a ref to their parent. Now, the parent variable
        is a non-retained reference to an EditCommand *. It would be nice to have a 
        weak reference to the parent or even override deref in composite commands (but I
        can't since deref() is not virtual). However, this should be OK since any
        dangling parent pointer is a sign of a bigger object lifetime problem that
        would need to be addressed anyway.

        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::CSSStyleDeclarationImpl): Fix bug in constructor that takes a 
        QPtrList<CSSProperty> *. List values must be copied into newly-allocated list, rather than
        just assigning the list variable passed in to the local list variable, or the list will be 
        double-deleted.
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommand::setStartingSelection): No longer call get(). m_parent is no longer a smart pointer.
        (khtml::EditCommand::setEndingSelection): Ditto.
        (khtml::EditCommand::assignTypingStyle): Short-circuit if passed in style is identical to current style.
        Unrelated to the change, but saves some ref's and deref's.
        (khtml::EditCommand::setTypingStyle): No longer call get(). m_parent is no longer a smart pointer.
        * khtml/editing/htmlediting.h: Change m_parent to a EditCommand *. Was an EditCommandPtr. Using an
        EditCommandPtr caused a reference cycle in composite commands as the children held a ref to their parent.
        (khtml::EditCommand::parent): No longer call get(). m_parent is no longer a smart pointer.

2004-11-15  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/3807080> Safari so slow it seems like a hang accessing a page on an IBM website
	
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeListImpl::NodeListImpl): Initialize isItemCacheValid, renamed isCacheValid to
	isLengthCacheValid.
        (NodeListImpl::recursiveLength): Adjusted for rename.
        (NodeListImpl::recursiveItem): Cache the last item accessed and its offset.
	If the same offset is looked up again, just return it, otherwise, if looking up
	a later offset, start at the last item and proceed from there.
        (NodeListImpl::itemById): Apply the special document optimization to all
	nodes that are either a document or in a document - just walk up to make
	sure the node found by ID has the root node as an ancestor.
        (NodeListImpl::rootNodeSubtreeModified): Adjust both cache bits.
        * khtml/xml/dom_nodeimpl.h: Prototype new stuff.

2004-11-15  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - fixed <rdar://problem/3879539> leak of NSString after pasting into editable HTML (e.g. Mail)

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::documentFragmentWithText):
        release mutable copy of string after we're done using it

2004-11-14  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs.

	fixed: <rdar://problem/3823038> LEAK: huge leak in DOM::HTMLElementImpl::createContextualFragment(DOM::DOMString const&, bool)

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::setInnerHTML): uses the ref counting system to deallocate fragments instead of explicitly invoking a destructor.
        (HTMLElementImpl::setOuterHTML): function is responsible for derefing the fragment prior to returning. Now it does.

2004-11-13  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/3878766> VIP: Program listings pages at directv.com takes 75% of time traversing NodeLists

        * khtml/dom/dom_node.cpp:
        (NodeList::itemById): New method, just forward to impl.
        * khtml/dom/dom_node.h: Prototype it.
        * khtml/ecma/kjs_dom.cpp:
        (DOMNodeList::tryGet): Instead of looping over the whole list to do by-id access,
	let the NodeList do it. The NodeList might be able to do it more efficiently.
        * khtml/xml/dom_nodeimpl.cpp:
	(NodeListImpl::itemById): Optimize for the case where the NodeList
	covers the whole document. In this case, just use getElementById,
	then check that the element satisfies the list criteria.
        (ChildNodeListImpl::nodeMatches): Return true only if the node is our child.
        (TagNodeListImpl::TagNodeListImpl): Irrelevant change to reformat initializers.
        * khtml/xml/dom_nodeimpl.h:

2004-11-12  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Gramps.

	- fixed another bug in the last checkin, isCacheValid was unitialized, resulting in
	sometimes using a huge bogus length value.
	
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeListImpl::NodeListImpl): Initialize isCacheValid.

2004-11-12  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed an infinite loop in that last check-in

        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::notifyLocalNodeListsSubtreeModified):
        Added a ++i to the loop so it won't get stuck on the first element in the list.

2004-11-12  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	- fixed <rdar://problem/3878183> Safari is 77% slower than it should be on a page on an IBM website due to NodeListImpl length
        
	I fixed this by changing NodeLists to cache their length, but
	invalidate it whenever there is a change in the DOM subtree at
	which they are rooted. This makes NodeListImpl::recursiveLength()
	drop completely off the profile, since we were repeatedly getting
	a length for the same NodeList over and over.
	
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::NodeImpl):
        (NodeImpl::~NodeImpl):
        (NodeImpl::registerNodeList):
        (NodeImpl::unregisterNodeList):
        (NodeImpl::notifyLocalNodeListsSubtreeModified):
        (NodeImpl::notifyNodeListsSubtreeModified):
        (NodeImpl::dispatchSubtreeModifiedEvent):
        (NodeListImpl::NodeListImpl):
        (NodeListImpl::~NodeListImpl):
        (NodeListImpl::recursiveLength):
        (NodeListImpl::recursiveItem):
        (NodeListImpl::rootNodeSubtreeModified):
        (ChildNodeListImpl::ChildNodeListImpl):
        (ChildNodeListImpl::length):
        (ChildNodeListImpl::item):
        (TagNodeListImpl::TagNodeListImpl):
        (TagNodeListImpl::length):
        (TagNodeListImpl::item):
        (NameNodeListImpl::NameNodeListImpl):
        (NameNodeListImpl::length):
        (NameNodeListImpl::item):
        * khtml/xml/dom_nodeimpl.h:

2004-11-12  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - various small cleanups

        * khtml/xml/dom_docimpl.h: Added policyBaseURL and setPolicyBaseURL.
        * khtml/html/html_documentimpl.h: Removed policyBaseURL and setPolicyBaseURL.

        * khtml/xml/xml_tokenizer.h: Marked isWaitingForScripts const.
        * khtml/xml/xml_tokenizer.cpp: (khtml::XMLTokenizer::isWaitingForScripts): Marked const.
        * khtml/html/htmltokenizer.h: Marked isWaitingForScripts const.
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::isWaitingForScripts): Marked const.
        (khtml::HTMLTokenizer::setOnHold): Took out extraneous line of code.

        * khtml/khtml_part.h: Removed docImpl function.
        * khtml/khtml_part.cpp: Ditto.

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::close): Simplified code that implements
        the "redirect during onload" optimization. Now uses isScheduledLocationChangePending.

        * kwq/KWQKHTMLPart.h: Removed now-unused _firstResponderAtMouseDownTime.
        * kwq/KWQKHTMLPart.mm: Removed _firstResponderAtMouseDownTime (forgot to land this
        part of the change last time, which is why the build broke).
        (KWQKHTMLPart::updatePolicyBaseURL): Use xmlDocImpl instead of docImpl.
        (KWQKHTMLPart::setPolicyBaseURL): Ditto.
        (KWQKHTMLPart::keyEvent): Ditto.
        (KWQKHTMLPart::dispatchCPPEvent): Ditto.
        (KWQKHTMLPart::bodyBackgroundColor): Ditto.

2004-11-12  Chris Blumenberg  <cblu@apple.com>

	<rdar://problem/3843312> REGRESSION: Tabbing into content area puts insertion point at start, should go to where it last was

        Reviewed by rjw.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::nextKeyViewInFrameHierarchy): only blow away selection when another view is focused

=== Safari-171 ===

2004-11-12  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed a couple places that would not work for XML documents

        * khtml/ecma/kjs_window.cpp:
        (Window::isSafeScript): Use xmlDocImpl instead of docImpl, since the function we're using
        is present on the base class.
        (WindowFunc::tryCall): More of the same.

2004-11-12  Darin Adler  <darin@apple.com>

        - land versions of these files generated by the newer gperf

        People building on Panther will continue to see these files modified.
        A workaround would be to install the newer gperf on our Tiger build machines.

        * khtml/css/cssproperties.c: Regenerated.
        * khtml/css/cssvalues.c: Regenerated.
        * khtml/html/doctypes.cpp: Regenerated.
        * khtml/html/kentities.c: Regenerated.
        * khtml/misc/htmlattrs.c: Regenerated.
        * khtml/misc/htmltags.c: Regenerated.
        * kwq/KWQColorData.c: Regenerated.

2004-11-11  Richard Williamson   <rjw@apple.com>
	
        Fix build horkage from previous checkin.
		
        * kwq/KWQKHTMLPart.h:

2004-11-11  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3846152> REGRESSION (125-166): can't drag text out of <input type=text> fields

        * kwq/WebCoreBridge.h: Added wasFirstResponderAtMouseDownTime: method.

        * kwq/KWQKHTMLPart.h: Removed _firstResponderAtMouseDownTime.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Use the new wasFirstResponderAtMouseDownTime:
        method on the bridge instead of _firstResponderAtMouseDownTime. This will return YES for the case where
        we started with the NSTextField as first responder, and then took focus away and gave it back, which
        makes dragging text work again.
        (KWQKHTMLPart::mouseDown): Removed code to set _firstResponderAtMouseDownTime.

2004-11-11  David Hyatt  <hyatt@apple.com>

	Disable the tokenizer deferral, since it hurts the PLT by 3% or so.
	
        Reviewed by vicki

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::continueProcessing):

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Maciej

        * khtml/editing/htmlediting.cpp:
        (khtml::InsertLineBreakCommand::doApply): Use new isLastVisiblePositionInBlock() helper instead
        of old isLastInBlock() member function on VisiblePosition. This is a cosmetic change in keeping
        with the prevailing style for the VisiblePosition class.
        * khtml/editing/htmlediting.h: Move isLastVisiblePositionInNode() function to visible_position.[cpp|h] files. 
        * khtml/editing/visible_position.cpp: Removed isLastInBlock() helper. Renamed to isLastVisiblePositionInBlock().
        (khtml::visiblePositionsInDifferentBlocks): New helper method.
        (khtml::isLastVisiblePositionInBlock): Ditto.
        (khtml::isLastVisiblePositionInNode): Ditto.
        * khtml/editing/visible_position.h: Add declarations for new functions.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::deleteInsignificantText): Call new compareBoundaryPoints convenience.
        (khtml::ApplyStyleCommand::removeBlockStyle): Ditto.
        (khtml::ApplyStyleCommand::removeInlineStyle): Ditto.
        (khtml::ApplyStyleCommand::nodeFullySelected): Ditto.
        (khtml::DeleteSelectionCommand::initializePositionData): Ditto.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::compareBoundaryPoints): New convenience variant of this function which takes two Position objects.
        * khtml/xml/dom2_rangeimpl.h: Ditto.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Some improvements to deleting when complete lines are selected.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): Detect when the line containing
        the end of a selection is fully selected. Turn off block merging in this case.
        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): Fix a bug in the check for
        whether a BR immediately followed a block. The old code could erroneously skip nodes.
        (khtml::DeleteSelectionCommand::handleGeneralDelete): Add a case for when the entire
        start block is selected. This new code will now delete this block in one call, rather
        than iterating over each child.
        * khtml/editing/visible_position.cpp:
        (khtml::visiblePositionsOnDifferentLines): New helper called in initializePositionData()
        to do the work mentioned above in the comment for that function.
        (khtml::isFirstVisiblePositionOnLine): Ditto.
        (khtml::isLastVisiblePositionOnLine): Ditto.
        * khtml/editing/visible_position.h: Add new functions.
        * layout-tests/editing/deleting/delete-line-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-001.html: Added.
        * layout-tests/editing/deleting/delete-line-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-002.html: Added.
        * layout-tests/editing/deleting/delete-line-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-003.html: Added.
        * layout-tests/editing/deleting/delete-line-004-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-004.html: Added.
        * layout-tests/editing/deleting/delete-line-005-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-005.html: Added.
        * layout-tests/editing/deleting/delete-line-006-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-006.html: Added.
        * layout-tests/editing/deleting/delete-line-007-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-007.html: Added.
        * layout-tests/editing/deleting/delete-line-008-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-008.html: Added.
        * layout-tests/editing/deleting/delete-line-009-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-009.html: Added.
        * layout-tests/editing/deleting/delete-line-010-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-010.html: Added.
        * layout-tests/editing/deleting/delete-line-011-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-011.html: Added.
        * layout-tests/editing/deleting/delete-line-012-expected.txt: Added.
        * layout-tests/editing/deleting/delete-line-012.html: Added.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Adele

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): Add some comments and a new piece of debugging output.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:

        <rdar://problem/3875618> REGRESSION (Mail): Hitting down arrow with full line selected skips line (br case)
        <rdar://problem/3875641> REGRESSION (Mail): Hitting down arrow with full line selected skips line (div case)

        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyMovingRightForward): Fixed by juggling the position as the starting point for
        the next line position when necessary.
        * layout-tests/editing/selection/move-3875618-fix-expected.txt: Added.
        * layout-tests/editing/selection/move-3875618-fix.html: Added.
        * layout-tests/editing/selection/move-3875641-fix-expected.txt: Added.
        * layout-tests/editing/selection/move-3875641-fix.html: Added.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Improved some function names, at John's urging. No changes to the
        functions themselves.
        
        canPerformSpecialCaseAllContentDelete() --> handleSpecialCaseAllContentDelete()
        canPerformSpecialCaseBRDelete() --> handleSpecialCaseBRDelete()
        performGeneralDelete() --> handleGeneralDelete()

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleSpecialCaseAllContentDelete)
        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete)
        (khtml::DeleteSelectionCommand::handleGeneralDelete)
        (khtml::DeleteSelectionCommand::doApply)
        * khtml/editing/htmlediting.h

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John
        
        Updated some layout test results that changed as a result of my last checking.
        Added a new test that has been in my tree for a few days.

        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt:
        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3851164-fix-expected.txt: Added.
        * layout-tests/editing/inserting/insert-3851164-fix.html: Added.

2004-11-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting.cpp:
        (khtml::debugNode): New debugging helper.
        (khtml::DeleteSelectionCommand::initializePositionData): No longer call obsoleted
        startPositionForDelete() and endPositionForDelete() functions. Just use the 
        m_selectionToDelete object to determine start and end positions for the delete.
        (khtml::DeleteSelectionCommand::canPerformSpecialCaseAllContentDelete): New
        function that creates a special case for deleting all the content in a root
        editable element.
        (khtml::DeleteSelectionCommand::doApply): Call canPerformSpecialCaseAllContentDelete()
        function before BR special case and the general case delete functions.
        * khtml/editing/htmlediting.h: Updated for changed functions.

2004-11-10  Kevin Decker  <kdecker@apple.com>

        Reviewed by mjs.
	
        Fixed <rdar://problem/3875011> DOMNodeList::tryGet() performs unnecessary (and expensive) dom tree traversals. Improved a loop from 2-n-squared to just n-squared.  

        * khtml/ecma/kjs_dom.cpp:
        (DOMNodeList::tryGet): Got rid of an unnecessary node traversal. 

2004-11-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): Move position adjustments for
        smart delete from the two functions below to here. There was an unnecessary double 
        calculation of the leading and trailing whitespace positions. Also refined the trailing
        case so it only acts when the leading position is null (which seems to match TextEdit in
        my tests). Also removed some unnecessary copying of Position objects.
        (khtml::DeleteSelectionCommand::startPositionForDelete): Move out smart delete adjustment
        from here.
        (khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.

2004-11-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        (khtml::DeleteSelectionCommand::performGeneralDelete): Add some more comments to
        make things more clear.
        * khtml/editing/selection.cpp:
        (khtml::Selection::toRange): Fixed the upstream and downstream calls so that the 
        resulting positions do not cross block boundaries. This was a bug and caused some
        delete problems when whole blocks were selected. I will be addressing that issue
        more fully in upcoming changes.

2004-11-10  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Some cleanups and fixes in upstream and downstream functions. 
        
        Removed redundant checks for isBlockFlow() when calling enclosingBlockFlowElement(). 
        Blocks do not need to skip the call to enclosingBlockFlowElement() for fear that the 
        block's enclosing block will be returned. 
        
        Remove code from upstream that confined the serach to block boundaries outside of
        the code which runs in the StayInBlock case. This code was redundant, and caused
        incorrect results to be returned in the DoNotStayInBlock case.
        
        In downstream, the check for crossing into a new block should use the equivalentDeepPosition()
        node, not the the this pointer's node.

        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream)
        (DOM::Position::downstream)

2004-11-09  David Hyatt  <hyatt@apple.com>

	Fix for 3873234, Safari UI is unresponsive when parsing multiple HTML docs and 3873233, Safari hangs when
        loading large local files.
	
        Reviewed by mjs

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::HTMLTokenizer):
        (khtml::HTMLTokenizer::reset):
        (khtml::HTMLTokenizer::write):
        (khtml::HTMLTokenizer::stopped):
        (khtml::HTMLTokenizer::processingData):
        (khtml::HTMLTokenizer::continueProcessing):
        (khtml::HTMLTokenizer::timerEvent):
        (khtml::HTMLTokenizer::allDataProcessed):
        (khtml::HTMLTokenizer::end):
        (khtml::HTMLTokenizer::finish):
        (khtml::HTMLTokenizer::notifyFinished):
        * khtml/html/htmltokenizer.h:
        * khtml/khtml_part.cpp:
        (KHTMLPart::slotFinished):
        (KHTMLPart::end):
        (KHTMLPart::stop):
        * khtml/khtml_part.h:
        (KHTMLPart::tokenizerProcessedData):
        * khtml/khtmlview.cpp:
        * khtml/xml/dom_docimpl.cpp:
        * khtml/xml/xml_tokenizer.h:
        (khtml::Tokenizer::stopped):
        (khtml::Tokenizer::processingData):
        * kwq/KWQDateTime.h:
        * kwq/KWQDateTime.mm:
        (QDateTime::secsTo):
        (KWQUIEventTime::uiEventPending):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::tokenizerProcessedData):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge stop]):
        (-[WebCoreBridge numPendingOrLoadingRequests]):
        (-[WebCoreBridge doneProcessingData]):

2004-11-09  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

		<rdar://problem/3865837> Wrong text style after delete to start of document
		
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::saveTypingStyleState):
        Sample computedStyle of m_selectionToDelete.start instead of m_downstreamStart.

2004-11-09  Richard Williamson   <rjw@apple.com>

        Fixed <rdar://problem/3872440> NSTimer prematurely released.

        Reviewed by Darin.

        * kwq/KWQTimer.mm:
        (QTimer::fire):
        * kwq/KWQWidget.mm:
        (QWidget::paint):

2004-11-09  Chris Blumenberg  <cblu@apple.com>

        Reviewed by vicki.

        * WebCore.pbproj/project.pbxproj: explicitly link against libxml2.2.6.14.dylib since the version number has been bumped

2004-11-08  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

		<rdar://problem/3865854> Deleting first line deletes all lines
		
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::performGeneralDelete):
        Problem was that the code that deletes fully selected m_downstreamEnd.node() by deleting one
        of its ancestors, failed to end the loop that deletes all fully selected nodes.  Also,
        fixed this code to clear m_trailingWhitespaceValid.  Also removed dead m_endingPosition
        update because it is handled in calculateEndingPosition now.
        * layout-tests/editing/deleting/delete-3865854-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3865854-fix.html: Added.

2004-11-08  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::createContextualFragment): Now takes flag to control whether comments
        are added to the DOM.
        * khtml/html/html_elementimpl.h: Ditto.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Ditto.
        (KHTMLParser::getElement): Remove ifdef for comment processing. Replace with flag check.
        * khtml/html/htmlparser.h: Add flag to constructor so callers can request comment nodes.
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::HTMLTokenizer): Add flag to constructor so callers can request comment nodes.
        (khtml::HTMLTokenizer::parseComment): Fix code to handle parsing out comment text correctly.
        There were a couple of indexing errors that resulted in the comment text containing part of the 
        comment markers.
        (khtml::HTMLTokenizer::processToken): Don't let token id be reset to ID_TEXT if token is a comment.
        * khtml/html/htmltokenizer.h:  Add flag to constructor so callers can request comment nodes.

2004-11-08  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3870907> WebCore unnecessary links against JavaVM and Security

        Reviewed by darin.

        * WebCore.pbproj/project.pbxproj: stop unnecessary linking
        * khtml/html/html_objectimpl.h: don't unnecessarily include JavaVM header
        * kwq/KWQKHTMLPart.h: ditto

2004-11-08  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3825966> 8A274 Safari crashes closing window: QTimer::fire() with MallocStackLogging and MallocScribble enabled

        * kwq/KWQTimer.mm: (QTimer::fire): Rearrange so we don't access the QTimer object after calling code
        that possibly deletes the QTimer.

2004-11-08  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3783904> Return key behavior is confusingly different between popup menus and autofill menus

        Reviewed by john.

        * kwq/KWQTextField.mm:
        (-[KWQTextFieldController textView:shouldHandleEvent:]): let the bridge have a crack at the event so that it can swallow the newline if it wants to
        * kwq/WebCoreBridge.h:

2004-11-08  David Harrison  <harrison@apple.com>

        Reviewed by Darin.
        
        Renamed NodeImpl::enclosingNonBlockFlowElement to NodeImpl::enclosingInlineElement, per Hyatt.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::enclosingInlineElement):
        * khtml/xml/dom_nodeimpl.h:

2004-11-05  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3838413> REGRESSION (Mail): "Smart" word paste adds spaces before/after special characters

        Reviewed by rjw.

        * khtml/editing/htmlediting.cpp:
        (khtml::ReplaceSelectionCommand::doApply): call isCharacterSmartReplaceExempt on the part to see if a space should be inserted
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::character): new, returns the character for the position
        * khtml/editing/visible_position.h:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::isCharacterSmartReplaceExempt): new, calls the bridge
        * kwq/WebCoreBridge.h:

=== Safari-170 ===

2004-11-05  Adele Amchan  <adele@apple.com>

        Reviewed by Darin

	Fix for <rdar://problem/3854383> REGRESSION(166-168) input fields show black background when background color is set to transparent
	and a workaround for displaying transparent backgrounds for textareas.

        * kwq/KWQLineEdit.mm: (QLineEdit::setPalette): If the background color is transparent (we check the alpha value) then we set the background to white
        * kwq/KWQTextEdit.mm: (QTextEdit::setPalette): If the background color is transparent, then we don't draw the background
        * kwq/KWQTextArea.mm: (-[KWQTextArea setDrawsBackground:]): added setDrawsBackground function which calls setDrawsBackground on the super class, 
          on the contentView, and on the textView.

2004-11-04  David Hyatt  <hyatt@apple.com>

	Fix for relpositioned inlines.  This was reviewed a long time ago, but I can't recall who reviewed it (either
	darin or ken).
	
        Reviewed by darin or ken

        * khtml/rendering/bidi.cpp:
        (khtml::appendRunsForObject):
        (khtml::RenderBlock::skipWhitespace):
        (khtml::RenderBlock::findNextLineBreak):
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::lowestPosition):
        (khtml::RenderBlock::rightmostPosition):
        (khtml::RenderBlock::leftmostPosition):
        * khtml/rendering/render_box.cpp:
        (RenderBox::position):
        * khtml/rendering/render_box.h:
        (khtml::RenderBox::staticX):
        (khtml::RenderBox::staticY):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateLayerPosition):
        (RenderLayer::convertToLayerCoords):
        * khtml/rendering/render_line.cpp:
        (khtml::InlineFlowBox::placeBoxesHorizontally):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::staticX):
        (khtml::RenderObject::staticY):

	Finish turning on XSLT.  Make sure child stylesheets can load.
	
        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::stylesheetLoadFunc):
        (DOM::XSLTProcessorImpl::transformDocument):

2004-11-04  David Hyatt  <hyatt@apple.com>

	Implement CSS3 support for multiple backgrounds.  Also fix a bug with background propagation so that it only
	happens (from the <body> to the root) for HTML documents.  Fixed background-position to handle a mixture of
	keyword and length values.

        Reviewed by darin

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::addBackgroundValue):
        (CSSParser::parseBackgroundShorthand):
        (CSSParser::parseBackgroundColor):
        (CSSParser::parseBackgroundImage):
        (CSSParser::parseBackgroundPositionXY):
        (CSSParser::parseBackgroundPosition):
        (CSSParser::parseBackgroundProperty):
        (CSSParser::parseColorFromValue):
        * khtml/css/cssparser.h:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::adjustRenderStyle):
        (khtml::CSSStyleSelector::applyProperty):
        (khtml::CSSStyleSelector::mapBackgroundAttachment):
        (khtml::CSSStyleSelector::mapBackgroundImage):
        (khtml::CSSStyleSelector::mapBackgroundRepeat):
        (khtml::CSSStyleSelector::mapBackgroundXPosition):
        (khtml::CSSStyleSelector::mapBackgroundYPosition):
        * khtml/css/cssstyleselector.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::paintRootBoxDecorations):
        (RenderBox::paintBoxDecorations):
        (RenderBox::paintBackgrounds):
        (RenderBox::paintBackground):
        (RenderBox::paintBackgroundExtended):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_form.cpp:
        (RenderFieldset::paintBoxDecorations):
        * khtml/rendering/render_line.cpp:
        (khtml::InlineFlowBox::paintBackgrounds):
        (khtml::InlineFlowBox::paintBackground):
        (khtml::InlineFlowBox::paintBackgroundAndBorder):
        * khtml/rendering/render_line.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):
        (RenderObject::updateBackgroundImages):
        (RenderObject::getVerticalPosition):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::paintBackgroundExtended):
        * khtml/rendering/render_style.cpp:
        (m_next):
        (BackgroundLayer::BackgroundLayer):
        (BackgroundLayer::~BackgroundLayer):
        (BackgroundLayer::operator=):
        (BackgroundLayer::operator==):
        (BackgroundLayer::fillUnsetProperties):
        (BackgroundLayer::cullEmptyLayers):
        (StyleBackgroundData::StyleBackgroundData):
        (StyleBackgroundData::operator==):
        (RenderStyle::diff):
        (RenderStyle::adjustBackgroundLayers):
        * khtml/rendering/render_style.h:
        (khtml::OutlineValue::operator==):
        (khtml::OutlineValue::operator!=):
        (khtml::BackgroundLayer::backgroundImage):
        (khtml::BackgroundLayer::backgroundXPosition):
        (khtml::BackgroundLayer::backgroundYPosition):
        (khtml::BackgroundLayer::backgroundAttachment):
        (khtml::BackgroundLayer::backgroundRepeat):
        (khtml::BackgroundLayer::next):
        (khtml::BackgroundLayer::isBackgroundImageSet):
        (khtml::BackgroundLayer::isBackgroundXPositionSet):
        (khtml::BackgroundLayer::isBackgroundYPositionSet):
        (khtml::BackgroundLayer::isBackgroundAttachmentSet):
        (khtml::BackgroundLayer::isBackgroundRepeatSet):
        (khtml::BackgroundLayer::setBackgroundImage):
        (khtml::BackgroundLayer::setBackgroundXPosition):
        (khtml::BackgroundLayer::setBackgroundYPosition):
        (khtml::BackgroundLayer::setBackgroundAttachment):
        (khtml::BackgroundLayer::setBackgroundRepeat):
        (khtml::BackgroundLayer::clearBackgroundImage):
        (khtml::BackgroundLayer::clearBackgroundXPosition):
        (khtml::BackgroundLayer::clearBackgroundYPosition):
        (khtml::BackgroundLayer::clearBackgroundAttachment):
        (khtml::BackgroundLayer::clearBackgroundRepeat):
        (khtml::BackgroundLayer::setNext):
        (khtml::BackgroundLayer::operator!=):
        (khtml::BackgroundLayer::containsImage):
        (khtml::BackgroundLayer::hasImage):
        (khtml::BackgroundLayer::hasFixedImage):
        (khtml::RenderStyle::setBitDefaults):
        (khtml::RenderStyle::hasBackground):
        (khtml::RenderStyle::hasFixedBackgroundImage):
        (khtml::RenderStyle::outlineWidth):
        (khtml::RenderStyle::outlineStyle):
        (khtml::RenderStyle::outlineStyleIsAuto):
        (khtml::RenderStyle::outlineColor):
        (khtml::RenderStyle::backgroundColor):
        (khtml::RenderStyle::backgroundImage):
        (khtml::RenderStyle::backgroundRepeat):
        (khtml::RenderStyle::backgroundAttachment):
        (khtml::RenderStyle::backgroundXPosition):
        (khtml::RenderStyle::backgroundYPosition):
        (khtml::RenderStyle::accessBackgroundLayers):
        (khtml::RenderStyle::backgroundLayers):
        (khtml::RenderStyle::outlineOffset):
        (khtml::RenderStyle::resetOutline):
        (khtml::RenderStyle::setBackgroundColor):
        (khtml::RenderStyle::setOutlineWidth):
        (khtml::RenderStyle::setOutlineStyle):
        (khtml::RenderStyle::setOutlineColor):
        (khtml::RenderStyle::clearBackgroundLayers):
        (khtml::RenderStyle::inheritBackgroundLayers):
        (khtml::RenderStyle::setOutlineOffset):
        * khtml/rendering/render_table.cpp:
        (RenderTable::paintBoxDecorations):
        (RenderTableCell::paintBoxDecorations):

2004-11-04  David Hyatt  <hyatt@apple.com>

	Make sure the text decoder returns empty strings rather than null strings when the utf8 char ptr is non-null.
	Ensures that <a href=""> works with libxml (which returns data in utf-8 buffers).

        Reviewed by darin

        * kwq/KWQTextCodec.mm:
        (KWQTextDecoder::convertLatin1):
        (KWQTextDecoder::convertUTF16):
        (KWQTextDecoder::convertUsingTEC):
        (KWQTextDecoder::toUnicode):

2004-11-04  David Hyatt  <hyatt@apple.com>

	Make sure line-height returns the correct value for normal.
	
        Reviewed by darin

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):

2004-11-04  David Harrison  <harrison@apple.com>

        Reviewed by Ken Kocienda.

		<rdar://problem/3857753> REGRESSION (Mail): Delete incorrectly causes text to take on new style
		
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Fixed to move entire source subtree (up
        to, but not including, the enclosingBlockFlowElement) rather than just the source element.
        Fixed to insert after the destination subtree, rather than the destination element.  Handles
        edge case of deleting back to the top of the tree, where there is nothing left to insert after.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::enclosingNonBlockFlowElement): New method to support moveNodesAfterNode changes.
        * khtml/xml/dom_nodeimpl.h: Declare NodeImpl::enclosingNonBlockFlowElement
        * layout-tests/editing/deleting/delete-3857753-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3857753-fix.html: Added.

2004-11-03  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me
        
        More layout tests.

        * layout-tests/editing/deleting/delete-br-008-expected.txt: Added.
        * layout-tests/editing/deleting/delete-br-008.html: Added.
        * layout-tests/editing/deleting/delete-br-009-expected.txt: Added.
        * layout-tests/editing/deleting/delete-br-009.html: Added.
        * layout-tests/editing/deleting/delete-br-010-expected.txt: Added.
        * layout-tests/editing/deleting/delete-br-010.html: Added.

2004-11-03  Maciej Stachowiak  <mjs@apple.com>

        Fix by Yasuo Kida, reviewed by me.

	<rdar://problem/3819004> REGRESSION (Mail): Can't move cursor / delete character after deleting the active input area
        
	* kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setMarkedTextRange): Treat a collapsed range the
	same as a nil range - setting an empty marked range should clear
	the marked range entirely.

2004-11-02  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dave Hyatt (when I originally coded it).

	WebCore part of fix for:

	<rdar://problem/3759187> REGRESSION (Mail): implement firstRectForCharacterRange:
	
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge firstRectForDOMRange:]): New method to compute the rect for a
	DOMRange, or if the range is split into multiple lines, the rect for the part on
	the first line only.
	
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect): Added extraWidthToEndOfLine parameter and ditto
	for the overrides below.
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::caretRect):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::caretRect):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect):

2004-11-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Implemented command to insert a block in response to typing a return key (even though
        I am not turning that on by default with this patch....that will come later). 
        
        This new command is called InsertParagraphSeparatorCommand.
        
        Reworked the command and function names associated with inserting content into a 
        document. Before this patch, there were inputXXX and insertXXX variants, with the
        former used for more high-level actions and the latter used for lower-level stuff.
        However, this was confusing as the AppKit uses insertXXX for everything. This resulted
        in an insertXXX command going through an inputXXX WebCore step and then finally to an
        insertXXX WebCore step. To make this less confusing, I have changes all the names to
        be insertXXX, and modified the lower-level operations so that it is clear what they do.
        
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommandPtr::isInsertTextCommand): Name change.
        (khtml::EditCommand::isInsertTextCommand): Ditto.
        (khtml::CompositeEditCommand::inputText): Ditto.
        (khtml::CompositeEditCommand::insertTextIntoNode): Ditto.
        (khtml::CompositeEditCommand::deleteTextFromNode): Ditto.
        (khtml::CompositeEditCommand::replaceTextInNode): Ditto.
        (khtml::CompositeEditCommand::deleteInsignificantText): Name changes in implementation.
        (khtml::CompositeEditCommand::isLastVisiblePositionInNode): Ditto.
        (khtml::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand): Class name change, was DeleteTextCommand.
        (khtml::DeleteFromTextNodeCommand::~DeleteFromTextNodeCommand): Ditto.
        (khtml::DeleteFromTextNodeCommand::doApply): Ditto.
        (khtml::DeleteFromTextNodeCommand::doUnapply): Ditto.
        (khtml::DeleteSelectionCommand::performGeneralDelete): Ditto.
        (khtml::DeleteSelectionCommand::fixupWhitespace): Ditto.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Ditto.
        (khtml::InsertIntoTextNode::InsertIntoTextNode): Class name change.
        (khtml::InsertIntoTextNode::~InsertIntoTextNode): Ditto.
        (khtml::InsertIntoTextNode::doApply): Ditto.
        (khtml::InsertIntoTextNode::doUnapply): Ditto.
        (khtml::InsertLineBreakCommand::InsertLineBreakCommand): Class name change, was InsertNewlineCommand.
        (khtml::InsertLineBreakCommand::insertNodeAfterPosition):
        (khtml::InsertLineBreakCommand::insertNodeBeforePosition):
        (khtml::InsertLineBreakCommand::doApply):
        (khtml::InsertNodeBeforeCommand::InsertNodeBeforeCommand): Code moved. No changes.
        (khtml::InsertNodeBeforeCommand::~InsertNodeBeforeCommand): Ditto.
        (khtml::InsertNodeBeforeCommand::doApply): Ditto.
        (khtml::InsertNodeBeforeCommand::doUnapply): Ditto.
        (khtml::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): New command.
        (khtml::InsertParagraphSeparatorCommand::doApply):
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::InsertParagraphSeparatorInQuotedContentCommand):
        Class name change, was InsertNewlineCommandInQuotedContentCommand.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::~InsertParagraphSeparatorInQuotedContentCommand): Ditto.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::isMailBlockquote): Ditto.
        (khtml::InsertParagraphSeparatorInQuotedContentCommand::doApply): Ditto.
        (khtml::InsertTextCommand::InsertTextCommand): Class name change, was InputTextCommand.
        (khtml::InsertTextCommand::doApply): Ditto.
        (khtml::InsertTextCommand::deleteCharacter): Ditto.
        (khtml::InsertTextCommand::prepareForTextInsertion): Ditto.
        (khtml::InsertTextCommand::input): Ditto.
        (khtml::InsertTextCommand::insertSpace): Ditto.
        (khtml::InsertTextCommand::isInsertTextCommand): Ditto.
        (khtml::TypingCommand::insertLineBreak): Name change, was insertNewline.
        (khtml::TypingCommand::insertParagraphSeparatorInQuotedContent): Name change, was insertNewlineInQuotedContent.
        (khtml::TypingCommand::insertParagraphSeparator): New function.
        (khtml::TypingCommand::doApply): Name changes, as above.
        (khtml::TypingCommand::insertText): Ditto.
        (khtml::TypingCommand::deleteKeyPressed): Ditto.
        (khtml::TypingCommand::preservesTypingStyle): Ditto.
        * khtml/editing/htmlediting.h:
        (khtml::DeleteFromTextNodeCommand::node): Name change.
        (khtml::DeleteFromTextNodeCommand::offset): Ditto.
        (khtml::DeleteFromTextNodeCommand::count): Ditto.
        (khtml::InsertIntoTextNode::text): Ditto.
        (khtml::InsertNodeBeforeCommand::insertChild): Ditto.
        (khtml::InsertNodeBeforeCommand::refChild): Ditto.
        (khtml::TypingCommand::): Ditto.
        * khtml/editing/jsediting.cpp: Name changes, as above.
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge insertLineBreak]): Name change, was insertNewline.
        (-[WebCoreBridge insertParagraphSeparator]): New function.
        (-[WebCoreBridge insertParagraphSeparatorInQuotedContent]): Name change, was insertNewlineInQuotedContent.

2004-11-01  Kevin Decker  <kdecker@apple.com>

        Reviewed by rjw.

	fixed <rdar://problem/3681094> Crash in KJS::WindowFunc::tryCall with application/xhtml+xml Content-Type
	once and for all. 

        * khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall): Added a nil check in the case of an empty document lacking a baseURL().

2004-11-01  Darin Adler  <darin@apple.com>

        Reviewed by Hyatt.

        - fixed <rdar://problem/3859381> REGRESSION (167-168): text in form fields should not use body's text color

        * khtml/css/html4.css: Use color: initial for textarea and related ones.

2004-11-01  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3775920> REGRESSION (Mail): Centering doesn't work in HTML mail

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties): Factor out the 
        implementation here into new copyPropertiesInSet helper. This now calls the
        generalized copyPropertiesInSet function with the arguments needed to make copying
        inheritable work.
        * khtml/css/css_computedstyle.h:
        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::diff): Move this function here from css_computedstyle.cpp.
        In order to do apply block properties, "regular" style declarations need to do style
        diffs as well.
        (CSSStyleDeclarationImpl::copyBlockProperties): New helper. Just like copyInheritableProperties
        except that it uses a different set of properties that apply only to blocks.
        (CSSStyleDeclarationImpl::copyPropertiesInSet): New helper that looks at a style declaration
        and copies out those properties listed in a pre-defined set.
        * khtml/css/css_valueimpl.h:
        * khtml/editing/htmlediting.cpp:
        (khtml::StyleChange::StyleChange): Modified to work with style changes that apply to a whole
        block, factoring out some of the special case code that should now only run in the inline case.
        (khtml::StyleChange::init): Factored out the code that now is in checkForLegacyHTMLStyleChange.
        (khtml::StyleChange::checkForLegacyHTMLStyleChange): New helper for case where we want
        special handling for "legacy" HTML styles like <B> and <I>.
        (khtml::ApplyStyleCommand::doApply): Much refactoring in this class to divide up the work of
        style changes into different kinds. CSS specifies certain properties only apply to certain
        element types. This set of changes now recognizes two such separate cases: styles that apply
        to blocks, and styles that apply to inlines.
        (khtml::ApplyStyleCommand::applyBlockStyle): New function to handle apply styles to whole blocks.
        (khtml::ApplyStyleCommand::applyInlineStyle): New function to handle apply styles to inlines.
        (khtml::ApplyStyleCommand::isHTMLStyleNode): Is now passed a CSSStyleDeclarationImpl to work
        with rather than working on the CSSStyleDeclarationImpl member variable of the class. This is
        done so that the function can be passed a portion of the styles being applied so that block styles
        and inline styles can be handled separately.
        (khtml::ApplyStyleCommand::removeCSSStyle): Ditto.
        (khtml::ApplyStyleCommand::removeBlockStyle): New function to handle removing styles from whole blocks.
        (khtml::ApplyStyleCommand::removeInlineStyle): New function to removing styles from inlines.
        (khtml::ApplyStyleCommand::addBlockStyleIfNeeded): New function to handle applying style to whole blocks.
        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded): New function to handle applying style to inlines.
        * khtml/editing/htmlediting.h:
        (khtml::StyleChange::): Changed as described above.
        (khtml::StyleChange::usesLegacyStyles):
        (khtml::EditCommand::setEndingSelectionNeedsLayout): New function to that tells the ending selection
        it needs to layout, even though it has not changed position in the DOM. For instance, this is needed 
        when text align changes.
        * khtml/khtml_part.cpp:
        (KHTMLPart::setTypingStyle): Put in an early bail-out in the case where the current style matches
        the passed-in argument.
        (KHTMLPart::applyStyle): Modify this function so that block styles are applied when the selection
        is a caret. Formerly, this just set typing style and made no visible changes to the document.

        New tests.

        * layout-tests/editing/editing.js: Added some glue to change text align.
        * layout-tests/editing/style/block-style-001-expected.txt: Added.
        * layout-tests/editing/style/block-style-001.html: Added.
        * layout-tests/editing/style/block-style-002-expected.txt: Added.
        * layout-tests/editing/style/block-style-002.html: Added.
        * layout-tests/editing/style/block-style-003-expected.txt: Added.
        * layout-tests/editing/style/block-style-003.html: Added.

=== Safari-169 ===

2004-10-29  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3751619> Safari crash in khtml::CircularSearchBuffer::append(QChar const&)

        * khtml/editing/visible_text.cpp: (khtml::findPlainText): Fix exit condition to check for break
        before advancing one character; before it did it backwards.

2004-10-29  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3853262> REGRESSION(166-168) gmail gets blank page when loading

        Reviewed by kocienda, adele.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): remove infinite frame recursion check for iframes

2004-10-29  Darin Adler  <darin@apple.com>

        Reviewed by Chris.

        - fixed <rdar://problem/3857395> clicking on calendar in Apple Travel site crashes Safari in invalidateClick (getthere.net)

        * khtml/khtmlview.cpp:
        (KHTMLView::viewportMousePressEvent): Use a SharedPtr<KHTMLView> to make sure the KHTMLView is not
        deleted before this function finishes running.
        (KHTMLView::viewportMouseDoubleClickEvent): Ditto.
        (KHTMLView::viewportMouseReleaseEvent): Ditto.
        (KHTMLView::dispatchMouseEvent): Removed ref/deref pairs that aren't needed since dispatchEvent
        is guaranteed to do ref/deref as needed.

        * kwq/KWQObject.mm: (QObject::startTimer): Fixed a comment.

2004-10-28  Chris Blumenberg  <cblu@apple.com>

	Enabled XSLT on Panther. See intrigue mail for compiling instructions.

        Reviewed by darin.

        * WebCore.pbproj/project.pbxproj: link against xslt unconditionally, link against specific version of libxml on Panther
        * WebCorePrefix.h: always use XSLT

2004-10-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for these bugs:
        
        <rdar://problem/3854848> Tiger Mail Crash in WebCore - khtml::CompositeEditCommand::insertNodeAfter
        <rdar://problem/3803832> REGRESSION (Mail): incorrect behavior after Return + Delete in quoted text
        
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Added node pointer class members 
        to initialization list, zeroing them out.
        (khtml::DeleteSelectionCommand::canPerformSpecialCaseBRDelete): New special-case helper to
        handle a delete of content in special cases where the only thing selected is a BR. This
        code path is much simpler than the newly-named performGeneralDelete, and detects when no
        content merging should be done between blocks. This aspect of the change fixes 3854848.
        One of the special cases added fixes 3803832.
        (khtml::DeleteSelectionCommand::performGeneralDelete): Renamed, from performDelete.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Made this helper be a no-arg function, just
        like the other helpers in this class.
        (khtml::DeleteSelectionCommand::clearTransientState): Fix cut and paste error in deref code.
        (khtml::DeleteSelectionCommand::doApply): Updated for changed helpers.
        * khtml/editing/htmlediting.h: Added new helper and changed an old one.

2004-10-28  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3856913> Panther-only crash in QString code copying front page of store.apple.com

        Reviewed by darin.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::attributedString): check that the renderer is a list item before making list item calls on it

2004-10-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Harrison

        Reorganization of delete command functionality so that doApply is not
        several hundred lines long. This is not a squeaky-clean cleanup, but
        it is a step in the right direction. No functionality changes.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::DeleteSelectionCommand):
        (khtml::DeleteSelectionCommand::initializePositionData): New helper.
        (khtml::DeleteSelectionCommand::saveTypingStyleState): Ditto.
        (khtml::DeleteSelectionCommand::performDelete): Ditto.
        (khtml::DeleteSelectionCommand::fixupWhitespace): Ditto.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Ditto.
        (khtml::DeleteSelectionCommand::calculateEndingPosition): Ditto.
        (khtml::DeleteSelectionCommand::calculateTypingStyleAfterDelete): Ditto.
        (khtml::DeleteSelectionCommand::clearTransientState): Ditto.
        (khtml::DeleteSelectionCommand::doApply): Factor out code into new helpers.
        * khtml/editing/htmlediting.h:

2004-10-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Typo in initializer caused
        new mergeBlocksAfterDelete flag to be set improperly, causing layout regressions.

2004-10-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::deleteSelection): Added new mergeBlocksAfterDelete flag to control
        whether content not in the block containing the start of the selection is moved to that block
        after the selection is deleted.
        (khtml::DeleteSelectionCommand::DeleteSelectionCommand): Ditto.
        (khtml::DeleteSelectionCommand::doApply): Ditto.
        (khtml::InputNewlineInQuotedContentCommand::InputNewlineInQuotedContentCommand): New command
        to handle the case of inserting a newline when in quoted content in Mail.
        (khtml::InputNewlineInQuotedContentCommand::~InputNewlineInQuotedContentCommand): Ditto.
        (khtml::InputNewlineInQuotedContentCommand::isMailBlockquote): Ditto.
        (khtml::InputNewlineInQuotedContentCommand::isLastVisiblePositionInBlockquote): Ditto.
        (khtml::InputNewlineInQuotedContentCommand::doApply): Ditto.
        (khtml::TypingCommand::insertNewlineInQuotedContent): Support for new newline command.
        (khtml::TypingCommand::doApply): Ditto.
        (khtml::TypingCommand::preservesTypingStyle): Ditto.
        * khtml/editing/htmlediting.h: Add new delclarations.
        (khtml::TypingCommand::): Ditto.
        * kwq/WebCoreBridge.h: Added new bridge method called from WebKit.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge insertNewlineInQuotedContent]): Ditto.

2004-10-26  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3774243> page up/down, arrow up/down, etc in Safari RSS should scroll main content

        Reviewed by dave.

        * khtml/ecma/kjs_dom.cpp:
        (DOMElementProtoFunc::tryCall): added scrollByLines and scrollByPages to HTML element for Safari RSS
        * khtml/ecma/kjs_dom.h:
        (KJS::DOMElement::):
        * khtml/ecma/kjs_dom.lut.h:
        (KJS::):

2004-10-26  David Hyatt  <hyatt@apple.com>

	Fix for 3848214, deleting a partial word left a repaint artifact if the partial word was pulled back onto
	the previous line.
	
        Reviewed by kocienda

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::layoutInlineChildren):

2004-10-26  David Hyatt  <hyatt@apple.com>

	Convert selectionRect() from using a list to a dict and patch it to be like setSelection.  It was still trying
	to use the old dirty bit optimization (which had been removed), and so it was pathologically slow on large documents.
	
        Reviewed by kocienda

        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::selectionRect):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::hasSelectedChildren):

2004-10-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug::
        
        <rdar://problem/3851164> mail crashed when I pasted a large amount of text into a reply

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): This now returns bool to
        let the caller know if a placeholder was removed.
        (khtml::ReplaceSelectionCommand::doApply): Use the bool return value from the call to
        removeBlockPlaceholderIfNeeded. If true, shift the selection to the now-empty block. In
        some cases, the selection was still set on the removed BR, and this was the cause of the
        crash.
        * khtml/editing/htmlediting.h: Change removeBlockPlaceholderIfNeeded return type.

2004-10-26  Darin Adler  <darin@apple.com>

        Reviewed by Chris.

        - fixed <rdar://problem/3851301> leak of one NSCFDictionary for each XMLHttpRequest issued

        * kwq/KWQLoader.mm: (KWQServeSynchronousRequest): Add a release.

2004-10-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::deleteInsignificantText): Do not call replaceText
        with a zero-length string. That triggers an assert. Call deleteText instead, 
        using the same indices that are passed to replaceText.
        
        Cleaned up the asserts in these three functions below, making them
        more consistent. This is not needed for the fix, but I tripped over
        these in the course of debugging.
        
        (khtml::InsertTextCommand::InsertTextCommand):
        (khtml::InsertTextCommand::doApply):
        (khtml::InsertTextCommand::doUnapply):

2004-10-25  Adele Amchan <adele@apple.com>

        Reviewed by Darin.

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::inDesignMode): made inDesignMode const
        * khtml/xml/dom_docimpl.h:

2004-10-25  Adele Amchan  <adele@apple.com>

        Reviewed by me, code change by Darin.

        * khtml/xml/dom_docimpl.cpp: Moved design mode code outside the XSLT ifdef.

2004-10-25  Ken Kocienda  <kocienda@apple.com>

        Oops. These two test results changed with my last checkin, for the better.

        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt
        * layout-tests/editing/inserting/insert-3775316-fix-expected.txt

2004-10-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3820349> REGRESSION (Mail): select all, delete does not always delete everything

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::startPositionForDelete): New helper that determines when to
        expand the selection outwards when the selection is on the visible boundary of a root
        editable element. This fixes the bug. Note that this function also contains a little code
        I factored out of doApply: it also takes care of adjusting the selection in the smart delete case.
        (khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.
        (khtml::DeleteSelectionCommand::doApply): Call new helpers. Refactored out the code as described.
        * khtml/editing/htmlediting.h: Declare new helpers.
        * layout-tests/editing/deleting/delete-select-all-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-select-all-001.html: Added.
        * layout-tests/editing/deleting/delete-select-all-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-select-all-002.html: Added.
        * layout-tests/editing/deleting/delete-select-all-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-select-all-003.html: Added.

2004-10-25  Ken Kocienda  <kocienda@apple.com>

        Added some more editing layout tests.

        * layout-tests/editing/deleting/delete-ws-fixup-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-001.html: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-002.html: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-003.html: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-004-expected.txt: Added.
        * layout-tests/editing/deleting/delete-ws-fixup-004.html: Added.
        * layout-tests/editing/inserting/typing-003-expected.txt: Added.
        * layout-tests/editing/inserting/typing-003.html: Added.

2004-10-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::findNextLineBreak): I did not get my fix for 3848343 and 3848224
        yesterday quite right: words that should have been placed on the next line were instead
        appearing on the line before, beyond the right margin. This was a one-word only error
        based on moving the line break object when it should have stayed put. Here is the rule:
        The line break object only moves to after the whitespace on the end of a line if that 
        whitespace caused line overflow when its width is added in.

2004-10-25  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.
 
        Fix for <rdar://problem/3619890> Feature request: designMode        

        This change implements the designMode property of a document.  This is an IE property that is also supported by Mozilla.  
        This will enable more JS editing compatibility.

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet): added case for designMode
        (KJS::HTMLDocument::putValue): added case for designMode
        * khtml/ecma/kjs_html.lut.h: (KJS::): regenerated
        * khtml/khtml_part.cpp: (KHTMLPart::isContentEditable): Now returns designMode value
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl): initialize m_designMode member variable
        (DocumentImpl::setDesignMode): added function to assign m_designMode value
        (DocumentImpl::getDesignMode): return m_designMode value
        (DocumentImpl::inDesignMode): if designMode is inherited, this will find the appropriate parent document designMode and return that value. 
            Otherwise, it will just return the m_designMode value.
        (DocumentImpl::parentDocument):
        * khtml/xml/dom_docimpl.h: (DOM::DocumentImpl::): added InheritedBool enum, prototypes, and m_designMode member variable.
        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::isContentEditable): added check for isContentEditable function in KHTMLPart

2004-10-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3844662> REGRESSION (Mail): Style changes can affect adjacent, unselected text

        * khtml/editing/htmlediting.cpp:
        (khtml::ApplyStyleCommand::doApply): Move end position downstream to be sure we remove style from
        everything that could be affected.
        (khtml::ApplyStyleCommand::removeCSSStyle): Comma in intended function call was outside the
        braces, making it act as a comma operator, with a zero value as the right value!!! This made
        an important check always fail!!! It turns out that we do not want the constant at all, since
        that constant is only needed when checking a computed style, not an inline style as is being
        done here.
        (khtml::ApplyStyleCommand::removeStyle): Call nodeFullySelected with new interface.
        (khtml::ApplyStyleCommand::nodeFullySelected): Change interface and implementation to rely on
        RangeImpl::compareBoundaryPoints to perform the required check.
        * khtml/editing/htmlediting.h: Changed nodeFullySelected function interface.

2004-10-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bugs:
        
        <rdar://problem/3848343> REGRESSION (Mail, 166-168u): Typed text after space at end of line before block quote does not appear
        <rdar://problem/3848224> REGRESSION (Mail): space typed at end of line vanishes after typing next character
    
        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::findNextLineBreak): When the khtmlLineBreak is in AFTER_WHITE_SPACE mode, as
        it is when we are editing, add in the space of the current character when calculating the width
        of committed plus uncommitted characters. If this value exceeds the width of the line, move up
        the line break object and call skipWhitespace to move past the end of the whitespace.

=== Safari-168 ===

2004-10-22  Ken Kocienda  <kocienda@apple.com>

        * WebCore.pbproj/project.pbxproj:
         Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.

2004-10-21  David Hyatt  <hyatt@apple.com>

        Reviewed by darin
	
	Clean up the inline run function so that it doesn't return incorrect answers when making children non-inline.
	
	<rdar://problem/3848724> REGRESSION (166-168u): RenderText::layout called, firing assertion that kills Mail
	<rdar://problem/3848357> RenderText::layout called, firing assertion that kills Safari (www.apple.com/downloads/macosx)
	
        * khtml/rendering/render_block.cpp:
        (khtml::getInlineRun):
        (khtml::RenderBlock::makeChildrenNonInline):

2004-10-21  David Hyatt  <hyatt@apple.com>

	Fix for 3810389, crash because of continuation() craziness.  Revert back to the old behavior of
	making sure that all line boxes get deleted and recreated when inlines are split because of a block.
	
        Reviewed darin

        * khtml/rendering/render_inline.cpp:
        (RenderInline::splitFlow):

2004-10-21  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin
        
        Significant improvement to the way that whitespace is handled during editing.

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::deleteInsignificantText): New functions (there are actually
        two being added with this name) that delete "insignificant" unrendered text.
        (khtml::CompositeEditCommand::deleteInsignificantTextDownstream): Takes a position,
        calculates the downstream position to use as the endpoint for the deletion, and
        then calls deleteInsignificantText with this start and end.
        (khtml::DeleteSelectionCommand::doApply): Call new deleteInsignificantTextDownstream function.
        (khtml::InputNewlineCommand::doApply): Ditto.
        (khtml::InputTextCommand::input): Ditto.
        * khtml/editing/htmlediting.h: Add new declarations.
        
        Modified layout test results:
        * layout-tests/editing/deleting/delete-block-merge-contents-016-expected.txt:
        * layout-tests/editing/deleting/delete-block-merge-contents-017-expected.txt:
        * layout-tests/editing/deleting/delete-contiguous-ws-001-expected.txt:
        * layout-tests/editing/deleting/delete-selection-001-expected.txt:
        * layout-tests/editing/deleting/delete-tab-001-expected.txt:
        * layout-tests/editing/deleting/delete-tab-004-expected.txt:
        * layout-tests/editing/deleting/delete-trailing-ws-001-expected.txt:
        * layout-tests/editing/inserting/insert-3659587-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3775316-fix-expected.txt:
        * layout-tests/editing/inserting/insert-3778059-fix-expected.txt:
        * layout-tests/editing/inserting/insert-br-001-expected.txt:
        * layout-tests/editing/inserting/insert-br-004-expected.txt:
        * layout-tests/editing/inserting/insert-br-005-expected.txt:
        * layout-tests/editing/inserting/insert-br-006-expected.txt:
        * layout-tests/editing/inserting/insert-tab-001-expected.txt:
        * layout-tests/editing/inserting/insert-tab-002-expected.txt:
        * layout-tests/editing/inserting/insert-tab-004-expected.txt:
        * layout-tests/editing/inserting/insert-text-with-newlines-expected.txt:
        * layout-tests/editing/inserting/typing-001-expected.txt:
        * layout-tests/editing/inserting/typing-around-br-001-expected.txt:
        * layout-tests/editing/inserting/typing-around-image-001-expected.txt:
        * layout-tests/editing/style/typing-style-003-expected.txt:
        * layout-tests/editing/undo/redo-typing-001-expected.txt:
        * layout-tests/editing/undo/undo-typing-001-expected.txt:

2004-10-21  David Hyatt  <hyatt@apple.com>

	Fix for 3847054, assertion failure in RenderText::layout() on news.com page.  Fix getInlineRun so that
	it no longer breaks early (thus causing some children not to get properly wrapped by anonymous blocks).
	
        Reviewed by darin

        * khtml/rendering/render_block.cpp:
        (khtml::getInlineRun):

2004-10-20  David Hyatt  <hyatt@apple.com>

	Add better dumping of overflow information for scrolling regions.

	Fix for 3726524, crash in updateLayerPosition.  Make sure anonymous elements properly remove themselves
	from the render tree so that layers and so forth are cleaned up.
	
        Reviewed by darin

        * khtml/rendering/render_container.cpp:
        (RenderContainer::detach):
        * khtml/rendering/render_layer.h:
        (khtml::RenderLayer::scrollXOffset):
        (khtml::RenderLayer::scrollYOffset):
        * kwq/KWQRenderTreeDebug.cpp:
        (write):

2004-10-20  David Hyatt  <hyatt@apple.com>

	Fix for 3791146, make sure all lines are checked when computing overflow.
	
        Reviewed by kocienda

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::computeHorizontalPositionsForLine):
        (khtml::RenderBlock::layoutInlineChildren):
        (khtml::RenderBlock::findNextLineBreak):
        (khtml::RenderBlock::checkLinesForOverflow):
        * khtml/rendering/render_block.h:

2004-10-20  David Hyatt  <hyatt@apple.com>

	Fix for 3790936, make the unicode-breaking on the layout tests match Panther.
	
        Reviewed by kocienda

        * khtml/rendering/break_lines.cpp:
        (khtml::isBreakable):

2004-10-20  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3317107> text input fields and text areas don't respect background color and text color CSS properties

        * khtml/rendering/render_form.cpp: (RenderFormElement::updateFromElement):
        Create a palette with the background and foreground colors in it and set it on the widget.

        * khtml/rendering/render_style.h: (khtml::StyleVisualData::operator==): No palette to compare
        with APPLE_CHANGES. Removed palette and palette-related function members.
        * khtml/rendering/render_style.cpp:
        (StyleVisualData::StyleVisualData): No palette to initialize with APPLE_CHANGES.
        (RenderStyle::diff): No palette to compare.

        * kwq/KWQLineEdit.h: Added setPalette override. Made text function const.
        * kwq/KWQLineEdit.mm:
        (QLineEdit::setPalette): Added. Sets foreground and background color based on palette.
        (QLineEdit::text): Made const.

        * kwq/KWQTextEdit.h: Added setPalette override.
        * kwq/KWQTextEdit.mm: (QTextEdit::setPalette): Added. Sets foreground and background color
        based on palette.

        * kwq/KWQPalette.h: Removed most things, leaving only background and foreground colors
        per color group, and only a single color group per palette.
        * kwq/KWQColorGroup.mm: Removed.
        * kwq/KWQPalette.mm: Removed.
        * WebCore.pbproj/project.pbxproj: Removed KWQColorGroup.mm and KWQPalette.mm.

        * kwq/KWQApplication.h: Removed unused palette function.
        * kwq/KWQApplication.mm: Ditto.

        * kwq/KWQWidget.h: Removed unsetPalette.
        * kwq/KWQWidget.mm: Ditto.

        - fixed storage leak

        * khtml/html/html_formimpl.cpp: (DOM::HTMLGenericFormElementImpl::~HTMLGenericFormElementImpl):
        Roll in storage leak fix from KDE guys.

2004-10-19  David Hyatt  <hyatt@apple.com>

        Reviewed by kocienda

	More cleanup of block layout.  Eliminates the separate step for tables that dont fit on a line with a float
	and consolidates it with clearing.

	Also patch dom_textimpl.cpp to reduce further the # of RenderTexts created.
	
        * khtml/rendering/render_block.cpp:
        (khtml::getInlineRun):
        (khtml::RenderBlock::layoutBlock):
        (khtml::RenderBlock::adjustFloatingBlock):
        (khtml::RenderBlock::collapseMargins):
        (khtml::RenderBlock::clearFloatsIfNeeded):
        (khtml::RenderBlock::estimateVerticalPosition):
        (khtml::RenderBlock::layoutBlockChildren):
        (khtml::RenderBlock::markAllDescendantsWithFloatsForLayout):
        (khtml::RenderBlock::getClearDelta):
        (khtml::RenderBlock::calcBlockMinMaxWidth):
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_frames.cpp:
        (RenderFrameSet::layout):
        * khtml/xml/dom_textimpl.cpp:
        (TextImpl::rendererIsNeeded):

        Fix for 3841060, regression with * in frames.  Reviewed by kocienda.
	
	* layout-tests/fast/frames/002-expected.txt: Added.
        * layout-tests/fast/frames/002.html: Added.

 2004-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - follow-on to my fix yesterday, which broke a layout test because I rolled out a fix that Maciej had done

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::write): Need to check the actual queue of external
        scripts being loaded here. If the current code being run is the external script itself, then we don't want
        to defer parsing. But loadingExtScript has to stay true until after the script runs. The old code would
        assume that any time we're running a script there's no need to look at loadingExtScript, but that was also
        wrong since there can be a script loading in that case too. Layout tests check for both problems.

        * layout-tests/fast/tokenizer/external-script-document-write-expected.txt: Added.
        * layout-tests/fast/tokenizer/external-script-document-write.html: Added.
        * layout-tests/fast/tokenizer/resources/external-script-document-write.js: Added.

        * layout-tests/fast/tokenizer/004.html: Fixed line endings (were CR, should be LF).

2004-10-18  Darin Adler  <darin@apple.com>

        Reviewed by Dave Hyatt.

        - 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)

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::scriptHandler): Use !isEmpty instead of count != 0, since it's cheaper.
        (khtml::HTMLTokenizer::write): Roll back to the old version of the check here. The fix is that
        we only want to look at loadingExtScript if m_executingScript is 0.

2004-10-18  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3840907> textedit doesn't render italic or bold text in html documents

        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::getStringValue): This function did not return string values for idents.
        Also changed the return value to be DOMString, rather than DOMStringImpl, to deal with the 
        lifecycle issues associated with creating a string to be returned in the ident case.
        * khtml/css/css_valueimpl.h: Change getStringValue to return DOMString rather than DOMStringImpl.
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty): Two calls of getStringValue needed updating.

2004-10-18  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3770135> hang loading page with EMBED tag pointing to same page (tridentantennas.co.uk)

        Reviewed by kocienda.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): use completeURL before comparing the URL of the plug-in with the base URL of the document when avoiding frame recursion

2004-10-15  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3841774> would like to get NSColor from DOM-CSS

        Reviewed by john.

        * kwq/DOM-CSS.mm:
        (-[DOMRGBColor _color]): new, returns getNSColor on KWQColor
        * kwq/DOMPrivate.h:

2004-10-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::skipNonBreakingSpace): Also need to forego the
        skipping after a clean line break, in addition to the cases already 
        checked for.
        * layout-tests/editing/inserting/insert-br-007-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-007.html: Added.
        * layout-tests/editing/inserting/insert-br-008-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-008.html: Added.

=== Safari-167 ===

2004-10-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3839989> REGRESSION (Mail): Left arrow does nothing after inserting attachment

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::deepEquivalent): Remove code that attempted to bridge old-style
        position code to new-style VisiblePosition code. In retrospect, this code was misguided.
        Since we do a good job of insulating external code from the internal workings of 
        VisiblePosition, the "hop ahead" being done here was not doing anyone any real good, and
        in the case of this bug, was doing harm. Simply removing this code makes the bug
        go away and does not cause any editing layout test regresssions.

2004-10-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/rendering/bidi.cpp:
        (khtml::skipNonBreakingSpace): New helper.
        (khtml::RenderBlock::skipWhitespace): Do not skip non-breaking spaces that are
        at the start of a block. This was preventing users from typing spaces in empty
        documents.
        * layout-tests/editing/inserting/insert-space-in-empty-doc-expected.txt: Added.
        * layout-tests/editing/inserting/insert-space-in-empty-doc.html: Added.

2004-10-14  Adele Amchan  <adele@apple.com>

        Reviewed by Darin and Ken.

	fix for <rdar://problem/3821070> null de-ref in DelectSelectionCommand::doApply()

        This change shifts some code around so that the code that determines what typing style
        is in effect is called before deleteUnrenderedText is called.  Two asserts are also added
        to ensure that start and end nodes of the selection are in the document.

        * khtml/editing/htmlediting.cpp: (khtml::DeleteSelectionCommand::doApply):

2004-10-14  Adele Amchan  <adele@apple.com>

        Reviewed by Ken
	
	This change makes these three functions virtual so that the work is being done in KWQHTMLPart 
        instead of khtml_part, eliminating the need for the "#if APPLE_CHANGES" statements in the khtml code.

        * khtml/khtml_part.cpp:
        (KHTMLPart::shouldBeginEditing):
        (KHTMLPart::shouldEndEditing):
        (KHTMLPart::isContentEditable):
        * khtml/khtml_part.h:
        * kwq/KWQKHTMLPart.h:

2004-10-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Final fix for these bugs:
        
        <rdar://problem/3806306> HTML editing puts spaces at start of line
        <rdar://problem/3814252> HTML editing groups space with word causing wrapping

        This change sets some new CSS properties that have been added to WebCore to 
        enable whitespace-handling and line-breaking features that make WebView work
        more like a text editor.

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty): Add and remove special editing CSS properties 
        based on property value.
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::setContentEditable): Add and remove special editing CSS properties 
        based on attribute value.
        * khtml/khtml_part.cpp:
        (KHTMLPart::applyEditingStyleToBodyElement): New helper. Calls applyEditingStyleToElement on
        body element.
        (KHTMLPart::removeEditingStyleFromBodyElement): New helper. Calls removeEditingStyleFromElement on
        body element.
        (KHTMLPart::applyEditingStyleToElement): Adds special editing CSS properties to passed in element.
        (KHTMLPart::removeEditingStyleFromElement): Removes special editing CSS properties from passed in element.
        * khtml/khtml_part.h: Add new declarations.
        * kwq/WebCoreBridge.h: Ditto.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge applyEditingStyleToBodyElement]): Call through to similarly-named function on KHTMLPart.
        (-[WebCoreBridge removeEditingStyleFromBodyElement]): Ditto.
        (-[WebCoreBridge applyEditingStyleToElement:]): Ditto.
        (-[WebCoreBridge removeEditingStyleFromElement:]): Ditto.

2004-10-14  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        - fixed <rdar://problem/3840052> Crash in removeBlockPlaceholderIfNeeded attaching file to empty document

        * khtml/editing/htmlediting.cpp:
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded):
        needed a nil check to handle empty document case

2004-10-13  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken.

	<rdar://problem/3824626> Change to do colormatching for DeviceRGB colorspace causes ~11% Safari slowdown
        
	- I fixed this by turning off all colormatching for WebKit
	content. We might turn it back on later. For now, it's possible to
	turn it on temporarily by defining COLORMATCH_EVERYTHING.
	
	* WebCorePrefix.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        (Context2D::colorRefFromValue):
        (Gradient::getShading):
        * khtml/rendering/render_canvasimage.cpp:
        (RenderCanvasImage::createDrawingContext):
        * kwq/KWQColor.mm:
        (QColor::getNSColor):
        * kwq/KWQPainter.h:
        * kwq/KWQPainter.mm:
        (CGColorFromNSColor):
        (QPainter::selectedTextBackgroundColor):
        (QPainter::rgbColorSpace):
        (QPainter::grayColorSpace):
        (QPainter::cmykColorSpace):
        * kwq/WebCoreGraphicsBridge.h:
        * kwq/WebCoreGraphicsBridge.m:
        (-[WebCoreGraphicsBridge createRGBColorSpace]):
        (-[WebCoreGraphicsBridge createGrayColorSpace]):
        (-[WebCoreGraphicsBridge createCMYKColorSpace]):

2004-10-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::merge): A little cleanup. Also, make sure m_lstValues
        is non-null before appending.

2004-10-13  Ken Kocienda  <kocienda@apple.com>

        Update expected results for improved behavior as a result of fix to 3816768.
    
        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt
        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt
        * layout-tests/editing/deleting/delete-block-merge-contents-002-expected.txt

2004-10-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Richard

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Add support to computed style
        for getting -khtml-line-break and -khml-nbsp-mode.

2004-10-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3816768> REGRESSION (Mail): Deleting last character in block incorrectly 
        moves caret out of block.

        The issue here is that an empty block with no explicit height set by style collapses
        to zero height, and does so immediately after the last bit of content is removed from
        it (as a result of deleting text with the delete key for instance). Since zero-height
        blocks are not eligible caret positions, the caret jumped to the closest eligible spot.
        
        The fix is to detect when a block has not been removed itself, but has had all its 
        contents removed. In this case, a BR element is placed in the block, one that is
        specially marked as a placeholder. Later, if the block ever receives content, this
        placeholder is removed.

        * khtml/editing/htmlediting.cpp:
        (khtml::blockPlaceholerClassString): String which acts as a placeholder marker class.
        (khtml::CompositeEditCommand::insertBlockPlaceholderIfNeeded): Adds a placeholder BR if needed.
        (khtml::CompositeEditCommand::removeBlockPlaceholderIfNeeded): Removes a placeholder BR if needed.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Call removeBlockPlaceholderIfNeeded.
        Also, do some cleanup on some old, crufty code in the move logic that is just so clearly wrong 
        (it's very clear that we needs to be able to move more than just text nodes). This may expose
        bugs, but these bugs needs to be filed and fixed, not ducked. Besides, undoing this silliness
        made the test case in the bug work.
        (khtml::DeleteSelectionCommand::doApply): Call insertBlockPlaceholderIfNeeded and
        removeBlockPlaceholderIfNeeded.
        (khtml::InputTextCommand::input): Call removeBlockPlaceholderIfNeeded.
        (khtml::ReplaceSelectionCommand::doApply): Call removeBlockPlaceholderIfNeeded.
        * khtml/editing/htmlediting.h: Declare new functions.

2004-10-13  Richard Williamson   <rjw@apple.com>

        Added support for -apple-dashboard-region:none.  And fixed
	a few computed style problems.

        Fixed <rdar://problem/3833532> -apple-dashboard-region: none; is needed
        Reviewed by Hyatt.

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::cssText):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseDashboardRegions):
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::noneDashboardRegions):
        * khtml/rendering/render_style.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::dashboardRegionsDictionary):

2004-10-13  David Hyatt  <hyatt@apple.com>

	Rework block layout to clean it up and simplify it (r=kocienda).  

	Also fixing the style sharing bug (r=mjs).
	
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::MarginInfo::MarginInfo):
        (khtml::RenderBlock::layoutBlock):
        (khtml::RenderBlock::adjustPositionedBlock):
        (khtml::RenderBlock::adjustFloatingBlock):
        (khtml::RenderBlock::handleSpecialChild):
        (khtml::RenderBlock::handleFloatingOrPositionedChild):
        (khtml::RenderBlock::handleCompactChild):
        (khtml::RenderBlock::insertCompactIfNeeded):
        (khtml::RenderBlock::handleRunInChild):
        (khtml::RenderBlock::collapseMargins):
        (khtml::RenderBlock::clearFloatsIfNeeded):
        (khtml::RenderBlock::estimateVerticalPosition):
        (khtml::RenderBlock::determineHorizontalPosition):
        (khtml::RenderBlock::setCollapsedBottomMargin):
        (khtml::RenderBlock::adjustChildIfOverhangingFloatsExist):
        (khtml::RenderBlock::handleBottomOfBlock):
        (khtml::RenderBlock::layoutBlockChildren):
        (khtml::RenderBlock::getAbsoluteRepaintRectIncludingFloats):
        (khtml::RenderBlock::addOverHangingFloats):
        * khtml/rendering/render_block.h:
        (khtml::RenderBlock::maxTopMargin):
        (khtml::RenderBlock::maxBottomMargin):
        (khtml::RenderBlock::CompactInfo::compact):
        (khtml::RenderBlock::CompactInfo::block):
        (khtml::RenderBlock::CompactInfo::matches):
        (khtml::RenderBlock::CompactInfo::clear):
        (khtml::RenderBlock::CompactInfo::set):
        (khtml::RenderBlock::CompactInfo::CompactInfo):
        (khtml::RenderBlock::MarginInfo::setAtTopOfBlock):
        (khtml::RenderBlock::MarginInfo::setAtBottomOfBlock):
        (khtml::RenderBlock::MarginInfo::clearMargin):
        (khtml::RenderBlock::MarginInfo::setSelfCollapsingBlockClearedFloat):
        (khtml::RenderBlock::MarginInfo::setTopQuirk):
        (khtml::RenderBlock::MarginInfo::setBottomQuirk):
        (khtml::RenderBlock::MarginInfo::setDeterminedTopQuirk):
        (khtml::RenderBlock::MarginInfo::setPosMargin):
        (khtml::RenderBlock::MarginInfo::setNegMargin):
        (khtml::RenderBlock::MarginInfo::setPosMarginIfLarger):
        (khtml::RenderBlock::MarginInfo::setNegMarginIfLarger):
        (khtml::RenderBlock::MarginInfo::setMargin):
        (khtml::RenderBlock::MarginInfo::atTopOfBlock):
        (khtml::RenderBlock::MarginInfo::canCollapseWithTop):
        (khtml::RenderBlock::MarginInfo::canCollapseWithBottom):
        (khtml::RenderBlock::MarginInfo::canCollapseTopWithChildren):
        (khtml::RenderBlock::MarginInfo::canCollapseBottomWithChildren):
        (khtml::RenderBlock::MarginInfo::selfCollapsingBlockClearedFloat):
        (khtml::RenderBlock::MarginInfo::quirkContainer):
        (khtml::RenderBlock::MarginInfo::determinedTopQuirk):
        (khtml::RenderBlock::MarginInfo::topQuirk):
        (khtml::RenderBlock::MarginInfo::bottomQuirk):
        (khtml::RenderBlock::MarginInfo::posMargin):
        (khtml::RenderBlock::MarginInfo::negMargin):
        (khtml::RenderBlock::MarginInfo::margin):
        * khtml/rendering/render_box.cpp:
        (RenderBox::calcAbsoluteVertical):
        * khtml/rendering/render_box.h:
        (khtml::RenderBox::marginTop):
        (khtml::RenderBox::marginBottom):
        (khtml::RenderBox::marginLeft):
        (khtml::RenderBox::marginRight):
        * khtml/rendering/render_image.cpp:
        (RenderImage::setImage):
        * khtml/rendering/render_object.cpp:
        (RenderObject::sizesToMaxWidth):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::collapsedMarginTop):
        (khtml::RenderObject::collapsedMarginBottom):
        (khtml::RenderObject::maxTopMargin):
        (khtml::RenderObject::maxBottomMargin):
        (khtml::RenderObject::marginTop):
        (khtml::RenderObject::marginBottom):
        (khtml::RenderObject::marginLeft):
        (khtml::RenderObject::marginRight):
        * khtml/rendering/render_text.h:
        (khtml::RenderText::marginLeft):
        (khtml::RenderText::marginRight):
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::recalcStyle):

2004-10-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3836158> REGRESSION (Mail): command-right-arrow moves to beginning of next line

        * khtml/editing/selection.cpp:
        (khtml::endOfLastRunAt): Do not let the end of the last run on a line be a BR.
        This will make it seem like the run ends on the next line.

2004-10-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3836986> Delete code removes elements of table structure; can result in very broken-looking web pages

        * khtml/editing/htmlediting.cpp:
        (khtml::isTableStructureNode): New helper. Determines whether a node is a table cell,
        row, section, or column.
        (khtml::CompositeEditCommand::removeFullySelectedNode): New helper that recurses into elements
        of table structure when doing deletes, rather than deleting the structure elements themselves.
        (khtml::DeleteSelectionCommand::moveNodesAfterNode): Do not move content between elements
        of table structure. We may want to revisit this some day, but this seems like the best behavior
        to me now.
        (khtml::DeleteSelectionCommand::doApply): Call removeFullySelectedNode instead of removeNode
        where needed.
        * khtml/editing/htmlediting.h: Add declarations for new functions.

2004-10-12  Richard Williamson   <rjw@apple.com>

        Fixed access to DOM object via WebScriptObject API.
        The execution context for DOM objects wasn't being found.	
        <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
        Reviewed by Chris

        Fixed <rdar://problem/3831063> regions use left offset instead of top offset
	Reviewed by John

        * khtml/khtml_part.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::addDashboardRegions):
        * kwq/DOM.mm:
        (-[DOMNode isContentEditable]):
        (-[DOMNode KJS::Bindings::]):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::executionContextForDOM):

2004-10-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:

        <rdar://problem/3834779> Mail crashes when editing HTML message - khtml::Selection::layout()
    
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::styleForSelectionStart): Table code seems to be more robust when the call to
        insert our style-checking node is done with an appendChild rather than an insertBefore. Note 
        that this table-related problem was exposed by fixing Selection::layout(), which I did
        yesterday. This change simply improves things even more so that we do not crash in the
        scenario described in the bug.

2004-10-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        This is a partial fix to this bug:
        
        <rdar://problem/3832886> increase quote level on new mail document leads to immediate 
        crash in caret painting code
        
        To eliminate the bad behavior for good, I have done some investigations in Mail code,
        and I have sent a suggested code change on to Grant. Basically, Mail can't add empty
        blocks (like blockquote elements used for quoting) to documents without giving those 
        blocks some content (so they have a height).

        I added some other crash protections below.

        * khtml/editing/selection.cpp:
        (khtml::Selection::layout): Check for non-null position after calls to VisiblePosition, since
        the VisiblePosition constructors may fail to find a visible spot in the document. Also, add
        a couple position-has-renderer assertion checks.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::styleForSelectionStart): Take out pos.isNotNull() assertion since VisiblePosition
        may not yield a position. This assertion is a holdover from before we had VisiblePosition.
        (KWQKHTMLPart::fontForSelection): Rearrange the code a little to deal with possible null results from
        calls to helpers.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3834230> empty table can result in division by 0

        * khtml/rendering/render_table.cpp: (RenderTableSection::layoutRows):
        Added 0 check; rolled in from KDE.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3818712> form checkbox value property is read only

        The underlying problem was that we were storing two separate values for all
        form elements; one for the value property (JavaScript) and the other for the
        value attribute (DOM). This is a good idea for text input, but not for other types.

        * khtml/html/html_formimpl.h: Changed setValue to take a const DOMString reference.
        Added private storesValueSeparateFromAttribute function.
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::setType): Handle type changes, including detaching and re-attaching
        if type changed, and moving value from m_value to ATTR_VALUE and vice versa.
        (DOM::HTMLInputElementImpl::type): Added a case for ISINDEX and moved the default out of the
        switch so that we will get a warning if a type is left out.
        (DOM::HTMLInputElementImpl::parseHTMLAttribute): Tweaked comment format.
        (DOM::HTMLInputElementImpl::reset): Changed to only nuke the value if the value property is stored
        separately from the attribute. Otherwise, we just want to lave it alone
        (DOM::HTMLInputElementImpl::value): Changed to always use m_value if it's not null, then fall back
        on the attribute, and finally fall back to the "on" for the checkbox only if both are null.
        (DOM::HTMLInputElementImpl::setValue): Changed to set the attribute unless the value property is
        supposed to be stored separate from the attribute.
        (DOM::HTMLInputElementImpl::storesValueSeparateFromAttribute): Added. Returns true for text-type
        input elements, and false for the others.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3296652> checkbox input type does not respond to onchange

        * khtml/rendering/render_form.cpp:
        (RenderFormElement::updateFromElement): Some new code, commented out, for form element colors.
        (RenderCheckBox::slotStateChanged): Added call to onChange.

2004-10-11  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Finish selection affinity implementation. This includes code to set the
        affinity correctly when clicking with the mouse, and clearing the
        affinity when altering the selection using any of the Selection object
        mutation functions.

        Each instance of the positionForCoordinates, inlineBox and caretRect 
        functions have been changed to include an EAffinity argument to give results
        which take this bit into account.

        * khtml/editing/selection.cpp:
        (khtml::Selection::init): Default affinity is now UPSTREAM, to match AppKit.
        (khtml::Selection::modifyAffinity): New function to compute affinity based on
        modification constants.
        (khtml::Selection::moveTo): Reset affinity to UPSTREAM.
        (khtml::Selection::modifyExtendingRightForward): Ditto.
        (khtml::Selection::modifyMovingRightForward): Ditto.
        (khtml::Selection::modifyExtendingLeftBackward): Ditto.
        (khtml::Selection::modifyMovingLeftBackward): Ditto.
        (khtml::Selection::modify): Support saving, restoring, and then calculating new
        affinity value as needed. 
        (khtml::Selection::xPosForVerticalArrowNavigation):
        (khtml::Selection::clear): Reset affinity to UPSTREAM.
        (khtml::Selection::setBase): Ditto.
        (khtml::Selection::setExtent): Ditto.
        (khtml::Selection::setBaseAndExtent): Ditto.
        (khtml::Selection::layout): Pass affinity to caretRect().
        (khtml::Selection::validate): Pass along affinity parameter to new functions that
        require it.
        (khtml::startOfFirstRunAt): Changed the way that the y-coordinate search is done, to
        keep this code working with changes made in selectionForLine().
        (khtml::endOfLastRunAt): Ditto.
        (khtml::selectionForLine): Make this function work for all renderers, not just text
        renderers.
        * khtml/editing/selection.h:
        (khtml::operator==): Consider affinity in equality check.
        * khtml/editing/visible_units.cpp:
        (khtml::previousLinePosition): Pass affinity argument to function so it can take this 
        information into account while processing.
        (khtml::nextLinePosition): Ditto.
        (khtml::previousParagraphPosition): Ditto.
        (khtml::nextParagraphPosition): Ditto.
        * khtml/editing/visible_units.h: Ditto, for each of the functions listed.
        * khtml/khtml_events.cpp:
        (khtml::MouseEvent::offset): Rework code to remove dependence on NodeImpl::positionForCoordinates,
        as this function is being removed.
        * khtml/khtml_part.cpp:
        (KHTMLPart::isPointInsideSelection): Ditto.
        (KHTMLPart::selectClosestWordFromMouseEvent): Ditto.
        (KHTMLPart::handleMousePressEventTripleClick): Ditto.
        (KHTMLPart::handleMousePressEventSingleClick): Ditto. Plus, pass affinity argument in
        call to positionForCoordinates, and set resulting affinity on the selection.
        (KHTMLPart::handleMouseMoveEventSelection): Rework code to remove dependence on 
        NodeImpl::positionForCoordinates, as this function is being removed.
        (KHTMLPart::khtmlMouseReleaseEvent): Ditto.
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::positionForCoordinates): Now takes an affinity argument.
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::caretRect): Ditto.
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::positionForCoordinates): Ditto.
        (RenderBR::caretRect): Ditto.
        (RenderBR::inlineBox): Ditto.
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::positionForCoordinates): Ditto.
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect): Ditto.
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::positionForCoordinates): Ditto.
        * khtml/rendering/render_inline.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect): Ditto.
        (RenderObject::positionForCoordinates): Ditto.
        (RenderObject::inlineBox): Ditto.
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_replaced.cpp:
        (RenderReplaced::positionForCoordinates): Ditto.
        * khtml/rendering/render_replaced.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::positionForCoordinates): Ditto.
        (firstRendererOnNextLine): New helper used by caretRect().
        (RenderText::caretRect): Now takes an affinity argument.
        (RenderText::inlineBox): Ditto.
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_nodeimpl.cpp: Remove positionForCoordinates helper.
        * khtml/xml/dom_nodeimpl.h: Ditto.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousLinePosition): Now takes an affinity argument.
        (DOM::Position::nextLinePosition): Ditto.
        * khtml/xml/dom_position.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge caretRectAtNode:offset:affinity:]): Ditto.
        (-[WebCoreBridge setSelectedDOMRange:affinity:]): Ditto.
        (-[WebCoreBridge _positionForPoint:]): Rework code to remove dependence on 
        NodeImpl::positionForCoordinates, as this function is being removed.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3670280> scroll position on overflowed textareas resets when leaving the tab

        * kwq/KWQTextArea.mm: (-[KWQTextAreaTextView becomeFirstResponder]):
        Scroll to reveal the text area, don't scroll to reveal the text view itself.
        Scrolling the text view ended up putting it at the top left, regardless of
        where the insertion point is.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3831546> More text is copied than is visually selected

        The bug here is that upstream was moving a position too far.

        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream): Use the "deep equivalent" node rather than the original node passed
        in for various checks. Also use local variables a bit more for slightly more efficiency.
        (DOM::Position::downstream): Ditto.

2004-10-11  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3833841> adding an event listener for keypress events does not work

        * khtml/xml/dom2_eventsimpl.h: Added numEventIds and made typeToId take a const DOMString &.
        * khtml/xml/dom2_eventsimpl.cpp:
        (EventImpl::typeToId): Changed to use table. Added "keypress", otherwise, the same as before.
        (EventImpl::idToType): Changed to use table.

2004-10-10  John Sullivan  <sullivan@apple.com>

        - fixed <rdar://problem/3664375> repro crash in -[KWQAccObject accessibilityAttributeNames]

        (-[KWQAccObject accessibilityActionNames]):
        check for nil m_renderer

2004-10-09  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3828147> REGRESSION: textareas with wrap="off" show their contents in a thin vertical line of text

        * kwq/KWQTextArea.h: Added setTextColor and setBackgroundColor methods. This is really for another fix
        I'm landing later, but it does no harm to add these now.
        * kwq/KWQTextArea.mm:
        (-[KWQTextArea _configureTextViewForWordWrapMode]): Set the container size after changing the flag that
        determines if the width tracks the text view. Otherwise, we won't successfully set the width in the case
        where we don't want it to track the text view. This caused the bug. 
        (-[KWQTextArea _createTextView]): Remove unneeded call to setMaxSize. The above method already does that.
        (-[KWQTextArea setTextColor:]): Added.
        (-[KWQTextArea setBackgroundColor:]): Added.

2004-10-09  Darin Adler  <darin@apple.com>

        Reviewed by Adele.

        - fixed <rdar://problem/3829452> REGRESSION (156-157): onload handler doesn't run on page with meta refresh of 0 duration (new Apple start page)

        The fix for <rdar://problem/3773150> made it so <meta> redirects prevent tokenizing the rest of the page.
        This is incorrect; the reason the JavaScript-triggered loads prevent tokenizing is that they take place
        "right away" in other browsers, but that is not true of <meta> redirect. We fixed this by using a separate
        call for <meta> redirect and not preventing tokenizing when that's in effect.

        * khtml/khtml_part.h: Removed userGesture parameter from scheduleRedirection. Renamed
        isImmediateRedirectPending to isScheduledLocationChangePending. Added scheduleLocationChange.
        * khtml/khtml_part.cpp:
        (KHTMLPart::openURL): Updated for new constant name.
        (KHTMLPart::scheduleRedirection): Removed now-unneeded userGesture parameter, and removed code that
        does the special case for redirection during load; a <meta> refresh can never be one of those special
        redirects during a load because it redirects the frame itself, not another frame. Also tightened up
        the logic by always stopping the redirect timer even if we aren't restarting it.
        (KHTMLPart::scheduleLocationChange): Added. Like scheduleRedirection, but with a different constant
        so we can tell it apart and always a delay of 0. The "redirection during load" case was moved in here
        and renamed to locationChangeScheduledDuringLoad.
        (KHTMLPart::isScheduledLocationChangePending): Renamed from isImmediateRedirectPending. This now
        returns true only for location changes and history navigation, not <meta> redirects.
        (KHTMLPart::scheduleHistoryNavigation): Tightened up logic to do the stop() outside the if as above,
        and got rid of a silly timer delay computation that always resulted in 0.

        * khtml/khtmlpart_p.h: Added a new value to the RedirectionScheduled enum for scheduleLocationChange
        and also renamed one of the existing values.

        * khtml/html/htmltokenizer.cpp: (HTMLTokenizer::write): Changed to use isScheduledLocationChangePending instead
        of isImmediateRedirectPending, because we do want to continue tokenizing if it's actually a redirect.

        * khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::putValue): Changed to call the new scheduleLocationChange
        instead of calling scheduleRedirection with delay of 0.
        * khtml/ecma/kjs_window.cpp:
        (Window::put): Ditto.
        (WindowFunc::tryCall): Ditto.
        (Location::put): Ditto.
        (LocationFunc::tryCall): Ditto.

2004-10-09  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3658277> REGRESSION (1.1-1.2): form submission should either not simulate a click at all or use (0,0) the way Mozilla does

        * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::click): Use 0,0 for the coordinates.

2004-10-09  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3804665> REGRESSION: WebCore framework now has many init routines

        * khtml/xml/dom_nodeimpl.h: Changed anyQName declaration to not use the inline function
        makeId. Surprisingly, the inline function was not "constant-folded" and we ended up with
        a copy of the function in each file as an init routine for the framework.

        * khtml/ecma/kjs_html.cpp: (Gradient::colorStops): Get rid of initialized ColorStop
        globals; their constructors were showing up as init routines for the framework.

        * khtml/rendering/render_style.h: Got rid of inline initialDashboardRegions function.
        * khtml/rendering/render_style.cpp: (RenderStyle::initialDashboardRegions): Made this
        a normal function. When it was an inline function, the constructors for the per-file
        copies of the globals were showing up as init routines for the framework.

2004-10-09  Chris Blumenberg  <cblu@apple.com>

	Fixed: 
	<rdar://problem/3625352> up and down arrow and page up/down keys don't work to scroll overflow:auto/scroll/overlay areas
	<rdar://problem/3397658> scroll wheel does not work to scroll overflow:auto/scroll/overlay areas (RSS)
	<rdar://problem/3822027> REGRESSION (Mail): When selection moves out of visible area, should center as NSText does

        Reviewed by hyatt, kocienda.

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::scroll): new
        * khtml/rendering/render_layer.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::scroll): new
        * khtml/rendering/render_object.h:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::scrollOverflow): new
        (KWQKHTMLPart::scrollOverflowWithScrollWheelEvent): new
        (KWQKHTMLPart::khtmlMousePressEvent): store pressed node so we know where the focus is
        * kwq/KWQScrollBar.h:
        * kwq/KWQScrollBar.mm:
        (QScrollBar::setValue): return a bool
        (QScrollBar::scrollbarHit): ditto
        (QScrollBar::scroll): new
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge scrollOverflowInDirection:granularity:]): new
        (-[WebCoreBridge scrollOverflowWithScrollWheelEvent:]): new
        (-[WebCoreBridge ensureSelectionVisible]): visually center the extent of the selection

2004-10-06  David Hyatt  <hyatt@apple.com>

	Back out style sharing perf fix.
	
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::locateCousinList):
        (khtml::CSSStyleSelector::canShareStyleWithElement):
        (khtml::CSSStyleSelector::locateSharedStyle):
        * khtml/css/cssstyleselector.h:
        * khtml/html/html_elementimpl.h:
        (DOM::HTMLElementImpl::inlineStyleDecl):
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::recalcStyle):
        * khtml/xml/dom_elementimpl.h:

=== Safari-166 ===

2004-10-05  David Hyatt  <hyatt@apple.com>

	Fix a bug in the iteration of locateCousinList and clean up the style sharing stats code.

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::locateCousinList):
        (khtml::CSSStyleSelector::elementsCanShareStyle):
        (khtml::CSSStyleSelector::locateSharedStyle):
        (khtml::CSSStyleSelector::styleForElement):

2004-10-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::computeHorizontalPositionsForLine): Fix coding mistake that
        broke layout tests involving compacts.

2004-10-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Finish selection affinity implementation. This includes code to set the
        affinity correctly when clicking with the mouse, and clearing the
        affinity when altering the selection using any of the Selection object
        mutation functions.

        Each instance of the positionForCoordinates function in the render tree
        has been changed to include an EAffinity argument. It is now the job of this
        function to set the selection affinity.

        * khtml/editing/selection.cpp:
        (khtml::Selection::moveTo): Set affinity to DOWNSTREAM.
        (khtml::Selection::modify): Ditto.
        (khtml::Selection::clear): Ditto.
        (khtml::Selection::setBase): Ditto.
        (khtml::Selection::setExtent): Ditto.
        (khtml::Selection::setBaseAndExtent): Ditto.
        * khtml/editing/selection.h:
        (khtml::operator==): Consider affinity in equality check.
        * khtml/khtml_events.cpp:
        (khtml::MouseEvent::offset): Rework code to remove dependence on NodeImpl::positionForCoordinates,
        as this function is being removed.
        * khtml/khtml_part.cpp: 
        (KHTMLPart::isPointInsideSelection): Ditto.
        (KHTMLPart::selectClosestWordFromMouseEvent): Ditto.
        (KHTMLPart::handleMousePressEventTripleClick): Ditto.
        (KHTMLPart::handleMousePressEventSingleClick): Ditto. Plus, pass affinity argument in
        call to positionForCoordinates, and set resulting affinity on the selection.
        (KHTMLPart::handleMouseMoveEventSelection): Rework code to remove dependence on 
        NodeImpl::positionForCoordinates, as this function is being removed.
        (KHTMLPart::khtmlMouseReleaseEvent):
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::positionForCoordinates): Changed, as described above.
        * khtml/rendering/render_block.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::positionForCoordinates): Ditto.
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::positionForCoordinates): Ditto.
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::positionForCoordinates): Ditto.
        * khtml/rendering/render_inline.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::positionForCoordinates): Ditto.
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_replaced.cpp:
        (RenderReplaced::positionForCoordinates): Ditto.
        * khtml/rendering/render_replaced.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::positionForCoordinates): Ditto.
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_nodeimpl.cpp: Removed positionForCoordinates convenience.
        * khtml/xml/dom_nodeimpl.h: Ditto.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge _positionForPoint:]): Rework code to remove dependence on 
        NodeImpl::positionForCoordinates, as this function is being removed.

2004-10-05  David Hyatt  <hyatt@apple.com>

	Fix style sharing optimization to be fast again.  Go back to using pointer comparisons when looking for
	cousins to share.
	
        Reviewed by darin

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::locateCousinList):
        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyleInternal):
        * khtml/rendering/render_object.h:
        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::recalcStyle):

2004-10-05  David Hyatt  <hyatt@apple.com>

	Fix lists so that they properly participate in line layout as though they are text (when text bullets are
	used) and as images (when image bullets are used).
	
        Reviewed by kocienda

        * khtml/rendering/render_list.cpp:
        (RenderListMarker::createInlineBox):
        * khtml/rendering/render_list.h:
        (khtml::ListMarkerBox:::InlineBox):
        (khtml::ListMarkerBox::isText):

2004-10-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Recent checkin adding upstreamDeepEquivalent had it backwards. The helper
        we want is downstreamDeepEquivalent, as the deepEquivalent function returns
        an upstream position.

        * khtml/editing/selection.cpp:
        (khtml::Selection::layout): DOWNSTREAM case now uses downstreamDeepEquivalent.
        UPSTREAM uses deepEquivalent.
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::downstreamDeepEquivalent): New helper, replacing 
        upstreamDeepEquivalent.
        * khtml/editing/visible_position.h

2004-10-05  David Hyatt  <hyatt@apple.com>

	New selection gap-filling architecture.  Makes the gap-filling much more like NSTextView and puts the responsibility
	for gap-filling in the block.  Fixes numerous bugs with selection drawing including bidi issues, incorrect old
	horizontal gap filling, and selection performance issues.
	
        Reviewed by kocienda

        * khtml/html/html_imageimpl.cpp:
        (HTMLImageLoader::notifyFinished):
        * khtml/misc/khtmllayout.h:
        (khtml::GapRects::left):
        (khtml::GapRects::center):
        (khtml::GapRects::right):
        (khtml::GapRects::uniteLeft):
        (khtml::GapRects::uniteCenter):
        (khtml::GapRects::uniteRight):
        (khtml::GapRects::unite):
        (khtml::GapRects::operator QRect):
        (khtml::GapRects::operator==):
        (khtml::GapRects::operator!=):
        * khtml/rendering/font.cpp:
        (Font::drawHighlightForText):
        * khtml/rendering/font.h:
        * khtml/rendering/render_block.cpp:
        (khtml:::RenderFlow):
        (khtml::RenderBlock::removeChild):
        (khtml::RenderBlock::paintObject):
        (khtml::RenderBlock::paintEllipsisBoxes):
        (khtml::RenderBlock::setSelectionState):
        (khtml::RenderBlock::shouldPaintSelectionGaps):
        (khtml::RenderBlock::isSelectionRoot):
        (khtml::RenderBlock::selectionGapRects):
        (khtml::RenderBlock::paintSelection):
        (khtml::RenderBlock::fillSelectionGaps):
        (khtml::RenderBlock::fillInlineSelectionGaps):
        (khtml::RenderBlock::fillBlockSelectionGaps):
        (khtml::RenderBlock::fillHorizontalSelectionGap):
        (khtml::RenderBlock::fillVerticalSelectionGap):
        (khtml::RenderBlock::fillLeftSelectionGap):
        (khtml::RenderBlock::fillRightSelectionGap):
        (khtml::RenderBlock::getHorizontalSelectionGapInfo):
        (khtml::RenderBlock::leftSelectionOffset):
        (khtml::RenderBlock::rightSelectionOffset):
        * khtml/rendering/render_block.h:
        (khtml::RenderBlock::hasSelectedChildren):
        (khtml::RenderBlock::selectionState):
        (khtml::RenderBlock::BlockSelectionInfo::BlockSelectionInfo):
        (khtml::RenderBlock::BlockSelectionInfo::rects):
        (khtml::RenderBlock::BlockSelectionInfo::state):
        (khtml::RenderBlock::BlockSelectionInfo::block):
        (khtml::RenderBlock::selectionRect):
        * khtml/rendering/render_box.cpp:
        (RenderBox::position):
        * khtml/rendering/render_br.cpp:
        (RenderBR::inlineBox):
        * khtml/rendering/render_br.h:
        (khtml::RenderBR::selectionRect):
        (khtml::RenderBR::paint):
        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::selectionRect):
        (RenderCanvas::setSelection):
        * khtml/rendering/render_canvasimage.cpp:
        (RenderCanvasImage::paint):
        * khtml/rendering/render_image.cpp:
        (RenderImage::paint):
        * khtml/rendering/render_image.h:
        * khtml/rendering/render_line.cpp:
        (khtml::InlineBox::nextLeafChild):
        (khtml::InlineBox::prevLeafChild):
        (khtml::InlineBox::selectionState):
        (khtml::InlineFlowBox::addToLine):
        (khtml::InlineFlowBox::firstLeafChild):
        (khtml::InlineFlowBox::lastLeafChild):
        (khtml::InlineFlowBox::firstLeafChildAfterBox):
        (khtml::InlineFlowBox::lastLeafChildBeforeBox):
        (khtml::InlineFlowBox::selectionState):
        (khtml::RootInlineBox::fillLineSelectionGap):
        (khtml::RootInlineBox::setHasSelectedChildren):
        (khtml::RootInlineBox::selectionState):
        (khtml::RootInlineBox::firstSelectedBox):
        (khtml::RootInlineBox::lastSelectedBox):
        (khtml::RootInlineBox::selectionTop):
        (khtml::RootInlineBox::block):
        * khtml/rendering/render_line.h:
        (khtml::RootInlineBox::RootInlineBox):
        (khtml::RootInlineBox::hasSelectedChildren):
        (khtml::RootInlineBox::selectionHeight):
        * khtml/rendering/render_object.cpp:
        (RenderObject::selectionColor):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::):
        (khtml::RenderObject::selectionState):
        (khtml::RenderObject::setSelectionState):
        (khtml::RenderObject::selectionRect):
        (khtml::RenderObject::canBeSelectionLeaf):
        (khtml::RenderObject::hasSelectedChildren):
        (khtml::RenderObject::hasDirtySelectionState):
        (khtml::RenderObject::setHasDirtySelectionState):
        (khtml::RenderObject::shouldPaintSelectionGaps):
        (khtml::RenderObject::SelectionInfo::SelectionInfo):
        * khtml/rendering/render_replaced.cpp:
        (RenderReplaced::RenderReplaced):
        (RenderReplaced::shouldPaint):
        (RenderReplaced::selectionRect):
        (RenderReplaced::setSelectionState):
        (RenderReplaced::selectionColor):
        (RenderWidget::paint):
        (RenderWidget::setSelectionState):
        * khtml/rendering/render_replaced.h:
        (khtml::RenderReplaced::canBeSelectionLeaf):
        (khtml::RenderReplaced::selectionState):
        * khtml/rendering/render_text.cpp:
        (InlineTextBox::checkVerticalPoint):
        (InlineTextBox::isSelected):
        (InlineTextBox::selectionState):
        (InlineTextBox::selectionRect):
        (InlineTextBox::paintSelection):
        (InlineTextBox::paintMarkedTextBackground):
        (RenderText::paint):
        (RenderText::setSelectionState):
        (RenderText::selectionRect):
        * khtml/rendering/render_text.h:
        (khtml::RenderText::canBeSelectionLeaf):
        * kwq/KWQPainter.h:
        * kwq/KWQPainter.mm:
        (QPainter::drawHighlightForText):
        * kwq/KWQPtrDict.h:
        (QPtrDictIterator::toFirst):
        * kwq/KWQRect.mm:
        (QRect::unite):
        * kwq/WebCoreTextRenderer.h:
        * kwq/WebCoreTextRendererFactory.mm:
        (WebCoreInitializeEmptyTextGeometry):

2004-10-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin
        
        Use the new CSS properties I added with my previous check-in. Also makes
        some changes to caret positioning and drawing to make the proper editing
        end-of-line behavior work correctly.

        * khtml/editing/selection.cpp:
        (khtml::Selection::layout): Caret drawing now takes affinity into account
        when deciding where to paint the caret (finally!).
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::previousVisiblePosition): Move off Position::rendersInDifferentPosition
        to determine the result. Use a simpler test involving comparisons between
        downstream positions while iterating. This is cheaper to do and easier to understand.
        (khtml::VisiblePosition::nextVisiblePosition): Ditto.
        * khtml/rendering/bidi.cpp:
        (khtml::BidiIterator::current): Do not return non-breaking spaces for empty
        text renderers and for non-text renderers. Return a null Qchar instead. Returning
        non-breaking spaces was causing errors when the new -khtml-nbsp-mode was set to "space".
        (khtml::RenderBlock::computeHorizontalPositionsForLine): Shrink line boxes that 
        contain with more spaces than can fit on the end of a line.
        (khtml::RenderBlock::skipWhitespace): Factor this out from findNextLineBreak.
        (khtml::RenderBlock::findNextLineBreak): Use new skipWhitespace function. Add
        in code to check and use new CSS properties.
        * khtml/rendering/break_lines.cpp:
        (khtml::isBreakable): Consider a non-breaking space a breakable character based
        on setting of new -khtml-nbsp-mode property.
        * khtml/rendering/break_lines.h: Ditto.
        * khtml/rendering/render_block.h: Declare skipWhitespace function.
        * khtml/rendering/render_text.cpp: 
        (RenderText::caretRect): Do not draw the caret beyond the right edge of the
        window when in white-space normal mode.

2004-10-05  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for these bugs:
        
        In this patch, I add two new CSS properties and their associated behavior.
        This is to support end-of-line and word-wrapping features that match the 
        conventions of text editors.

        There are also some other small changes here which begin to lay the groundwork
        for using these new properties to bring about the desired editing behavior.

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue): Add support for new CSS properties.
        * khtml/css/cssproperties.c: Generated file.
        * khtml/css/cssproperties.h: Ditto.
        * khtml/css/cssproperties.in: Add new properties.
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty): Add support for new CSS properties.
        * khtml/css/cssvalues.c: Generated file.
        * khtml/css/cssvalues.h: Ditto.
        * khtml/css/cssvalues.in:  Add support for new CSS properties.
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::upstreamDeepEquivalent): Added new helper.
        * khtml/editing/visible_position.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::deleteLineBoxWrapper): Zero out inlineBoxWrapper.
        * khtml/rendering/render_replaced.cpp:
        (RenderWidget::detach): Zero out inlineBoxWrapper.
        * khtml/rendering/render_style.cpp:
        (StyleCSS3InheritedData):
        (StyleCSS3InheritedData::operator==): Add support for new CSS properties.
        (RenderStyle::diff): Ditto.
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::nbspMode): Ditto.
        (khtml::RenderStyle::khtmlLineBreak): Ditto.
        (khtml::RenderStyle::setNBSPMode): Ditto.
        (khtml::RenderStyle::setKHTMLLineBreak): Ditto.
        (khtml::RenderStyle::initialNBSPMode): Ditto.
        (khtml::RenderStyle::initialKHTMLLineBreak): Ditto.

2004-10-05  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3673150> Pasting string from clipboard that is longer than input box will accept fails rather than truncating

        * kwq/KWQTextField.mm:
        (-[KWQTextFieldFormatter isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:]):
        Wrote a new version of this method that truncates incoming strings rather than rejecting them
        out of hand.

2004-10-04  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3826343> crash in KHTMLParser::setCurrent parsing document fragment (happens in Calendar widget)

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Initialized currentIsReferenced to false (fixes bug).
        (KHTMLParser::reset): Use doc() to make code easier to read.
        (KHTMLParser::setCurrent): Ditto.
        (KHTMLParser::parseToken): Ditto.
        (KHTMLParser::insertNode): Ditto.
        (KHTMLParser::getElement): Ditto.
        (KHTMLParser::popOneBlock): Ditto.

        - fixed <rdar://problem/3814237> REGRESSION (Mail): Copy/paste style does not set color in Mail compose window

        * kwq/KWQKHTMLPart.h: Added fontAttributesForSelectionStart.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::styleForSelectionStart): Factored out most of fontForSelection.
        (KWQKHTMLPart::fontAttributesForSelectionStart): Added.
        (KWQKHTMLPart::fontAttributesForSelectionStart): Added.
        (KWQKHTMLPart::registerCommandForUndo): Updated for name change (see below).
        (KWQKHTMLPart::registerCommandForRedo): Ditto.

        * kwq/WebCoreBridge.h: Added fontAttributesForSelectionStart.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge undoEditing:]): Updated for name change (see below).
        (-[WebCoreBridge redoEditing:]): Ditto.
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:]): Got rid of named temporary
        EditCommandPtr variable to make things slightly more terse.
        (-[WebCoreBridge moveSelectionToDragCaret:smartMove:]): Ditto.
        (-[WebCoreBridge deleteSelectionWithSmartDelete:]): Ditto.
        (-[WebCoreBridge fontAttributesForSelectionStart]): Added.

        - fix compile on Panther and other cleanup

        * khtml/khtml_part.cpp: Removed unneeded include.
        * kwq/KWQEditCommand.h: Got rid of use of "impl" when referring to EditCommand pointers.
        * kwq/KWQEditCommand.mm: Added include so we compile on Panther.
        (-[KWQEditCommand initWithEditCommand:]): Changed name.
        (-[KWQEditCommand dealloc]): Updated for m_impl change to m_command.
        (-[KWQEditCommand finalize]): Ditto.
        (+[KWQEditCommand commandWithEditCommand:]): Changed name.
        (-[KWQEditCommand command]): Changed name.

2004-10-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - did a more-robust version of the fix I just landed

        * khtml/html/htmlparser.h: Added currentIsReferenced boolean.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Initializes currentIsReferenced.
        (KHTMLParser::setCurrent): Changed to respect and set currentIsReferenced.

2004-10-04  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3824393> REGRESSION (165-TOT): Crash in KHTMLParser::popOneBlock closing window (bose.com)

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::~KHTMLParser): Move call to setCurrent(0) after the call to freeBlock, since freeBlock doesn't
        work well when current is 0, and there's no reason we need to reset the current block first.
        (KHTMLParser::setCurrent): Don't ever hold a reference to the document. This prevents a situation where there
        would be a reference cycle. In the test case from the bug above, this cycle actually happened and resulted
        in a double-delete of the document, tokenizer, and parser.

2004-10-04  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3825429> onclick handler called when mouse down on another element (affects Dashboard Movies widget, test case enclosed)

        * khtml/khtmlview.cpp:
        (KHTMLViewPrivate::KHTMLViewPrivate): Initialize the click node to 0.
        (KHTMLViewPrivate::~KHTMLViewPrivate): Deref the click node.
        (KHTMLViewPrivate::reset): Clear the click node.
        (KHTMLView::viewportMousePressEvent): Call invalidateClick when we pass the event to a subframe to
        reduce the chance that we'll hold on to an old click node for a long time. Set the click node to
        the node we we are clicking on.
        (KHTMLView::viewportMouseDoubleClickEvent): Only send a click even if the node is the same one from
        the original click. Call invalidateClick when done to reduce the chance that we'll hold on to an
        old click node for a long time.
        (KHTMLView::invalidateClick): Clear the click node.
        (KHTMLView::viewportMouseReleaseEvent): Only send a click even if the node is the same one from
        the original click. Call invalidateClick when done to reduce the chance that we'll hold on to an
        old click node for a long time.
        (KHTMLView::keyPressEvent): Remove code that sets the originalNode field, which is never used.

2004-10-04  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3825289> REGRESSION (Mail): Crash in fontForSelection in empty window

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::previousPosition): Switch to node iteration instead "leaf"
        iteration. I have been wanting to make this change for a long time, but couldn't
        since other code relied on the leaf behavior. That is no longer true. Plus, the
        bug fix requires the new behavior.
        (khtml::VisiblePosition::nextPosition): Ditto.
        (khtml::VisiblePosition::isCandidate): Empty blocks needed a height to be a candidate,
        but we make a special case for the body element. This fixes the bug.

2004-10-04  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3800667> REGRESSION (Mail): double-clicking multiple spaces only selects two spaces

        * kwq/KWQTextUtilities.mm: (KWQFindWordBoundary): Moved here from the .cpp file. Changed to use the
        doubleClickAtIndex: method from NSAttributedString rather than using Unicode Utilities.
        * kwq/KWQTextUtilities.cpp: Removed.
        * WebCore.pbproj/project.pbxproj: Removed KWQTextUtilities.cpp.

        - fixed a problem that would show up using HTML editing under garbage collection

        * kwq/KWQEditCommand.mm: (-[KWQEditCommand finalize]): Fixed a [super dealloc] that should have been a
        [super finalize].

        - another small change

        * khtml/editing/visible_units.cpp: (khtml::nextWordBoundary): Tweaked a comment.

2004-10-01  Darin Adler  <darin@apple.com>

        Reviewed by Ken (or arguably done by Ken, reviewed by Darin).

        - fixed <rdar://problem/3823828> REGRESSION (Mail): Clicking past end of any line puts insertion point at beginning of next line

        * khtml/editing/visible_position.cpp: (khtml::VisiblePosition::VisiblePosition):
        Check for an offset of 0 and a <br> and use UPSTREAM affinity in that case.
        This is a short term fix for something that needs a better longer-term fix.

        - fixed <rdar://problem/3823816> REGRESSION (Mail): double-clicking first word on line also selects previous empty line

        * khtml/editing/visible_units.cpp: (khtml::previousWordBoundary): Added a special
        case for <br>. While I'm not sure why this regressed, I'm sure this fix is good.

2004-10-01  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3782117> CrashTracer: ..722 crashes at com.apple.WebCore: DOM::HTMLBodyElementImpl::insertedIntoDocument + 0x2c (AOL website)

        * khtml/html/html_baseimpl.cpp:
        (HTMLBodyElementImpl::insertedIntoDocument): Check for nil document case.
        (HTMLFrameElementImpl::isURLAllowed): Ditto.
        (HTMLFrameElementImpl::openURL): Ditto.

2004-10-01  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3822218> REGRESSION (164-165): images don't update on rollover on directv.com page

        I introduced a major regression where various JavaScript window properties would not be found when I
        fixed bug 3809600.

        * khtml/ecma/kjs_window.h: Added hasProperty.
        * khtml/ecma/kjs_window.cpp: (Window::hasProperty): Return true in all the cases where get returns something.

2004-09-30  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3461499> JavaScript function document.open() is buggy with 2nd argument "replace"

        Experiments with Firefox indicate that document.open() should not be treated as window.open() unless there
        are more than two parameters. Also, Firefox does not implement the "replace" behavior, so we don't have
        to worry about it either.

        * khtml/ecma/kjs_html.cpp: (KJS::HTMLDocFunction::tryCall): Only forward to window if there are more than
        two parameters, rather than if there are more than one.

        - fixed <rdar://problem/3672933> oninput is firing at page load time for <input type=range>

        * kwq/KWQSlider.mm: (QSlider::setValue): Don't emit a signal here. This follows the usual pattern, where
        a signal is only emitted for changes that are not explicitly requested by the caller.

        - fixed <rdar://problem/3821167> leaks of something allocated by recalcStyle after loading altavista page from cvs-base

        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyle): Ref and deref the style we allocate so it's
        not left floating if setStyle decides not to ref it.

        - fixed <rdar://problem/3821172> leak of HTML attribute string after loading the ESPN page from cvs-base

        * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Use the DOMString version of
        the lower() operation so we don't end up leaving a DOMStringImpl * floating if AtomicString decides not
        to ref it.

2004-09-30  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3822330> REGRESSION: crash on launch when homepage is set to about:blank
	
	Added nil check.
	
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setDisplaysWithFocusAttributes):

2004-09-30  Chris Blumenberg  <cblu@apple.com>
	
	Fixed: <rdar://problem/3792822> Safari is calling the Cocoa QuickTime plugin twice for the OBJECT and EMBED tags

        Reviewed by hyatt.

        * khtml/html/html_objectimpl.cpp:
        (HTMLObjectElementImpl::attach): call dispatchHTMLEvent after updateWidget instead of every time this method is called
        (HTMLObjectElementImpl::recalcStyle): ditto

2004-09-30  Darin Adler  <darin@apple.com>

        - rolled out bad image change that caused performance regression

        * khtml/rendering/render_image.cpp: (RenderImage::setPixmap):
        Don't reference the new image before doing the assignment.
        This forced an unwanted.

2004-09-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by me, coded by Darin

        - fixed <rdar://problem/3818305> REGRESSION (Mail): Shift + page up has no effect; should modify selection

        * khtml/editing/selection.cpp: (khtml::Selection::modify): Fix problem where vertical distance
        was used as a distance threshold, but was a negative number. Now make it positive at the start
        of the function (and make a couple related changes).

2004-09-29  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3779998> bringing window to front or sending to back does not send focus/blur events to JavaScript window object

	The fix has two parts, 1) make onblur and onfocus work for windows, 
        and 2), allow the dashboard to override WebKit's special key/non-key
        behaviors.

        Reviewed by Chris.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setDisplaysWithFocusAttributes):

2004-09-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug:
        
        <rdar://problem/3705894> REGRESSION (Mail): if a single word is wider than the window, 
        it doesn't break and just runs off the right side

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Add support for CSS_PROP_WORD_WRAP.
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue): Ditto.
        * khtml/css/cssproperties.c: Generated file.
        * khtml/css/cssproperties.h: Ditto.
        * khtml/css/cssproperties.in: Add word-wrap property.
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty): Add support for CSS_PROP_WORD_WRAP.
        * khtml/css/cssvalues.c: Generated file.
        * khtml/css/cssvalues.h: Ditto.
        * khtml/css/cssvalues.in: Add break-word value.
        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::findNextLineBreak): Add code to implement new word wrapping feature.
        * khtml/rendering/render_style.cpp:
        (StyleCSS3InheritedData): Add support for new wordWrap property.
        (StyleCSS3InheritedData::operator==): Ditto.
        (RenderStyle::diff): Ditto.
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::wordWrap): Ditto.
        (khtml::RenderStyle::setWordWrap): Ditto.
        (khtml::RenderStyle::initialWordWrap): Ditto.

2004-09-29  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	- consolidated OS version checks into prefix header

        * WebCorePrefix.h:
        * khtml/rendering/render_canvasimage.cpp:
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject roleDescription]):
        (-[KWQAccObject accessibilityActionDescription:]):
        * kwq/KWQComboBox.mm:
        (QComboBox::QComboBox):
        * kwq/KWQFoundationExtras.h:

2004-09-29  David Hyatt  <hyatt@apple.com>

	Make sure <br>s always get line boxes.  Also prevent the creation of RenderTexts for whitespace normal/nowrap nodes
	that follow <br>s.
	
        Reviewed by kocienda

        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::isCandidate):
        * khtml/rendering/render_br.cpp:
        (RenderBR::RenderBR):
        (RenderBR::createInlineBox):
        (RenderBR::baselinePosition):
        (RenderBR::lineHeight):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_line.cpp:
        (khtml::InlineFlowBox::placeBoxesVertically):
        * khtml/rendering/render_line.h:
        (khtml::InlineBox::isText):
        (khtml::InlineFlowBox::addToLine):
        * khtml/rendering/render_text.cpp:
        (RenderText::detach):
        * khtml/rendering/render_text.h:
        (khtml::InlineTextBox:::InlineRunBox):
        (khtml::InlineTextBox::isInlineTextBox):
        (khtml::InlineTextBox::isText):
        (khtml::InlineTextBox::setIsText):
        * khtml/xml/dom_textimpl.cpp:
        (TextImpl::rendererIsNeeded):
        * kwq/KWQRenderTreeDebug.cpp:
        (operator<<):

2004-09-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3815895> exception inside fontForSelection causes Mail to abort when selection hits bottom

        * khtml/editing/selection.cpp:
        (khtml::Selection::toRange): Use RangeImpl calls to detect exceptions when creating a Range
        from a Selection. Return an empty Range when there is an exception.

        Fix for this bug:
        
        <rdar://problem/3817268> REGRESSION (Mail): Window does not scroll when selecting out of 
        visible area of view with arrow keys

        * khtml/editing/selection.cpp: Did some name changing. m_needsCaretLayout -> m_needsLayout.
        Added m_expectedVisibleRect which supplies the right rectangle to update when scrolling.
        (khtml::Selection::Selection): m_needsCaretLayout -> m_needsLayout name change.
        (khtml::Selection::init): Handle m_expectedVisibleRect in initialization.
        (khtml::Selection::operator=): Handle m_expectedVisibleRect in assignment.
        (khtml::Selection::setNeedsLayout): m_needsCaretLayout -> m_needsLayout name change.
        (khtml::Selection::layout): Changed name from layoutCaret, since m_expectedVisibleRect
        is also calculated here.
        (khtml::Selection::caretRect): m_needsCaretLayout -> m_needsLayout name change.
        (khtml::Selection::expectedVisibleRect): New. Returns m_expectedVisibleRect, doing a 
        layout if needed.
        (khtml::Selection::needsCaretRepaint): m_needsCaretLayout -> m_needsLayout name change.
        (khtml::Selection::paintCaret): Ditto.
        (khtml::Selection::validate): Ditto.
        * khtml/editing/selection.h: Add m_expectedVisibleRect member variable and 
        expectedVisibleRect accessor.
        * kwq/WebCoreBridge.h: Change name of ensureCaretVisible to ensureSelectionVisible, since
        this is not only about making the caret visible anymore. Now it can reveal the varying
        end of the selection when scrolling with arrow keys.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]): ensureCaretVisible to 
        ensureSelectionVisible name change.
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:]): Ditto
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:]): Ditto
        (-[WebCoreBridge insertNewline]): Ditto
        (-[WebCoreBridge insertText:selectInsertedText:]): Ditto
        (-[WebCoreBridge deleteKeyPressed]): Ditto
        (-[WebCoreBridge ensureSelectionVisible]): Ditto

2004-09-29  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug:
        
        <rdar://problem/3818296> REGRESSION (Mail): centerSelectionInVisibleArea does not work correctly
        
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::centerSelectionInVisibleArea): New function. Handles both caret
        and range selections correctly.
        * kwq/KWQNSViewExtras.h: Add forceCentering boolean to some methods in this file.
        * kwq/KWQNSViewExtras.m: Ditto. This addition has been done since the AppKit 
        method we use to do the centering, -[NSView scrollRectToVisible:],  does not alter 
        the view if the rectangle passed to it is already in view. When forceCentering is
        true, extra math is done to make scrollRectToVisible center the rectangle we want.
        (-[NSView _KWQ_scrollFrameToVisible]): Pass NO for forceCentering in call through to 
        _KWQ_scrollRectToVisible:forceCentering:
        (-[NSView _KWQ_scrollRectToVisible:forceCentering:]): Add forceCentering argument.
        (-[NSView _KWQ_scrollRectToVisible:inView:forceCentering:]): Ditto.
        (-[NSClipView _KWQ_scrollRectToVisible:inView:forceCentering:]): Ditto. Do extra
        math to implement the forceCentering effect.
        * kwq/KWQScrollView.h: Add forceCentering default argument to ensureRectVisibleCentered.
        * kwq/KWQScrollView.mm:
        (QScrollView::ensureRectVisibleCentered): Ditto.
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge centerSelectionInVisibleArea]): New function. Call through to KWQKHTMLPart. 

2004-09-28  Chris Blumenberg  <cblu@apple.com>

	Fixed: WebArchives begin with "<#document/>"

        Reviewed by hyatt.

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::startMarkup): don't return markup if this is a document node, forgot this when factoring this method out from toHTML

2004-09-28  Chris Blumenberg  <cblu@apple.com>

	Removed range parameter from recursive_toHTML and friends since that code path is no longer used.
	
        Reviewed by mjs.

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::recursive_toString):
        (NodeImpl::recursive_toHTML):
        * khtml/xml/dom_nodeimpl.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge markupStringFromNode:nodes:]):

2004-09-28  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - improve spell checking so it doesn't unmark and remark as you move the cursor with the arrow

        * khtml/editing/htmlediting.h: Remove obsolete markMisspellingsInSelection private function.
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommand::EditCommand): Blow away the selection when starting an edit command.
        (khtml::EditCommand::apply): Remove code to mark misspellings because that's now done as part
        of blowing away the selection.
        (khtml::EditCommand::unapply): Blow away the selection instead of marking misspellings.
        (khtml::EditCommand::reapply): Ditto.
        (khtml::ReplaceSelectionCommand::doApply): Removed incorrect code that does spell checking
        on inserted text; this doesn't match NSText behavior.
        (khtml::TypingCommand::markMisspellingsAfterTyping): Use markMisspellingsInAdjacentWords
        function for greater clarity on what this actually does.

        * khtml/khtml_part.h: Replaced setSelection's "unmarkOldSelection" boolean parameter with a
        "keepTypingStyle" boolean parameter. Removed notifySelectionChanged.
        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection): Replaced the "unmarkOldSelection" boolean with a new "keepTypingStyle"
        boolean. This is a step on the way to simplifying how this works. Moved the code from the
        notifySelectionChanged function here, since there was no clear line between the two functions.
        (KHTMLPart::clearSelection): Call setSelection rather that having special case code here for
        the case of an empty selection.
        (KHTMLPart::appliedEditing): Remove the explicit "false" for "unmarkOldSelection".
        (KHTMLPart::unappliedEditing): Ditto.
        (KHTMLPart::reappliedEditing): Ditto.

        * kwq/KWQKHTMLPart.h: Replaced markMisspellingsInSelection and updateSpellChecking with
        markMisspellings and markMisspellingsInAdjacentWords. Added parameters to respondToChangedSelection.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::markMisspellingsInAdjacentWords): Added.
        (KWQKHTMLPart::markMisspellings): New name for markMisspellingsInSelection. Simplified logic a
        bit and made it the caller's responsibility to expand the selection passed in to word boundaries.
        (KWQKHTMLPart::respondToChangedSelection): Added parameter that identifies the old selection,
        and changed logic so it won't mark misspellings in a word if the selection still starts in that word.

        - implemented empty-cells property in computed style

        * khtml/css/css_computedstyle.cpp: (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        Added code for CSS_PROP_EMPTY_CELLS. I think the HTML converter in AppKit uses this.

2004-09-28  Chris Blumenberg  <cblu@apple.com>

	Fixed n-squared issues with appending to KWQValueListImpl. This fixes the hang in 3794799.

        Fixed by Darin, reviewed by me.

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): tweaks
        * kwq/KWQValueListImpl.mm:
        (KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate):
        (KWQValueListImpl::KWQValueListPrivate::copyList):
        (KWQValueListImpl::clear):
        (KWQValueListImpl::appendNode):
        (KWQValueListImpl::prependNode):
        (KWQValueListImpl::removeEqualNodes):
        (KWQValueListImpl::containsEqualNodes):
        (KWQValueListImpl::removeIterator):
        (KWQValueListImpl::lastNode):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge nodesFromList:]): use iterator, not at()

2004-09-28  Richard Williamson   <rjw@apple.com>

	More dashboard region changes for John.

        <rdar://problem/3817421> add getter for dashboard regions (debugging)
        
        <rdar://problem/3817417> NSScrollView need autoregions for dashboard
        
        <rdar://problem/3817388> should have short form form control regions
        
        <rdar://problem/3817477> visibility does not work with dashboard control regions

        Reviewed by Hyatt.

        * WebCore-combined.exp:
        * WebCore.exp:
        * khtml/css/cssparser.cpp:
        (skipCommaInDashboardRegion):
        (CSSParser::parseDashboardRegions):
        * khtml/khtmlview.cpp:
        (KHTMLView::updateDashboardRegions):
        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):
        (RenderObject::addDashboardRegions):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::setDashboardRegions):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::setDashboardRegionsDirty):
        (DOM::DocumentImpl::dashboardRegionsDirty):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::paint):
        (KWQKHTMLPart::dashboardRegionsDictionary):
        (KWQKHTMLPart::dashboardRegionsChanged):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge dashboardRegions]):
        * kwq/WebDashboardRegion.h:
        * kwq/WebDashboardRegion.m:
        (-[WebDashboardRegion description]):

2004-09-28  John Sullivan  <sullivan@apple.com>

        Reviewed by Chris.

        - fixed <rdar://problem/3818558> REGRESSION: "Installed Plug-ins" is blank 
        because of <script type="application/x-javascript">

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::parseTag):
        add "application/x-javascript" to the list of legal scripting types. Mozilla
        accepts this, but WinIE doesn't.
        
        * layout-tests/fast/tokenizer/004.html:
        updated layout test to test some application/xxxx types

2004-09-27  David Hyatt  <hyatt@apple.com>

	Reworked lists to work well with RTL text.  Specifically the following bugs have been fixed:

	(1) All bullets use the same offset constant now (a padding of 7 pixels).  Before, images used 5 and others used 7.
	(2) Line height now works properly, so that list items with no content aren't squished (and missing the line descent).
	(3) Punctuation now works correctly with inside and outside style ordered lists in RTL.
	(4) RTL lists now properly apply padding and margin to the right side rather than the left.  This was done by adding
	-khtml-margin-start and -khtml-padding-start properties that are just mapped to left/right based off the direction.
	
        Reviewed by darin

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyDeclarations):
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/css/html4.css:
        * khtml/rendering/bidi.cpp:
        (khtml::BidiIterator::direction):
        * khtml/rendering/render_list.cpp:
        (RenderListItem::getAbsoluteRepaintRect):
        (RenderListMarker::paint):
        (RenderListMarker::calcMinMaxWidth):
        (RenderListMarker::lineHeight):
        (RenderListMarker::baselinePosition):

2004-09-28  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin
        
        Mark the VisiblePosition taking (Position &, EAffinity=DOWNSTREAM) explicit. Recently, when I added
        the EAffinity argument, I left this constructor implicit. Darin pointed out to me that this is
        undesirable since implicit use of the the constructor involved making the affinity choice, something
        which should be done explicitly.

        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyExtendingRightForward): Make explicit use of constructor mentioned above.
        (khtml::Selection::modifyMovingRightForward): Ditto.
        (khtml::Selection::modifyExtendingLeftBackward): Ditto.
        (khtml::Selection::modifyMovingLeftBackward): Ditto.
        (khtml::Selection::modify): Ditto.
        (khtml::Selection::validate): Ditto.
        * khtml/editing/visible_position.h: Make constructor taking (Position &, EAffinity) explicit.
        * khtml/editing/visible_units.cpp: Ditto.
        (khtml::previousWordBoundary): Make explicit use of constructor mentioned above.
        (khtml::nextWordBoundary): Ditto.
        (khtml::previousLinePosition): Ditto.
        (khtml::nextLinePosition): Ditto.
        * kwq/KWQKHTMLPart.mm: Ditto.
        (KWQKHTMLPart::findString): Ditto.
        (KWQKHTMLPart::advanceToNextMisspelling): Ditto.
        (KWQKHTMLPart::markMisspellingsInSelection): Ditto.
        (KWQKHTMLPart::updateSpellChecking): Ditto.

2004-09-28  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed a storage leak discovered by code inspection

        * khtml/html/htmlparser.cpp: (KHTMLParser::~KHTMLParser): Call setCurrent(0) to deref
        the parser's current node in the rare case where it still has one.

2004-09-27  David Hyatt  <hyatt@apple.com>

	Don't allow nested headers when only inlines are in between them.  Fixes a hang related to pathological nesting
	on magicmethodsonline.com.
	
        Reviewed by darin

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::parseToken):
        (KHTMLParser::processCloseTag):
        (KHTMLParser::isHeaderTag):
        (KHTMLParser::popNestedHeaderTag):
        * khtml/html/htmlparser.h:

2004-09-27  Kevin Decker  <kdecker@apple.com>

        Reviewed by John.

        * khtml/css/css_base.cpp:
        (CSSSelector::selectorText): changed another ATTR_CLASS case to properly return class selector names. 

2004-09-27  David Hyatt  <hyatt@apple.com>

	Fix style sharing so that it doesn't share when it shouldn't.  Partially fixes 3671516, table cells don't update
	their color on macosx.apple.com.

	Fix 3521639, iframe mispositioned on bidi page.  Make sure that when the width of a line exceeds the available line
	width that the spillage out of the block is determined by the direction of the block and not by the text-align value.

	Partial fix for 3762962, make sure the image cells with specified widths but percentage heights don't just get a minwidth
	of 0.

	Fix for 3533878, framesets that use percentages that add up to a value > 100% should normalize those percentages.
	
        Reviewed by john

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::locateCousinList):
        (khtml::CSSStyleSelector::elementsCanShareStyle):
        (khtml::CSSStyleSelector::locateSharedStyle):
        * khtml/css/cssstyleselector.h:
        * khtml/html/html_elementimpl.h:
        (DOM::HTMLNamedAttrMapImpl::hasMappedAttributes):
        (DOM::HTMLElementImpl::inlineStyleDecl):
        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::computeHorizontalPositionsForLine):
        * khtml/rendering/render_frames.cpp:
        (RenderFrameSet::layout):
        * khtml/rendering/render_replaced.cpp:
        (RenderReplaced::calcMinMaxWidth):
        * khtml/xml/dom_elementimpl.h:
        (DOM::ElementImpl::inlineStyleDecl):
        (DOM::ElementImpl::hasMappedAttributes):

2004-09-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Removed closestRenderedPosition function from Position class and gave this work
        to VisiblePosition instead. However, in order to make the transfer possible,
        VisiblePosition needed upstream and downstream affinities added to its
        constructors. Also moved the EAffinity enum into its own file. Also moved it
        to the khtml namespace.

        Updated several functions which used closestRenderedPosition to use VisiblePosition
        instead.
        
        Also deleted Position::equivalentShallowPosition. This was unused.

        * ForwardingHeaders/editing/text_affinity.h: Added.
        * ForwardingHeaders/editing/visible_position.h: Added.
        * WebCore.pbproj/project.pbxproj: Added new files.
        * khtml/editing/selection.cpp:
        (khtml::Selection::validate): Use VisiblePosition instead of closestRenderedPosition.
        * khtml/editing/selection.h:
        * khtml/editing/text_affinity.h: Added.
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::VisiblePosition):
        (khtml::VisiblePosition::initUpstream): New helper for finding upstream visible position.
        (khtml::VisiblePosition::initDownstream): Was old init function that unconditionally did
        downstream checks for visible position. Renamed to describe this more clearly.
        * khtml/editing/visible_position.h:
        * khtml/editing/visible_units.cpp:
        (khtml::previousWordBoundary): Use VisiblePosition instead of closestRenderedPosition.
        (khtml::nextWordBoundary): Use VisiblePosition instead of closestRenderedPosition.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection): Use VisiblePosition instead of closestRenderedPosition.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::closestRenderedPosition): Removed.
        * khtml/xml/dom_position.h: Removed two functions mentioned above.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection) Use VisiblePosition instead of closestRenderedPosition.:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:]): Use VisiblePosition instead of closestRenderedPosition.
        * layout-tests/editing/deleting/delete-block-merge-contents-012-expected.txt: Updated expected results.
        * layout-tests/editing/deleting/delete-block-merge-contents-017-expected.txt: Ditto.
        * layout-tests/editing/deleting/delete-contiguous-ws-001-expected.txt: Ditto.
        * layout-tests/editing/selection/move-by-character-004-expected.txt: Ditto.

2004-09-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin and Maciej

        Removed EditCommand smart pointer wrappers from htmlediting.cpp/.h, save for the one
        at the root of the hierarchy, and this one has been renamed EditCommandPtr. Renamed
        each of the XXXCommandImpl classes, removing the Impl suffix from each, and rolled
        these into the htmlediting.cpp/.h files. The htmlediting_impl.cpp/.h files have
        been emptied and are being removed.

        For the remainder of files, perform the mechanical changes necessary to make everything
        compile and run as before.

        * WebCore.pbproj/project.pbxproj
        * khtml/editing/htmlediting.cpp
        * khtml/editing/htmlediting.h
        * khtml/editing/htmlediting_impl.cpp: Removed.
        * khtml/editing/htmlediting_impl.h: Removed.
        * khtml/editing/jsediting.cpp
        * khtml/khtml_part.cpp
        (KHTMLPart::openURL)
        (KHTMLPart::lastEditCommand)
        (KHTMLPart::appliedEditing)
        (KHTMLPart::unappliedEditing)
        (KHTMLPart::reappliedEditing)
        (KHTMLPart::applyStyle):
        * khtml/khtml_part.h
        * khtml/khtmlpart_p.h
        * kwq/KWQEditCommand.h
        * kwq/KWQEditCommand.mm
        (-[KWQEditCommand initWithEditCommandImpl:])
        (+[KWQEditCommand commandWithEditCommandImpl:])
        (-[KWQEditCommand impl])
        * kwq/KWQKHTMLPart.h
        * kwq/KWQKHTMLPart.mm
        (KWQKHTMLPart::registerCommandForUndo)
        (KWQKHTMLPart::registerCommandForRedo)
        * kwq/WebCoreBridge.mm
        (-[WebCoreBridge undoEditing:])
        (-[WebCoreBridge redoEditing:])
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:])
        (-[WebCoreBridge moveSelectionToDragCaret:smartMove:])
        (-[WebCoreBridge deleteSelectionWithSmartDelete:])

2004-09-26  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3816170> image.width/height not available from Image objects (works in Firefox)

        * khtml/ecma/kjs_html.h: Added width and height.
        * khtml/ecma/kjs_html.cpp: (Image::getValueProperty): Added width and height.
        * khtml/ecma/kjs_html.lut.h: Regenerated.

        - unrelated change; changed ordering of use count manipulation just in case we decide some day to do
          something when the use count hits 0

        * khtml/rendering/render_image.cpp: (RenderImage::setPixmap): Increment use count on new object before
        decrementing use count on old object.

2004-09-26  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3812771> document.implementation.hasFeature returns false for a lot of features we implement

        * khtml/xml/dom_docimpl.cpp: (DOMImplementationImpl::hasFeature): Added all the DOM features that we implemented
        as part of the HTML editing work.

        * khtml/dom/dom_node.cpp: (Node::isSupported): Changed this to call DOMImplementationImpl::hasFeature to share
        code. Later this might need to be different per-node, but at the moment that does not seem to be so.

        * khtml/ecma/kjs_dom.cpp:
        (DOMNodeProtoFunc::tryCall): Pass a null string if the parameter is omitted, undefined, or null. This is better than
        having a special case for the string "null" in the DOM implementation.
        (DOMDOMImplementationProtoFunc::tryCall): Ditto.

        - fixed <rdar://problem/3814605> REGRESSION: fast/table/039 layout test is failing due to extra trailing whitespace in innerText        

        * khtml/editing/visible_text.cpp: (khtml::TextIterator::advance): Check for the case where we are at the end of
        iteration, and don't call exitNode in that case. This prevents us from getting some unwanted trailing \n characters.

        - fixed <rdar://problem/3813253> method cloneNode() does not clone dynamically-set style attributes correctly

        * khtml/html/html_elementimpl.h: Added cloneNode override.
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::cloneNode): Added. Copies m_inlineStyleDecl.
        (HTMLElementImpl::parseHTMLAttribute): Changed to use getInlineStyleDecl().
        (HTMLElementImpl::innerText): Changed to do the same thing with fewer lines of code.
        (HTMLElementImpl::outerText): Tweaked comment.

        - other cleanup

        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::cloneNode): Removed an uneeded type cast.
        (XMLElementImpl::cloneNode): Ditto.

2004-09-24  Kevin Decker  <kdecker@apple.com>

        Reviewed by Maciej.

	<rdar://problem/3799334> DIG: Safari does not properly return style names [DigCSS.htm]

        * khtml/css/css_base.cpp:
        (CSSSelector::selectorText): Properly returns Class Selector names.  
	Before we would get *[CLASS"foo"] instead of .foo

2004-09-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3814660> REGRESSION (8A200-8A259): Select All has no effect on livepage.apple.com

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection): Move the selection start and end to rendered positions
        before passing off to the RenderCanvas for drawing.
        * layout-tests/editing/selection/select-all-004-expected.txt: Added.
        * layout-tests/editing/selection/select-all-004.html: Added.

2004-09-24  John Sullivan  <sullivan@apple.com>

        Reviewed by Maciej.
        
        - fixed <rdar://problem/3528339> Turn on full keyboard access shows 
        invisible <input> elements

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLGenericFormElementImpl::isFocusable):
        reject elements that have zero width or height, even if they aren't hidden

2004-09-24  Maciej Stachowiak  <mjs@apple.com>

	- fixed deployment build

        Reviewed by Ken.

        * khtml/dom/dom_string.cpp: put implementation of ascii() in #ifdef !NDEBUG
	to match prototype.

2004-09-24  David Hyatt  <hyatt@apple.com>

	Fix for 3800316, test 37 for tables is failing on the layout tests.  Make sure we don't incorrectly match
	non-HTML elements with HTML tag selectors in CSS.
	
        Reviewed by rjw

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::checkOneSelector):

2004-09-23  David Hyatt  <hyatt@apple.com>

	Fix for 3601920, CSS "tabs" not switching properly on zen garden design.  Improve the repainting to account
	for layer changes of z-index that necessitate an invalidation.
	
        Reviewed by kocienda

        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::):

2004-09-24  Chris Blumenberg  <cblu@apple.com>

	Made markup copying 5 times faster. Unfortunately, this still doesn't fix:
	<rdar://problem/3794799> Tiger8A252: copying a bunch o' text is so slow it seems like a hang

        Reviewed by rjw.

        * khtml/dom/dom_string.h:
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): serialize the range by iterating through the range
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::startMarkup): new, factored out from recursive_toString
        (NodeImpl::endMarkup): ditto
        (NodeImpl::recursive_toString): call factored out methods
        * khtml/xml/dom_nodeimpl.h:

=== Safari-165 ===

2004-09-24  Ken Kocienda  <kocienda@apple.com>

        Hyatt made an improvement in the render tree which caused the results
        to get a little thinner.

        * layout-tests/editing/deleting/delete-block-merge-contents-001-expected.txt
        * layout-tests/editing/deleting/delete-block-merge-contents-008-expected.txt

2004-09-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug:
        
        <rdar://problem/3812939> REGRESSION: move-between-blocks-no-001 editing layout test fails in DeleteSelectionCommandImpl

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::removeChild): Hyatt said this regression was caused by a bad merge. 
        Found by code inspection.

2004-09-23  John Sullivan  <sullivan@apple.com>

        Reviewed by Maciej.
        
        - fixed <rdar://problem/3551850> hang caused by interpreting bad javascript 
        guarded by a deliberately bogus "language" attribute (www.riibe.com)

        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::parseTag):
        Check for language attribute of <script> tag in a way that matches WinIE.
        Previously we were far too permissive.

2004-09-23  David Hyatt  <hyatt@apple.com>

	Fix for 3685234 and 3548444, the x-offset for frame borders was off by 1 pixel, causing mojibake to occur when
	repainting happened.

        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::repaintViewRectangle):

2004-09-23  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3813271> dashboard-region-circle and dashboard-region-rectangle should be collapsed into dashboard-region
	Fixed <rdar://problem/3813289> dashboard regions need to correctly account for overflow/scrolling

        Reviewed by Chris.

        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::cssText):
        * khtml/css/css_valueimpl.h:
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (skipCommaInDashboardRegion):
        (CSSParser::parseDashboardRegions):
        * khtml/khtmlview.cpp:
        (KHTMLView::layout):
        (KHTMLView::updateDashboardRegions):
        * khtml/khtmlview.h:
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::scrollToOffset):
        * khtml/rendering/render_object.cpp:
        (RenderObject::addDashboardRegions):
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::dashboardRegionsChanged):
        * kwq/WebDashboardRegion.h:
        * kwq/WebDashboardRegion.m:
        (-[WebDashboardRegion initWithRect:clip:type:]):
        (-[WebDashboardRegion dashboardRegionClip]):
        (-[WebDashboardRegion description]):

2004-09-23  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Richard

        * khtml/xml/dom_position.cpp:
        (DOM::Position::inRenderedContent): Make the "empty block" check the same as the one
        use in visible position. This fixes a recent regression which broke up and down
        arrowing between blocks with an empty block in between.

2004-09-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3685235> REGRESSION (Mail): links are not properly editable
        
	* khtml/html/html_inlineimpl.cpp:
        (HTMLAnchorElementImpl::isFocusable): If this element is editable, then follow
	the normal focus rules so the link does not swallow focus when you arrow key
	or drag-select into it.

2004-09-23  Darin Adler  <darin@apple.com>

        - added test for the DOM::Range bug fixed recently

        * layout-tests/fast/dom/clone-contents-0-end-offset-expected.txt: Added.
        * layout-tests/fast/dom/clone-contents-0-end-offset.html: Added.

2004-09-23  David Hyatt  <hyatt@apple.com>

	Fix for hitlist bug, crash when deleting.  

	Also fix repaint bug when inlines are inside overflow:auto/scroll regions.
	
        Reviewed by kocienda

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::DeleteSelectionCommandImpl):
        (khtml::DeleteSelectionCommandImpl::doApply):
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::removeChild):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::getAbsoluteRepaintRect):

2004-09-23  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3527840> reproducible crash at johnbrown.v32.qikker.com 
        (nil-deref in NodeImpl::dispatchEvent)

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::dispatchEvent):
        guard against document or document->document() being nil

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - added new VisibleRange class; not used yet

        * WebCore.pbproj/project.pbxproj: Added visible_range.h and visible_range.cpp.
        * khtml/editing/visible_range.cpp: Added.
        * khtml/editing/visible_range.h: Added.

        - tweaks

        * kwq/WebCoreBridge.mm: (-[WebCoreBridge alterCurrentSelection:direction:granularity:]):
        Use switch statement instead of if statement so we get a warning if we ever add a new
        granularity.

        * khtml/editing/selection.h: khtml, not DOM, namespace
        * khtml/editing/visible_position.h: Ditto.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3812758> 8S266: attaching mutation events to an editable div crashes Safari

        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::dispatchEvent): Added ref/deref so this works if passed a "floating" event object.
        (NodeImpl::dispatchGenericEvent): Ditto.
        (NodeImpl::dispatchHTMLEvent): Removed unneeded ref/deref now that dispatchEvent takes care of it.
        (NodeImpl::dispatchMouseEvent): Ditto.
        (NodeImpl::dispatchUIEvent): Ditto.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed some minor mistakes discovered by code inspection

        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection): Changed to not grab focus if clearing the selection.
        Grabbing focus when we get the selection is also probably something that should be
        conditional, since you can use a WebView in a mode where it can have selection even
        when not first responder, ala NSTextView.
        (KHTMLPart::setCaretVisible): Changed to not grab focus if making the caret invisible.
        Not sure if it's ever important to grab focus when making the caret visible, but by
        code inspection it seemed that was unlikely to do harm.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3790595> "ERROR: unimplemented propertyID: 97" logged to console when copying selection (table-layout)

        * khtml/css/css_computedstyle.cpp: (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        Added CSS_PROP_TABLE_LAYOUT case.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3809600> REGRESSION: text in search field doesn't disappear when clicked at developer.apple.com

        Reversing the order of scope caused us to get and set too many properties in the window
        object; in the case of this bug setting value ended up setting a window.value property
        instead of the value of the <input> element.

        * khtml/ecma/kjs_window.h: Removed bogus hasProperty function that always returns true.
        Testing shows that MacIE and Gecko match our behavior when we remove this, despite the
        "need this to match IE behavior" comment in the file, which I believe is incorrect.
        * khtml/ecma/kjs_window.cpp: Ditto.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3812471> -[DOMRange cloneContents] clones too much in some cases where endOffset is 0

        * khtml/xml/dom2_rangeimpl.cpp: (DOM::RangeImpl::processContents): Added some nil
        checks to prevent this function from crashing if offsets are greater than the
        number of child nodes. Added a special case for offset 0 in one case that has a loop
        that won't work correctly for that case.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3811890> when selecting and moving the caret, some words aren't spell-checked (test case included)

        This was mostly fixed by changes I made recently, but using the test case in the bug
        I discovered one regression I introduced and another problem that wasn't fixed yet.
        This change fixes both.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::markMisspellingsInSelection): Removed unneeded inRenderedContent() check. It was returning false
        in cases involving a <br> at the end of line, and the check isn't all that helpful now that we use VisiblePosition,
        which takes care of that sort of thing for you. Changed code to determine the range to check to use the two
        different flavors of word boundary to expand to words we touch in both directions.
        (KWQKHTMLPart::updateSpellChecking): Changed to use the same logic about word boundaries. By being consistent,
        the anomalies reported in the bug report go away.

2004-09-23  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3811584> REGRESSION (85-125): iframe.document undefined in function called from button onclick; works from img onclick

        Since we are doing a bit less "defers callbacks" work, when testing I ran into this code path.

        * khtml/xml/dom2_eventsimpl.cpp: (MouseEventImpl::computeLayerPos): Check for document without renderer.

2004-09-23  Darin Adler  <darin@apple.com>

        - checked in a new file I forgot

        * khtml/editing/text_granularity.h: Added.

2004-09-22  Darin Adler  <darin@apple.com>

        - renamed

            DOM::CaretPosition -> khtml::VisibleRange
            DOM::Selection     -> khtml::Selection

        - moved all the functions in visible_units.h from DOM to khtml namespace
        - moved the one thing from Selection that KHTMLPart uses into its own header

        * WebCore.pbproj/project.pbxproj: Added text_granularity.h.

        * ForwardingHeaders/editing/selection.h: Added.
        * WebCore-combined.exp: Regenerated.
        * WebCore-tests.exp: Updated symbol for DOM::Selection debugging.

        * khtml/ecma/kjs_window.cpp: Update names and namespaces.
        * khtml/editing/htmlediting.cpp: Ditto.
        * khtml/editing/htmlediting.h: Ditto.
        * khtml/editing/htmlediting_impl.cpp: Ditto.
        * khtml/editing/htmlediting_impl.h: Ditto.
        * khtml/editing/jsediting.cpp: Ditto.
        * khtml/editing/selection.cpp: Ditto.
        * khtml/editing/selection.h: Ditto.
        * khtml/editing/visible_position.cpp: Ditto.
        * khtml/editing/visible_position.h: Ditto.
        * khtml/editing/visible_text.h: Ditto.
        * khtml/editing/visible_units.cpp: Ditto.
        * khtml/editing/visible_units.h: Ditto.
        * khtml/khtml_part.cpp: Ditto.
        * khtml/khtml_part.h: Ditto.
        * khtml/khtmlpart_p.h: Ditto.
        * khtml/rendering/render_block.cpp: Ditto.
        * khtml/xml/dom_docimpl.h: Ditto.
        * khtml/xml/dom_nodeimpl.cpp: Ditto.
        * kwq/KWQKHTMLPart.h: Ditto.
        * kwq/KWQKHTMLPart.mm: Ditto.
        * kwq/KWQRenderTreeDebug.cpp: Ditto.
        * kwq/WebCoreBridge.mm: Ditto.

2004-09-22  Darin Adler  <darin@apple.com>

        * ForwardingHeaders/*: Use import instead of include.

2004-09-22  Darin Adler  <darin@apple.com>

        - renamed these files:

            misc/khtml_text_operations.h   -> editing/visible_text.h
            misc/khtml_text_operations.cpp -> editing/visible_text.cpp
            xml/dom_caretposition.cpp      -> editing/visible_position.cpp
            xml/dom_caretposition.h        -> editing/visible_position.h
            xml/dom_selection.cpp          -> editing/selection.cpp
            xml/dom_selection.h            -> editing/selection.h

        - broke out the word/line/paragraph part of visible_position.h into visible_units.h
        - removed some unnecessary includes from some header files to reduce the number of
          files that trigger "building the world"

        * WebCore.pbproj/project.pbxproj: Added the files under new names, removed the old ones.

        * ForwardingHeaders/editing/jsediting.h: Added.
        * ForwardingHeaders/editing/visible_text.h: Added.
        * ForwardingHeaders/misc/khtml_text_operations.h: Removed.
        * ForwardingHeaders/xml/dom_caretposition.h: Removed.
        * ForwardingHeaders/xml/dom_selection.h: Removed.

        * khtml/ecma/kjs_window.cpp: Updated or removed #include lines.
        * khtml/editing/htmlediting.cpp: Ditto.
        * khtml/editing/htmlediting.h: Ditto.
        * khtml/editing/htmlediting_impl.cpp: Ditto.
        * khtml/editing/htmlediting_impl.h: Ditto.
        * khtml/editing/jsediting.cpp: Ditto.
        * khtml/editing/selection.cpp: Ditto.
        * khtml/editing/selection.h: Ditto.
        * khtml/editing/visible_position.cpp: Ditto.
        * khtml/editing/visible_position.h: Ditto.
        * khtml/editing/visible_text.cpp: Ditto.
        * khtml/editing/visible_text.h: Ditto.
        * khtml/editing/visible_units.cpp: Added.
        * khtml/editing/visible_units.h: Added.
        * khtml/html/html_elementimpl.cpp: Updated or removed #include lines.
        * khtml/khtml_part.cpp: Ditto.
        * khtml/khtml_part.h: Ditto.
        * khtml/khtmlpart_p.h: Ditto.
        * khtml/khtmlview.cpp: Ditto.
        * khtml/misc/khtml_text_operations.cpp: Removed.
        * khtml/misc/khtml_text_operations.h: Removed.
        * khtml/rendering/render_block.cpp: Updated or removed #include lines.
        * khtml/xml/dom2_rangeimpl.cpp: Ditto.
        * khtml/xml/dom_caretposition.cpp: Removed.
        * khtml/xml/dom_caretposition.h: Removed.
        * khtml/xml/dom_docimpl.cpp: Updated or removed #include lines.
        * khtml/xml/dom_docimpl.h: Ditto.
        * khtml/xml/dom_elementimpl.cpp: Ditto.
        * khtml/xml/dom_nodeimpl.cpp: Ditto.
        * khtml/xml/dom_position.cpp: Ditto.
        * khtml/xml/dom_selection.cpp: Removed.
        * khtml/xml/dom_selection.h: Removed.
        * kwq/KWQKHTMLPart.mm: Updated or removed #include lines.
        * kwq/KWQKHTMLPart.h: Ditto.
        * kwq/KWQRenderTreeDebug.cpp: Ditto.
        * kwq/WebCoreBridge.mm: Ditto.

2004-09-22  Richard Williamson   <rjw@apple.com>
	
	Pass dashboard regions up to WebKit.
	
	Don't collect regions from RenderTexts.

	Made more args and return types references to avoid
	copying value lists.

        Reviewed by Hyatt.

        * WebCore.pbproj/project.pbxproj:
        * khtml/khtmlview.cpp:
        (KHTMLView::layout):
        * khtml/rendering/render_object.cpp:
        (RenderObject::collectDashboardRegions):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::dashboardRegions):
        (DocumentImpl::setDashboardRegions):
        * khtml/xml/dom_docimpl.h:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::didFirstLayout):
        (KWQKHTMLPart::dashboardRegionsChanged):
        * kwq/WebCoreBridge.h:
        * kwq/WebDashboardRegion.h: Added.
        * kwq/WebDashboardRegion.m: Added.
        (-[WebDashboardRegion initWithRect:type:]):
        (-[WebDashboardRegion copyWithZone:]):
        (-[WebDashboardRegion dashboardRegionRect]):
        (-[WebDashboardRegion dashboardRegionType]):
        (-[WebDashboardRegion description]):

2004-09-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this hitlist bug:
        
        <rdar://problem/3805486> REGRESSION (Mail): Empty block elements can cause the caret to get "stuck" in one spot

        * khtml/xml/dom_caretposition.cpp:
        (DOM::CaretPosition::isCandidate): You can no longer caret into empty blocks with no height.
        Also did a little clean up in this function.
        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt: Regenerated expected results. 
        This test was actually failing and had bogus results checked in!
        * layout-tests/editing/selection/select-all-003-expected.txt: Regenerated expected results.

2004-09-22  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3812091> REGRESSION (Mail): double-clicked word is not smart inserted on drag

        Reviewed by john.

        * khtml/editing/htmlediting.cpp:
        (khtml::MoveSelectionCommand::MoveSelectionCommand): take smartMove arg
        * khtml/editing/htmlediting.h:
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::deleteSelection): take smartDelete arg
        (khtml::MoveSelectionCommandImpl::MoveSelectionCommandImpl): take smartMove arg
        (khtml::MoveSelectionCommandImpl::doApply): pass smartMove for smartDelete and smartReplace
        * khtml/editing/htmlediting_impl.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge moveSelectionToDragCaret:smartMove:]): take smartMove arg

2004-09-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): New overloaded 
	version of this function, one that takes a flag to determine whether to
	perform a document updateLayout() call before querying the style system.
        * khtml/css/css_computedstyle.h:
        (DOM::EUpdateLayout): Give a symbolic constant to true/false for the 
	purpose of the new call to getPropertyCSSValue.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::StyleChange::currentlyHasStyle): Pass DoNotUpdateLayout to call to
	getPropertyCSSValue.
        (khtml::CompositeEditCommandImpl::applyTypingStyle): Add in top-level calls
	to updateLayout before doing style changes that now do not update styles
	themselves.
        (khtml::ApplyStyleCommandImpl::doApply): Ditto.
        (khtml::ApplyStyleCommandImpl::removeCSSStyle): Pass DoNotUpdateLayout to call to
        getPropertyCSSValue.
        (khtml::DeleteSelectionCommandImpl::computeTypingStyle): Remove this dead code.
        * khtml/editing/htmlediting_impl.h: Ditto.

2004-09-22  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        * WebCore.pbproj/project.pbxproj: New files added.
        * khtml/khtml_part.cpp:
        (KHTMLPart::clearSelection): No longer calls setFocusIfNeeded.
        (KHTMLPart::slotClearSelection): Merged old implementation from this function to
        clearSelection. Now just calls clearSelection. Also put in !APPLE_CHANGES since
        we do not call it.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::setFocusNode): Add some code to determine when setting the focus should
        clear the selection.
        * kwq/KWQWidget.mm:
        (QWidget::hasFocus): Call _webcore_effectiveFirstResponder to get view to check for focus.
        (QWidget::setFocus): Ditto.
        * kwq/WebCoreBridge.mm: 
        (-[WebCoreBridge deselectText]): Called slotClearSelection and should have been. Now calls
        clearSelection.
        * kwq/WebCoreView.h: Added.
        * kwq/WebCoreView.m: Added.
        (-[NSView _webcore_effectiveFirstResponder]): New method to yield the correct responder
        to check for firstResponder-ness before calling makeFirstResonder. This helps to prevent 
        unwanted firstResponder switching.
        (-[NSClipView _webcore_effectiveFirstResponder]): Ditto.
        (-[NSScrollView _webcore_effectiveFirstResponder]): Ditto.

2004-09-21  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3805137> REGRESSION: Cannot search on pricetool.com

        The problem here is that residual style handling can cause an
	element associated with a misnested form to lose the association,
	because it can become detached and then reattached in this
	case. So we need to maintain the association.
	
        * khtml/html/html_formimpl.h: Added list of dormant elements to form,
	and dormant bit to generic form element.
	* khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::~HTMLFormElementImpl): Clear m_form field for
	dormant elements too.
        (DOM::HTMLFormElementImpl::registerFormElement): Remove from dormant list
	in addition to adding to main list.
        (DOM::HTMLFormElementImpl::removeFormElement): Remove from both lists.
        (DOM::HTMLFormElementImpl::makeFormElementDormant): New method, remove from
	main list, add to dormant list.
        (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl): Initialize
	dormant bit to false.
        (DOM::HTMLGenericFormElementImpl::insertedIntoDocument): If the element is
	dormant and has a form, re-register it and clear the dormant bit.
        (DOM::HTMLGenericFormElementImpl::removedFromDocument): If the document has
	a form, tell the form it is dormant and set the dormant bit.

2004-09-22  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3811187> REGRESSION (Mail): Control-click past end of document does not spell check last word

        Reviewed by kocienda.

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::validate): if at the end of the document, expand to the left.

2004-09-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Ken and John.

	<rdar://problem/3759228> REGRESSION (Mail): stray characters when entering text via input method right after newline
        
	* khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::inputText): Add an optional 
	selectInsertedText parameter.
        (khtml::ReplaceSelectionCommandImpl::doApply): Let the inputText operation
	select the text when inserting plain text, because it already knows all the right
	information to do so, and this function doesn't (sometimes text is inserted
	before the start of the old selection, not after!)
        * khtml/editing/htmlediting_impl.h:

2004-09-22  Richard Williamson   <rjw@apple.com>

	More tweaks to dashboard regions.

	Move dashboard regions list into css3NonInheritedData so it will be shared
	by all styles that don't modify the empty region list.

	Make the initial value for dashboard region list a static to minimize allocations
	of empty lists.

	Make marquee and flex style accessor functions const.

        Reviewed by Hyatt.

        * khtml/rendering/render_style.cpp:
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::opacity):
        (khtml::RenderStyle::boxAlign):
        (khtml::RenderStyle::boxDirection):
        (khtml::RenderStyle::boxFlexGroup):
        (khtml::RenderStyle::boxOrdinalGroup):
        (khtml::RenderStyle::boxOrient):
        (khtml::RenderStyle::boxPack):
        (khtml::RenderStyle::marqueeIncrement):
        (khtml::RenderStyle::marqueeSpeed):
        (khtml::RenderStyle::marqueeLoopCount):
        (khtml::RenderStyle::marqueeBehavior):
        (khtml::RenderStyle::marqueeDirection):
        (khtml::RenderStyle::dashboardRegions):
        (khtml::RenderStyle::setDashboardRegions):
        (khtml::RenderStyle::setDashboardRegion):
        (khtml::RenderStyle::initialDashboardRegions):

2004-09-22  David Hyatt  <hyatt@apple.com>

	Fix for 3802766, entire view redrawn in Blot while typing.  Don't needlessly create text nodes just to find
	out the font for the caret position.
	
        Reviewed by darin

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection):

2004-09-21  Chris Blumenberg  <cblu@apple.com>

	Fixed:
	<rdar://problem/3735071> REGRESSION (Mail): WebCore Editing must do smart paste
	<rdar://problem/3799163> REGRESSION (Mail): Deleting a word doesn't delete whitespace

        Reviewed by darin.

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::DeleteSelectionCommand): take smartDelete parameter
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): take smartReplace parameter
        * khtml/editing/htmlediting.h:
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::DeleteSelectionCommandImpl): take smartDelete parameter
        (khtml::DeleteSelectionCommandImpl::doApply): delete whitespace before and after selection if necessary
        (khtml::ReplaceSelectionCommandImpl::ReplaceSelectionCommandImpl): take smartReplace parameter
        (khtml::ReplaceSelectionCommandImpl::doApply): add whitespace before and after the replacement if necessary
        * khtml/editing/htmlediting_impl.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:smartReplace:]): take smartReplace parameter
        (-[WebCoreBridge replaceSelectionWithNode:selectReplacement:smartReplace:]): ditto
        (-[WebCoreBridge replaceSelectionWithMarkupString:baseURLString:selectReplacement:smartReplace:]): ditto
        (-[WebCoreBridge replaceSelectionWithText:selectReplacement:smartReplace:]): ditto
        (-[WebCoreBridge deleteSelectionWithSmartDelete:]): take smartDelete parameter

2004-09-21  Richard Williamson   <rjw@apple.com>

	More dashboard region work.

	Added support for computed style and cssText for new region property.
	Added restriction on length types allowed in region functions.
	Added initial and inheritance support for -apple-dashboard-region.

        Reviewed by Hyatt.

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::cssText):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseDashboardRegions):
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/rendering/render_object.cpp:
        (RenderObject::addDashboardRegions):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::StyleDashboardRegion::operator==):
        (khtml::RenderStyle::dashboardRegions):
        (khtml::RenderStyle::setDashboardRegions):
        (khtml::RenderStyle::initialDashboardRegions):

2004-09-21  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed problem where our updateLayout call ignores pending stylesheets all the time

        * khtml/xml/dom_docimpl.h: Added updateLayoutIgnorePendingStylesheets.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateLayout): Took out the "ignore pending stylesheets" business here.
        (DocumentImpl::updateLayoutIgnorePendingStylesheets): Put it in here.

        * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Call the new
        updateLayoutIgnorePendingStylesheets function.
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElement::getValueProperty): Ditto.
        (KJS::HTMLElement::putValue): Ditto.
        * khtml/ecma/kjs_views.cpp: (DOMAbstractViewFunc::tryCall): Ditto.
        * khtml/ecma/kjs_window.cpp:
        (Window::updateLayout): Ditto.
        (Selection::get): Ditto.
        (SelectionFunc::tryCall): Ditto.

        * khtml/html/html_imageimpl.h: Add ignorePendingStylesheets boolean parameter.
        * khtml/html/html_imageimpl.cpp:
        (HTMLImageElementImpl::width): Respect new parameter.
        (HTMLImageElementImpl::height): Ditto.

        - tweaks

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]): Removed unneeded
        explicit "true" parameter to setSelection.
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:]): Ditto.

2004-09-21  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fix crash when pasting text at the end of the document and then doing an undo

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::EditCommandImpl::apply): Call markMisspellingsInSelection before doing
        the editing operation, and we'll tell setSelection not to unmark the old selection.
        Also call updateLayout before calling appliedEditing so DOM operations in the
        code responding to the selection change will work.
        (khtml::EditCommandImpl::unapply): Ditto.
        (khtml::EditCommandImpl::reapply): Ditto.

        * khtml/khtml_part.h: Added a third parameter to setSelection to tell it whether
        to unmark the old selection. We must pass false when editing, because the old
        selection might have now-invalid offsets inside it.
        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection): Add unmarkOldSelection parameter, and respect it.
        (KHTMLPart::appliedEditing): Pass false for unmarkOldSelection.
        (KHTMLPart::unappliedEditing): Ditto.
        (KHTMLPart::reappliedEditing): Ditto.

2004-09-21  Richard Williamson   <rjw@apple.com>

        Part 2 of the feature requested in
        <rdar://problem/3752791> Dashboard: Need a better solution for control regions
	
        This patch actually collections the regions and converts to absolute coordinates.
        Only remaining piece is to pass over the bridge and up the alley to WebKit
        UI delegate.
 
        Reviewed by Ken.

        * khtml/css/css_valueimpl.h:
        (DOM::CSSPrimitiveValueImpl::getDashboardRegionValue):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseDashboardRegions):
        * khtml/css/cssproperties.c:
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/khtmlview.cpp:
        (KHTMLView::layout):
        * khtml/rendering/render_object.cpp:
        (RenderObject::computeDashboardRegions):
        (RenderObject::addDashboardRegions):
        (RenderObject::collectDashboardRegions):
        * khtml/rendering/render_object.h:
        (khtml::DashboardRegionValue::operator==):
        * khtml/rendering/render_style.cpp:
        * khtml/rendering/render_style.h:
        (khtml::StyleDashboardRegion::):
        (khtml::RenderStyle::dashboardRegions):
        (khtml::RenderStyle::setDashboardRegion):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::updateLayout):
        (DocumentImpl::acceptsEditingFocus):
        (DocumentImpl::dashboardRegions):
        (DocumentImpl::setDashboardRegions):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::hasDashboardRegions):
        (DOM::DocumentImpl::setHasDashboardRegions):

2004-09-21  John Sullivan  <sullivan@apple.com>

        Reviewed by Darin.
        
        - WebCore part of fix for <rdar://problem/3618274> REGRESSION (125-135): 
        Option-tab doesn't always work as expected

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::tabsToAllControls):
        reworked logic to match what we promise in the UI; this worked correctly
        before for regular tabbing, but not for option-tabbing.

        * kwq/KWQButton.mm:
        (QButton::focusPolicy):
        check tabsToAllControls() rather than just WebCoreKeyboardAccessFull
        
        * kwq/KWQComboBox.mm:
        (QComboBox::focusPolicy):
        ditto
        
        * kwq/KWQFileButton.mm:
        (KWQFileButton::focusPolicy):
        ditto
        
        * kwq/KWQListBox.mm:
        (QListBox::focusPolicy):
        ditto

2004-09-21  John Sullivan  <sullivan@apple.com>

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modify):
        initialize xPos to make compiler happy in deployment builds

2004-09-21  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - some small mechanical improvements to the position and selection classes

        * khtml/xml/dom_position.h: Added clear(), startPosition(), and endPosition().
        * khtml/xml/dom_position.cpp:
        (DOM::Position::clear): Added.
        (DOM::startPosition): Added.
        (DOM::endPosition): Added.

        * khtml/xml/dom_caretposition.h: Changed m_position to m_deepPosition. Added clear(),
        removed node() and offset().
        * khtml/xml/dom_caretposition.cpp:
        (DOM::CaretPosition::init): Updated for name change of m_position to m_deepPosition.
        (DOM::CaretPosition::isLastInBlock): Ditto.
        (DOM::CaretPosition::next): Ditto.
        (DOM::CaretPosition::previous): Ditto.
        (DOM::CaretPosition::debugPosition): Ditto.
        (DOM::CaretPosition::formatForDebugger): Ditto.

        * khtml/xml/dom_selection.h: Remove setStart, setEnd, setStartAndEnd, rangeStart, rangeEnd,
        and all the assignXXX functions.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::Selection): Wean from assign functions, get and set data members directly.
        (DOM::Selection::init): Don't clear base, extent, start, and end, since they have constructors.
        (DOM::Selection::operator=): Wean from assign functions, get and set data members directly.
        (DOM::Selection::moveTo): Ditto.
        (DOM::Selection::setModifyBias): Ditto.
        (DOM::Selection::modifyExtendingRightForward): Ditto.
        (DOM::Selection::modifyMovingRightForward): Ditto.
        (DOM::Selection::modifyExtendingLeftBackward): Ditto.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::modify): Ditto.
        (DOM::Selection::xPosForVerticalArrowNavigation): Ditto.
        (DOM::Selection::clear): Ditto.
        (DOM::Selection::setBase): Ditto.
        (DOM::Selection::setExtent): Ditto.
        (DOM::Selection::setBaseAndExtent): Ditto.
        (DOM::Selection::toRange): Ditto.
        (DOM::Selection::layoutCaret): Ditto.
        (DOM::Selection::needsCaretRepaint): Ditto.
        (DOM::Selection::validate): Ditto.
        (DOM::Selection::debugRenderer): Ditto.
        (DOM::Selection::debugPosition): Ditto.
        (DOM::Selection::end):

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::advanceToNextMisspelling): Tweaked whitespace.

2004-09-21  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3647229> Safari does not play inline Windows Media Content on some sites (miggy.net and ministryofsound.com)

        Reviewed by john.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): when no MIME type is specified map from the WMP CLASSID to the WMP MIME type, look for the URL of the content in the URL PARAM tag

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed regression from my recent check-in where misspelled words do not get unmarked when moving the caret
        - changed CaretPosition to hold a Position instead of a node and offset
        - renamed isEmpty to isNull, etc.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::jumpToSelection): Updated for name changes.
        (KWQKHTMLPart::advanceToNextMisspelling): Ditto.
        (KWQKHTMLPart::fontForSelection): Ditto.
        (KWQKHTMLPart::setDisplaysWithFocusAttributes): Ditto.
        (KWQKHTMLPart::markMisspellingsInSelection): Ditto.
        (KWQKHTMLPart::updateSpellChecking): Fixed bug by using LeftWordIfOnBoundary.

        * khtml/xml/dom_position.h: Updated for name changes.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::element): Change to not use a separate null check.
        (DOM::Position::computedStyle): Updated for name changes.
        (DOM::Position::previousCharacterPosition): Ditto.
        (DOM::Position::nextCharacterPosition): Ditto.
        (DOM::Position::equivalentRangeCompliantPosition): Ditto.
        (DOM::Position::equivalentShallowPosition): Ditto.
        (DOM::Position::equivalentDeepPosition): Ditto.
        (DOM::Position::closestRenderedPosition): Ditto.
        (DOM::Position::inRenderedContent): Ditto.
        (DOM::Position::inRenderedText): Ditto.
        (DOM::Position::isRenderedCharacter): Ditto.
        (DOM::Position::rendersInDifferentPosition): Ditto.
        (DOM::Position::isFirstRenderedPositionOnLine): Ditto.
        (DOM::Position::isLastRenderedPositionOnLine): Ditto.
        (DOM::Position::inFirstEditableInRootEditableElement): Ditto.
        (DOM::Position::leadingWhitespacePosition): Ditto.
        (DOM::Position::trailingWhitespacePosition): Ditto.
        (DOM::Position::debugPosition): Ditto.
        (DOM::Position::formatForDebugger): Ditto.

        * khtml/xml/dom_caretposition.h: Change to use m_position, and change names.
        * khtml/xml/dom_caretposition.cpp:
        (DOM::CaretPosition::CaretPosition): Remove code to set up m_node.
        (DOM::CaretPosition::init): Set m_position directly.
        (DOM::CaretPosition::isLastInBlock): Updated for name changes.
        (DOM::CaretPosition::next): Set m_position directly.
        (DOM::CaretPosition::previous): Set m_position directly.
        (DOM::CaretPosition::previousCaretPosition): Updated for name changes.
        (DOM::CaretPosition::nextCaretPosition): Ditto.
        (DOM::CaretPosition::previousPosition): Ditto.
        (DOM::CaretPosition::nextPosition): Ditto.
        (DOM::CaretPosition::atStart): Ditto.
        (DOM::CaretPosition::atEnd): Ditto.
        (DOM::CaretPosition::isCandidate): Ditto.
        (DOM::CaretPosition::debugPosition): Ditto.
        (DOM::CaretPosition::formatForDebugger): Ditto.
        (DOM::startOfWord): Ditto.
        (DOM::endOfWord): Ditto.
        (DOM::previousParagraphPosition): Ditto.
        (DOM::nextParagraphPosition): Ditto.

        * khtml/xml/dom_selection.h: Updated names. Added isCaret and isRange.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modifyMovingRightForward): Updated for name changes.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::modify): Ditto.
        (DOM::Selection::expandUsingGranularity): Ditto.
        (DOM::Selection::xPosForVerticalArrowNavigation): Ditto.
        (DOM::Selection::toRange): Ditto.
        (DOM::Selection::layoutCaret): Ditto.
        (DOM::Selection::needsCaretRepaint): Ditto.
        (DOM::Selection::validate): Ditto.
        (DOM::startOfFirstRunAt): Ditto.
        (DOM::endOfLastRunAt): Ditto.
        (DOM::selectionForLine): Ditto.
        (DOM::Selection::formatForDebugger): Ditto.

        * khtml/ecma/kjs_window.cpp:
        (Selection::get): Updated for name changes.
        (Selection::toString): Ditto.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::debugPosition): Ditto.
        (khtml::StyleChange::init): Ditto.
        (khtml::StyleChange::currentlyHasStyle): Ditto.
        (khtml::CompositeEditCommandImpl::deleteSelection): Ditto.
        (khtml::CompositeEditCommandImpl::deleteUnrenderedText): Ditto.
        (khtml::ApplyStyleCommandImpl::doApply): Ditto.
        (khtml::DeleteSelectionCommandImpl::doApply): Ditto.
        (khtml::InputNewlineCommandImpl::doApply): Ditto.
        (khtml::InputTextCommandImpl::prepareForTextInsertion): Ditto.
        (khtml::InputTextCommandImpl::input): Ditto.
        (khtml::ReplaceSelectionCommandImpl::doApply): Ditto.
        (khtml::MoveSelectionCommandImpl::doApply): Ditto.
        (khtml::TypingCommandImpl::doApply): Ditto.
        (khtml::TypingCommandImpl::markMisspellingsAfterTyping): Ditto.
        (khtml::TypingCommandImpl::issueCommandForDeleteKey): Ditto.
        * khtml/editing/jsediting.cpp:
        (enabledAnySelection): Ditto.
        (enabledRangeSelection): Ditto.
        * khtml/khtml_part.cpp:
        (KHTMLPart::hasSelection): Ditto.
        (KHTMLPart::setFocusNodeIfNeeded): Ditto.
        (KHTMLPart::selectionLayoutChanged): Ditto.
        (KHTMLPart::timerEvent): Ditto.
        (KHTMLPart::isPointInsideSelection): Ditto.
        (KHTMLPart::selectClosestWordFromMouseEvent): Ditto.
        (KHTMLPart::handleMousePressEventTripleClick): Ditto.
        (KHTMLPart::handleMousePressEventSingleClick): Ditto.
        (KHTMLPart::handleMouseMoveEventSelection): Ditto.
        (KHTMLPart::khtmlMouseReleaseEvent): Ditto.
        (KHTMLPart::selectionHasStyle): Ditto.
        (KHTMLPart::selectionComputedStyle): Ditto.
        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::updateSelection): Ditto.
        * khtml/xml/dom_positioniterator.cpp:
        (DOM::PositionIterator::peekPrevious): Ditto.
        (DOM::PositionIterator::peekNext): Ditto.
        (DOM::PositionIterator::atStart): Ditto.
        (DOM::PositionIterator::atEnd): Ditto.
        * khtml/xml/dom_positioniterator.h:
        (DOM::PositionIterator::isEmpty): Ditto.
        * kwq/KWQRenderTreeDebug.cpp:
        (writeSelection): Ditto.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge editableDOMRangeForPoint:]): Ditto.
        (-[WebCoreBridge deleteSelection]): Ditto.
        (-[WebCoreBridge ensureCaretVisible]): Ditto.
        (-[WebCoreBridge rangeOfCharactersAroundCaret]): Ditto.

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3808073> find is broken

        * khtml/misc/khtml_text_operations.h: Add m_pastEndNode and change name of m_endNode to
        m_endContainer to more accurately reflect its purpose.
        * khtml/misc/khtml_text_operations.cpp:
        (khtml::TextIterator::TextIterator): Use pastEnd() for end of iteration, and change to
        handle bad ranges better: just return an empty iterator instead of raising an exception.
        (khtml::TextIterator::advance): Change to use m_pastEndNode to detect the end of iteration.
        (khtml::TextIterator::handleTextNode): Update for name change.
        (khtml::TextIterator::handleTextBox): Ditto.
        (khtml::TextIterator::range): Handle case where m_endContainer is nil.

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::surroundContents): Use offsetInCharacters.
        (DOM::RangeImpl::startNode): Added check for nil start container and use offsetInCharacters.
        (DOM::RangeImpl::pastEndNode): Ditto.

2004-09-20  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3781290> REGRESSION (Mail): Crash in ReplaceSelectionCommandImpl attaching file to new message

        Reviewed by kocienda.

        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection): setFocusNodeIfNeeded now works on the current selection so call setFocusNodeIfNeeded after setting the selection
        (KHTMLPart::clearSelection): don't call setFocusNodeIfNeeded with the current selection
        (KHTMLPart::setCaretVisible): ditto
        (KHTMLPart::setFocusNodeIfNeeded): do nothing if the part isn't focused, work with the current selection
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:
        (KHTMLPartPrivate::KHTMLPartPrivate): added m_isFocused
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::KWQKHTMLPart): removed _displaysWithFocusAttributes this is replaced by m_isFocused
        (KWQKHTMLPart::setSelectionFromNone): new, code factored out from setDisplaysWithFocusAttributes
        (KWQKHTMLPart::setDisplaysWithFocusAttributes): call setSelectionFromNone
        (KWQKHTMLPart::displaysWithFocusAttributes): now returns m_isFocused
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectionFromNone]): new

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Dave.

        - fixed nil-deref happening often in Mail when I delete

        * khtml/rendering/render_br.cpp: (RenderBR::selectionRect): Check for nil lastLeafChild.
        Dave may want to figure out why it's nil and do a different fix later.

2004-09-20  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	<rdar://problem/3672101> HANG: typing into login field at dws-direkt.deutsche-bank.de (infinite recursion)
        
	* khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::defaultEventHandler): Copy the list of handlers
	before firing any of them, in case a handler affects the list of
	event handlers.

2004-09-20  Chris Blumenberg  <cblu@apple.com>

	Fixed:
	<rdar://problem/3429921> obey PARAM tags inside of OBJECT tags when necessary
	<rdar://problem/3515685> Object tag in Java 1.4.1 / Safari doesn't recognize params

        Reviewed by darin.

        * khtml/khtml_part.cpp:
        (KHTMLPart::requestFrame): take 2 parameter arrays rather than 1 which will have to be parsed
        (KHTMLPart::requestObject): ditto
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:
        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): use PARAM tags when there is no EMBED specified
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::createPart): call renamed bridge method
        * kwq/KWQKJavaAppletWidget.mm:
        (KJavaAppletWidget::KJavaAppletWidget): ditto
        * kwq/KWQStringList.h:
        * kwq/KWQStringList.mm:
        (QStringList::getNSArray): return a const array
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge URLWithAttributeString:]): renamed to match API

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3655360> REGRESSION (Mail): Ctrl-V emacs key binding, -pageDown: method, unimplemented (and pageUp, and selection-modifying versions)
        - fixed <rdar://problem/3735055> REGRESSION (Mail): WebCore double click rules treat style change as a boundary
        - fixed <rdar://problem/3789939> REGRESSION (Mail): double-clicking on border whitespace selects space plus word before/after
        - fixed <rdar://problem/3792138> REGRESSION (Mail): Spell checker doesn't check current selected word
        - fixed <rdar://problem/3806604> REGRESSION (164): Triple-click sometimes selects extra characters
        - fixed <rdar://problem/3806996> REGRESSION (125-162): Triple-click in <pre> tagged text behaves oddly (leuf.net)

        * khtml/xml/dom_caretposition.h: Added a lot of new functions. Removed implicit conversion operator
        that converts from CaretPosition to Position.
        * khtml/xml/dom_caretposition.cpp:
        (DOM::CaretPosition::CaretPosition): Change to call deepEquivalent so it works without the implicit
        Position conversion operator.
        (DOM::CaretPosition::operator=): Ditto.
        (DOM::CaretPosition::next): Ditto.
        (DOM::CaretPosition::previous): Ditto.
        (DOM::CaretPosition::setPosition): Added an assertion.
        (DOM::start): Added.
        (DOM::end): Added.
        (DOM::setStart): Added.
        (DOM::setEnd): Added.
        (DOM::previousWordBoundary): Added.
        (DOM::nextWordBoundary): Added.
        (DOM::startWordBoundary): Added.
        (DOM::startOfWord): Added.
        (DOM::endWordBoundary): Added.
        (DOM::endOfWord): Added.
        (DOM::previousWordPositionBoundary): Added.
        (DOM::previousWordPosition): Added.
        (DOM::nextWordPositionBoundary): Added.
        (DOM::nextWordPosition): Added.
        (DOM::previousLinePosition): Added.
        (DOM::nextLinePosition): Added.
        (DOM::startOfParagraph): Changed function name.
        (DOM::endOfParagraph): Changed function name. Fixed code in includeLineBreak to work around
        the CaretPosition constructor issue for <br>, pass the right parameter for the block flow case,
        and handle <pre> properly.
        (DOM::inSameParagraph): Added.
        (DOM::previousParagraphPosition): Added.
        (DOM::nextParagraphPosition): Added.

        * khtml/xml/dom_position.h: Removed a number of functions no longer used; also made some private.
        * khtml/xml/dom_position.cpp: Removed a number of functions no longer used.

        * khtml/xml/dom_selection.h: Replaced DOCUMENT with DOCUMENT_BOUNDARY. Added overloads of lots
        of functions that take CaretPosition directly. Added overload of modify that takes a parameter
        for vertical distance to help implement pageDown: and friends. Replaced getRepaintRect with
        two new functions named caretRect and caretRepaintRect. Removed nodeIsBeforeNode.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::Selection): Added constructor that takes two CaretPosition objects.
        (DOM::Selection::setModifyBias): Added. Helper function.
        (DOM::Selection::modifyExtendingRightForward): Don't set modify bias, since that's now the caller's
        responsibility. Reimplement WORD and LINE in terms of new CaretPosition functions. Implement PARAGRAPH
        and change PARAGRAPH_BOUNDARY to use CaretPosition function by its new name.
        (DOM::Selection::modifyMovingRightForward): Ditto.
        (DOM::Selection::modifyExtendingLeftBackward): Ditto.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::modify): Call setModifyBias, and use a switch statement instead of if.
        (DOM::caretY): Added. Helper for the new modify function that implements moving a pixel distance,
        used by pageDown: and friends.
        (DOM::Selection::modify): Added.
        (DOM::Selection::toRange): Use RangeImpl::compareBoundaryPoints instead of nodeIsBeforeNode.
        (DOM::Selection::caretRect): Added. Replaces getRepaintRect, but does not add slop.
        (DOM::Selection::caretRepaintRect): Added. Replaces getRepaintRect; still adds slop.
        (DOM::Selection::needsCaretRepaint): Call caretRepaintRect.
        (DOM::Selection::validate): Use RangeImpl::compareBoundaryPoints instead of nodeIsBeforeNode.
        Reimplement WORD to use new CaretPosition functions; this fixes the double-clicking problems.
        Change paragraph calls to use new names.

        * ForwardingHeaders/dom/dom_position.h: Removed. This was in the wrong location.
        * khtml/editing/htmlediting.cpp: Fixed include that said "dom/dom_position.h".
        * khtml/editing/htmlediting_impl.cpp: Fixed include that said "dom/dom_position.h".
        (khtml::TypingCommandImpl::markMisspellingsAfterTyping): Rewrote this to use the new CaretPosition
        functions instead of the old Position functions.

        * khtml/misc/helper.h: Added const to character pointer parameter. Also put invertedColor inside
        an !APPLE_CHANGES since it doesn't do us any good.
        * khtml/misc/helper.cpp:
        (khtml::findWordBoundary): Added const to character pointer parameter.
        (khtml::nextWordFromIndex): Ditto.

        * kwq/KWQTextUtilities.h: Change parameters to const.
        * kwq/KWQTextUtilities.cpp: (KWQFindWordBoundary): Change parameter to const.
        * kwq/KWQTextUtilities.mm: (KWQFindNextWordFromIndex): Change parameter to const.

        * khtml/css/cssstyleselector.cpp: Disable code that uses invertedColor when APPLE_CHANGES, since it
        won't work for us.

        * khtml/rendering/render_canvas.cpp: (RenderCanvas::setSelection): Added checks for selection end
        so we can set the selection end to nodes that are not leaf nodes and it will still work. Also took
        out bogus firstChild/lastChild loops for the same reason.

        * kwq/KWQKHTMLPart.h: Add "start before selection" flag to advanceToNextMisspelling.
        Needed to fix bug with spell checking.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::findString): Changed to use CaretPosition.
        (KWQKHTMLPart::advanceToNextMisspelling): Added code to handle "start before selection" flag
        and changed to use CaretPosition and new helper functions.
        (KWQKHTMLPart::markMisspellingsInSelection): More changes to use CaretPosition.
        (KWQKHTMLPart::updateSpellChecking): Ditto.

        * kwq/WebCoreBridge.h: Replaced WebSelectByDocument with WebSelectToDocumentBoundary.
        Added advanceToNextMisspellingStartingJustBeforeSelection,
        rangeByAlteringCurrentSelection:verticalDistance:, and
        alterCurrentSelection:verticalDistance:.

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge advanceToNextMisspellingStartingJustBeforeSelection]): Added.
        (-[WebCoreBridge alterCurrentSelection:direction:granularity:]): Added case for selecting by
        paragraph to save X position.
        (-[WebCoreBridge rangeByAlteringCurrentSelection:verticalDistance:]): Added.
        (-[WebCoreBridge alterCurrentSelection:verticalDistance:]): Added.
        (-[WebCoreBridge ensureCaretVisible]): Call caretRect instead of getRepaintRect.

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - cleaned up DOM::RangeImpl a little so compareBoundaryPoints can be used outside the class

        * khtml/xml/dom2_rangeimpl.h: Added const to many of the member functions and made the
        compareBoundaryPoints that works on parameters be a const member function.
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::commonAncestorContainer): Added const.
        (DOM::RangeImpl::compareBoundaryPoints): Added const.
        (DOM::RangeImpl::boundaryPointsValid): Added const, and wrote cleaner version.
        (DOM::RangeImpl::insertNode): Simplified by calling containedByReadOnly.
        (DOM::RangeImpl::toString): Added const.
        (DOM::RangeImpl::toHTML): Added const.
        (DOM::RangeImpl::createContextualFragment): Added const.
        (DOM::RangeImpl::cloneRange): Added const.
        (DOM::RangeImpl::surroundContents): Simplified by calling containedByReadOnly.

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3806990> REGRESSION (125-162): Crash on Select All at http://leuf.net/cgi/wikidn?PerlConvertEolScript

        * khtml/rendering/render_replaced.cpp: (RenderWidget::setSelectionState): Added nil check for the
        widget.

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3773740> calling addEventListener on a frame that hasn't loaded yet crashes

        * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Add nil checks for the document.
        The nil check prevents the crash but there's still a bug here; I filed 3807059 about that.

2004-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed problem where up and down arrow keys are not preserving X position

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionLayoutChanged): Moved code to clear m_xPosForVerticalArrowNavigation out of here.
        (KHTMLPart::notifySelectionChanged): Moved it into here.

2004-09-18  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3805627> -[DOMRange _text] sometimes includes all text to the end of the document for certain ranges

        * khtml/misc/khtml_text_operations.cpp: (khtml::TextIterator::advance):
        Correctly handle the case when we are already on m_endNode. The concept here is that
        m_endNode is a node you must never "leave" when iterating.

=== Safari-164 ===

2004-09-17  Ken Kocienda  <kocienda@apple.com>

        * layout-tests/editing/selection/unrendered-004-expected.txt: Updated expected results.

2004-09-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3780245> REGRESSION (Mail): some lines are skipped when doing arrow navigation

        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousLinePosition): One-line fix. Make sure that BRs at the end of blocks
        are not skipped.

2004-09-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3805594> REGRESSION (Mail): Second return key stroke does not work when first was in blockquote

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::toRange): Code to convert caret positions moved the position upstream
        before making a range-compliant position, but erroneously would allow the position
        to cross blocks. Now it will no longer do so.

2004-09-16  Richard Williamson   <rjw@apple.com>

        Part 1 of the feature requested in
        <rdar://problem/3752791> Dashboard: Need a better solution for control regions

        This patch implements the CSS parsing necessary for dashboard regions.  
        Here's an example of the syntax we support:

        <style>
        #aDiv {
            -apple-dashboard-region:
                dashboard-region-circle(control 0 0 80 0)
                dashboard-region-rectangle(control,20,0,20,0)
                dashboard-region-circle(control 80 0 0 0); 
        }
        </style>


	Part 2 will determine the appropriate regions.

        Reviewed by Chris.

        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
        * khtml/css/css_valueimpl.h:
        (DOM::CSSPrimitiveValueImpl::):
        (DOM::DashboardRegionImpl::DashboardRegionImpl):
        (DOM::DashboardRegionImpl::~DashboardRegionImpl):
        (DOM::DashboardRegionImpl::setNext):
        (DOM::DashboardRegionImpl::setLabel):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseContent):
        (skipCommaInDashboardRegion):
        (CSSParser::parseDashboardRegions):
        * khtml/css/cssparser.h:
        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/dom/css_value.h:
        (DOM::CSSPrimitiveValue::):

2004-09-16  Darin Adler  <darin@apple.com>

        - fixed caret-drawing regression from my last patch

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::xPosForVerticalArrowNavigation): Pass false, meaning "vertical line caret"
        rather than true meaning "big box for overtyping".
        (DOM::Selection::layoutCaret): Ditto.

2004-09-16  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3803280> crash in selectAll on page with no contents

        * khtml/khtml_part.cpp: (KHTMLPart::selectAll): Handle case of 0 for documentElement().
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousWordPosition): Ditto.
        (DOM::Position::nextWordPosition): Ditto.

        - cleaned up caret code
        - changed DOM::Selection to use CaretPosition more

        * khtml/rendering/render_box.cpp: (RenderBox::caretRect): Change to use empty rectangles
        instead of an X value of -1 to mean no rectangle.
        * khtml/rendering/render_image.cpp: (RenderImage::selectionRect): Take advantage of the
        fixed QRect constructor.
        * khtml/rendering/render_object.cpp: (RenderObject::caretRect): Change to use empty
        rectangle instead of an X value of -1 to mean no rectangle.
        * khtml/rendering/render_text.cpp: (RenderText::caretRect): Cleaned up, and changed to use
        an empty rectangle instead of an X value of -1 to mean no rectangle.

        * khtml/xml/dom_caretposition.h: Made conversion from Position to CaretPosition something you
        can do implicitly, since it's an unambiguous conversion. Conversion in the other direction
        needs to be done explicitly. Moved EIncludeLineBreak here, and added startParagraphBoundary
        and endParagraphBoundary functions.
        * khtml/xml/dom_caretposition.cpp:
        (DOM::startParagraphBoundary): Added. Replaces, and made from, member function of DOM::Position.
        (DOM::endParagraphBoundary): Ditto.

        * khtml/xml/dom_position.h: Removed EIncludeLineBreak and startParagraphBoundary and
        endParagraphBoundary.
        * khtml/xml/dom_position.cpp: Removed startParagraphBoundary and endParagraphBoundary.

        * khtml/xml/dom_selection.h: Use CaretPosition instead of Position in a few places.
        Use a QRect for the caret rect. Change nodeIsBeforeNode to be a static member function.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::Selection): Change caret to store QRect instead of 3 separate fields.
        (DOM::Selection::init): Ditto.
        (DOM::Selection::operator=): Ditto.
        (DOM::Selection::modifyExtendingRightForward): Change to use CaretPosition instead of Position.
        Check for 0.
        (DOM::Selection::modifyMovingRightForward): Ditto. Check for 0.
        (DOM::Selection::modifyExtendingLeftBackward): Ditto.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::modify): Ditto.
        (DOM::Selection::layoutCaret): Change to use a QRect for the caret rect, and use an empty
        one to mean no rectangle.
        (DOM::Selection::getRepaintRect): Ditto.
        (DOM::Selection::paintCaret): Ditto.
        (DOM::Selection::validate): Change to use CaretPosition instead of Position. Also fixed
        PARAGRAPH_BOUNDARY, which was broken and doing the same thing as PARAGRAPH before, but
        it's not really used so that didn't matter. Check for 0.
        (DOM::Selection::nodeIsBeforeNode): Tightened up a bit and added some FIXMEs. This function
        has a number of problems and should probably be discarded in favor of the DOMStringImpl
        method that does the same thing.

2004-09-16  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
        
        Fix for this bug:
        
        <rdar://problem/3787168> REGRESSION (Mail): Deleting text from the beginning of a quoted range removes the quoting from the rest

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::moveNodesAfterNode): Only move the text nodes (and their siblings) when
        doing this move between blocks. This serves to mimic NSText behavior very well.

2004-09-15  Darin Adler  <darin@apple.com>

        - fixed Panther build

        * kwq/KWQAccObject.mm: (-[KWQAccObject accessibilityActionDescription:]): Fixed backwards
        check in #if that was compiling the code on Panther only rather than Tiger only.

2004-09-15  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed lockFocus exception I observed; perhaps not a real issue in the field due to exception blocking

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::imageFromRect): Put most of the function inside a
        big if statement to avoid the exception we get from lockFocus otherwise.

2004-09-15  Darin Adler  <darin@apple.com>

        Reviewed by Dave.

        - fixed <rdar://problem/3786467> REGRESSION (Mail): Reproducible crash replying to an HTML message when your preference is for plain text composing.

        * khtml/rendering/render_block.h: Remove removeChildrenFromLineBoxes.
        * khtml/rendering/render_block.cpp: (khtml::RenderBlock::removeChild): Remove calls
        to removeChildrenFromLineBoxes which was the old way of working around this.
        * khtml/rendering/render_flow.cpp: (RenderFlow::detach): Add comments and code to handle
        removing children from line boxes we are about to delete.

2004-09-15  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3781561> REGRESSION (Mail): typing in Mail became suddenly really sluggish (substitute font code)

	A DocumentMarker may begin before the InLineBox that includes
	it.  Ensure that we correctly handle that case.  The paintMarker()
	method and code that calls it could do with some cleanup to
	make it clearer how all the cases are handled, i.e. marker
	within box, or intersecting beginning or end of box.

        Reviewed by Darin.

        * khtml/rendering/render_text.cpp:
        (InlineTextBox::paintMarker):  Minimal change to ensure that we
	handle the case of marker starting before box.

2004-09-15  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - get rid of some of the localizable strings in here; we still have to figure out
          how we're going to localize the last few role descriptions

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject roleDescription]): Use NSAccessibilityRoleDescription for most
        descriptions instead of a hard-coded string (inside the UI_STRING placeholder).
        (-[KWQAccObject accessibilityActionDescription:]): Same thing, with NSAccessibilityActionDescription.

2004-09-15  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - did some QRect-related changes to facilitate later bug fixing

        * kwq/KWQPainter.h: Added fillRect overload that takes QRect to match the real Qt one.
        * kwq/KWQPainter.mm: (QPainter::fillRect): Added overload that takes QRect.

        * kwq/KWQRect.mm: (QRect::QRect): Change default constructed QRect to have a width and
        height of 0 rather than 1. Contrary to what we believed earlier, this is what Qt does.

2004-09-15  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3799512> REGRESSION (Mail): caret flashes 1 pixel too far to the left

        * khtml/rendering/render_text.cpp: (RenderText::caretRect): Added one to the horizontal position
        of the caret rect.

2004-09-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::doApply): The whitespace fixup code
        that makes sure proper whitespace renders after deletion was getting confused
        in cases where the deletion merged blocks. Basically, I needed to move some
        whitespace fixup code so it runs before deleting in the case where blocks
        need to be merged. It used to run after, and was getting confused by
        whitespace left over at the ends of the block after the deletion.
        * layout-tests/editing/deleting/delete-block-merge-contents-012-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-012.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-013-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-013.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-014-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-014.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-015-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-015.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-016-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-016.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-017-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-017.html: Added.

2004-09-15  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::moveNodesAfterNode): Renamed from moveNodesToBlock.
        Just some simplification and cleanup in this function.
        (khtml::DeleteSelectionCommandImpl::doApply): Remove a hunk of start-of-block code I thought
        I was going to get around to improving and refining. However, I no longer need this case.
        * khtml/editing/htmlediting_impl.h: Function name change.

2004-09-14  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - added method for fix to <rdar://problem/3788894> REGRESSION (Mail): ctrl-t emacs key binding does not work (transpose)

        * kwq/WebCoreBridge.h: Added rangeOfCharactersAroundCaret.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge rangeOfCharactersAroundCaret]): Added.

        * khtml/xml/dom_caretposition.h: Added range function to make a Range from two CaretPosition objects.
        * khtml/xml/dom_caretposition.cpp:
        (DOM::CaretPosition::rangeCompliantEquivalent): Fixed a bug in this that caused it to screw up
        ranges in text nodes. Also changed it to use offset 0 as Ken and I discussed.
        (DOM::range): Added.

        * kwq/DOM.mm: (-[DOMRange description]): Added.

2004-09-14  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3786986> REGRESSION: TEXTAREAs have extra wide right margins where the scrollbars used to be

        * kwq/KWQTextArea.mm:
        (-[KWQTextArea _updateTextViewWidth]): Renamed from _frameSizeChanged. Now uses the width of
        the size from the contentSize method rather than trying to compute a size.
        (-[KWQTextArea initWithFrame:]): Call method by new name.
        (-[KWQTextArea tile]): Override this instead of setFrame: to adjust the size as the size of
        the text area changes.

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Backed out my changes to these files. They were not meant to be checked. (I'm having a bad CVS day)

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:]):
        (-[WebCoreBridge replaceSelectionWithNode:selectReplacement:]):
        (-[WebCoreBridge replaceSelectionWithMarkupString:baseURLString:selectReplacement:]):
        (-[WebCoreBridge replaceSelectionWithText:selectReplacement:]):

2004-09-14  David Hyatt  <hyatt@apple.com>

	Fix the crash in the layout tests caused by my recent selection changes.  Simply eliminate the buggy
	selection border setting code and let isSelectionBorder be implemented in terms of the SelectionState.
	
        Reviewed by kocienda

        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::setSelection):
        * khtml/rendering/render_object.cpp:
        (RenderObject::RenderObject):
        (RenderObject::container):
        (RenderObject::isSelectionBorder):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::minMaxKnown):
        (khtml::RenderObject::setReplaced):

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3778680> REGRESSION: plug-in content sometimes doesn't show up

        Reviewed by dave.

        * khtml/html/html_objectimpl.cpp:
        (HTMLObjectElementImpl::parseHTMLAttribute): set needWidgetUpdate to true only if there is a renderer
        (HTMLObjectElementImpl::attach): if needWidgetUpdate is true, call updateWidget

2004-09-14  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	- fixed <rdar://problem/3800315> encode-URI-test layout test is failing
	- updated escape/encodeURI layout test to match our new, more
	compatible behavior.

        * layout-tests/fast/js/global/encode-URI-test.html:

2004-09-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Richard

        Fix for this bug:
        
        <rdar://problem/3800834> REGRESSION (Mail): Can't delete backwards past quoted text using HTML editing

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::TypingCommandImpl::issueCommandForDeleteKey): Use CaretPosition class to get superior
        smarts about the selection to delete in the "start of block" case. This fixes the bug.
        While I was in the neighborhood, I cleaned up this function a bit.
        * layout-tests/editing/deleting/delete-3800834-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3800834-fix.html: Added.

2004-09-14  Ken Kocienda  <kocienda@apple.com>

        * khtml/css/parser.cpp: Did not regenerate this file from parser.y before last checkin.

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Fixed typos in last check-in.

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectClosestWordFromMouseEvent):
        (KHTMLPart::handleMousePressEventDoubleClick):
        * khtml/khtml_part.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendContextMenuEvent):

2004-09-09  David Hyatt  <hyatt@apple.com>

	Fix for 3667862, regression where dragging of selection became really slow.  This patch completely rewrites
	selection painting and drawing so that the enclosing rect is much more snug.  The containing block rect is no
	longer used at all.
	
        Reviewed by kocienda

        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::selectionRect):
        (getSelectionInfo):
        (RenderCanvas::setSelection):
        (RenderCanvas::clearSelection):
        * khtml/rendering/render_canvas.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::removeChildNode):
        * khtml/rendering/render_image.cpp:
        (RenderImage::selectionRect):
        (RenderImage::selectionTintColor):
        (RenderImage::paint):
        * khtml/rendering/render_image.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::selectionStartEnd):
        * khtml/rendering/render_object.h:
        (khtml::RenderObject::selectionRect):
        (khtml::RenderObject::SelectionInfo::object):
        (khtml::RenderObject::SelectionInfo::rect):
        (khtml::RenderObject::SelectionInfo::state):
        (khtml::RenderObject::SelectionInfo::SelectionInfo):
        (khtml::RenderObject::SelectionInfo::m_state):
        * khtml/rendering/render_text.cpp:
        (InlineTextBox::textObject):
        (InlineTextBox::selectionRect):
        (InlineTextBox::paintSelection):
        (RenderText::getAbsoluteRepaintRect):
        (RenderText::selectionRect):
        * khtml/rendering/render_text.h:
        * kwq/KWQPainter.mm:
        (getBlendedColorComponent):
        (QPainter::selectedTextBackgroundColor):

2004-09-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3794376> vertical formatting lines that show quote level are missing

        Rolling out change Dave made to fix 3787686. It turns out that we do not want this
        change, as it does not appear to have any effect on the bug. In addition, it caused
        the regression in quote bar behavior.

        * khtml/css/parser.cp
        * khtml/css/parser.y

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Fixed: Control-click shouldn't cause deselect when clicking selection.

        Reviewed by rjw.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendContextMenuEvent): don't attempt to select the closest word when the selection is clicked

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Fixed badness that my last patch caused. Because there was a conflict, my last patch added stuff that darin had just removed.

        Reviewed by darin.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendContextMenuEvent): don't call deref on the view

2004-09-14  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3783595> REGRESSION (Mail): control-click does not select closest word

        Reviewed by kocienda.

        * khtml/khtml_part.cpp:
        (KHTMLPart::selectionGranularity): new getter, need this for an upcoming patch
        (KHTMLPart::selectClosetWordFromMouseEvent): new, factored from handleMousePressEventDoubleClick
        (KHTMLPart::handleMousePressEventDoubleClick): call selectClosetWordFromMouseEvent
        * khtml/khtml_part.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendContextMenuEvent): call selectClosetWordFromMouseEvent if nothing swallows the event

2004-09-14  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3800346> Inserting newline in BR after block not working

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputNewlineCommandImpl::doApply): The code to insert the "extra" BR at the end
        of blocks (hack done to make BRs show up when they appear at the ends of blocks) did not
        cover this one quirky case where the insertion point can be placed in a BR at the end of 
        a block that does actually render. Now the input newline code can handle this addtional
        case.
        * layout-tests/editing/selection/insert-3800346-fix-expected.txt: Added.
        * layout-tests/editing/selection/insert-3800346-fix.html: Added.

2004-09-14  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3479392> REGRESSION (Mail): select all does not select all at some pages

        * khtml/xml/dom_caretposition.cpp: (DOM::CaretPosition::deepEquivalent):
        Use caretMaxOffset instead of maxOffset when descending to the last node.
        Also change around the function a bit.

2004-09-13  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3710123> Loading iframe that replaces content in the parent document crashes Safari (Oracle Portal)

        This is a more complete fix, but it requires the previous attempt at a fix for this same
        bug below, because this is only the "don't destroy the KHTMLPart" portion; other fixes are
        still needed to survive shutdown of the part.

        * khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::interpreter): Call the new keepAlive method.
        This is called whenever we're about to use an interpreter to run some JavaScript, and
        it's JavaScript that might destroy the part, hence the interpreter.

        * khtml/khtml_part.h: Added keepAlive() and slotEndLifeSupport() member functions.
        * khtml/khtmlpart_p.h: Added m_lifeSupportTimer.
        * khtml/khtml_part.cpp:
        (KHTMLPart::init): Connects m_lifeSupportTimer to slotEndLifeSupport.
        (KHTMLPart::write): Removed old attempt to work around this issue.
        (KHTMLPart::end): Ditto.
        (KHTMLPart::keepAlive): Added. References the part, then sets up a one-shot timer.
        (KHTMLPart::slotEndLifeSupport): Added. Stops the timer and then removes the reference
        from the part, possibly destroying it.

        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot): Added the new slot to the list of slots.
        (KWQSlot::call): Ditto.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::sendResizeEvent): Removed an old attempt to work around this same issue.
        (KWQKHTMLPart::mouseDown): Ditto.
        (KWQKHTMLPart::mouseDragged): Ditto.
        (KWQKHTMLPart::mouseUp): Ditto.
        (KWQKHTMLPart::mouseMoved): Ditto.
        (KWQKHTMLPart::sendContextMenuEvent): Ditto.

2004-09-13  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed regression caused by change earlier today

        * khtml/xml/dom_selection.cpp: (DOM::Selection::modifyExtendingRightForward):
        Use CaretPosition for CHARACTER, not WORD.

2004-09-13  Darin Adler  <darin@apple.com>

        Reviewed by Kevin.

        - fixed <rdar://problem/3798453> DIG failure: getting variable with same name as DOM element attribute gets attribute value instead

        * khtml/ecma/kjs_events.cpp: (JSEventListener::handleEvent): When adding current target and
        other event handler scope, put it below the existing scope chain. This ensures that things
        found in the function's scope will come before the event handler, as in other browsers.

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin
        
        Fix for this bug:
        
        <rdar://problem/3798346> REGRESSION (125-162): crash pushing down arrow key on KLM.com site

        * khtml/xml/dom_position.cpp:
        (DOM::Position::nextLinePosition): This function was being called in a case where it was not expected
        until we traced the code. It has to do with some deeper issues associated with handling arrow keys, 
        resulting in the editing arrow-down code running in a case where we are not editing. I discussed this 
        with Darin, and we decided to handle the broader issues at a later date. The fix I am checking in
        here to fix the bug is merely avoiding a null-deref.

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3784840> REGRESSION (Mail): Text is inserted in the wrong place after changing typing style

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputTextCommandImpl::prepareForTextInsertion): Code to handle typing style did not
        check to see if the reference node used for the DOM node insertion operation was a block.
        If it is, then the new node containing the new editing style now is inserted at the start of the block,
        instead of after it.

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Added a couple new layout tests to cover recent changes.

        * layout-tests/editing/editing.js: Added some new functions to do by-word selection movement.
        * layout-tests/editing/selection/move-backwords-by-word-001-expected.txt: Added.
        * layout-tests/editing/selection/move-backwords-by-word-001.html: Added.
        * layout-tests/editing/selection/selection-3748164-fix-expected.txt: Added.
        * layout-tests/editing/selection/selection-3748164-fix.html: Added.

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3765519> REGRESSION (Mail): word movement goes too far upstream at start of line
        
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousWordPosition): Use downstream position here when making final placement of caret. 

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Various editing improvements, many focused on the improvements made possible by the
        new CaretPosition class.
        
        Includes fixes for these bugs:
        
        <rdar://problem/3748164> REGRESSION (Mail): Arrow navigation in typical mail message can result in stuck caret
        <rdar://problem/3782062> REGRESSION (Mail): option-delete can delete almost all of a message when it has trouble finding a word
        <rdar://problem/3790456> triple click does not select entire paragraph (folklore.org)

        * WebCore.pbproj/project.pbxproj: Added CaretPosition class files.
        * khtml/dom/dom2_range.h:
        (DOM::offsetInCharacters): Moved this helper here from khtml_text_operations.cpp. This
        function helps to determine how to interpret the offsets used in DOM Ranges.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputNewlineCommandImpl::doApply): Use CaretPosition class to make "end-of-block" determination.
        Also, fix a caret placement glitch in "case 1" in the code: Place the caret in the node after the inserted
        BR. This makes it show up in the right place.
        * khtml/khtml_part.cpp:
        (KHTMLPart::handleMousePressEventDoubleClick): Don't limit double-click and triple-click handling only to text nodes.
        (KHTMLPart::handleMousePressEventTripleClick): Ditto.
        (KHTMLPart::selectAll): Use CaretPosition class to implement improved selectAll.
        * khtml/misc/khtml_text_operations.cpp:
        (khtml::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator): Make a fix to the initial state setting of
        m_handledChildren. This is true if the offset into the end node is 0, meaning that we do not want to descend
        into its children at all.
        * khtml/xml/dom_caretposition.cpp: Added.
        * khtml/xml/dom_caretposition.h: Added.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::traverseNextNode): Fix bugs with the stayWithin implementation. We could miss nodes we want to test
        due to an erroneous check of stayWithin when no such check is needed.
        (NodeImpl::traverseNextSibling): Ditto.
        (NodeImpl::traversePreviousNodePostOrder): Ditto.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::Position): Remove spurious semi-colon.
        (DOM::Position::upstream): Move incoming Position to its equivalentDeepPosition. This is part of the transition
        that will make this code work better with increased use of CaretPosition.
        (DOM::Position::downstream): Ditto.
        (DOM::Position::atStartOfContainingEditableBlock): Removed. Dead code; was not being called.
        (DOM::Position::atStartOfRootEditableElement): Removed. Dead code; was not being called.
        (DOM::Position::isLastRenderedPositionInEditableBlock): Removed. Replaced with calls to CaretPosition class.
        (DOM::Position::inLastEditableInRootEditableElement): Removed. Dead code; was not being called.
        (DOM::Position::inFirstEditableInRootEditableElement): Removed. Was only being called by other code that has been removed.
        * khtml/xml/dom_position.h:
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modifyExtendingRightForward): Moved implementation of CHARACTER case to use CaretPosition class instead
        of Position class helpers.
        (DOM::Selection::modifyMovingRightForward): Ditto.
        (DOM::Selection::modifyExtendingLeftBackward): Ditto.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::validate): Made simplifications in code that used to call a concoction of Position class helpers to
        do the right thing. Now calls CaretPosition equivalents.

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        This test was broken. The result is that it was not testing what it was supposed to 
        be testing. I fixed the test and updated the expected results.

        * layout-tests/editing/selection/move-between-blocks-no-001-expected.txt
        * layout-tests/editing/selection/move-between-blocks-no-001.html

2004-09-13  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:
        
        <rdar://problem/3784835> REGRESSION (Mail): crash in DOM::ElementImpl::tagName inside delete text command code while editing a Mail message
        <rdar://problem/3788015> REGRESSION (Mail): Crash deleting before a blockquote
        <rdar://problem/3796366> REGRESSION (Mail): Crash Mail by deleting the right line from pasted HTML

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::doApply): All of these bugs are due to the same problem. When I
        made the delete command run even when the text is a caret (to make block merges work right when the
        caret is at the start of a block), I failed to handle one case when there might be no text to 
        delete. This resulted in a call to the DeleteTextCommand with a zero-length deletion request.
        This is not supported. Now, I have added an additional test in this one place in the code that
        was causing all these failures.

2004-09-12  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3797758> REGRESSION (155-156): Cannot tab between input fields at switchboard.com

        * kwq/KWQLineEdit.mm: (QLineEdit::selectAll): Use setFocus() instead of calling makeFirstResponder
        directly since it handles the case where the field editor has focus.

2004-09-12  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3792082> zero character codes in UTF-16 input cause crash

        * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertUTF16): Fixed code that was using the wrong variable
        to decrement the input length, causing buffer overrun.

2004-09-12  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3798240> computed style error log messages seen with numbers in the range 74-77

        * khtml/css/css_computedstyle.cpp: (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        Added implementations for CSS_PROP__KHTML_MARQUEE_INCREMENT, CSS_PROP_MAX_HEIGHT, CSS_PROP_MAX_WIDTH,
        CSS_PROP_MIN_HEIGHT, CSS_PROP_MIN_WIDTH, and CSS_PROP_VISIBILITY.

2004-09-12  Darin Adler  <darin@apple.com>

        * layout-tests/css1/text_properties/text-transform-expected.txt: Removed unused test result.

2004-09-11  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3787208> can't log in to SAP SDN site (JS parse error)

        * kwq/KWQKURL.mm:
        (KURL::decode_string): Check for find result >= 0 instead of >0,
	to handle case of first character in a string being encoded.

2004-09-09  Chris Blumenberg  <cblu@apple.com>

	Support for: <rdar://problem/3795485> debug menu item to enable RSS animation on first layout

        Reviewed by rjw.

        * khtml/khtml_part.h:
        (KHTMLPart::didFirstLayout): new
        * khtml/khtmlview.cpp:
        (KHTMLView::layout): call didFirstLayout
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::didFirstLayout): new
        * kwq/WebCoreBridge.h:

=== Safari-163 ===

2004-09-09  Maciej Stachowiak  <mjs@apple.com>

        - roll out the last change, it appears to cause a performance regression

        * khtml/rendering/render_box.cpp:
        (RenderBox::caretRect):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::caretRect):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect):
        * khtml/rendering/render_text.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:

2004-09-08  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dave.

	WebCore part of fix for:
	
	<rdar://problem/3759187> REGRESSION (Mail): implement firstRectForCharacterRange:
	
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge firstRectForDOMRange:]): New method to compute the rect for a
	DOMRange, or if the range is split into multiple lines, the rect for the part on
	the first line only.
	
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect): Added extraWidthToEndOfLine parameter and ditto
	for the overrides below.
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::caretRect):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::caretRect):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect):

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3790526> mark-related methods not implemented (needed for people with them in their key bindings files)

        * khtml/khtml_part.h: Added mark and setMark.
        * khtml/khtmlpart_p.h: Added m_mark.
        * khtml/khtml_part.cpp:
        (KHTMLPart::mark): Added.
        (KHTMLPart::setMark): Added.

        * kwq/KWQKHTMLPart.h: Change name of markedRange to markedTextRange to decrease
        the change it will be confused with the mark.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::clear): Update for name change.
        (KWQKHTMLPart::markedTextRange): Ditto.
        (KWQKHTMLPart::setMarkedTextRange): Ditto.

        * khtml/rendering/render_text.cpp: (RenderText::paint): Update for name change.

        * kwq/WebCoreBridge.h: Remove setSelectionFrom, selectionStart, selectionStartOffset,
        selectionEnd, selectionEndOffset, and clearMarkedDOMRange. Renamed setMarkedDOMRange
        to setMarkedTextDOMRange and markedDOMRange to markedTextDOMRange. Added setMarkDOMRange
        and markDOMRange for the Emacs "mark".
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setMarkDOMRange:]): Added.
        (-[WebCoreBridge markDOMRange]): Added.
        (-[WebCoreBridge setMarkedTextDOMRange:]): Renamed.
        (-[WebCoreBridge markedTextDOMRange]): Renamed.

        * khtml/xml/dom_selection.cpp: (DOM::Selection::validate): Make paragraph positions
        canonical by using deep rendered positions. Maybe someday this won't be an ad hoc
        decision any more.

        * khtml/xml/dom_nodeimpl.cpp: (NodeBaseImpl::removeChildren): Use ref and deref
        rather than the unconventional check for 0 refCount. This makes us a bit more
        robust against a node going away partway through the removal process.

        * WebCore.pbproj/project.pbxproj: Update MACOSX_DEPLOYMENT_TARGET to 10.3.

2004-09-08  Maciej Stachowiak  <mjs@apple.com>

        - fixed deployment build problems noticed by Grant

        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect):
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect):

2004-09-08  David Hyatt  <hyatt@apple.com>

	Fix XML so that elements with no namespace never make HTML elements (when their names coincidentally match).
	
        Reviewed by rjw

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createElementNS):

2004-09-07  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	- renamed caretPos to caretRect and made it return a QRect instead
	of taking four out parameters by reference.
	
        * khtml/rendering/render_box.cpp:
        (RenderBox::caretRect):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_br.cpp:
        (RenderBR::caretRect):
        * khtml/rendering/render_br.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::caretRect):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::caretRect):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::caretRect):
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::xPosForVerticalArrowNavigation):
        (DOM::Selection::layoutCaret):
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge caretRectAtNode:offset:]):

2004-09-07  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Kevin.

	<rdar://problem/3759209> REGRESSION (Mail): assertion failure when all of marked text deleted at start of document
	
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setMarkedRange): Allow any empty range, even if
	it's not in a text node, since in this case it won't matter and
	weird things can happen when all marked text is removed, there
	might not be any text nodes.

2004-09-07  David Hyatt  <hyatt@apple.com>

	Initial text-decoration CSS3 work for editing.  Just gets the properties and values parsed.
	
        Reviewed by darin

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::adjustRenderStyle):
        * khtml/css/cssvalues.c:
        (hash_val):
        (findValue):
        * khtml/css/cssvalues.h:
        * khtml/css/cssvalues.in:

2004-09-06  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin and Ken.

	<rdar://problem/3655568> window.open fails when URL contains trailing space

        * kwq/KWQKURL.mm:
        (KURL::KURL): Strip trailing and leading space when resolving relative URLs in all
	cases, instead of just leading in the non-absolute case as before.

	- refactored KURL constructor to put more work in separate
	functions and also to change static methods to static functions,
	to avoid having to change the header when only changing helper
	functions that do not affect the KURL API (since KURL.h is widely
	included).
	
        * kwq/KWQKURL.mm:
        (encodeHostname):
        (findHostnamesInMailToURL):
        (findHostnameInHierarchicalURL):
        (encodeHostnames):
        (encodeRelativeString):
        (substituteBackslashes):
	* kwq/KWQKURL.h:

	- add missing include of qvaluelist.h

        * khtml/ecma/kjs_dom.h:

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3512066> REGRESSION (Mail): Select All highlights only part of the content, though all is copied
        - fixed <rdar://problem/3157025> REGRESSION (Mail): Should select paragraph instead of line on triple-click
        - fixed <rdar://problem/3735048> REGRESSION (Mail): HTML editing must select newline on triple click
        - fixed <rdar://problem/3788872> REGRESSION (Mail): ctrl-a emacs key binding does not work (move to start of paragraph)
        - fixed <rdar://problem/3788881> REGRESSION (Mail): ctrl-e emacs key binding does not work (move to end of paragraph)
        - fixed <rdar://problem/3789931> REGRESSION (Mail): typing style lost when you backspace
        - added code to select inserted text to help WebKit implement yankAndSelect:
        - did some clean-up on editing commands code
        
        * khtml/khtml_part.cpp:
        (KHTMLPart::handleMousePressEventTripleClick): Expand to a paragraph, not a line.
        (KHTMLPart::selectAll): Remove a lot of unneeded code and just expand to document using Selection.
        (KHTMLPart::selectionHasStyle): Remove check that limited us to only HTML elements, and add
        a check for nil. Together, these two changes fix a few cases I ran into during testing.

        * khtml/rendering/render_canvas.cpp: (RenderCanvas::setSelection): Fix test that was checking if
        the old selection spanned multiple objects when it really should have checked whether the new
        new selection spans multiple objects. This caused the select all redraw bug.

        * khtml/editing/htmlediting.h: Fixed indenting. Remove command IDs, replacing them with a couple
        of specific type checking methods, and SharedCommandImpl, using EditCommandImpl directly instead.
        Got rid of virtual functions, since the command objects have no data members other than the ones
        inherited from SharedPtr. Removed explicit copy constructors and destructors. Removed unneeded
        empty constructors. Removed inline directives that were having no effect. Added some boolean
        selectInsertedText parameter to some commands. Made almost all member functions const, because
        the const here applies to the command object which is a smart pointer, not the pointed-to
        command implementation object.
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommand::EditCommand): Changed since SharedPtr is now a pointer to EditCommandImpl.
        (khtml::EditCommand::operator=): Added. By defining this explicitly, we don't need the class
        that we are pointing to defined in the header, which lets us get rid of SharedCommandImpl.
        (khtml::EditCommand::isInputTextCommand): Added.
        (khtml::EditCommand::isTypingCommand): Added.
        (khtml::EditCommand::setParent): Updated since EditCommandImpl.setParent takes an impl pointer now.
        (khtml::EditCommand::handle): Removed, since it's identical to get().
        (khtml::InputTextCommand::input): Added selectInsertedText parameter.
        (khtml::TypingCommand::TypingCommand): Ditto.
        (khtml::TypingCommand::insertText): Ditto.
        (khtml::TypingCommand::isOpenForMoreTypingCommand): Use isTypingCommand instead of commandID.
        (khtml::TypingCommand::closeTyping): Change parameter type to const reference.

        * khtml/editing/htmlediting_impl.h: Made StyleChange functions be const member functions.
        Changed parent() and setParent() to take and return EditCommandImpl pointers and be inlined.
        Added virtual isInputTextCommand, isTypingCommand, and preservesTypingStyle functions.
        Removed commandID functions and unneeded explicit destructors. Removed unneeded doApply
        function declaration in CompositeEditCommandImpl. Changed type of applyTypingStyle to return
        a node, not necessarily an element. Removed private execute function from InputTextCommandImpl.
        Added selectInsertedText to InputTextCommandImpl's input function and TypingCommandImpl's constructor
        and insertText function.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::StyleChange::StyleChange): Don't bother initializing the booleans since init handles that.
        (khtml::StyleChange::init): Added code to strip whitespace, and tweaked how the function does its job.
        (khtml::StyleChange::currentlyHasStyle): Added a check for null value, which can happen for properties
        where we don't have computed style implemented yet.
        (khtml::EditCommandImpl::EditCommandImpl): Updated since there is no SharedCommandImpl any more.
        (khtml::EditCommandImpl::apply): Call new preservesTypingStyle function rather than checking
        the command ID. This preserves typing style when deleting with the keyboard.
        (khtml::EditCommandImpl::setStartingSelection): Changed since parent is now a EditCommandImpl.
        Also rewrote to use for loop so it's simpler-looking.
        (khtml::EditCommandImpl::setEndingSelection): Ditto.
        (khtml::EditCommandImpl::setTypingStyle): Ditto.
        (khtml::EditCommandImpl::preservesTypingStyle): Added. Returns false.
        (khtml::EditCommandImpl::isInputTextCommand): Added. Returns false.
        (khtml::EditCommandImpl::isTypingCommand): Added. Returns false.
        (khtml::CompositeEditCommandImpl::applyTypingStyle): Changed this function to return a node rather
        than an element. Also change it so it returns the child as-is if the style change has nothing in it.
        (khtml::AppendNodeCommandImpl::~AppendNodeCommandImpl): Removed unneeded null checks.
        (khtml::DeleteSelectionCommandImpl::preservesTypingStyle): Added. Returns true.
        (khtml::DeleteTextCommandImpl::~DeleteTextCommandImpl): Removed unneeded null checks.
        (khtml::InputTextCommandImpl::input): Renamed execute function to input and got rid of the additional
        level of indirection, since it was the only caller. Added selectInsertedText parameter and changed
        the code so it will respect it.
        (khtml::InputTextCommandImpl::isInputTextCommand): Added. Returns true.
        (khtml::InsertNodeBeforeCommandImpl::~InsertNodeBeforeCommandImpl): Removed unneeded null checks.
        (khtml::JoinTextNodesCommandImpl::~JoinTextNodesCommandImpl): Ditto.
        (khtml::MoveSelectionCommandImpl::MoveSelectionCommandImpl): Hold a reference to the fragment
        while the command exists.
        (khtml::MoveSelectionCommandImpl::~MoveSelectionCommandImpl): Release the fragment.
        (khtml::RemoveNodeCommandImpl::~RemoveNodeCommandImpl): Remove unneeded null checks.
        (khtml::RemoveNodeCommandImpl::doUnapply): Take advantage of defined behavior of insertBefore when
        the node to insert before is 0 (means the same thing as appendChild).
        (khtml::RemoveNodePreservingChildrenCommandImpl::~RemoveNodePreservingChildrenCommandImpl):
        Remove unneeded null check.
        (khtml::ReplaceSelectionCommandImpl::ReplaceSelectionCommandImpl): Hold a reference to the fragment
        while the command exists.
        (khtml::ReplaceSelectionCommandImpl::~ReplaceSelectionCommandImpl): Release the fragment.
        (khtml::SetNodeAttributeCommandImpl::~SetNodeAttributeCommandImpl): Remove unneeded null check.
        (khtml::SplitTextNodeCommandImpl::~SplitTextNodeCommandImpl): Remove unneeded null check.
        (khtml::TypingCommandImpl::TypingCommandImpl): Added selectInsertedText parameter.
        (khtml::TypingCommandImpl::doApply): Pass along selectInsertedText parameter.
        (khtml::TypingCommandImpl::insertText): Ditto.
        (khtml::TypingCommandImpl::preservesTypingStyle): Added. Returns true for DeleteKey.
        (khtml::TypingCommandImpl::isTypingCommand): Added. Returns true.

        * khtml/editing/jsediting.cpp: Add a cut at implementing the underline command. May not work
        perfectly yet because text-decoration is not inherited the way, say, font-weight is.

        * khtml/xml/dom_selection.h: Removed some unneeded friend declarations for comparison operators
        that use only public members. Added PARAGRAPH_BOUNDARY.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modifyExtendingRightForward): Implemented paragraph boundary case, simplified line
        boundary case (by changing parameter types and function names, not the algorithm), and made
        paragraph case fall into line case for now.
        (DOM::Selection::modifyMovingRightForward): Ditto.
        (DOM::Selection::modifyExtendingLeftBackward): Ditto.
        (DOM::Selection::modifyMovingLeftBackward): Ditto.
        (DOM::Selection::validate): Implemented paragraph case and paragraph boundary case, simplified the
        line case as above and also fixed the document case.
        (DOM::startOfFirstRunAt): Changed to use DOM::Position instead of node
        offset pairs. Also renamed and got rid of separate bool to indicate "not found".
        (DOM::endOfLastRunAt): Ditto.
        (DOM::selectionForLine): Ditto.

        * khtml/xml/dom_position.h: Added startParagraphBoundary and endParagraphBoundary.
        Also used enums instead of bools in a couple of places. Removed some unneeded friend
        declarations for comparison operators that use only public members.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::Position): Coding style tweak.
        (DOM::Position::startParagraphBoundary): Added.
        (DOM::Position::endParagraphBoundary): Added.
        (DOM::Position::upstream): Use enum parameter instead of bool.
        (DOM::Position::downstream): Ditto.
        (DOM::Position::rendersOnSameLine): Removed unused function. Noticed some backwards logic
        here, and removed it rather than fixing it.

        * khtml/xml/dom_nodeimpl.h: Added traversePreviousNodePostOrder.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::traversePreviousNodePostOrder): Added. For some uses, this function is more analogous
        to traverseNextNode in reverse than traversePreviousNode, which does a backwards pre-order traversal.

        * kwq/WebCoreBridge.h: Replaced fontForCurrentPosition method with fontForSelection:, added
        selectInsertedText parameter to insertText method, and added selectionStartHasStyle: method.
        Add WebSelectToParagraphBoundary.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setSelectedDOMRange:affinity:]): Added workaround for bug where isRenderedContent
        returns false for <br> elements at the ends of lines.
        (-[WebCoreBridge insertText:selectInsertedText:]): Added selectInsertedText parameter, passing it
        along to TypingCommand::insertText.
        (-[WebCoreBridge selectionStartHasStyle:]): Added. Calls code in the part that does the real work.
        (-[WebCoreBridge fontForSelection:]): Ditto.

        * kwq/KWQKHTMLPart.h: Renamed fontForCurrentPosition to fontForSelection, and added a feature
        where it tells us whether there are multiple fonts in the selection or not.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForSelection): Rewrote this to be a bit simpler, and added code to detect
        whether there are multiple fonts in the selection.
        (KWQKHTMLPart::didTellBridgeAboutLoad): Use a global character rather than a bad pointer here.
        Better not to rely on undefined behavior.
        (KWQKHTMLPart::documentFragmentWithText): Use lowercase HTML. I believe this works better when
        the document is XML, and we should probably visit all callers and change them.
        (KWQKHTMLPart::registerCommandForUndo): Call get() instead of handle().
        (KWQKHTMLPart::registerCommandForRedo): Call get() instead of handle().

        * khtml/misc/shared.h: Added a private, non-implemented copy constructor and assignment
        operator to Shared<> and TreeShared<> to prevent copying reference counts by accident.
        * khtml/rendering/render_style.h: Get rid of Shared<BorderData>, since it's not used that way.
        This makes BorderData smaller, and allows it to compile with the change to Shared<>.
        * khtml/xml/dom_docimpl.h: Remove unneeded copy constructor on DocumentFragmentImpl,
        which ran afoul of the change to Shared<> and was unused.
        * khtml/xml/dom_docimpl.cpp: Ditto.
        * khtml/xml/dom_stringimpl.cpp:
        (DOM::DOMStringImpl::empty): Changed code around so it doesn't run afoul of the change to
        Shared<>. The old code was copying a DOMStringImpl.
        (DOM::DOMStringImpl::ascii): Added code to null-terminate the string buffer.

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - improved computed style code and implemented text-decoration and text-shadow (needed for, e.g., underline)

        * khtml/css/css_computedstyle.cpp:
        Added CSS_PROP_TEXT_DECORATION to the InheritableProperties array for now even though it's
        not inheritable. This makes underline work in some cases for typing style. We may decide to
        take it back out again after further consideration.
        (DOM::valueForLength): Use IDs in primitive values rather than strings.
        (DOM::valueForBorderStyle): Ditto, also renamed this.
        (DOM::valueForTextAlign): More of the same.
        (DOM::valueForShadow): Added this function.
        (DOM::CSSComputedStyleDeclarationImpl::getPositionOffsetValue): More IDs in primitive values.
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Changed all the cases to use
        IDs instead of strings in primitive values. Also put the style in a local variable for
        better code size and smaller source code too. Added implementation for CSS_PROP_TEXT_DECORATION
        and CSS_PROP_TEXT_SHADOW.

        * khtml/css/css_valueimpl.cpp:
        (CSSValueListImpl::cssText): Put commas between list elements.
        (CSSPrimitiveValueImpl::cssText): Fixed some messed up indenting and removed an unneeded
        default case that would just prevent a warning if we ever have an unhandled enum value.

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - did some clean-up on form data code

        * khtml/misc/formdata.h: Added more public functions as suggested by Chris when he reviewed
        this class.
        * khtml/misc/formdata.cpp: (khtml::FormData::appendFile): Added. Will be needed soon.
        * kwq/KWQFormData.mm: (arrayFromFormData): Use new cleaned-up FormData API.

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        * kwq/DOM-CSS.mm: (-[DOMCSSStyleDeclaration description]): Use cssText in the description
        so it's easier to see in the debugger.

2004-09-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        * khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::send): Remove uneeded QCString copy.

2004-09-04  Richard Williamson   <rjw@apple.com>

        Fix build problem on panther.

        * khtml/ecma/kjs_html.cpp:
        * khtml/rendering/render_canvasimage.h:

2004-09-03  David Hyatt  <hyatt@apple.com>

	Simple tweak to background-attachment.  Don't apply the slow repaint flag until after the whole style has been
	resolved, since while cascading someone may set the attachment to fixed but later override with scroll.

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::adjustRenderStyle):
        (khtml::CSSStyleSelector::applyProperty):

2004-09-03  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3781001>: redirection of URL via resource load delegate does not correctly set base URL for subsequent loads

	Ensure that stylesheets have the correct URL when request
	is redirected.

        Reviewed by Maciej.

        * khtml/misc/loader.cpp:
        (CachedCSSStyleSheet::checkNotify):
        * kwq/KWQLoader.h:
        * kwq/KWQLoader.mm:
        (KWQIsResponseURLEqualToURL):
        (KWQResponseURL):

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
	Compare parameter count with == instead of <=.

2004-09-03  David Hyatt  <hyatt@apple.com>

	Fix for 3779083, deleting large amount of text is really slow.  Don't use NodeLists in editing remove commands.
	
        Reviewed by darin

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::RemoveNodeCommandImpl::RemoveNodeCommandImpl):
        (khtml::RemoveNodePreservingChildrenCommandImpl::doApply):

2004-09-03  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3714501> REGRESSION (125.8-8A162): Chinese words display as garbage in search results (www.sz.net.cn)

        * khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::putValue): Resolve URL using the document method
        that passes the codec rather than calling the KURL constructor directly.

2004-09-03  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3788409> can't create or clone an embed element

        Reviewed by rjw.

        * khtml/html/htmlparser.cpp: added fixme about sharing code
        * khtml/xml/dom_docimpl.cpp: ditto
        (DocumentImpl::createHTMLElement): create and return a HTMLEmbedElementImpl

2004-09-03  Darin Adler  <darin@apple.com>

        Reviewed by Chris.

        - fixed <rdar://problem/3410112> filename with non-ASCII name for <input type=file> should be sent in the page's encoding

        * khtml/html/html_formimpl.cpp: (DOM::HTMLFormElementImpl::formData):
        Encode filename using the codec rather than doing the &# dance. It turns out that Mozilla
        only does the &# thing under certain circumstances that are not important. Always encoding
        the filename is almost certainly better behavior, and will fix many serious problems for
        Japanese and Korean users and websites.

2004-09-03  Richard Williamson   <rjw@apple.com>

	Made drawImage() in <canvas> compliant with whatwg spec.
	
        Reviewed by John.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        * khtml/html/html_imageimpl.h:
        (DOM::HTMLImageElementImpl::pixmap):

2004-09-03  David Hyatt  <hyatt@apple.com>

	Fix for 3787686, CSS parser should do case-sensitive matching of ids and attributes only in strict mode
	(and not whenever you have an HTML document).
	
        Reviewed by john

        * khtml/css/parser.cpp:
        * khtml/css/parser.y:

=== Safari-162 ===

2004-09-03  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - <rdar://problem/3788040> REGRESSION: text that i type into a textarea disappears when i tab out of the textarea

        * kwq/KWQTextArea.mm: (-[KWQTextArea textDidChange:]): Bring back an unconditional version of
        this method. Earlier, we deleted this method, but we should have instead removed the check.

2004-09-02  David Hyatt  <hyatt@apple.com>

	Swap RenderBox and RenderContainer.  Make leaf RenderObjects actually derive off of RenderBox instead.
	
        Reviewed by kocienda

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::addChildToFlow):
        * khtml/rendering/render_box.cpp:
        (RenderBox::RenderBox):
        (RenderBox::detach):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::RenderContainer):
        (RenderContainer::detach):
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::detach):
        (RenderFlow::dirtyLineBoxes):
        (RenderFlow::createInlineBox):
        (RenderFlow::getAbsoluteRepaintRect):
        (RenderFlow::lowestPosition):
        (RenderFlow::rightmostPosition):
        (RenderFlow::leftmostPosition):
        (RenderFlow::caretPos):
        * khtml/rendering/render_flow.h:
        (khtml::RenderFlow::RenderFlow):
        * khtml/rendering/render_frames.cpp:
        (RenderFrameSet::RenderFrameSet):
        (RenderFrameSet::nodeAtPoint):
        (RenderFrameSet::dump):
        * khtml/rendering/render_frames.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::addChildToFlow):
        * khtml/rendering/render_replaced.cpp:
        * khtml/rendering/render_replaced.h:
        (khtml::RenderReplaced::setIntrinsicHeight):
        * khtml/rendering/render_table.cpp:
        (RenderTableSection::RenderTableSection):
        (RenderTableSection::detach):
        (RenderTableSection::setStyle):
        * khtml/rendering/render_table.h:

2004-09-02  Ken Kocienda  <kocienda@apple.com>

        * khtml/editing/htmlediting_impl.h: Fix some inconsistent use of whitespace. No code change.

2004-09-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3786848> REGRESSION (Mail): Typing styles and font panel updates broken

        * khtml/xml/dom_position.cpp:
        (DOM::Position::inRenderedContent): Check for inlines that can have kids is wrong.
        I busted this the other day when making the PositionIterator class iterate over
        all nodes and not just leaves of the DOM tree.
        
        Update all the following functions. These use the PositionIterator class, but still 
        only want to consider leaf nodes.
        
        (DOM::Position::isFirstRenderedPositionOnLine)
        (DOM::Position::isLastRenderedPositionOnLine)
        (DOM::Position::isLastRenderedPositionInEditableBlock)
        (DOM::Position::inFirstEditableInRootEditableElement)
        (DOM::Position::inLastEditableInRootEditableElement)
        (DOM::Position::inFirstEditableInContainingEditableBlock)
        (DOM::Position::inLastEditableInContainingEditableBlock)

2004-09-02  Richard Williamson   <rjw@apple.com>

	Support for patterns in <canvas>

        Reviewed by Hyatt.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        (Context2D::putValue):
        (drawPattern):
        (ImagePattern::ImagePattern):
        (ImagePattern::~ImagePattern):
        * khtml/ecma/kjs_html.h:
        (KJS::ImagePattern::getPattern):
        (KJS::ImagePattern::pixmap):
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (QPixmap::imageRef):
        * kwq/WebCoreImageRenderer.h:

2004-09-01  David Hyatt  <hyatt@apple.com>

	Fix for 3769409, a regression from 10.3.4 to 10.3.5 involving <colgroup>s in malformed HTML.
	
        Reviewed by mjs

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::insertNode):

2004-09-01  David Hyatt  <hyatt@apple.com>

	Fix for the <colgroup> crasher.  Make sure adding to an anonymous box just returns immediately. Also eliminate
	all the redundant setPos -500000 calls, since we don't need those at all.
	
        Reviewed by john

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::addChildToFlow):
        (khtml::RenderBlock::makeChildrenNonInline):
        * khtml/rendering/render_inline.cpp:
        (RenderInline::splitFlow):

2004-09-02  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for these bugs:
        
        <rdar://problem/3729219> REGRESSION (Mail): Caret placement and navigation not working correctly at yahoo.com
        <rdar://problem/3758606> REGRESSION (Mail): Deletions across DIV elements is broken
        <rdar://problem/3784810> REGRESSION (Mail): delete at beginning of line instead deletes to the end of the document (simple reduced test)

        I made some very big improvements to the code which handles deletions of selections
        which span more than one block.

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::deleteUnrenderedText): An new, overloaded version of this
        function which works on a NodeImpl. The code in this function fell out of some refactoring
        I did in the function with the same name which takes a Position as an argument.
        (khtml::DeleteSelectionCommandImpl::moveNodesToBlock): New function. This new logic provides
        the smarts to fix the bugs listed above and greatly improves the code to perform deleting 
        selections which span more than one block.
        (khtml::DeleteSelectionCommandImpl::doApply): Several changes. Constrain downstream positions
        so that they stay in the current block. This was a mistake before I think. Add code to detect
        when the insertion point is a caret at the start of a block. This is a special-case of a
        cross-block selection. Change the end-of-deletion-fixup case to operate on the downstreamEnd
        position of the selection rather than the upstream. This is more logical. Refine the block 
        merge logic to handle more cases, like dealing with whitespace. 
        * khtml/editing/htmlediting_impl.h: Associated header file changes.
        * khtml/xml/dom_nodeimpl.cpp: 
        (NodeImpl::rootEditableElement): Add code to clamp the return value to the body element.
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::validate): Make selection canonicalizations stay in the current block.
        * layout-tests/editing/deleting/delete-block-merge-contents-001-expected.txt:
        * layout-tests/editing/deleting/delete-block-merge-contents-001.html:
        * layout-tests/editing/deleting/delete-block-merge-contents-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-002.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-003.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-004-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-004.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-005-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-005.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-006-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-006.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-007-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-007.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-008-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-008.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-009-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-009.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-010-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-010.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-011-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-011.html: Added.
        * layout-tests/editing/inserting/insert-3654864-fix-expected.txt: Updated with new results.
        * layout-tests/editing/inserting/insert-3654864-fix.html: Updated test to deal better with
        improved select all behavior.
        * layout-tests/editing/selection/select-all-003-expected.txt: Updated with new results.

2004-09-01  Richard Williamson   <rjw@apple.com>

	Fixed panther build glitch.

        Reviewed by Ken.

        * khtml/ecma/kjs_html.cpp:

2004-09-01  Richard Williamson   <rjw@apple.com>

	Finished implementation of gradient support in <canvas>.

        Reviewed by John.

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElementFunction::tryCall):
        (isGradient):
        (isImagePattern):
        (KJS::Context2DFunction::tryCall):
        (Context2D::putValue):
        (Context2D::Context2D):
        (KJS::GradientFunction::tryCall):
        (gradientCallback):
        (Gradient::commonInit):
        (Gradient::Gradient):
        (Gradient::~Gradient):
        (Gradient::getShading):
        (Gradient::addColorStop):
        (sortStops):
        (Gradient::colorStops):
        * khtml/ecma/kjs_html.h:
        (KJS::ColorStop::ColorStop):
        * khtml/ecma/kjs_html.lut.h:
        (KJS::):

2004-09-01  David Hyatt  <hyatt@apple.com>

	Fix for 3784686, hidden links still active.  Make sure text nodes exclude themselves from nodeAtPoint checks
	when hidden.
	
        * khtml/rendering/render_text.cpp:
        (RenderText::nodeAtPoint):

2004-08-31  David Hyatt  <hyatt@apple.com>

	Fixes for 3761411 and 3782201.  This patch makes two changes to percentage heights.  First it makes sure that
	replaced elements always flex inside a cell (unlike blocks and tables, which do so only sometimes under bizarre
	conditions that are still being guessed at by me).  The second fix is a recognition that empty tables do not
	actually honor their heights, and so it is a mistake to try to flex them.
	
        Reviewed by mjs

        * khtml/rendering/render_table.cpp:
        (RenderTableSection::layoutRows):
        * khtml/rendering/render_table.h:
        (khtml::RenderTable::hasSections):

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt
    
        Fix for this bug:
        
        <rdar://problem/3781572> can't paste text in replied message view

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): Copying text placed in an anonymous block was failing
        since the code in here depending on the text node's containing block having an
        element, which it won't. In fact, using containing block is wrong anyway, since
        positioned elements can have containing blocks far from where they live in the
        tree. This "move up to block check" should use the more DOM-wise enclosingBlockFlowElement()
        in NodeImpl.

2004-08-30  David Hyatt  <hyatt@apple.com>

	Fix for 3742585, sony dhtml menus wrong size.  The percentage table height algorithm was wrong.  This patch
	unifies the table percentage height algorithm with the block percentage height algorithm and fixes bugs in
	both.
	
        Reviewed by john

        * khtml/rendering/render_box.cpp:
        (RenderBox::calcPercentageHeight):
        * khtml/rendering/render_table.cpp:
        (RenderTable::layout):

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Added more editing layout tests.

        * layout-tests/editing/deleting/delete-tab-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-tab-001.html: Added.
        * layout-tests/editing/deleting/delete-tab-002-expected.txt: Added.
        * layout-tests/editing/deleting/delete-tab-002.html: Added.
        * layout-tests/editing/deleting/delete-tab-003-expected.txt: Added.
        * layout-tests/editing/deleting/delete-tab-003.html: Added.
        * layout-tests/editing/deleting/delete-tab-004-expected.txt: Added.
        * layout-tests/editing/deleting/delete-tab-004.html: Added.
        * layout-tests/editing/editing.js: Fixed a little bug in one of the "delayed" commands.
        * layout-tests/editing/inserting/insert-tab-001-expected.txt: Added.
        * layout-tests/editing/inserting/insert-tab-001.html: Added.
        * layout-tests/editing/inserting/insert-tab-002-expected.txt: Added.
        * layout-tests/editing/inserting/insert-tab-002.html: Added.
        * layout-tests/editing/inserting/insert-tab-003-expected.txt: Added.
        * layout-tests/editing/inserting/insert-tab-003.html: Added.
        * layout-tests/editing/inserting/insert-tab-004-expected.txt: Added.
        * layout-tests/editing/inserting/insert-tab-004.html: Added.

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3782521> Typing newline at start of block does not work

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputNewlineCommandImpl::doApply): Change handling of case to insert
        newline at the start of a block.
        * layout-tests/editing/inserting/insert-br-006-expected.txt: Updated layout test with
        new results.

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Checked in incorrect results for these tests. There are the right ones.

        * layout-tests/editing/deleting/collapse-whitespace-3587601-fix-expected.txt
        * layout-tests/editing/selection/move-by-line-001-expected.txt

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Added more editing layout tests.

        * layout-tests/editing/deleting/collapse-whitespace-3587601-fix-expected.txt: Added.
        * layout-tests/editing/deleting/collapse-whitespace-3587601-fix.html: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-001-expected.txt: Added.
        * layout-tests/editing/deleting/delete-block-merge-contents-001.html: Added.
        * layout-tests/editing/editing.js: Added some more navigation commands.
        * layout-tests/editing/inserting/insert-3778059-fix-expected.txt: Added.
        * layout-tests/editing/inserting/insert-3778059-fix.html: Added.
        * layout-tests/editing/selection/move-by-line-001-expected.txt: Added.
        * layout-tests/editing/selection/move-by-line-001.html: Added.
        * layout-tests/editing/style/typing-style-003-expected.txt: Added.
        * layout-tests/editing/style/typing-style-003.html: Added.

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Added more editing layout tests. Renamed some others.

        * layout-tests/editing/inserting/insert-br-001-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-001.html: Added.
        * layout-tests/editing/inserting/insert-br-002-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-002.html: Added.
        * layout-tests/editing/inserting/insert-br-003-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-003.html: Added.
        * layout-tests/editing/inserting/insert-br-004-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-004.html: Added.
        * layout-tests/editing/inserting/insert-br-005-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-005.html: Added.
        * layout-tests/editing/inserting/insert-br-006-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-006.html: Added.
        * layout-tests/editing/inserting/insert-br-case1-expected.txt: Removed.
        * layout-tests/editing/inserting/insert-br-case1.html: Removed.
        * layout-tests/editing/inserting/insert-br-case2-expected.txt: Removed.
        * layout-tests/editing/inserting/insert-br-case2.html: Removed.
        * layout-tests/editing/inserting/insert-br-case3-expected.txt: Removed.
        * layout-tests/editing/inserting/insert-br-case3.html: Removed.
        * layout-tests/editing/inserting/insert-br-case6-expected.txt: Removed.
        * layout-tests/editing/inserting/insert-br-case6.html: Removed.
        * layout-tests/editing/inserting/insert-text-with-newlines-expected.txt: Added.
        * layout-tests/editing/inserting/insert-text-with-newlines.html: Added.

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        * layout-tests/editing/editing.js: Modified typeCharacterCommand so it can accept a character
        as an argument.

2004-08-31  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for these bugs:

        <rdar://problem/3777629> REGRESSION (Mail): can't delete blank lines in quoted text in HTML mail replies
        <rdar://problem/3780309> REGRESSION (Mail): can't delete past an empty span in a particular test case
        <rdar://problem/3780315> REGRESSION (Mail): right arrow works incorrectly in a particular test case with an empty span
        <rdar://problem/3780320> REGRESSION (Mail): left arrow works incorrectly in a particular test case with an empty span
        <rdar://problem/3780336> REGRESSION (Mail): down arrow fails in a reduction of a Mail reply test case (seems to be inside a span)

        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream): If this position's node is a block, use it for the StayInBlock case, not the block's
        enclosing block.
        (DOM::Position::downstream): Ditto.
        (DOM::Position::inRenderedContent): Refine the case for non-text nodes. This was erroneously returning true
        for any empty element (like <span></span>).
        * khtml/xml/dom_positioniterator.cpp: Change the following four functions to consider all nodes, not just
        leaves of the DOM tree. This is a step towards making this iteration less cranky and unpredictable, and
        was necessary to do now to keep the inRenderedContent() change above from breaking editign layout tests.
        (DOM::PositionIterator::peekPrevious)
        (DOM::PositionIterator::peekNext)
        (DOM::PositionIterator::atStart)
        (DOM::PositionIterator::atEnd)
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::fontForCurrentPosition): Check that the position being checked is an element and that the
        element is in rendered content. I ran across some null-check failures while I was coding this fix, and
        the additions seem prudent.
        
        Updated these layout tests with new results.
        
        * layout-tests/editing/deleting/delete-3608430-fix-expected.txt:
        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt:
        * layout-tests/editing/deleting/delete-block-contents-001-expected.txt:
        * layout-tests/editing/deleting/delete-block-contents-002-expected.txt:
        * layout-tests/editing/deleting/delete-block-contents-003-expected.txt:
        * layout-tests/editing/deleting/delete-image-004-expected.txt:
        * layout-tests/editing/deleting/delete-trailing-ws-001-expected.txt:
        * layout-tests/editing/editing.js:
        * layout-tests/editing/execCommand/boldSelection-expected.txt:
        * layout-tests/editing/execCommand/italicizeByCharacter-expected.txt:
        * layout-tests/editing/execCommand/modifyForeColorByCharacter-expected.txt:
        * layout-tests/editing/execCommand/print-expected.txt:
        * layout-tests/editing/execCommand/selectAll-expected.txt:
        * layout-tests/editing/selection/extend-by-character-002-expected.txt:
        * layout-tests/editing/selection/extend-by-character-004-expected.txt:
        * layout-tests/editing/selection/extend-by-character-005-expected.txt:
        * layout-tests/editing/selection/extend-by-character-006-expected.txt:
        * layout-tests/editing/selection/select-all-001-expected.txt:
        * layout-tests/editing/selection/select-all-002-expected.txt:
        * layout-tests/editing/selection/select-all-003-expected.txt:

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3637519> REGRESSION (125-128): unrepro crash in QListBox::sizeForNumberOfLines at istweb.apple.com

        * kwq/KWQListBox.h: Added a clearCachedTextRenderers function.
        * kwq/KWQListBox.mm:
        (itemTextRenderer): Change to use globals that are outside the function, and added retain calls.
        (groupLabelTextRenderer): Ditto.
        (QListBox::clearCachedTextRenderers): Release global text renderers and nil out the globals.

        * kwq/WebCoreBridge.h: Removed updateAllViews; not needed any more.
        * kwq/WebCoreBridge.mm: Ditto.

        * kwq/WebCoreTextRendererFactory.h: Added a clearCaches method.
        * kwq/WebCoreTextRendererFactory.mm:
        (-[WebCoreTextRendererFactory clearCaches]): Added. Tells all the views to repaint after clearing the cached
        text renderers from KWQListBox. To be more elegant, we could generalize the KWQListBox trick, but for now why bother?

        * kwq/WebCoreTextRendererFactory.m: Removed. I needed to put some C++ code in here, so changed the extension to .mm.
        * WebCore.pbproj/project.pbxproj: Removed WebCoreTextRendererFactory.m, and added WebCoreTextRendererFactory.mm.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fixed <rdar://problem/3528538> can paste a Return character into the Search field at amazon.com, other browsers won't

        * kwq/KWQTextField.mm: (-[KWQTextFieldController controlTextDidChange:]):
        Truncate text before the first line break.

2004-08-30  Darin Adler  <darin@apple.com>

        * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertOneChunkUsingTEC):
        Added some more assertions I used to track down what looks like a TEC bug.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - fixed <rdar://problem/3779122> No accesskey support on LABEL element

        * khtml/html/html_formimpl.h: Change type of m_currValue to DOMString. Should have been done
        as part of my form data check-in, but harmless to do now. Add accessKeyAction function for
        HTMLLabelElementImpl.
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLButtonElementImpl::parseHTMLAttribute): Remove conversion of DOMString to QString
        for m_currValue.
        (DOM::HTMLLabelElementImpl::formElement): If there's no "for" attribute, search children for
        the first control.
        (DOM::HTMLLabelElementImpl::accessKeyAction): Forward the accesskey action to the formElement.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by Dave.

        - fixed <rdar://problem/3303968> final newline character omitted from <textarea> when parsing a new page

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::processListing): Handle newline pending
        cases as well as space and tab pending spaces at the end of this function. This seems right for
        both scripts and text areas; it's not clear why omittiing the LF is ever needed. Tested by running
        all the layout tests; no regressions.

        - fixed <rdar://problem/3552736> word wrapped text fields that blur/focus when you type move the insertion point strangely (vtext.com)

        * khtml/rendering/render_form.cpp: (RenderTextArea::updateFromElement): Call text() instead of
        calling widget->text() directly. This prevents this function from running in cases where the
        text didn't really change for text areas in wrap mode.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by Dave.

        - got rid of ERROR message when running layout tests by implementing text-transform in computed style

        * khtml/css/css_computedstyle.cpp:
        (DOM::numberAsString): Added. Helper that returns "1" rather then "1.0" for integer values.
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Fixed use of tabs instead of
        spaces. Fixed switch statements so they don't use default so we get errors if we leave
        a case out. Changed callers to use numberAsString instead of QString::number. Added implementation
        of CSS_PROP_TEXT_TRANSFORM. Added code to prevent falling through to next property when no item
        in a switch statement matches.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by Chris.

        - did work to prepare for uploading files incrementally when submitting forms

        * khtml/misc/formdata.h: Added. Class for holding form data inside WebCore.
        * khtml/misc/formdata.cpp: Added.

        * khtml/html/html_formimpl.h: Added the FormDataList type, changed the formData function parameters
        and made it private, renamed the encoding method to appendFormData and changed the parameters around.
        * khtml/html/html_formimpl.cpp:
        (DOM::FormDataList): Added. Class that replaces the old use of QValueList<QCString> for form data.
        Later we'll change it to accomodate filenames too.
        (DOM::HTMLFormElementImpl::formData): Changed code to use FormDataList intsead of the old encodingList.
        Also changed to return the "OK" result as the function result and put the form data into something
        passed as an "out" parameter; the old way was the other way around.
        (DOM::HTMLFormElementImpl::submit): Change to use FormData rather than a QByteArray when getting the
        form data to submit.
        (DOM::HTMLButtonElementImpl::appendFormData): Rename from encoding, and use the new appendData function
        instead of the old way of doing += to put data on the list.
        (DOM::HTMLInputElementImpl::appendFormData): Ditto.
        (DOM::HTMLSelectElementImpl::appendFormData): Ditto.
        (DOM::HTMLKeygenElementImpl::appendFormData): Ditto.
        (DOM::HTMLTextAreaElementImpl::appendFormData): Ditto.
        (DOM::FormDataList::FormDataList): Added.
        (DOM::FormDataList::appendString): Added.
        (DOM::FormDataList::begin): Added.
        (DOM::FormDataList::end): Added.

        * khtml/khtml_part.h: Changed the type of the submitForm parameter to FormData instead of QByteArray.
        * khtml/khtmlpart_p.h: Changed the type of the submitFormData data member to FormData instead of QByteArray.
        * khtml/khtml_part.cpp: (KHTMLPart::submitForm): Called the new flattenToString function in all the
        code that handles mailto forms. Called the new flatten function in the non-Apple code path.

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::submitForm): Pass NSArray for form data instead of NSData.

        * kwq/KWQKJob.h: Use FormData instead of QByteArray. A couple other small cleanups.
        * kwq/KWQKJobClasses.h: Ditto.
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJobPrivate::TransferJobPrivate): Ditto.
        (KIO::TransferJob::TransferJob): Ditto.
        (KIO::TransferJob::postData): Ditto.
        * kwq/KWQKPartsBrowserExtension.h: Ditto.
        * kwq/KWQLoader.mm:
        (KWQServeRequest): Ditto.
        (KWQServeSynchronousRequest): Ditto.

        * kwq/KWQFormData.h: Added. A function to convert KHTML form data into an NSArray for communication
        with the WebKit side.
        * kwq/KWQFormData.mm: Added.

        * kwq/WebCoreBridge.h: Pass NSArray instead of NSData for form data.

        * kwq/KWQArrayImpl.h: Added a detach member function. The old version would do unnecessary work when
        detach was called on an array that had exactly one reference.
        * kwq/KWQArrayImpl.mm: (KWQArrayImpl::detach): Added.
        * kwq/KWQMemArray.h: (QMemArray::detach): Call through to KWQArrayImpl.

        * kwq/KWQValueList.h:
        (QValueList::first): Added overload for non-const.
        (QValueList::last): Ditto.

        * ForwardingHeaders/misc/formdata.h: Added.
        * WebCore.pbproj/project.pbxproj: Added formdata.h, formdata.cpp, KWQFormData.h, and KWQFormData.cpp.

        * WebCore-tests.exp: Updated for changes to QValueList, and re-sorted.
        * WebCore-combined.exp: Regenerated.

2004-08-30  Darin Adler  <darin@apple.com>

        Reviewed by Ken.

        - improved multiple submit logic in preparation for making command-click on a form
          button load a form in another frame

        * kwq/KWQKHTMLPart.h: Added const to a bunch of member functions for cleanup.
        Added prepareForUserAction member function.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::submitForm): Simplified logic and removed special case for "http" and "https".
        (KWQKHTMLPart::renderer): Added const.
        (KWQKHTMLPart::keyEvent): Added call to prepareForUserAction.
        (KWQKHTMLPart::lastEventIsMouseUp): Added const.
        (KWQKHTMLPart::eventMayStartDrag): Added const.
        (KWQKHTMLPart::mouseDown): Added call to prepareForUserAction.
        (KWQKHTMLPart::overrideMediaType): Added const.
        (KWQKHTMLPart::canGoBackOrForward): Added const.
        (KWQKHTMLPart::prepareForUserAction): Added. Clears _submittedFormURL.
        * kwq/KWQAccObject.mm: (-[KWQAccObject accessibilityPerformAction:]): Added call to prepareForUserAction.

2004-08-30  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:

        <rdar://problem/3762231> REGRESSION (Mail): tab key inserts a single space

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::isTab): New helper. Checks a DOMString to see if it is one character and
        that character is a tab.
        (khtml::InputTextCommandImpl::execute): Trap tabs before handling insertion of
        other kinds of whitespace. Treat a tab like four spaces. Rearrange the code to
        update the ending position after the text insertion to cover the new tab case
        where the amount of advance is not the same as the number of character in the
        passed-in DOMString (i.e. tabs expand to four characters).
        
2004-08-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3779706> plain text on pasteboard loses indentation when pasted into Blot

        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::documentFragmentWithText): New function that takes over the code from
        KWQKHTMLPart and improves it to handle converting tabs and spaces for suitable
        display in HTML.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge documentFragmentWithText:]): Move smarts from here to KWQKHTMLPart.

2004-08-27  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	<rdar://problem/3778314> REGRESSION: Can't proceed to survey questions on Lominger's Apple website

	Because we will stop parsing when there is a pending redirection,
	avoid setting one if no navigation would actually take place
	because the number of steps is out of range.
	
        * khtml/khtml_part.cpp:
        (KHTMLPart::scheduleHistoryNavigation):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::canGoBackOrForward):
        * kwq/KWQKPartsBrowserInterface.h:
        * kwq/WebCoreBridge.h:

2004-08-27  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Chris.

	- fixed <rdar://problem/3778043> REGRESSION: innerHTML is broken, breaks automated iBench testing
	- also fixed outerHTML, which would spill over past the node for whch it was supposed to get HTML
	
        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::outerHTML):
        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML):
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::toHTML):
        (NodeImpl::recursive_toString):
        (NodeImpl::recursive_toHTML):
        * khtml/xml/dom_nodeimpl.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge markupStringFromNode:nodes:]):

	- added new layout tests to cover the problems I fixed
        
	* layout-tests/fast/innerHTML/001-expected.txt: Added.
        * layout-tests/fast/innerHTML/001.html: Added.
        * layout-tests/fast/innerHTML/002-expected.txt: Added.
        * layout-tests/fast/innerHTML/002.html: Added.
        * layout-tests/fast/innerHTML/003-expected.txt: Added.
        * layout-tests/fast/innerHTML/003.html: Added.

2004-08-27  David Hyatt  <hyatt@apple.com>

	Fix for 3739239, getComputedStyle of top not being implemented broke a site that checked for it.
	
        Reviewed by kocienda

        * khtml/css/css_computedstyle.cpp:
        (DOM::valueForLength):
        (DOM::CSSComputedStyleDeclarationImpl::getPositionOffsetValue):
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/css_computedstyle.h:

2004-08-27  John Sullivan  <sullivan@apple.com>

        Reviewed by Ken.
        
        Tweaked option-tab handling to match good suggestion from Tim Omernick of OmniWeb

        * kwq/KWQTextArea.mm:
        removed override of textDidChange:
        (-[KWQTextAreaTextView keyDown:]):
        moved option-tab handling that was in textDidChange to here. Rearranged existing code
        a little for clarity.

2004-08-27  Adele Amchan  <adele@apple.com>

        Reviewed by Darin.

	Fix for:
	<rdar://problem/3689949> Provide contentWindow access on an iframe

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElement::getValueProperty): added cases for contentWindow for frames and iframes
        * khtml/ecma/kjs_html.h: added contentWindow to the list of properties for frames and iframes
        * khtml/ecma/kjs_html.lut.h: regenerated file
        * khtml/html/html_baseimpl.cpp:
        (HTMLFrameElementImpl::contentPart): factored out old contentDocument code to return KHTMLPart for frame
        (HTMLFrameElementImpl::contentDocument): now just gets the contentDocument from contentPart
        * khtml/html/html_baseimpl.h: added declaration for contentPart

=== Safari-161 ===

2004-08-27  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        
        <rdar://problem/3778059> Odd behaviour when editing between blockquote elements

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::deleteUnrenderedText): This function should not move
        the selection out of the current block, ever. This is exactly what the bug reported.
        What was I thinking? Now, the code looks at the passed-in position and then the equivalent
        upstream and downstream positions to see if the selection can be placed there after the
        delete, and settles on the block containing the passed-in position as a fallback.
        * layout-tests/editing/inserting/insert-3778059-fix-expected.txt: Added.
        * layout-tests/editing/inserting/insert-3778059-fix.html: Added.

2004-08-26  Richard Williamson   <rjw@apple.com>

        Boiler plate for canvas gradients and patterns.

        Reviewed by John.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        (Context2D::tryPut):
        (Context2D::~Context2D):
        (KJS::GradientFunction::tryCall):
        (Gradient::Gradient):
        (Gradient::tryGet):
        (Gradient::getValueProperty):
        (Gradient::tryPut):
        (Gradient::putValue):
        (Gradient::~Gradient):
        (ImagePattern::ImagePattern):
        (ImagePattern::tryGet):
        (ImagePattern::getValueProperty):
        (ImagePattern::tryPut):
        (ImagePattern::putValue):
        (ImagePattern::~ImagePattern):
        * khtml/ecma/kjs_html.h:
        (KJS::Gradient::toBoolean):
        (KJS::Gradient::classInfo):
        (KJS::Gradient::):
        (KJS::ImagePattern::toBoolean):
        (KJS::ImagePattern::classInfo):
        (KJS::ImagePattern::):
        * khtml/ecma/kjs_html.lut.h:
        (KJS::):

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3777899> REGRESSION (Mail): only first of several misspelled words separated by 
        carriage returns is marked

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::TypingCommandImpl::markMisspellingsAfterTyping): Give the spellchecker a slightly larger 
        selection to work with while typing. This should preclude bugs of this type.

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris
        
        Fix for this bug:
        
        <rdar://problem/3777804> Deleting all content in a document can result in giant tall-as-window insertion point

        * khtml/rendering/render_box.cpp:
        (RenderBox::caretPos): Always use the font height for calculating the caret height in 
        non-replaced elements (like blocks), rather than the height of the box.

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Silly me. Forgot to add this file before.

        * layout-tests/editing/inserting/insert-3775316-fix-expected.txt: Added.

2004-08-26  David Hyatt  <hyatt@apple.com>

	Fix for 3777172, crash from nested colgroup.  Don't allow nested table sections or col groups.
	
        Reviewed by darin

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::insertNode):

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Fix for this bug:
        
        <rdar://problem/3775316> document sprouts an extra newline character at the end

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputNewlineCommandImpl::doApply): There was in insufficient check
        in the code which adds extra BR elements at the ends of blocks, which we do 
        to work around the fact that BR elements, when they are the last element in a
        block, do not render. Now the code sees whether there already is one of these
        extra BR's in the document and won't add and "extra" extra. 
        * layout-tests/editing/inserting/insert-3775316-fix.html: Added.

2004-08-26  David Hyatt  <hyatt@apple.com>

	Fix for 3710721 and 3504114, crashes because of bad ownership model for list markers.
	
        Reviewed by mjs

        * khtml/rendering/render_container.cpp:
        (RenderContainer::detach):
        * khtml/rendering/render_list.cpp:
        (RenderListItem::setStyle):
        (RenderListItem::detach):
        (RenderListItem::updateMarkerLocation):
        * khtml/rendering/render_list.h:

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::ApplyStyleCommandImpl::doApply): Remove the StayInBlock modifier from the
        call to upstream when passing the start position to removeStyle(). This makes the
        start position sufficiently upstream so that all relevant style tags are removed.
        (khtml::ApplyStyleCommandImpl::removeStyle): Pass the start position to nodeFullySelected.
        (khtml::ApplyStyleCommandImpl::nodeFullySelected): Change interface so start position
        for calculation is passed in, rather than recalculating it every time.
        * khtml/editing/htmlediting_impl.h: nodeFullySelected interface change.
        * khtml/xml/dom_position.h: Add a comment about the working of upstream() and
        downstream().

2004-08-26  Ken Kocienda  <kocienda@apple.com>

        Fix garbled contenteditable attribute. I must have checked
        this in with a typo.

        * layout-tests/editing/deleting/delete-3775172-fix.html

2004-08-25  Kevin Decker  <kdecker@apple.com>

        Reviewed by John and Maciej.

	- Fixes SAP bug <rdar://problem/3751295> Personalize link at the
 	top gives an error in the pop-up window. 

        * khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall): Passes a referrer to KHTMLPart::begin() 

2004-08-25  Richard Williamson   <rjw@apple.com>

	Updated to <canvas> API to match the spec.  (Still need
	to implement gradients and patterns.)

        Reviewed by Ken.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        (Context2D::getValueProperty):
        (Context2D::drawingContext):
        (Context2D::colorRefFromValue):
        (Context2D::colorFromValue):
        (Context2D::setShadow):
        (Context2D::putValue):
        (Context2D::save):
        (Context2D::restore):
        (Context2D::Context2D):
        * khtml/ecma/kjs_html.h:
        (KJS::Context2D::):
        * khtml/ecma/kjs_html.lut.h:
        (KJS::):

2004-08-25  Ken Kocienda  <kocienda@apple.com>

        * layout-tests/editing/deleting/delete-3775172-fix.html: Wrong version of test checked in
        a moment ago.

2004-08-25  Ken Kocienda  <kocienda@apple.com>

        Added test case for <rdar://problem/3775172> Blot crashes after typing one character then deleting it

        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt: Added.
        * layout-tests/editing/deleting/delete-3775172-fix.html: Added.

2004-08-25  Ken Kocienda  <kocienda@apple.com>

        * layout-tests/editing/style/style-3690704-fix-expected.txt: Fewer styling spans added
        on this test as a result of the previously-checked-in fix.

2004-08-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3775214> BR elements cause unnecessary spans to be added when applying style

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::ApplyStyleCommandImpl::doApply): BR elements can be grouped more liberally with other nodes
        now in the iteration when attempting to find nodes that can be styled together with one span.
        * layout-tests/editing/style/style-3690704-fix-expected.txt: Updated with new results after
        bug fix.

2004-08-25  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3775172> Blot crashes after typing one character then deleting it

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Bail early if the element
        being queried does not have a renderer or that renderer does not have a style. Prevents
        a crash in the cases that it does not.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::DeleteSelectionCommandImpl::doApply): Add one more case to deleting when the
        start and end nodes are different. If the downstream end node is the last node in the
        block, then it may need to be deleted completely. Before this patch, the code
        erroneously assumed that any deletion in this node had to be trimming of a text node.
        This was asserted, and the description in 3775172 shows a simple case where this assertion
        does not hold. The additional case and associated checks now make it all better.
        * layout-tests/editing/deleting/delete-3775172-fix.html: Added.

2004-08-25  David Hyatt  <hyatt@apple.com>

	Fix for 3365086, large tables crash Safari.  Make sure to use ints rather than shorts for row and column
	counts.  Also fix a pathological array resize scenario for tables as rows are added.
	
        Reviewed by darin

        * khtml/rendering/render_table.cpp:
        (RenderTable::splitColumn):
        (RenderTable::appendColumn):
        (RenderTableSection::RenderTableSection):
        (RenderTableSection::ensureRows):
        (RenderTableSection::setCellWidths):
        (RenderTableSection::calcRowHeight):
        (RenderTableSection::layoutRows):
        (RenderTableSection::paint):
        (RenderTableSection::recalcCells):
        (RenderTableSection::clearGrid):
        * khtml/rendering/render_table.h:
        (khtml::RenderTableSection::numRows):

2004-08-25  David Hyatt  <hyatt@apple.com>

	To save memory in the common case, move the margin***Collapse variables into the CSS3 struct instead of
	bloating the surround struct.
	
        * khtml/rendering/render_style.cpp:
        (StyleSurroundData::StyleSurroundData):
        (StyleSurroundData::operator==):
        (marginBottomCollapse):
        (StyleCSS3NonInheritedData::operator==):
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::marginTopCollapse):
        (khtml::RenderStyle::marginBottomCollapse):
        (khtml::RenderStyle::setMarginTopCollapse):
        (khtml::RenderStyle::setMarginBottomCollapse):

2004-08-25  David Hyatt  <hyatt@apple.com>

	Fix the "extra space in TypePad blogs" Emerson problem by adding the ability to collapse away margins.
	Also added support for explicitly preventing margin collapsing.
	
        Reviewed by mjs

        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        * khtml/css/cssproperties.c:
        (hash_prop):
        (findProp):
        * khtml/css/cssproperties.h:
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/css/cssvalues.c:
        (hash_val):
        (findValue):
        * khtml/css/cssvalues.h:
        * khtml/css/cssvalues.in:
        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::isSelfCollapsingBlock):
        (khtml::RenderBlock::layoutBlockChildren):
        * khtml/rendering/render_style.cpp:
        (StyleSurroundData::StyleSurroundData):
        (StyleSurroundData::operator==):
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::):
        (khtml::RenderStyle::marginTopCollapse):
        (khtml::RenderStyle::marginBottomCollapse):
        (khtml::RenderStyle::setMarginTopCollapse):
        (khtml::RenderStyle::setMarginBottomCollapse):
        (khtml::RenderStyle::initialMarginTopCollapse):
        (khtml::RenderStyle::initialMarginBottomCollapse):

2004-08-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Improved the ability of the bridge to report selection state.     

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::TypingCommandImpl::doApply): Bail when there is no selection.
        * kwq/WebCoreBridge.h: Added an enum to report selection state. These constants
        mirror those used in DOM::Selection.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge selectionState]): Replacement for haveSelection. Returns a value 
        from an enum telling whether the selection is in the None, Caret, or Range state, 
        rather than just true/false for the Range state as it did before.

2004-08-24  David Hyatt  <hyatt@apple.com>

	Make sure the ifdef XSLT is present for Panther.
	
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::XMLTokenizer::insertErrorMessageBlock):

2004-08-24  David Hyatt  <hyatt@apple.com>

	Polish the XML error message so that it indicates when a document is the result of an XSL transformation
	when reporting line/col #s.
	
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::applyXSLTransform):
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::XMLTokenizer::insertErrorMessageBlock):
        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):

2004-08-24  David Hyatt  <hyatt@apple.com>

	Add support for Atom and RSS MIME types to the set of XML types.
	
        Reviewed by rjw

        * khtml/ecma/xmlhttprequest.cpp:
        (KJS::XMLHttpRequest::getValueProperty):
        * khtml/khtml_part.cpp:
        (KHTMLPart::begin):
        * khtml/misc/loader.cpp:
        (CachedXSLStyleSheet::CachedXSLStyleSheet):
        (CachedXBLDocument::CachedXBLDocument):
        * khtml/xml/dom_xmlimpl.cpp:
        (DOM::ProcessingInstructionImpl::checkStyleSheet):

2004-08-24  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3746447> hang loading geocities.com/cinemaorchestra

        Reviewed by john.

        * khtml/rendering/render_frames.cpp:
        (RenderPartObject::updateWidget): do nothing if the src URL is the same as the part's URL

2004-08-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3773564> REGRESSION (125-159): Code to remove HTML styles before applying new HTML styles is broken

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::ApplyStyleCommandImpl::doApply): Unrelated change to constrain downstream position of selection
        start to block boundaries. This is a new feature of the downstream function and I missed this usage
        when adding the feature.
        (khtml::ApplyStyleCommandImpl::removeCSSStyle): There once was code to remove style attributes from spans
        which became emptied as a result of removing CSS properties, but I do not see such code in the 
        tree any more. A quick review of the ChangeLog did not reveal anything. I do not remember making such
        a change myself...
        
        In any case, I have restored logic to prune out styling spans we insert if the process of 
        removing styles caused a span-plus-styles node to become emptied of markup which changes the style
        of its contents. This fixes the bug.

2004-08-24  Ken Kocienda  <kocienda@apple.com>

        Reviewed by John

        Fix for this bug:
        
        <rdar://problem/3765535> paste of text with newlines into text with newlines results in broken doc, crash
        
        This is a "belt and suspenders" fix. The issue is with the paste code path which was creating
        zero-length DOM text nodes when a selection being pasted ended with a newline. The normal
        code path for parsing HTML does not allow this, but the code to convert newlines to BR's 
        during paste was creating such nodes. This will no longer happen.
        
        In the case where someone inserts such zero-length nodes using the DOM API, the render tree
        will no longer create render objects for these nodes, and it was these empty render text 
        nodes that was confusing the code doing editing navigation.

        * khtml/xml/dom_textimpl.cpp:
        (CharacterDataImpl::rendererIsNeeded): Do not create renderers for zero-length DOM text nodes.
        * khtml/xml/dom_textimpl.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge documentFragmentWithText:]): Do not insert zero-length DOM text nodes as part
        of converting line-end sequences to BR's.

2004-08-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	- reduce cost of innerHTML from O(N^2) to O(N*D) where N is the
	number of nodes and D is the maximum DOM tree depth.
	
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::recursive_toString): New static helper method for
	recursive_toHTML - this is recursive for children but iterative
	for siblings.
        (NodeImpl::recursive_toHTML): Call the helper with this as the
	first argument.
        * khtml/xml/dom_nodeimpl.h:

2004-08-23  David Hyatt  <hyatt@apple.com>

	Fix for 3558334. 

	Init the encodedURL explicitly for CSSStyleSelectors.  Construction time was too early to be passing in the
	document m_url, since it doesn't get set during construction.

	Fix for 3769643, crash on vancouverblast.org.
	
        Reviewed by darin

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::CSSStyleSelector):
        (khtml::CSSStyleSelector::init):
        (khtml::CSSStyleSelector::setEncodedURL):
        * khtml/css/cssstyleselector.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::setURL):
        (DocumentImpl::recalcStyleSelector):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::URL):

2004-08-23  Kevin Decker  <kdecker@apple.com>

        Reviewed by Maciej.

	- fixed rdar://problem/3681094> Crash in KJS::WindowFunc::tryCall 	with application/xhtml+xml Content-Type
        * khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall): since this is an xml document, we get the
	domain from the xmlDocImpl(), not docImpl().

2004-08-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3771426> assertion failed due to reentering dispatchImageLoadEventsNow
        
	* khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::dispatchImageLoadEventsNow): Avoid re-entering this
	function, since it uses a data member for the copy of the list of events
	to be dispatched.

2004-08-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3770306> XMLHttpRequest does not honor character set encoding

        * khtml/ecma/xmlhttprequest.cpp:
        (KJS::XMLHttpRequest::slotData): Get encoding from the transfer job.
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJobPrivate::TransferJobPrivate): Added retrievedCharset
	flag.
        (KIO::TransferJob::retrieveCharset): New method, gets the charset
	from the response.
        (KIO::TransferJob::queryMetaData): Handle charset.
        (KIO::TransferJob::emitReceivedResponse): Clear retreivedCharset flag.
        * kwq/KWQLoader.h:
        * kwq/KWQLoader.mm:
        (KWQResponseTextEncodingName): New function, gets the encoding from the response.

2004-08-23  David Hyatt  <hyatt@apple.com>

	Apply leo's fix to marquees.
	
        Reviewed by hyatt

        * khtml/rendering/render_layer.cpp:
        (Marquee::start):

2004-08-20  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - added an ascii() member function to DOMString and DOMStringImpl to help debugging

        * khtml/dom/dom_string.h: Add ascii member function for debugging.
        * khtml/dom/dom_string.cpp: (DOM::DOMString::ascii): Added. Calls through to DOMStringImpl::ascii.
        * khtml/xml/dom_stringimpl.h: Add ascii member function for debugging.
        * khtml/xml/dom_stringimpl.cpp: (DOM::DOMStringImpl::ascii): Added. Makes a new buffer and puts
        a simple ASCII version in it. Maybe make it better about characters outside the 0x20-0x7E range
        some day, but for now this is way better than what we had before.

2004-08-20  David Hyatt  <hyatt@apple.com>

	Divorce the notion of a marquee being stopped from JS from the notion of being suspended by the back/forward cache.

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElementFunction::tryCall):
        * khtml/rendering/render_layer.cpp:
        (m_direction):
        (Marquee::start):
        (Marquee::stop):
        (Marquee::updateMarqueePosition):
        * khtml/rendering/render_layer.h:

2004-08-20  Richard Williamson   <rjw@apple.com>

        Implemented new JNI abstraction.  We no longer invoke Java methods
        directly with JNI, rather we call into the plugin.  This allows the
        plugin to dispatch the call to the appropriate VM thread.  This
        change should (will?) fix a whole class of threading related problems with
        the Java VM.

        Reviewed by Hyatt.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::getAppletInstanceForView):
        * kwq/WebCoreBridge.mm:
        (rootForView):
        (-[WebCoreBridge executionContextForView:]):

2004-08-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	More text paint cleanup. Separated the background and foreground
	passes instead of doing a weird for loop thing. Eliminated
	redundant if conditions. Added comments.

        * khtml/rendering/render_text.cpp:
        (RenderText::paint):

2004-08-19  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        * khtml/css/css_computedstyle.cpp:
        (DOM::): Changed CopyProperties constant to InheritableProperties. This reflects the
        name change of copy() to copyInheritableProperties()
        (DOM::CSSComputedStyleDeclarationImpl::copyInheritableProperties: Renamed from copy().
        Now just copies those properties which can be inherited.
        (DOM::CSSComputedStyleDeclarationImpl::diff): Add a couple null checks.
        * khtml/css/css_computedstyle.h: copyInheritableProperties name change. No longer needs to be virtual.
        * khtml/css/css_valueimpl.cpp: Removed unneeded copy() function from CSSStyleDeclarationImpl.
        * khtml/css/css_valueimpl.h: Ditto.
        * khtml/editing/htmlediting.cpp:
        (khtml::EditCommand::typingStyle): Added.
        (khtml::EditCommand::setTypingStyle): Added.
        * khtml/editing/htmlediting.h:
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::StyleChange::currentlyHasStyle): Fix leak of computed style used in this function.
        (khtml::EditCommandImpl::EditCommandImpl): Initialize m_typingStyle.
        (khtml::EditCommandImpl::~EditCommandImpl): Deref m_typingStyle.
        (khtml::EditCommandImpl::assignTypingStyle): New helper used in setting typing style.
        (khtml::EditCommandImpl::setTypingStyle): New setter.
        (khtml::DeleteSelectionCommandImpl::doApply): Use new method for managing typing style.
        * khtml/editing/htmlediting_impl.h:
        (khtml::EditCommandImpl::typingStyle): New accessor.
        * khtml/khtml_part.cpp:
        (KHTMLPart::appliedEditing): Restores typing style from command after setting selection.
        (KHTMLPart::applyStyle): Does a diff between the current style and the style of the caret.
        * khtml/khtml_part.h:
        * khtml/xml/dom_position.cpp:
        (DOM::Position::computedStyle): Now returns a CSSComputedStyleDeclarationImpl instead of a plain
        CSSStyleDeclarationImpl.
        * khtml/xml/dom_position.h:
        * layout-tests/editing/style/style-3681552-fix-002-expected.txt:

2004-08-20  Trey Matteson  <trey@apple.com>

	3655407 - Editing: -complete: method unimplemented (WebKit editing API)

	One new support routine here.

        Reviewed by John

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge caretRectAtNode:offset:]):  New routine.
        (-[WebCoreBridge rangeByExpandingSelectionWithGranularity:]):
	Fixed former misleading method name.

2004-08-20  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Trey

        Fix for this bug:
        
        <rdar://problem/3768378> crash typing newline in Blot

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::InputNewlineCommandImpl::doApply): Adding an assert in a recent change
        showed up that inserting newlines that was not being handled correctly for the 
        case described in the bug. I added a new case to handle inserting BR's when
        at the caret max offset for a node, and this new code runs instead of the
        fall-through case that should not have been running and triggered the assert.
        * layout-tests/editing/inserting/insert-br-case2-expected.txt: Regenerated results.
        * layout-tests/editing/inserting/insert-br-case6-expected.txt: Added.
        * layout-tests/editing/inserting/insert-br-case6.html: Added.

2004-08-20  Trey Matteson  <trey@apple.com>

        Fixing: Spellchecker called once or twice for every char typed.

        Reviewed by Ken

        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection):  Don't do any spell checking if we're typing (it's done
        elsewhere, in markMisspellingsAfterTyping)
 
2004-08-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by John.

	- fixed <rdar://problem/3549369> Crash at www.e1.ru in HTMLTokenizer::notifyFinished

	Probably also fixed the following likely duplicates:

	<rdar://problem/3503938> Safari crashed opening many tabs (HTMLTokenizer::notifyFinished(khtml::CachedObject*))
	<rdar://problem/3566332> CrashTracer: ..405 crashes at com.apple.WebCore: QString::QString[unified] + 0x5c
	<rdar://problem/3703964> CrashTracer: ...86 crashes at com.apple.WebCore: QString::QString[unified] + 0x5c
	<rdar://problem/3703969> CrashTracer: ..234 crashes at com.apple.WebCore: HTMLTokenizer::notifyFinished + 0x1c8

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::open): call setParsing(true), because we need to know we are once again
	parsing when we re-open a document that has previously completed loading.

2004-08-19  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dave and Darin.

        * khtml/rendering/render_text.cpp:
        (RenderText::paint): Split apple and non-apple code paths to allow further cleanup.

2004-08-19  Darin Adler  <darin@apple.com>

        Reviewed by Dave.

        - fixed <rdar://problem/3767274> crash in partForWidget inside setFocus (test page attached)

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::nextKeyViewInFrame): Remove code to do position
        the widget; no longer needed since we reworked how widgets get their positions.
        * kwq/KWQWidget.mm: (QWidget::setFocus): Ditto. This was the one that caused the bug.

2004-08-19  David Hyatt  <hyatt@apple.com>

	Fix crash when text is contained inside a table-colgroup.
	
        Reviewed by john

        * khtml/xml/dom_textimpl.cpp:
        (TextImpl::rendererIsNeeded):

2004-08-19  Trey Matteson  <trey@apple.com>

	Unexpected errors hit while finding word boundaries, leading to crash.

        Reviewed by Ken.

        * kwq/KWQTextUtilities.cpp:
        (KWQFindWordBoundary):  Don't call UCFindTextBreak with edge cases it thinks
	are param errors, and pass correct mask for forward case.  Also fix off-by-one
	crashers in fallback code.

2004-08-19  David Hyatt  <hyatt@apple.com>

	Make XSLT imports/includes work.  This code has to be turned off until the newer version of libxslt is
	available.
	
        Reviewed by kocienda

        * khtml/css/css_ruleimpl.cpp:
        (CSSImportRuleImpl::init):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::~DocumentImpl):
        (DocumentImpl::applyXSLTransform):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::setTransformSource):
        (DOM::DocumentImpl::transformSource):
        * khtml/xml/dom_xmlimpl.cpp:
        (DOM::ProcessingInstructionImpl::checkStyleSheet):
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::matchFunc):
        (khtml::openFunc):
        (khtml::readFunc):
        (khtml::writeFunc):
        (khtml::createQStringParser):
        (khtml::XMLTokenizer::setTransformSource):
        * khtml/xsl/xsl_stylesheetimpl.cpp:
        (DOM::XSLStyleSheetImpl::XSLStyleSheetImpl):
        (DOM::XSLStyleSheetImpl::~XSLStyleSheetImpl):
        (DOM::XSLStyleSheetImpl::isLoading):
        (DOM::XSLStyleSheetImpl::clearDocuments):
        (DOM::XSLStyleSheetImpl::parseString):
        (DOM::XSLStyleSheetImpl::loadChildSheets):
        (DOM::XSLStyleSheetImpl::loadChildSheet):
        (DOM::XSLImportRuleImpl::parentStyleSheet):
        (DOM::XSLStyleSheetImpl::compileStyleSheet):
        (DOM::XSLStyleSheetImpl::locateStylesheetSubResource):
        (DOM::XSLImportRuleImpl::XSLImportRuleImpl):
        (DOM::XSLImportRuleImpl::~XSLImportRuleImpl):
        (DOM::XSLImportRuleImpl::setStyleSheet):
        (DOM::XSLImportRuleImpl::isLoading):
        (DOM::XSLImportRuleImpl::loadSheet):
        * khtml/xsl/xsl_stylesheetimpl.h:
        (DOM::XSLStyleSheetImpl::setOwnerDocument):
        (DOM::XSLStyleSheetImpl::setDocument):
        (DOM::XSLStyleSheetImpl::markAsProcessed):
        (DOM::XSLStyleSheetImpl::processed):
        (DOM::XSLImportRuleImpl::href):
        (DOM::XSLImportRuleImpl::styleSheet):
        (DOM::XSLImportRuleImpl::isImportRule):
        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::m_sourceDocument):
        (DOM::stylesheetLoadFunc):
        (DOM::XSLTProcessorImpl::transformDocument):
        * khtml/xsl/xslt_processorimpl.h:

=== Safari-158 ===

2004-08-18  Trey Matteson  <trey@apple.com>

	3765958	- downstreamPosition() can hit infinite loop when at end of doc
	
	The problem was that I had a position that was after the maximum position in the text
	node, because it was the old caret position before a backspace was processed.  Later
	I happened to call downstream() on that position, and hit the bug.  Fix is to consider
	a position past the end point of its node if it is *greater than* or equal to its max offset.
		 	
        Reviewed by Ken.

        * khtml/xml/dom_positioniterator.cpp:
        (DOM::PositionIterator::atEnd):

2004-08-18  David Hyatt  <hyatt@apple.com>

        - did WebCore part of <rdar://problem/3682969> SLIDER: absolute left position of slider should be headline only

	Make the header overlap the footer in the zero-line case.  Changes to Emerson's template will ensure the
	header draws over the footer.
	
        Reviewed by darin

        * khtml/rendering/render_block.cpp:
        (khtml::getHeightForLineCount):

2004-08-18  Richard Williamson   <rjw@apple.com>

        Replace horrible pollForAppletInView: with new
        webPlugInGetApplet.  The details of how the applet instance
        is provided now belong to the Java team.  Yeh.
		
        Reviewed by Chris.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::getAppletInstanceForView):
        * kwq/WebCoreBridge.h:

2004-08-18  Chris Blumenberg  <cblu@apple.com>

	Fixed: <rdar://problem/3692199> 8A146: Safari crashes in toHTMLWithOptions, selection with no renderer (various sites)

        Reviewed by trey.

        * khtml/xml/dom2_rangeimpl.cpp:
        (DOM::RangeImpl::toHTML): renamed, don't assume that nodes of the range had renderers, use the common ancestor of the range as the root
        * khtml/xml/dom2_rangeimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::recursive_toHTML): renamed, removed code that determines whether to include the root in the HTML, leave this up to the caller
        * khtml/xml/dom_nodeimpl.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge markupStringFromNode:nodes:]): call renamed methods
        (-[WebCoreBridge markupStringFromRange:nodes:]): ditto

2004-08-18  Ken Kocienda  <kocienda@apple.com>

        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::copy): Roll back silly last minute change that broke this code.
        Note to self: read code before making changes to it.

2004-08-18  Ken Kocienda  <kocienda@apple.com>

        Coded by Darin and Ken

        * khtml/css/css_computedstyle.cpp: Added CopyProperties static array. This contains
        the properties we implement that we also want to copy in the new
        CSSComputedStyleDeclarationImpl::copy described below.
        (DOM::CSSComputedStyleDeclarationImpl::copy): New function. In this class, copies the
        computed values of all the properties listed in CopyProperties. In essence, this makes
        a freeze-dired version of a computed style.
        (DOM::CSSComputedStyleDeclarationImpl::diff): Removes every property from the passed-in 
        CSSStyleDeclarationImpl that is also in the computed style.
        * khtml/css/css_computedstyle.h:
        * khtml/css/css_valueimpl.cpp:
        (CSSStyleDeclarationImpl::copy): New function. In this class, the copy operation is
        straightforward. Returns a copy that will be unchanged when the original changes.
        * khtml/css/css_valueimpl.h:
        (DOM::CSSStyleDeclarationImpl::values): Added a accessor suitable for use when the 
        CSSStyleDeclarationImpl is const.

2004-08-17  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	<rdar://problem/3703768> CrashTracer: ...50 crashes at com.apple.WebCore: KHTMLPart::xmlDocImpl const + 0
	
        * khtml/khtmlview.cpp:
        (KHTMLView::viewportMouseMoveEvent): Add a nil check and an
	assertion for m_part being null. It seems impossible for this to
	happen, so we want to debug it ourselves, but in the meantime,
	let's try to avoid causing crashes for our users.

2004-08-17  David Hyatt  <hyatt@apple.com>

	Fix the line truncation function for Emerson so that at the far left setting of the slider, only the header
	is visible.
	
        Reviewed by darin

        * khtml/rendering/render_block.cpp:
        (khtml::getHeightForLineCount):
        * khtml/rendering/render_flexbox.cpp:
        (khtml::RenderFlexibleBox::layoutVerticalBox):

2004-08-17  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Hyatt

        Rewrite of the command that deletes a selection. I deleted great 
        big swaths of bug-ridden code to accomplish this and replaced it
        with code that is much cleaner and smarter.
        
        Also, renamed equivalentUpstreamPosition and equivalentDownstreamPosition to
        upstream to downstream, respectively.
        
        Added a couple of new helper methods.
        
        * khtml/editing/htmlediting.cpp: DeleteCollapsibleWhitespaceCommand and
        RemoveNodeAndPruneCommand now obsolete. A huge win.
        * khtml/editing/htmlediting.h: Ditto.
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::debugPosition): Fix printf which had a placeholder, but no argument passed in the varargs.
        (khtml::CompositeEditCommandImpl::deleteUnrenderedText): New helper. Much simplified and cleaner
        version of 
        (khtml::ApplyStyleCommandImpl::doApply): upstream/downstream name change
        (khtml::ApplyStyleCommandImpl::nodeFullySelected):  upstream/downstream name change
        (khtml::DeleteSelectionCommandImpl::doApply):  upstream/downstream name change
        (khtml::DeleteTextCommandImpl::DeleteTextCommandImpl): Add an assert to check that the
        passed offset is less than the length of the text node.
        (khtml::InputNewlineCommandImpl::insertNodeAfterPosition): upstream/downstream name change
        (khtml::InputNewlineCommandImpl::insertNodeBeforePosition): upstream/downstream name change
        (khtml::InputNewlineCommandImpl::doApply): upstream/downstream name change
        (khtml::InputTextCommandImpl::prepareForTextInsertion): upstream/downstream name change
        (khtml::InputTextCommandImpl::execute): upstream/downstream name change
        (khtml::InputTextCommandImpl::insertSpace): upstream/downstream name change
        (khtml::ReplaceSelectionCommandImpl::doApply): upstream/downstream name change
        (khtml::TypingCommandImpl::issueCommandForDeleteKey): upstream/downstream name change
        (khtml::TypingCommandImpl::deleteKeyPressed):
        * khtml/editing/htmlediting_impl.h:
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousWordBoundary):
        (DOM::Position::nextWordBoundary):
        (DOM::Position::upstream):
        (DOM::Position::downstream):
        (DOM::Position::inRenderedText): Add null check.
        (DOM::Position::isRenderedCharacter): New helper.
        (DOM::isWS): New helper in this file.
        (DOM::Position::leadingWhitespacePosition): New helper. Factored out from htmlediting_impl.cpp.
        (DOM::Position::trailingWhitespacePosition): Ditto.
        (DOM::Position::debugPosition): Add null check.
        * khtml/xml/dom_position.h:
        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::toRange): upstream/downstream name change
        (DOM::Selection::validate): upstream/downstream name change
        (DOM::Selection::debugPosition): upstream/downstream name change
        * layout-tests/editing/deleting/delete-block-contents-003-expected.txt: Updated tests with new expected results.
        * layout-tests/editing/deleting/delete-contiguous-ws-001-expected.txt: Ditto.
        * layout-tests/editing/deleting/delete-selection-001-expected.txt: Ditto.
        * layout-tests/editing/deleting/delete-trailing-ws-001-expected.txt: Ditto.
        * layout-tests/editing/inserting/insert-br-case1-expected.txt: Ditto.
        * layout-tests/editing/inserting/insert-br-case2-expected.txt: Ditto.
        * layout-tests/editing/style/style-3681552-fix-002-expected.txt: Ditto.

2004-08-17  Trey Matteson  <trey@apple.com>

	Various spelling fixes.

        Reviewed by Ken.

        * khtml/khtml_part.cpp:
        (KHTMLPart::setSelection): No misspellings in the spelling code comments
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::removeMarker):  Repaint if doc changes.  Sometimes the markers
	were not being erased when you clicked in a word.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousWordBoundary):  Small optimization.  Bail after first
	try if the second try will not come out any different.
        (DOM::Position::nextWordBoundary):  Ditto
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::markMisspellingsInSelection):  Comment.

2004-08-17  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fixed <rdar://problem/3689700> crash loading page; stoxx.com (works in IE and Firefox)

        * khtml/khtml_part.h: Make completeURL public.
        * kwq/KWQKJavaAppletWidget.mm: (KJavaAppletWidget::KJavaAppletWidget): Complete the base URL
        before passing it across the bridge. This sidesteps the crashing bug in CFURL, filed as
        '<rdar://problem/3764632> CFURLCreateAbsoluteURLWithBytes crashes if passed the string "../.."'
        and also is obviously correct behavior that may fix other sites too.

        - fixed <rdar://problem/3547725> Crashes at csuohio.edu, list box vs. mouse event problem (Spoof No Fix)

        * kwq/KWQListBox.mm:
        (QListBox::~QListBox): Nil out the pointer from the KWQTableView back to the widget by calling
        a new detach method.
        (-[KWQTableView detach]): Set the pointer to the QListBox to 0. Also set the delegate and data
        source to nil, so we don't need nil checks in delegate and data source methods.
        (-[KWQTableView mouseDown:]): Add nil check.
        (-[KWQTableView keyDown:]): Add nil check.
        (-[KWQTableView keyUp:]): Add nil check.
        (-[KWQTableView becomeFirstResponder]): Add nil check.
        (-[KWQTableView resignFirstResponder]): Add nil check.
        (-[KWQTableView canBecomeKeyView]): Add nil check.
        (-[KWQTableView tableViewSelectionDidChange:]): Add nil checks, even though this is a delegate
        callback, to handle cases where calls to JavaScript result in the QListBox going away partway
        through.
        (-[KWQTableView drawRow:clipRect:]): Add nil check.
        (-[KWQTableView _accessibilityTableCell:tableColumn:]): Add nil check.

2004-08-17  Trey Matteson  <trey@apple.com>

	Fix ASSERT in spelling marker management.

        Reviewed by John.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::shiftMarkers):  Use assert instead of ASSERT.
	Tweak test to allow for a start position of 0.

2004-08-17  Trey Matteson  <trey@apple.com>

	3764147 - failure of subframe to load leaves links in parent doc broken

        Reviewed by Maciej.

        * khtml/khtml_part.cpp:
        (KHTMLPart::childBegin):  New method to mark part as not complete.
        (KHTMLPart::processObjectRequest):  Mark child part imcomplete, so if we
	later get a failure on load it won't think it's already complete and do nothing.
        * khtml/khtml_part.h:

=== Safari-157 ===

2004-08-16  David Hyatt  <hyatt@apple.com>

	Fix the #define.  I had it all backwards.
	
        * WebCorePrefix.h:

2004-08-16  David Hyatt  <hyatt@apple.com>

	Land initial support for XSLT using xml-stylesheet PIs.
	
        * WebCore.pbproj/project.pbxproj:
        * khtml/khtml_part.cpp:
        (KHTMLPart::replaceDocImpl):
        * khtml/khtml_part.h:
        * khtml/khtmlview.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::~DocumentImpl):
        (DocumentImpl::recalcStyleSelector):
        (DocumentImpl::applyXSLTransform):
        (DocumentImpl::setTransformSourceDocument):
        * khtml/xml/dom_docimpl.h:
        (DOM::DocumentImpl::setTransformSource):
        (DOM::DocumentImpl::transformSource):
        (DOM::DocumentImpl::transformSourceDocument):
        * khtml/xml/dom_xmlimpl.cpp:
        (DOM::ProcessingInstructionImpl::checkStyleSheet):
        * khtml/xml/dom_xmlimpl.h:
        (DOM::ProcessingInstructionImpl::isXSL):
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::matchFunc):
        (khtml::openFunc):
        (khtml::createQStringParser):
        (khtml::XMLTokenizer::processingInstruction):
        (khtml::XMLTokenizer::finish):
        (khtml::XMLTokenizer::setTransformSource):
        * khtml/xml/xml_tokenizer.h:
        (khtml::Tokenizer::setTransformSource):
        * khtml/xml/xsl_stylesheetimpl.cpp: Removed.
        * khtml/xml/xsl_stylesheetimpl.h: Removed.
        * khtml/xsl/xsl_stylesheetimpl.cpp: Added.
        (DOM::XSLStyleSheetImpl::XSLStyleSheetImpl):
        (DOM::XSLStyleSheetImpl::~XSLStyleSheetImpl):
        (DOM::XSLStyleSheetImpl::isLoading):
        (DOM::XSLStyleSheetImpl::checkLoaded):
        (DOM::XSLStyleSheetImpl::docLoader):
        (DOM::XSLStyleSheetImpl::parseString):
        * khtml/xsl/xsl_stylesheetimpl.h: Added.
        (DOM::XSLStyleSheetImpl::isXSLStyleSheet):
        (DOM::XSLStyleSheetImpl::type):
        (DOM::XSLStyleSheetImpl::ownerDocument):
        (DOM::XSLStyleSheetImpl::document):
        (DOM::XSLStyleSheetImpl::clearDocument):
        * khtml/xsl/xslt_processorimpl.cpp: Added.
        (DOM::m_sourceDocument):
        (DOM::XSLTProcessorImpl::~XSLTProcessorImpl):
        (DOM::XSLTProcessorImpl::transformDocument):
        (DOM::bufferWrite):
        (DOM::XSLTProcessorImpl::addToResult):
        (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):
        * khtml/xsl/xslt_processorimpl.h: Added.

2004-08-16  Maciej Stachowiak  <mjs@apple.com>

        Fix build.

        * khtml/khtml_part.cpp:
        (KHTMLPart::isImmediateRedirectPending):

2004-08-16  Richard Williamson   <rjw@apple.com>

	Fixed <rdar://problem/3704339> Context2D forces integer positions in drawImage

	Use floats instead of ints to draw images.

        Reviewed by Ken.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2DFunction::tryCall):
        * kwq/KWQPainter.h:
        * kwq/KWQPainter.mm:
        (QPainter::drawPixmap):
        (QPainter::drawFloatPixmap):

2004-08-13  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.

	- fixed <rdar://problem/3752509> Pop up windows not showing up within SAP's BW Module (changing location.href on new window created by window.open)
	
	(actually the previous fix for this bug was mostly correct, but
	this additional change is needed to avoid the regression in
	<rdar://problem/3751025> REGRESSION: website rejects Safari 125.9
	as "need to upgrade to IE 6", but didn't reject 125.8

	So if merging for a software update, make sure to include both
	this and the previous fix.
	
        * khtml/html/htmltokenizer.cpp:
        (khtml::HTMLTokenizer::write): When there is an immediate reidrect pending,
	make sure to stop tokenizing, because we need to make sure no further
	script tags are processed beyond the one that triggered the redirect.
        * khtml/khtml_part.cpp:
        (KHTMLPart::isImmediateRedirectPending): New method to allow
	checking if a redirect is pending.
	* khtml/khtml_part.h:

2004-08-15  David Hyatt  <hyatt@apple.com>

        - fixed <rdar://problem/3760508> REGRESSION (154-155): No text in textarea

	Fix the blank textarea problem by ensuring that any change to a <textarea>'s DOM children causes the form control
	to resync with the DOM.  This behavior matches WinIE.
	
        Reviewed by kocienda

        * khtml/html/html_formimpl.cpp:
        (HTMLTextAreaElementImpl::childrenChanged):
        * khtml/html/html_formimpl.h:

2004-08-13  Trey Matteson  <trey@apple.com>

	3761794 Slider doesn't call onmouseup handler

        Reviewed by Hyatt

        * khtml/rendering/render_form.cpp:
        (RenderSlider::RenderSlider):  Listen for signal.
        (RenderSlider::slotClicked):  Pass to superclass.
        * khtml/rendering/render_form.h:
        * kwq/KWQSlider.h:
        * kwq/KWQSlider.mm:
        (-[KWQSlider mouseDown:]):  Generate mouseUp and clicked events,
	since AK consumes the mouseUp event in a modal tracking loop.
        (QSlider::QSlider):  Make signal.
        (QSlider::clicked):  Send signal.

2004-08-12  Trey Matteson  <trey@apple.com>

	3761329 - query result links all dead in ingrammicro.com (sometimes)
	3761328 - links in some docs dead when doc is loaded from WebArchive

	Make sure to get part to completed state when end is called,
	even if we have no doc.  See WebKit changelog for more info.

        Reviewed by Richard and Darin.

        * khtml/khtml_part.cpp:
        (KHTMLPart::end):

2004-08-13  Trey Matteson  <trey@apple.com>

        3761098 - red dotted underline for misspelled words shows up in drag image

        Reviewed by Ken

        * khtml/rendering/render_text.cpp:
        (RenderText::paint):  Don't draw misspelling when creating selection image.

2004-08-12  Richard Williamson   <rjw@apple.com>

	Bring npruntime.h and friends closer to compliance with
	latest spec.

        Reviewed by Maciej.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::windowScriptNPObject):

2004-08-12  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Richard.

	<rdar://problem/3245706> URLs with backslashes instead of slashes work on WinIE; should work on Safari (SAP)
	<rdar://problem/3506429> <BASE> tag containing backslash is breaking images with absolute URLs
	
        * kwq/KWQKURL.mm:
        (substituteBackslashes): Helper method
        (KURL::KURL): If the URL contains any backslashes, substitute all
	that appear before the query or fragment.

2004-08-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Chris

        Fix for this bug:
        
        <rdar://problem/3761014> command-down-arrow takes you to start of document instead of end of document

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modifyExtendingRightForward): Code used to assume, incorrectly, that index 1 of the
        document element was beyond the last node in the document. But this is not true, since the document
        element is the HTML element (generally). Instead, move to the index equal to the number of children
        of the document element. This puts us past everything.
        (DOM::Selection::modifyMovingRightForward): Ditto.

2004-08-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Trey

        Fix for this bug:
        
        <rdar://problem/3695446> shift-down-arrow on last line of editable text should select to end of document
        
        Detect when current position is on first or last line and move to the
        start or end of that line, respectively.

        * khtml/xml/dom_position.cpp:
        (DOM::Position::previousLinePosition)
        (DOM::Position::nextLinePosition)

=== Safari-156 ===

2004-08-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Some consolidation in style application code.

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::StyleChange::StyleChange): Made this a full-on class and added a couple of 
        members and a constructors to make a StyleChange from a CSSStyleDeclarationImpl, as
        well as from a CSSStyleDeclarationImpl and a Position.
        (khtml::StyleChange::init): Common init function for StyleChange constructors.
        (khtml::StyleChange::currentlyHasStyle): Moved this here from ApplyStyleCommandImpl.
        (khtml::CompositeEditCommandImpl::applyTypingStyle): Tweak to adjust to new StyleChange
        interface.
        (khtml::ApplyStyleCommandImpl::applyStyleIfNeeded): Ditto.
        * khtml/editing/htmlediting_impl.h:
        (khtml::StyleChange::StyleChange):
        (khtml::StyleChange::cssStyle): New accessor.
        (khtml::StyleChange::applyBold): Ditto.
        (khtml::StyleChange::applyItalic): Ditto.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::computedStyle): New helper.
        * khtml/xml/dom_position.h: Ditto.

2004-08-12  Ken Kocienda  <kocienda@apple.com>

        Reviewed by Darin

        Fix for this bug:
        <rdar://problem/3751098> HTML email has one set of SPAN tags per character in the message
        
        Progress on this bug:
        <rdar://problem/3755562> Typing styles do not use same tag application conventions as font and color panel

        * khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::applyTypingStyle): Name changed from createTypingStyleElement.
        Also, interface changed to take the node to which the typing style is to be applied. 
        This makes it easier to apply what may be up to three levels of nested tags to get the 
        desired style (<B>, <I>, and <SPAN STYLE="">).
        Also, Borrow some of the style change