WebCore:
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2004 23:23:27 +0000 (23:23 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2004 23:23:27 +0000 (23:23 +0000)
commite2f8ec4f47fc011fa8bb52f01241db2cc02be44a
treec2881dfc51f1c87a87b3535ffc47624f95b76333
parent5a18deb46779d030eaa7bba99f7b950a422253ac
WebCore:

        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.

WebKit:

        Reviewed by Hyatt

        Improved the checks used to see if certain operations can be done based
        on the state of the selection and whether the selection is editable. I
        added some helpers and improved some others to assist in making these
        determinations.

        This helps to fix this bug:
        <rdar://problem/3764987> Crash after adding newline to quoted text

        Since some editing methods expect the the selection to be in a certain state
        in order to work, these checks help obviate crashes like 3764987.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _writeSelectionToPasteboard:]): _haveSelection name changed to _hasSelection.
        (-[WebHTMLView _canCopy]): Checks to see if state is appropriate to perform this operation.
        (-[WebHTMLView _canCut]): Ditto. Function added.
        (-[WebHTMLView _canDelete]): Ditto. Function refined.
        (-[WebHTMLView _canPaste]): Ditto. Function refined.
        (-[WebHTMLView _canType]): Ditto. Function added.
        (-[WebHTMLView _hasSelection]): Name changed from _haveSelection.
        (-[WebHTMLView _hasSelectionOrInsertionPoint]): Added.
        (-[WebHTMLView _isEditable]): Added.
        (-[WebHTMLView takeFindStringFromSelection:]): _haveSelection name changed to _hasSelection.
        (-[WebHTMLView validateUserInterfaceItem:]): Ditto
        (-[WebHTMLView validRequestorForSendType:returnType:]): Ditto
        (-[WebHTMLView keyDown:]):
        (-[WebHTMLView copy:]): Uses new _canCopy check.
        (-[WebHTMLView cut:]): Uses new _canCut check.
        (-[WebHTMLView delete:]): Now uses _canDelete check.
        (-[WebHTMLView paste:]): Now uses _canPaste check.
        (-[WebHTMLView _updateFontPanel]): _haveSelection name changed to _hasSelection.
        * WebView.subproj/WebHTMLViewPrivate.h:
        * WebView.subproj/WebView.m:
        (-[WebView writeSelectionWithPasteboardTypes:toPasteboard:]): Use selectionState check to
        determine whether or not operation can be done.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/htmlediting_impl.cpp
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m
WebKit/WebView.subproj/WebHTMLViewPrivate.h
WebKit/WebView.subproj/WebView.m