-
darin authored
Fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=6523> "Extract data from SelectionController" This patch refactors the data portions of SelectionController into its own class, "Selection". The extracted data are the base/extent/start/end positions and cursor affinity. Also a couple cached values generated by validation are kept around in the new class. This patch does away with all the different affinities (start/end/base/extent) that were never implemented properly, since affinity only makes sense when the selection is a caret (as per discussion with mjs and darin on #webkit). No test cases added because this is a refactoring. * WebCore.xcodeproj/project.pbxproj: * bridge/mac/MacFrame.mm: (MacFrame::findString): (MacFrame::advanceToNextMisspelling): (MacFrame::baseWritingDirectionForSelectionStart): (MacFrame::respondToChangedSelection): * bridge/mac/WebCoreFrameBridge.mm: (-[WebCoreFrameBridge selectionState]): (-[WebCoreFrameBridge selectNSRange:]): (-[WebCoreFrameBridge selectionAffinity]): (-[WebCoreFrameBridge setMarkDOMRange:]): (-[WebCoreFrameBridge ensureSelectionVisible]): (-[WebCoreFrameBridge rangeOfCharactersAroundCaret]): * khtml/editing/Selection.cpp: Added. (khtml::Selection::Selection): (khtml::Selection::clear): (khtml::Selection::toRange): (khtml::Selection::validate): (khtml::Selection::adjustForEditableContent): (khtml::Selection::debugPosition): * khtml/editing/Selection.h: Added. (khtml::Selection::): (khtml::Selection::state): (khtml::Selection::setAffinity): (khtml::Selection::affinity): (khtml::Selection::setBase): (khtml::Selection::setExtent): (khtml::Selection::setStart): (khtml::Selection::setEnd): (khtml::Selection::base): (khtml::Selection::extent): (khtml::Selection::start): (khtml::Selection::end): (khtml::Selection::isNone): (khtml::Selection::isCaret): (khtml::Selection::isRange): (khtml::Selection::isCaretOrRange): (khtml::Selection::isBaseFirst): (khtml::operator==): (khtml::operator!=): * khtml/editing/SelectionController.cpp: (khtml::SelectionController::SelectionController): (khtml::SelectionController::operator=): (khtml::SelectionController::moveTo): (khtml::SelectionController::setModifyBias): (khtml::SelectionController::modifyExtendingRightForward): (khtml::SelectionController::modifyMovingRightForward): (khtml::SelectionController::modifyExtendingLeftBackward): (khtml::SelectionController::modifyMovingLeftBackward): (khtml::SelectionController::modify): (khtml::SelectionController::expandUsingGranularity): (khtml::SelectionController::xPosForVerticalArrowNavigation): (khtml::SelectionController::clear): (khtml::SelectionController::setBase): (khtml::SelectionController::setExtent): (khtml::SelectionController::toString): (khtml::SelectionController::getRangeAt): (khtml::SelectionController::frame): (khtml::SelectionController::collapseToEnd): (khtml::SelectionController::collapseToStart): (khtml::SelectionController::layout): (khtml::SelectionController::caretRect): (khtml::SelectionController::needsCaretRepaint): (khtml::SelectionController::paintCaret): (khtml::SelectionController::debugRenderer): (khtml::SelectionController::formatForDebugger): (khtml::SelectionController::showTree): * khtml/editing/SelectionController.h: (khtml::SelectionController::state): (khtml::SelectionController::affinity): (khtml::SelectionController::base): (khtml::SelectionController::extent): (khtml::SelectionController::start): (khtml::SelectionController::end): (khtml::SelectionController::isNone): (khtml::SelectionController::isCaret): (khtml::SelectionController::isRange): (khtml::SelectionController::isCaretOrRange): (khtml::SelectionController::toRange): (khtml::SelectionController::baseNode): (khtml::SelectionController::extentNode): (khtml::SelectionController::baseOffset): (khtml::SelectionController::extentOffset): (khtml::SelectionController::anchorNode): (khtml::SelectionController::anchorOffset): (khtml::SelectionController::focusNode): (khtml::SelectionController::focusOffset): (khtml::operator==): * khtml/editing/apply_style_command.cpp: (khtml::ApplyStyleCommand::updateStartEnd): * khtml/editing/break_blockquote_command.cpp: (khtml::BreakBlockquoteCommand::doApply): * khtml/editing/delete_selection_command.cpp: (khtml::DeleteSelectionCommand::initializePositionData): (khtml::DeleteSelectionCommand::handleGeneralDelete): (khtml::DeleteSelectionCommand::doApply): * khtml/editing/insert_line_break_command.cpp: (khtml::InsertLineBreakCommand::doApply): * khtml/editing/insert_paragraph_separator_command.cpp: (khtml::InsertParagraphSeparatorCommand::doApply): * khtml/editing/insert_text_command.cpp: (khtml::InsertTextCommand::input): * khtml/editing/move_selection_command.cpp: (khtml::MoveSelectionCommand::doApply): * khtml/editing/replace_selection_command.cpp: (khtml::ReplaceSelectionCommand::doApply): (khtml::ReplaceSelectionCommand::completeHTMLReplacement): * khtml/editing/typing_command.cpp: (khtml::TypingCommand::deleteKeyPressed): (khtml::TypingCommand::forwardDeleteKeyPressed): (khtml::TypingCommand::markMisspellingsAfterTyping): * khtml/xml/DocumentImpl.cpp: (DocumentImpl::updateSelection): * kwq/KWQAccObject.mm: (-[KWQAccObject accessibilityAttributeValue:]): (-[KWQAccObject doAXTextMarkerRangeForLine:]): * kwq/KWQRenderTreeDebug.cpp: (writeSelection): * page/Frame.cpp: (Frame::selectContentsOfNode): (Frame::shouldChangeSelection): (Frame::computeAndSetTypingStyle): (Frame::applyStyle): (Frame::applyParagraphStyle): (Frame::selectFrameElementInParentIfFullySelected): (Frame::revealSelection): (Frame::centerSelectionInVisibleArea): (Frame::styleForSelectionStart): * <a few other files, including editing ones>: Added includes since Selection.h and SelectionController.h now include fewer things. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@12118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
9aa45a49