Changeset 67909 in webkit
- Timestamp:
- Sep 20, 2010 6:51:21 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r67906 r67909 1 2010-09-19 Antonio Gomes <agomes@rim.com> 2 3 Reviewed by Ojan Vafai. 4 5 SelectionController::modify should ask EditingBehavior for platform specific behavior 6 https://bugs.webkit.org/show_bug.cgi?id=41975 7 8 As a follow up of the refactoring work in bug 39854, patch makes SelectionController::modify() 9 stop accessing EditingBehaviorType values directly, and replaces its use by the EditingBehavior 10 class. 11 12 Since the "Settings*" parameter of the private SelectionController::modify() method becomes unneeded 13 with this change (it was used to query the editingBehaviorType), patch merges two modify() methods. 14 15 No behavior change, so no new tests. 16 17 * editing/EditingBehavior.h: 18 (WebCore::EditingBehavior::shouldAlwaysGrowSelectionWhenExtendingToBoundary): 19 * editing/SelectionController.cpp: 20 (WebCore::SelectionController::modify): 21 * editing/SelectionController.h: 22 1 23 2010-09-20 Vangelis Kokkevis <vangelis@chromium.org> 2 24 -
trunk/WebCore/editing/EditingBehavior.h
r62815 r67909 54 54 bool shouldToggleStyleBasedOnStartOfSelection() const { return m_type == EditingMacBehavior; } 55 55 56 // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the base 57 // in place and moving the extent. Matches NSTextView. 58 bool shouldAlwaysGrowSelectionWhenExtendingToBoundary() const { return m_type == EditingMacBehavior; } 59 56 60 private: 57 61 EditingBehaviorType m_type; -
trunk/WebCore/editing/SelectionController.cpp
r67653 r67909 623 623 } 624 624 625 bool SelectionController::modify(EAlteration alter, EDirection dir, TextGranularity granularity, bool userTriggered)626 {627 Settings* settings = m_frame ? m_frame->settings() : 0;628 return modify(alter, dir, granularity, userTriggered, settings);629 }630 631 625 static bool isBoundary(TextGranularity granularity) 632 626 { … … 634 628 } 635 629 636 bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered , Settings* settings)630 bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered) 637 631 { 638 632 if (userTriggered) { … … 640 634 trialSelectionController.setSelection(m_selection); 641 635 trialSelectionController.setIsDirectional(m_isDirectional); 642 trialSelectionController.modify(alter, direction, granularity, false , settings);636 trialSelectionController.modify(alter, direction, granularity, false); 643 637 644 638 bool change = shouldChangeSelection(trialSelectionController.selection()); … … 691 685 break; 692 686 case AlterationExtend: 693 if (!settings || settings->editingBehaviorType() != EditingMacBehavior || m_selection.isCaret() || !isBoundary(granularity)) 687 // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the 688 // base in place and moving the extent. Matches NSTextView. 689 if (!m_frame || !m_frame->editor()->behavior().shouldAlwaysGrowSelectionWhenExtendingToBoundary() || m_selection.isCaret() || !isBoundary(granularity)) 694 690 setExtent(position, userTriggered); 695 691 else { 696 // Standard Mac behavior when extending to a boundary is grow the selection rather697 // than leaving the base in place and moving the extent. Matches NSTextView.698 692 if (direction == DirectionForward || direction == DirectionRight) 699 693 setEnd(position, userTriggered); … … 701 695 setStart(position, userTriggered); 702 696 } 697 break; 703 698 } 704 699 -
trunk/WebCore/editing/SelectionController.h
r67238 r67909 182 182 VisiblePosition endForPlatform() const; 183 183 184 bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered, Settings*);185 186 184 VisiblePosition modifyExtendingRight(TextGranularity); 187 185 VisiblePosition modifyExtendingForward(TextGranularity);
Note: See TracChangeset
for help on using the changeset viewer.