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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 void updateSecureKeyboardEntryIfActive(); | 243 void updateSecureKeyboardEntryIfActive(); |
244 | 244 |
245 // Returns true if a word is selected. | 245 // Returns true if a word is selected. |
246 bool selectWordAroundPosition(const VisiblePosition&); | 246 bool selectWordAroundPosition(const VisiblePosition&); |
247 | 247 |
248 #ifndef NDEBUG | 248 #ifndef NDEBUG |
249 void showTreeForThis() const; | 249 void showTreeForThis() const; |
250 #endif | 250 #endif |
251 | 251 |
252 enum EndPointsAdjustmentMode { | |
253 AdjustEndpointsAtBidiBoundary, | |
254 DoNotAdjustEndpoints | |
255 }; | |
256 void setNonDirectionalSelectionIfNeeded( | |
257 const VisibleSelectionInFlatTree&, | |
258 TextGranularity, | |
259 EndPointsAdjustmentMode = DoNotAdjustEndpoints); | |
260 void setFocusedNodeIfNeeded(); | 252 void setFocusedNodeIfNeeded(); |
261 void notifyLayoutObjectOfSelectionChange(EUserTriggered); | 253 void notifyLayoutObjectOfSelectionChange(EUserTriggered); |
262 | 254 |
263 EditingStyle* typingStyle() const; | 255 EditingStyle* typingStyle() const; |
264 void setTypingStyle(EditingStyle*); | 256 void setTypingStyle(EditingStyle*); |
265 void clearTypingStyle(); | 257 void clearTypingStyle(); |
266 | 258 |
267 String selectedHTMLForClipboard() const; | 259 String selectedHTMLForClipboard() const; |
268 String selectedText(TextIteratorBehavior = TextIteratorDefaultBehavior) const; | 260 String selectedText(TextIteratorBehavior = TextIteratorDefaultBehavior) const; |
269 String selectedTextForClipboard() const; | 261 String selectedTextForClipboard() const; |
(...skipping 18 matching lines...) Expand all Loading... |
288 // |FrameSelection::selection()| to make sure we use updated selection, | 280 // |FrameSelection::selection()| to make sure we use updated selection, |
289 // rather than having |updateIfNeeded()|. Once, we update all layout tests | 281 // rather than having |updateIfNeeded()|. Once, we update all layout tests |
290 // to use updated selection, we should make |updateIfNeeded()| private. | 282 // to use updated selection, we should make |updateIfNeeded()| private. |
291 void updateIfNeeded(); | 283 void updateIfNeeded(); |
292 | 284 |
293 DECLARE_VIRTUAL_TRACE(); | 285 DECLARE_VIRTUAL_TRACE(); |
294 | 286 |
295 private: | 287 private: |
296 friend class FrameSelectionTest; | 288 friend class FrameSelectionTest; |
297 friend class PaintControllerPaintTestForSlimmingPaintV1AndV2; | 289 friend class PaintControllerPaintTestForSlimmingPaintV1AndV2; |
| 290 friend class SelectionControllerTest; |
298 FRIEND_TEST_ALL_PREFIXES(PaintControllerPaintTestForSlimmingPaintV1AndV2, | 291 FRIEND_TEST_ALL_PREFIXES(PaintControllerPaintTestForSlimmingPaintV1AndV2, |
299 FullDocumentPaintingWithCaret); | 292 FullDocumentPaintingWithCaret); |
300 | 293 |
301 explicit FrameSelection(LocalFrame*); | 294 explicit FrameSelection(LocalFrame*); |
302 | 295 |
303 // Note: We have |selectionInFlatTree()| for unit tests, we should | 296 // Note: We have |selectionInFlatTree()| for unit tests, we should |
304 // use |visibleSelection<EditingInFlatTreeStrategy>()|. | 297 // use |visibleSelection<EditingInFlatTreeStrategy>()|. |
305 const VisibleSelectionInFlatTree& selectionInFlatTree() const; | 298 const VisibleSelectionInFlatTree& selectionInFlatTree() const; |
306 | 299 |
307 template <typename Strategy> | 300 template <typename Strategy> |
308 VisiblePositionTemplate<Strategy> originalBase() const; | |
309 void setOriginalBase(const VisiblePosition&); | |
310 void setOriginalBase(const VisiblePositionInFlatTree&); | |
311 | |
312 template <typename Strategy> | |
313 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, | 301 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, |
314 SetSelectionOptions, | 302 SetSelectionOptions, |
315 CursorAlignOnScroll, | 303 CursorAlignOnScroll, |
316 TextGranularity); | 304 TextGranularity); |
317 | 305 |
318 void respondToNodeModification(Node&, | 306 void respondToNodeModification(Node&, |
319 bool baseRemoved, | 307 bool baseRemoved, |
320 bool extentRemoved, | 308 bool extentRemoved, |
321 bool startRemoved, | 309 bool startRemoved, |
322 bool endRemoved); | 310 bool endRemoved); |
(...skipping 15 matching lines...) Expand all Loading... |
338 | 326 |
339 // For unittests | 327 // For unittests |
340 bool shouldPaintCaretForTesting() const; | 328 bool shouldPaintCaretForTesting() const; |
341 bool isPreviousCaretDirtyForTesting() const; | 329 bool isPreviousCaretDirtyForTesting() const; |
342 | 330 |
343 Member<Document> m_document; | 331 Member<Document> m_document; |
344 Member<LocalFrame> m_frame; | 332 Member<LocalFrame> m_frame; |
345 const Member<PendingSelection> m_pendingSelection; | 333 const Member<PendingSelection> m_pendingSelection; |
346 const Member<SelectionEditor> m_selectionEditor; | 334 const Member<SelectionEditor> m_selectionEditor; |
347 | 335 |
348 // Used to store base before the adjustment at bidi boundary | |
349 VisiblePositionInFlatTree m_originalBaseInFlatTree; | |
350 TextGranularity m_granularity; | 336 TextGranularity m_granularity; |
351 LayoutUnit m_xPosForVerticalArrowNavigation; | 337 LayoutUnit m_xPosForVerticalArrowNavigation; |
352 | 338 |
353 Member<EditingStyle> m_typingStyle; | 339 Member<EditingStyle> m_typingStyle; |
354 | 340 |
355 bool m_focused : 1; | 341 bool m_focused : 1; |
356 | 342 |
357 // Controls text granularity used to adjust the selection's extent in | 343 // Controls text granularity used to adjust the selection's extent in |
358 // moveRangeSelectionExtent. | 344 // moveRangeSelectionExtent. |
359 std::unique_ptr<GranularityStrategy> m_granularityStrategy; | 345 std::unique_ptr<GranularityStrategy> m_granularityStrategy; |
(...skipping 14 matching lines...) Expand all Loading... |
374 } | 360 } |
375 } // namespace blink | 361 } // namespace blink |
376 | 362 |
377 #ifndef NDEBUG | 363 #ifndef NDEBUG |
378 // Outside the WebCore namespace for ease of invocation from gdb. | 364 // Outside the WebCore namespace for ease of invocation from gdb. |
379 void showTree(const blink::FrameSelection&); | 365 void showTree(const blink::FrameSelection&); |
380 void showTree(const blink::FrameSelection*); | 366 void showTree(const blink::FrameSelection*); |
381 #endif | 367 #endif |
382 | 368 |
383 #endif // FrameSelection_h | 369 #endif // FrameSelection_h |
OLD | NEW |