| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded); | 117 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded); |
| 118 void moveTo(const Position&, TextAffinity); | 118 void moveTo(const Position&, TextAffinity); |
| 119 | 119 |
| 120 template <typename Strategy> | 120 template <typename Strategy> |
| 121 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; | 121 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; |
| 122 | 122 |
| 123 const VisibleSelection& selection() const; | 123 const VisibleSelection& selection() const; |
| 124 void setSelection(const VisibleSelection&, | 124 void setSelection(const VisibleSelection&, |
| 125 SetSelectionOptions = CloseTyping | ClearTypingStyle, | 125 SetSelectionOptions = CloseTyping | ClearTypingStyle, |
| 126 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, | 126 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, |
| 127 TextGranularity = CharacterGranularity); | 127 TextGranularity = CharacterGranularity, |
| 128 bool isHandleVisible = false); |
| 128 void setSelection(const VisibleSelectionInFlatTree&, | 129 void setSelection(const VisibleSelectionInFlatTree&, |
| 129 SetSelectionOptions = CloseTyping | ClearTypingStyle, | 130 SetSelectionOptions = CloseTyping | ClearTypingStyle, |
| 130 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, | 131 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, |
| 131 TextGranularity = CharacterGranularity); | 132 TextGranularity = CharacterGranularity, |
| 133 bool isHandleVisible = false); |
| 132 // TODO(yosin) We should get rid of two parameters version of | 134 // TODO(yosin) We should get rid of two parameters version of |
| 133 // |setSelection()| to avoid conflict of four parameters version. | 135 // |setSelection()| to avoid conflict of four parameters version. |
| 134 void setSelection(const VisibleSelection& selection, | 136 void setSelection(const VisibleSelection& selection, |
| 135 TextGranularity granularity) { | 137 TextGranularity granularity, |
| 138 bool isHandleVisible = false) { |
| 136 setSelection(selection, CloseTyping | ClearTypingStyle, | 139 setSelection(selection, CloseTyping | ClearTypingStyle, |
| 137 CursorAlignOnScroll::IfNeeded, granularity); | 140 CursorAlignOnScroll::IfNeeded, granularity, isHandleVisible); |
| 138 } | 141 } |
| 139 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()| | 142 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()| |
| 140 // for Oilpan. | 143 // for Oilpan. |
| 141 bool setSelectedRange( | 144 bool setSelectedRange( |
| 142 Range*, | 145 Range*, |
| 143 TextAffinity, | 146 TextAffinity, |
| 144 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, | 147 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, |
| 145 SetSelectionOptions = CloseTyping | ClearTypingStyle); | 148 SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 146 bool setSelectedRange( | 149 bool setSelectedRange( |
| 147 const EphemeralRange&, | 150 const EphemeralRange&, |
| 148 TextAffinity, | 151 TextAffinity, |
| 149 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, | 152 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, |
| 150 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); | 153 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 151 void selectAll(); | 154 void selectAll(); |
| 152 void clear(); | 155 void clear(); |
| 153 | 156 |
| 154 // Call this after doing user-triggered selections to make it easy to delete | 157 // Call this after doing user-triggered selections to make it easy to delete |
| 155 // the frame you entirely selected. | 158 // the frame you entirely selected. |
| 156 void selectFrameElementInParentIfFullySelected(); | 159 void selectFrameElementInParentIfFullySelected(); |
| 157 | 160 |
| 161 bool contains(const HitTestResult&); |
| 158 bool contains(const LayoutPoint&); | 162 bool contains(const LayoutPoint&); |
| 159 | 163 |
| 160 SelectionType getSelectionType() const { | 164 SelectionType getSelectionType() const { |
| 161 return selection().getSelectionType(); | 165 return selection().getSelectionType(); |
| 162 } | 166 } |
| 163 | 167 |
| 164 TextAffinity affinity() const { return selection().affinity(); } | 168 TextAffinity affinity() const { return selection().affinity(); } |
| 165 | 169 |
| 166 bool modify(EAlteration, | 170 bool modify(EAlteration, |
| 167 SelectionDirection, | 171 SelectionDirection, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Used to suspend caret blinking while the mouse is down. | 239 // Used to suspend caret blinking while the mouse is down. |
| 236 void setCaretBlinkingSuspended(bool); | 240 void setCaretBlinkingSuspended(bool); |
| 237 bool isCaretBlinkingSuspended() const; | 241 bool isCaretBlinkingSuspended() const; |
| 238 | 242 |
| 239 // Focus | 243 // Focus |
| 240 void setFocused(bool); | 244 void setFocused(bool); |
| 241 bool isFocused() const { return m_focused; } | 245 bool isFocused() const { return m_focused; } |
| 242 bool isFocusedAndActive() const; | 246 bool isFocusedAndActive() const; |
| 243 void pageActivationChanged(); | 247 void pageActivationChanged(); |
| 244 | 248 |
| 249 bool isHandleVisible() const { return m_isHandleVisible; } |
| 250 |
| 245 void updateSecureKeyboardEntryIfActive(); | 251 void updateSecureKeyboardEntryIfActive(); |
| 246 | 252 |
| 247 // Returns true if a word is selected. | 253 // Returns true if a word is selected. |
| 248 bool selectWordAroundPosition(const VisiblePosition&); | 254 bool selectWordAroundPosition(const VisiblePosition&); |
| 249 | 255 |
| 250 #ifndef NDEBUG | 256 #ifndef NDEBUG |
| 251 void showTreeForThis() const; | 257 void showTreeForThis() const; |
| 252 #endif | 258 #endif |
| 253 | 259 |
| 254 enum EndPointsAdjustmentMode { | 260 enum EndPointsAdjustmentMode { |
| 255 AdjustEndpointsAtBidiBoundary, | 261 AdjustEndpointsAtBidiBoundary, |
| 256 DoNotAdjsutEndpoints | 262 DoNotAdjustEndpoints |
| 257 }; | 263 }; |
| 258 void setNonDirectionalSelectionIfNeeded( | 264 void setNonDirectionalSelectionIfNeeded( |
| 259 const VisibleSelectionInFlatTree&, | 265 const VisibleSelectionInFlatTree&, |
| 260 TextGranularity, | 266 TextGranularity, |
| 261 EndPointsAdjustmentMode = DoNotAdjsutEndpoints); | 267 EndPointsAdjustmentMode = DoNotAdjustEndpoints, |
| 268 bool isHandleVisible = false); |
| 262 void setFocusedNodeIfNeeded(); | 269 void setFocusedNodeIfNeeded(); |
| 263 void notifyLayoutObjectOfSelectionChange(EUserTriggered); | 270 void notifyLayoutObjectOfSelectionChange(EUserTriggered); |
| 264 | 271 |
| 265 EditingStyle* typingStyle() const; | 272 EditingStyle* typingStyle() const; |
| 266 void setTypingStyle(EditingStyle*); | 273 void setTypingStyle(EditingStyle*); |
| 267 void clearTypingStyle(); | 274 void clearTypingStyle(); |
| 268 | 275 |
| 269 String selectedHTMLForClipboard() const; | 276 String selectedHTMLForClipboard() const; |
| 270 String selectedText(TextIteratorBehavior = TextIteratorDefaultBehavior) const; | 277 String selectedText(TextIteratorBehavior = TextIteratorDefaultBehavior) const; |
| 271 String selectedTextForClipboard() const; | 278 String selectedTextForClipboard() const; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 315 |
| 309 template <typename Strategy> | 316 template <typename Strategy> |
| 310 VisiblePositionTemplate<Strategy> originalBase() const; | 317 VisiblePositionTemplate<Strategy> originalBase() const; |
| 311 void setOriginalBase(const VisiblePosition&); | 318 void setOriginalBase(const VisiblePosition&); |
| 312 void setOriginalBase(const VisiblePositionInFlatTree&); | 319 void setOriginalBase(const VisiblePositionInFlatTree&); |
| 313 | 320 |
| 314 template <typename Strategy> | 321 template <typename Strategy> |
| 315 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, | 322 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, |
| 316 SetSelectionOptions, | 323 SetSelectionOptions, |
| 317 CursorAlignOnScroll, | 324 CursorAlignOnScroll, |
| 318 TextGranularity); | 325 TextGranularity, |
| 326 bool isHandleVisible = false); |
| 319 | 327 |
| 320 void respondToNodeModification(Node&, | 328 void respondToNodeModification(Node&, |
| 321 bool baseRemoved, | 329 bool baseRemoved, |
| 322 bool extentRemoved, | 330 bool extentRemoved, |
| 323 bool startRemoved, | 331 bool startRemoved, |
| 324 bool endRemoved); | 332 bool endRemoved); |
| 325 | 333 |
| 326 void notifyAccessibilityForSelectionChange(); | 334 void notifyAccessibilityForSelectionChange(); |
| 327 void notifyCompositorForSelectionChange(); | 335 void notifyCompositorForSelectionChange(); |
| 328 void notifyEventHandlerForSelectionChange(); | 336 void notifyEventHandlerForSelectionChange(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 353 | 361 |
| 354 // Used to store base before the adjustment at bidi boundary | 362 // Used to store base before the adjustment at bidi boundary |
| 355 VisiblePositionInFlatTree m_originalBaseInFlatTree; | 363 VisiblePositionInFlatTree m_originalBaseInFlatTree; |
| 356 TextGranularity m_granularity; | 364 TextGranularity m_granularity; |
| 357 LayoutUnit m_xPosForVerticalArrowNavigation; | 365 LayoutUnit m_xPosForVerticalArrowNavigation; |
| 358 | 366 |
| 359 Member<EditingStyle> m_typingStyle; | 367 Member<EditingStyle> m_typingStyle; |
| 360 | 368 |
| 361 bool m_focused : 1; | 369 bool m_focused : 1; |
| 362 | 370 |
| 371 bool m_isHandleVisible : 1; |
| 372 |
| 363 // Controls text granularity used to adjust the selection's extent in | 373 // Controls text granularity used to adjust the selection's extent in |
| 364 // moveRangeSelectionExtent. | 374 // moveRangeSelectionExtent. |
| 365 std::unique_ptr<GranularityStrategy> m_granularityStrategy; | 375 std::unique_ptr<GranularityStrategy> m_granularityStrategy; |
| 366 | 376 |
| 367 const Member<FrameCaret> m_frameCaret; | 377 const Member<FrameCaret> m_frameCaret; |
| 368 }; | 378 }; |
| 369 | 379 |
| 370 inline EditingStyle* FrameSelection::typingStyle() const { | 380 inline EditingStyle* FrameSelection::typingStyle() const { |
| 371 return m_typingStyle.get(); | 381 return m_typingStyle.get(); |
| 372 } | 382 } |
| 373 | 383 |
| 374 inline void FrameSelection::clearTypingStyle() { | 384 inline void FrameSelection::clearTypingStyle() { |
| 375 m_typingStyle.clear(); | 385 m_typingStyle.clear(); |
| 376 } | 386 } |
| 377 | 387 |
| 378 inline void FrameSelection::setTypingStyle(EditingStyle* style) { | 388 inline void FrameSelection::setTypingStyle(EditingStyle* style) { |
| 379 m_typingStyle = style; | 389 m_typingStyle = style; |
| 380 } | 390 } |
| 381 } // namespace blink | 391 } // namespace blink |
| 382 | 392 |
| 383 #ifndef NDEBUG | 393 #ifndef NDEBUG |
| 384 // Outside the WebCore namespace for ease of invocation from gdb. | 394 // Outside the WebCore namespace for ease of invocation from gdb. |
| 385 void showTree(const blink::FrameSelection&); | 395 void showTree(const blink::FrameSelection&); |
| 386 void showTree(const blink::FrameSelection*); | 396 void showTree(const blink::FrameSelection*); |
| 387 #endif | 397 #endif |
| 388 | 398 |
| 389 #endif // FrameSelection_h | 399 #endif // FrameSelection_h |
| OLD | NEW |