| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi
table(); } | 52 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi
table(); } |
| 53 | 53 |
| 54 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio
nalMode, FrameSelection::SetSelectionOptions); | 54 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio
nalMode, FrameSelection::SetSelectionOptions); |
| 55 | 55 |
| 56 bool modify(EAlteration, SelectionDirection, TextGranularity, EUserTriggered
); | 56 bool modify(EAlteration, SelectionDirection, TextGranularity, EUserTriggered
); |
| 57 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection, EUser
Triggered, CursorAlignOnScroll); | 57 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection, EUser
Triggered, CursorAlignOnScroll); |
| 58 | 58 |
| 59 template <typename Strategy> | 59 template <typename Strategy> |
| 60 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; | 60 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; |
| 61 void setVisibleSelection(const VisibleSelection&, FrameSelection::SetSelecti
onOptions); | 61 void setVisibleSelection(const VisibleSelection&, FrameSelection::SetSelecti
onOptions); |
| 62 void setVisibleSelection(const VisibleSelectionInComposedTree&, FrameSelecti
on::SetSelectionOptions); | 62 void setVisibleSelection(const VisibleSelectionInFlatTree&, FrameSelection::
SetSelectionOptions); |
| 63 | 63 |
| 64 void setIsDirectional(bool); | 64 void setIsDirectional(bool); |
| 65 void setWithoutValidation(const Position& base, const Position& extent); | 65 void setWithoutValidation(const Position& base, const Position& extent); |
| 66 | 66 |
| 67 void resetXPosForVerticalArrowNavigation(); | 67 void resetXPosForVerticalArrowNavigation(); |
| 68 | 68 |
| 69 void willBeModified(EAlteration, SelectionDirection); | 69 void willBeModified(EAlteration, SelectionDirection); |
| 70 | 70 |
| 71 // If this FrameSelection has a logical range which is still valid, this | 71 // If this FrameSelection has a logical range which is still valid, this |
| 72 // function return its clone. Otherwise, the return value from underlying | 72 // function return its clone. Otherwise, the return value from underlying |
| 73 // |VisibleSelection|'s |firstRange()| is returned. | 73 // |VisibleSelection|'s |firstRange()| is returned. |
| 74 PassRefPtrWillBeRawPtr<Range> firstRange() const; | 74 PassRefPtrWillBeRawPtr<Range> firstRange() const; |
| 75 | 75 |
| 76 // VisibleSelectionChangeObserver interface. | 76 // VisibleSelectionChangeObserver interface. |
| 77 void didChangeVisibleSelection() override; | 77 void didChangeVisibleSelection() override; |
| 78 | 78 |
| 79 // Updates |m_selection| and |m_selectionInComposedTree| with up-to-date | 79 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date |
| 80 // layout if needed. | 80 // layout if needed. |
| 81 void updateIfNeeded(); | 81 void updateIfNeeded(); |
| 82 | 82 |
| 83 DECLARE_VIRTUAL_TRACE(); | 83 DECLARE_VIRTUAL_TRACE(); |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 explicit SelectionEditor(FrameSelection&); | 86 explicit SelectionEditor(FrameSelection&); |
| 87 | 87 |
| 88 // TODO(yosin) We should use capitalized name for |EPositionType|. | 88 // TODO(yosin) We should use capitalized name for |EPositionType|. |
| 89 enum EPositionType { START, END, BASE, EXTENT }; // NOLINT | 89 enum EPositionType { START, END, BASE, EXTENT }; // NOLINT |
| 90 | 90 |
| 91 LocalFrame* frame() const; | 91 LocalFrame* frame() const; |
| 92 | 92 |
| 93 void adjustVisibleSelectionInComposedTree(); | 93 void adjustVisibleSelectionInFlatTree(); |
| 94 void adjustVisibleSelectionInDOMTree(); | 94 void adjustVisibleSelectionInDOMTree(); |
| 95 | 95 |
| 96 TextDirection directionOfEnclosingBlock(); | 96 TextDirection directionOfEnclosingBlock(); |
| 97 TextDirection directionOfSelection(); | 97 TextDirection directionOfSelection(); |
| 98 | 98 |
| 99 VisiblePosition positionForPlatform(bool isGetStart) const; | 99 VisiblePosition positionForPlatform(bool isGetStart) const; |
| 100 VisiblePosition startForPlatform() const; | 100 VisiblePosition startForPlatform() const; |
| 101 VisiblePosition endForPlatform() const; | 101 VisiblePosition endForPlatform() const; |
| 102 VisiblePosition nextWordPositionForPlatform(const VisiblePosition&); | 102 VisiblePosition nextWordPositionForPlatform(const VisiblePosition&); |
| 103 | 103 |
| 104 VisiblePosition modifyExtendingRight(TextGranularity); | 104 VisiblePosition modifyExtendingRight(TextGranularity); |
| 105 VisiblePosition modifyExtendingForward(TextGranularity); | 105 VisiblePosition modifyExtendingForward(TextGranularity); |
| 106 VisiblePosition modifyMovingRight(TextGranularity); | 106 VisiblePosition modifyMovingRight(TextGranularity); |
| 107 VisiblePosition modifyMovingForward(TextGranularity); | 107 VisiblePosition modifyMovingForward(TextGranularity); |
| 108 VisiblePosition modifyExtendingLeft(TextGranularity); | 108 VisiblePosition modifyExtendingLeft(TextGranularity); |
| 109 VisiblePosition modifyExtendingBackward(TextGranularity); | 109 VisiblePosition modifyExtendingBackward(TextGranularity); |
| 110 VisiblePosition modifyMovingLeft(TextGranularity); | 110 VisiblePosition modifyMovingLeft(TextGranularity); |
| 111 VisiblePosition modifyMovingBackward(TextGranularity); | 111 VisiblePosition modifyMovingBackward(TextGranularity); |
| 112 | 112 |
| 113 void startObservingVisibleSelectionChange(); | 113 void startObservingVisibleSelectionChange(); |
| 114 void stopObservingVisibleSelectionChangeIfNecessary(); | 114 void stopObservingVisibleSelectionChangeIfNecessary(); |
| 115 | 115 |
| 116 LayoutUnit lineDirectionPointForBlockDirectionNavigation(EPositionType); | 116 LayoutUnit lineDirectionPointForBlockDirectionNavigation(EPositionType); |
| 117 bool dispatchSelectStart(); | 117 bool dispatchSelectStart(); |
| 118 | 118 |
| 119 RawPtrWillBeMember<FrameSelection> m_frameSelection; | 119 RawPtrWillBeMember<FrameSelection> m_frameSelection; |
| 120 | 120 |
| 121 LayoutUnit m_xPosForVerticalArrowNavigation; | 121 LayoutUnit m_xPosForVerticalArrowNavigation; |
| 122 VisibleSelection m_selection; | 122 VisibleSelection m_selection; |
| 123 VisibleSelectionInComposedTree m_selectionInComposedTree; | 123 VisibleSelectionInFlatTree m_selectionInFlatTree; |
| 124 bool m_observingVisibleSelection; | 124 bool m_observingVisibleSelection; |
| 125 | 125 |
| 126 // The range specified by the user, which may not be visually canonicalized | 126 // The range specified by the user, which may not be visually canonicalized |
| 127 // (hence "logical"). This will be invalidated if the underlying | 127 // (hence "logical"). This will be invalidated if the underlying |
| 128 // |VisibleSelection| changes. If that happens, this variable will | 128 // |VisibleSelection| changes. If that happens, this variable will |
| 129 // become |nullptr|, in which case logical positions == visible positions. | 129 // become |nullptr|, in which case logical positions == visible positions. |
| 130 RefPtrWillBeMember<Range> m_logicalRange; | 130 RefPtrWillBeMember<Range> m_logicalRange; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace blink | 133 } // namespace blink |
| 134 | 134 |
| 135 #endif // SelectionEditor_h | 135 #endif // SelectionEditor_h |
| OLD | NEW |