WebCore:
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Oct 2004 16:04:11 +0000 (16:04 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Oct 2004 16:04:11 +0000 (16:04 +0000)
commit5a6c6fa7bd57de183de4fcad04b14efbc0a14899
tree167356b37771089ffaf4434b07281c3f7a9130c8
parentee5a5fffe43f0188bca9c8a02c2004e942b1f920
WebCore:

        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.

WebKit:

        Reviewed by Darin

        * WebView.subproj/WebHTMLView.m:
        (-[WebTextCompleteController doCompletion]): bridge call to get caret rect at a node
        now takes an affinity: caretRectAtNode:offset:affinity:.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/SelectionController.cpp
WebCore/khtml/editing/SelectionController.h
WebCore/khtml/editing/selection.cpp
WebCore/khtml/editing/selection.h
WebCore/khtml/editing/visible_units.cpp
WebCore/khtml/editing/visible_units.h
WebCore/khtml/khtml_events.cpp
WebCore/khtml/khtml_part.cpp
WebCore/khtml/rendering/render_block.cpp
WebCore/khtml/rendering/render_block.h
WebCore/khtml/rendering/render_box.cpp
WebCore/khtml/rendering/render_box.h
WebCore/khtml/rendering/render_br.cpp
WebCore/khtml/rendering/render_br.h
WebCore/khtml/rendering/render_container.cpp
WebCore/khtml/rendering/render_container.h
WebCore/khtml/rendering/render_flow.cpp
WebCore/khtml/rendering/render_flow.h
WebCore/khtml/rendering/render_inline.cpp
WebCore/khtml/rendering/render_inline.h
WebCore/khtml/rendering/render_object.cpp
WebCore/khtml/rendering/render_object.h
WebCore/khtml/rendering/render_replaced.cpp
WebCore/khtml/rendering/render_replaced.h
WebCore/khtml/rendering/render_text.cpp
WebCore/khtml/rendering/render_text.h
WebCore/khtml/xml/dom_nodeimpl.cpp
WebCore/khtml/xml/dom_nodeimpl.h
WebCore/khtml/xml/dom_position.cpp
WebCore/khtml/xml/dom_position.h
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m